农村经济管理信息系统设计与实现 第10页
附录二:数据上传主要程序清单
1. 上传按钮的脚本
string szFtpLocalDir
string szFtpRemoteDir
string szFtpHost
string szFtpUser
string szFtpPassword
szFtpLocalDir =trim(ProfileString("nw_CountryEco.ini","ftp","localdir", " "))
szFtpRemoteDir =trim(ProfileString("nw_CountryEco.ini","ftp","remotedir", " "))
szFtpHost =trim(ProfileString("nw_CountryEco.ini","ftp","serverip", " "))
szFtpUser =trim(ProfileString("nw_CountryEco.ini","ftp","user", " "))
szFtpPassword =trim(ProfileString("nw_CountryEco.ini","ftp","password", " "))
if gsrip=''then
messagebox('IP地址未找到!',' IP地址未找到!请重试!')
else
int yjsc
rc=dw_countrytrsclient.RowCount()
select nw_systempara.value
into :spuv
from nw_systempara
where parameter='unitid';
spuv=trim(spuv)
sy=ddlb_year.text
sm=ddlb_month.text
select count(IsRecvSucc)
into :yjsc
from nw_transissucc
where IsRecvSucc='1' and year=:sy and month=:sm;
integer Net
if yjsc=0 then
messagebox("提示:","没收到数据,不可上传数据!")
return
end if
//messagebox("dirr",szFtpLocalDir+sy+sm+spuv)
if yjsc>0 then
IF yjsc<rc THEN
Net = MessageBox("确定是否等待窗口", '还单位数据没收到,真的不等了吗?', Exclamation!, OKCancel!, 2)
IF Net = 1 THEN
w_countrytrsclient.dw_subbalance.SetTransObject(SQLCA)
w_countrytrsclient.dw_subbalance.Retrieve(sy,sm)
dw_subbalance.SaveAs(gslocaldir+sy+sm+spuv+".txt", text!, FALSE)
// modified by gyuan 2002/12/13
// Inet1.object.Execute ("","put "+gslocaldir+sy+sm+spuv+".txt c:\nw_transserver\"+sy+sm+spuv+".txt")
//ÉèÖÃftp¿Ø¼þµÄÖµ
oFtp.object.RemoteAddress = szFtpHost
oFtp.object.UserName = szFtpUser
oFtp.object.password = szFtpPassword
//ÉÏ´«
oFtp.object.Connect
oFtp.object.Binary = True
oFtp.object.RemoteDirectory = szFtpRemoteDir
oFtp.object.LocalFile = gslocaldir+sy+sm+spuv+".txt"
oFtp.object.RemoteFile = sy+sm+spuv+".txt"
oFtp.object.PutFile
oFtp.object.Disconnect
// modified by gyuan 2002/12/13 end
end if
ELSE
Net=MessageBox("确定是否发送", '数据已全部收到,确定发送吗? ', Exclamation!, OKCancel!, 2)
IF Net = 1 THEN
w_countrytrsclient.dw_subbalance.SetTransObject(sqlca)
w_countrytrsclient.dw_subbalance.Retrieve(dw_subbalance,sy,sm)
dw_subbalance.SaveAs(gslocaldir+sy+sm+spuv+".txt", text!, FALSE)
// modified by gyuan 2002/12/13
// Inet1.object.Execute ("","put "+gslocaldir+sy+sm+spuv+".txt c:\nw_transserver\"+sy+sm+spuv+".txt")
//设置Ftp控件的值
oFtp.object.RemoteAddress = szFtpHost
oFtp.object.UserName = szFtpUser
oFtp.object.password = szFtpPassword
//上传
oFtp.object.Connect
oFtp.object.Binary = True
oFtp.object.RemoteDirectory = szFtpRemoteDir
oFtp.object.LocalFile = gslocaldir+sy+sm+spuv+".txt"
// oFtp.object.LocalFile = szFtpLocalDir+sy+sm+spuv+".txt"
oFtp.object.RemoteFile = sy+sm+spuv+".txt"
oFtp.object.PutFile
oFtp.object.Disconnect
// modified by gyuan 2002/12/13 end
end if
END IF
end if
end if
2. 接受按钮的脚本
sy=ddlb_year.text
sm=ddlb_month.text
dw_1.SetTransObject(SQLCA)
string txtpathname, named
integer value
value = GetFileOpenName("最近收到本下属单位数据",txtpathname, named,"TXT","Text Files (*.TXT),*.TXT" )
dw_1.reset()
dw_1.ImportFile(txtpathname)
int lenspuv
string getyear,getmonth,getunitid,justunitid,revnamed,revunitid
if named<>''then
revnamed=reverse(named)
revunitid=revnamed
revnamed=left(revnamed,4)
revnamed=reverse(revnamed)
IF revnamed='.txt' THEN
revunitid=replace(revunitid,1,4,'')
revunitid=reverse(revunitid)
named=revunitid
getyear=left(named,4)
getmonth=mid(named,5,2)
getunitid=mid(named,7,ii_len)
lenspuv=len(spuv)
justunitid=left(getunitid,lenspuv)
if sy <> getyear or sm <>getmonth then
messagebox('提示','非本年或本月数据!')
return
end if
IF justunitid=spuv and len(getunitid)>len(spuv) THEN
//messagebox('',(dw_1.Rowcount()))
dw_1.update()
insert into nw_transissucc(unitid,year,month,isrecvsucc)
values(:getunitid,:getyear,:getmonth,'1');
IF SQLCA.SQLCode=0 THEN
commit;
w_countrytrsclient.dw_countrytrsclient.SetTransObject(SQLCA)
w_countrytrsclient.dw_countrytrsclient.Retrieve(sy,sm,spuv,ii_len)
filedelete(txtpathname)
messagebox('接收数据成功!',接受'+getunitid+'成功!')
ELSE
rollback;
messagebox('接收数据出错','接受'+getunitid+'出错,请重试!或因为本下属单位数据已接收!')
END IF
ELSE
messagebox('接收数据出错!',对不起,非本下属单位数据拒绝接收!')
filedelete(txtpathname)
END IF
ELSE
messagebox('接收数据出错!','对不起,拒绝接收该类型文件!')
END IF
end if
3. 上传到目录按钮的脚本
string szFtpLocalDir
string szFtpRemoteDir
string szFtpHost
string szFtpUser
string szFtpPassword
szFtpLocalDir =trim(ProfileString("nw_CountryEco.ini","ftp","localdir", " "))
szFtpRemoteDir =trim(ProfileString("nw_CountryEco.ini","ftp","remotedir", " "))
szFtpHost =trim(ProfileString("nw_CountryEco.ini","ftp","serverip", " "))
szFtpUser =trim(ProfileString("nw_CountryEco.ini","ftp","user", " "))
szFtpPassword =trim(ProfileString("nw_CountryEco.ini","ftp","password", " "))
if GetPath='' or isnull(GetPath) then
messagebox('信息提示','请选择目录')
www.751com.cn
messagebox('IP地址未找到',' IP地址未找到,请重试!')
else
int yjsc
rc=dw_countrytrsclient.RowCount()
select nw_systempara.value
into :spuv
from nw_systempara
where parameter='unitid';
spuv=trim(spuv)
sy=ddlb_year.text
sm=ddlb_month.text
select count(IsRecvSucc)
into :yjsc
from nw_transissucc
where IsRecvSucc='1' and year=:sy and month=:sm
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>