新到一公司,前员工留下一数据库系统,出现故障,不知如何解决,请大神帮忙看看。
与前员工联系后得知,是需要使用VFP,但是这个东东比较古老,加上本人是没有经验的新手,特来此取经。
程序代码:
Close Data
Set Safe Off
Set Deleted On
Set Exclusive Off
Delete From clrkdzk Where 库名=' '
Select * From clrkdzk Order By 库名 Into Cursor curCLRKDZK
Select curCLRKDZK
Browse Title "材料入库单总表"
Close Databases
CLSJ=" "
DDSJ=" "
Set Colo To 6/4,0/2,3
@20,48 Clea To 38,110
@21,62 Say"材料(发票)入库单录入" Font"宋体",15
@23,64 Say"请输入年月日(如:010101):" Get CLSJ
* [color=#008000]@25,64 SAY"请输入订单序号(年月顺序号)(如:020101):" GET DDSJ[/color]
read
on error ResetSetting()
todayCLRK=CLSJ+"CLRK"
todayCLHK=CLSJ+"HK"
au=CLSJ+".xls"
B1=Val(Subs(CLSJ,1,2))
sDate=alltrim(CLSJ)
Local oDateTool As yznVFP.yznDate
oDateTool =Createobject("yznVFP.yznDate")
If !DateTool.ValidYearMonthDay(CLSJ)
Set Colo To 2/0,6/5,3
@20,46 Clea To 38,119
ResetSetting()
Return
Endif
IfNotExitsRecordThenAdd("CLRKDZK","库名",todayCLRK,"CLRKD")
IfNotExitsRecordThenAdd("HKDZK","库名",todayCLHK,"HK")
Use &todayCLRK
Go Bott
If eof()
Appe Blan
endif
go bottom
pp=recno()
*Go Top
WW="Y"
Do Whil WW="Y"
LLL=Recn()
@25,60 Say"─────────────────────-----"
@26,60 Say"发票单号: 材料代码: "
@27,60 Say"─────────────────────-----"
@28,60 Say"数 量: 入 库 人: "
@29,60 Say"─────────────────────-----"
@30,60 Say" "
@31,60 Say"─────────────────────-----"
@32,60 Say"当前记录数: "
@26,70 Get 发票单号
@26,95 Get 材料代码
@28,70 Get 数量
@28,95 Get 入库人
@32,80 Say LLL
@33,66 Say"继续录入吗(Y/N)?" Get WW
Read
If WW="Y"
If PP<LLL+1
D1=发票单号
D2=材料代码
D3=数量
D5=入库人
Appe Blan
Repl 发票单号 With D1
Repl 材料代码 With D2
Repl 数量 With D3
Repl 入库人 With D5
Else
Skip
Endi
Endi
Endd
Dele All For 数量=0 .or. Val(Subs(材料代码,1,1))<=0
close databases
use (todayCLRK) in 0 exclusive
pack
**
close databases
use &todayCLRK in 0 alias tCLRK
Use mzk in 0
update tCLRK set 材料名称=mzk.材料名称 ,规格型号=mzk.规格型号, 单位=mzk.单位, 供应商代码=mzk.供应商代码, 供应商=mzk.供应商 ;
from tCLRK, mzk ;
where tCLRK.材料代码=mzk.材料代码
insert into tCLRK(材料名称) values ("总 计")
**转回库单
use &todayCLHK in 0 alias tCLHK exclusive
select tCLHK
delete all
pack
insert into tCLHK (材料代码,材料名称,规格型号,到货数量,单位,取货日期) ;
select 材料代码,材料名称,规格型号,数量,单位,sDate ;
from tCLRK ;
where val(substr(材料代码,1,1)) <> 0
*!* update tCLHK set 取货日期 = sDate
*转入入库单总单 以便年统计数据
close databases
use clrkdzd in 0 exclusive
delete for 入库日期=todayCLRK
pack
append from &todayCLRK for 材料代码<>" "
replace 入库日期 with todayCLRK for 入库日期=" "
close databases
use (todayCLRK) in 0 exclusive
pack
close databases
use (todayCLRK) in 0 shared
*!* use
*!* use &todayCLRK shared
browse fiel 订单号,发票单号,未票单号,加工单号,材料代码,数量,单位,入库人,材料名称,规格型号,供应商,供应商代码 ;
LOCK -2 TITL sDate + "入库单导入查询"
Set Colo To 2/0,6/5,3
@20,46 Clea To 38,119
close databases
ResetSetting()
messagebox("如果你编辑或删除了入库单导入查询窗口数据,请重新运行本功能确认所有数据更新!",0,"提示")
Retu
Procedure IfNotExitsRecordThenAdd(sTable As String, sField As String, sValue As String,sTemplateTable As String) As String
Use &sTable In 0
Locate For &sField = sValue
If Not Found()
Append Blank
Replace &sField With sValue
Use &sTemplateTable
Copy Structure To &sValue
Endif
Use
endproc
procedure ResetSetting()
on error
Set Exclusive on
endproc






