D
dreameast-1
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TfrmClsldDjsh.BitBtn1Click(Sender: TObject);
begin
frmSLD.aqSLDMAIN.FieldByName('AuditingPerson').value := GetEmployeeName;
DBEdit2.text:=getemployeename;
end;
procedure TfrmClsldDjsh.SpeedButton1Click(Sender: TObject);
var
SysDate: oleVariant;
vs_clbm: string;
vr_sssl, vr_yssl: integer; //入库单中实收数量,库存表中原有数量
query: TADOQuery;
str:string;
begin
aqKC.Close;
aqKC.Open;
if dbedit2.text = '' then
begin
application.MessageBox('审核人不能为空', '仓库管理系统', mb_iconinformation + mb_defbutton1);
dbedit2.SetFocus;
exit;
end;
frmsld.aqSLDMAIN.edit;
frmSLD.aqSLDMAIN.fieldbyname('IsAuditing').value := true;
frmSLD.aqSLDMAIN.post;
//从库存情况表中按材料编号寻找某种材料是否已经存在
vs_clbm := trim(frmSLD.edtmoldcode.Text);
query := TADOQuery.Create(Self);
query.Connection:= dmWarehouse.ACWarehouse;
query.SQL.Text:= 'select * from KCQKB where moldcode="'+vs_clbm+'"';
query.Prepared;
query.Open;
//如果该材料存在,那么在该材料的基础上完成增加数量的操作
if not query.Eof then
begin
vr_sssl := frmSLD.aqSLDmain.fieldbyname('yuansum').asinteger;
// vr_yssl := aqKC.fieldbyname('yuansum').asfloat;
str:= 'update KCQKB set yuansum=yuansum+vr_sssl where moldcode="'+vs_clbm+'"';
query := TADOQuery.Create(Self);
query.Connection:= dmWarehouse.ACWarehouse;
query.SQL.Clear;
query.SQL.add(str);
query.ExecSQL;
end
else
//否则,在库存情况表中添加新的记录
begin
vr_sssl := frmSLD.aqSLDmain.fieldbyname('yuansum').value;
vr_yssl := aqKC.fieldbyname('yuansum').value;
aqKC.Insert;
aqKC.FieldByName('MoldCode').value := frmSLD.aqSLDmain.fieldbyname('MoldCode').value;
aqKC.FieldByName('Moldname').value := frmSLD.aqSLDmain.fieldbyname('MoldName').value;
aqKC.FieldByName('Size').value := frmSLD.aqSLDmain.fieldbyname('Size').value;
aqKC.FieldByName('matprice').value := frmSLD.aqSLDmain.fieldbyname('matprice').value;
aqKC.FieldByName('machPrice').value :=0;
aqKC.FieldByName('allprice').value := frmSLD.aqSLDmain.fieldbyname('matprice').value;
aqKC.FieldByName('bansum').value := 0;
aqKC.FieldByName('chengsum').value := 0;
aqKC.fieldbyname('yuansum').value := vr_sssl;
aqKC.fieldbyname('curdate').asdatetime := date;
//aqKC.FieldByName('memo').asstring := frmSLD.aqSLDmain.fieldbyname('memo').value;
end;
aqKC.post;
close;
end;
procedure TfrmClsldDjsh.SpeedButton2Click(Sender: TObject);
begin
close;
end;
procedure TfrmClsldDjsh.FormActivate(Sender: TObject);
begin
dbedit2.setfocus;
end;
end.
此段程序的功能是材料入库时连带更新库存表中的材料数量(字段yuansum)为什么运行时总是提示“变量‘vr_sssl”没有默认值阿????????????
begin
frmSLD.aqSLDMAIN.FieldByName('AuditingPerson').value := GetEmployeeName;
DBEdit2.text:=getemployeename;
end;
procedure TfrmClsldDjsh.SpeedButton1Click(Sender: TObject);
var
SysDate: oleVariant;
vs_clbm: string;
vr_sssl, vr_yssl: integer; //入库单中实收数量,库存表中原有数量
query: TADOQuery;
str:string;
begin
aqKC.Close;
aqKC.Open;
if dbedit2.text = '' then
begin
application.MessageBox('审核人不能为空', '仓库管理系统', mb_iconinformation + mb_defbutton1);
dbedit2.SetFocus;
exit;
end;
frmsld.aqSLDMAIN.edit;
frmSLD.aqSLDMAIN.fieldbyname('IsAuditing').value := true;
frmSLD.aqSLDMAIN.post;
//从库存情况表中按材料编号寻找某种材料是否已经存在
vs_clbm := trim(frmSLD.edtmoldcode.Text);
query := TADOQuery.Create(Self);
query.Connection:= dmWarehouse.ACWarehouse;
query.SQL.Text:= 'select * from KCQKB where moldcode="'+vs_clbm+'"';
query.Prepared;
query.Open;
//如果该材料存在,那么在该材料的基础上完成增加数量的操作
if not query.Eof then
begin
vr_sssl := frmSLD.aqSLDmain.fieldbyname('yuansum').asinteger;
// vr_yssl := aqKC.fieldbyname('yuansum').asfloat;
str:= 'update KCQKB set yuansum=yuansum+vr_sssl where moldcode="'+vs_clbm+'"';
query := TADOQuery.Create(Self);
query.Connection:= dmWarehouse.ACWarehouse;
query.SQL.Clear;
query.SQL.add(str);
query.ExecSQL;
end
else
//否则,在库存情况表中添加新的记录
begin
vr_sssl := frmSLD.aqSLDmain.fieldbyname('yuansum').value;
vr_yssl := aqKC.fieldbyname('yuansum').value;
aqKC.Insert;
aqKC.FieldByName('MoldCode').value := frmSLD.aqSLDmain.fieldbyname('MoldCode').value;
aqKC.FieldByName('Moldname').value := frmSLD.aqSLDmain.fieldbyname('MoldName').value;
aqKC.FieldByName('Size').value := frmSLD.aqSLDmain.fieldbyname('Size').value;
aqKC.FieldByName('matprice').value := frmSLD.aqSLDmain.fieldbyname('matprice').value;
aqKC.FieldByName('machPrice').value :=0;
aqKC.FieldByName('allprice').value := frmSLD.aqSLDmain.fieldbyname('matprice').value;
aqKC.FieldByName('bansum').value := 0;
aqKC.FieldByName('chengsum').value := 0;
aqKC.fieldbyname('yuansum').value := vr_sssl;
aqKC.fieldbyname('curdate').asdatetime := date;
//aqKC.FieldByName('memo').asstring := frmSLD.aqSLDmain.fieldbyname('memo').value;
end;
aqKC.post;
close;
end;
procedure TfrmClsldDjsh.SpeedButton2Click(Sender: TObject);
begin
close;
end;
procedure TfrmClsldDjsh.FormActivate(Sender: TObject);
begin
dbedit2.setfocus;
end;
end.
此段程序的功能是材料入库时连带更新库存表中的材料数量(字段yuansum)为什么运行时总是提示“变量‘vr_sssl”没有默认值阿????????????