inv_mnlistaudit_d.pas
来自「一个MRPII系统源代码版本」· PAS 代码 · 共 1,613 行 · 第 1/4 页
PAS
1,613 行
sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+whCode+''' and WhPositionCode='''+WhPositionCode+''' and ItemCode='''+Extedt_ItemCode.text+'''');
open;
if not eof then
lbl_onhandInv.Caption:=fieldbyname('onhandInv').asstring
else
lbl_onhandInv.Caption:='0';
lbl_MoCtrlqty.Caption:='0';
lbl_MoRealqty.Caption:='0';
end;
end;
end;
end;
if not DefaultWHCheck(AdoQry_tmp,whCode,Extedt_ItemCode.text) then
begin
twincontrol(sender).setfocus;
abort;
end;
selectnext(activecontrol,True,True);
cmbx_WhCode1.ControlStyle:=[cSclickEvents];
cmbx_WhCode1.ControlState:=[cSclicked];
if cmbx_WhCode1.CanFocus then
cmbx_WhCode1.SetFocus ;
end;
procedure TFrm_Inv_MnListAudit_D.edt_Batchno1KeyDon(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
edt_Batchno1.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,'',whCode,WhPositionCode);
end;
procedure TFrm_Inv_MnListAudit_D.btn_okClick(Sender: TObject);
var
stext,ItemCode,time1,time2,time3,time4,time5:string;
begin
{
judge1:=False;
judge2:=False;
judge3:=False;
judge4:=False;
judge5:=False;
judge1_1:=False;
judge2_1:=False;
judge3_1:=False;
judge4_1:=False;
judge5_1:=False;
oldrealqty1:=AdoQry_Body.fieldbyname('realoutqty1').asstring;
oldrealqty2:=AdoQry_Body.fieldbyname('realoutqty2').asstring;
oldrealqty3:=AdoQry_Body.fieldbyname('realoutqty3').asstring;
oldrealqty4:=AdoQry_Body.fieldbyname('realoutqty4').asstring;
oldrealqty5:=AdoQry_Body.fieldbyname('realoutqty5').asstring;
ItemCode:=Extedt_ItemCode.Text ;
Itemid:=AdoQry_Body.fieldbyname('ItemListid').asstring;
//三次实领数量的判断依据确定
if getCode(cmbx_WhpCode1.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode1').asstring) then
judge1:=True;
if (edt_MoRealqty1.Text<>AdoQry_Body.fieldbyname('realoutqty1').asstring)and(strtofloat(edt_MoRealqty1.Text)<>0) then
begin
judge1:=True;
judge1_1:=True;
end;
if edt_Batchno1.Text<>AdoQry_Body.fieldbyname('Batchno1').asstring then
judge1:=True;
if getCode(cmbx_WhpCode2.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode2').asstring) then
judge2:=True;
if (edt_MoRealqty2.Text<>AdoQry_Body.fieldbyname('realoutqty2').asstring)and(strtofloat(edt_MoRealqty2.Text)<>0) then
begin
judge2:=True;
judge2_1:=True;
end;
if edt_Batchno2.Text<>AdoQry_Body.fieldbyname('Batchno2').asstring then
judge2:=True;
if getCode(cmbx_WhpCode3.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode3').asstring) then
judge3:=True;
if (edt_MoRealqty3.Text<>AdoQry_Body.fieldbyname('realoutqty3').asstring)and(strtofloat(edt_MoRealqty3.Text)<>0) then
begin
judge3:=True;
judge3_1:=True;
end;
if edt_Batchno3.Text<>AdoQry_Body.fieldbyname('Batchno3').asstring then
judge3:=True;
//
if getCode(cmbx_WhpCode4.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode4').asstring) then
judge4:=True;
if (edt_MoRealqty4.Text<>AdoQry_Body.fieldbyname('realoutqty4').asstring)and(strtofloat(edt_MoRealqty4.Text)<>0) then
begin
judge4:=True;
judge4_1:=True;
end;
if edt_Batchno4.Text<>AdoQry_Body.fieldbyname('Batchno4').asstring then
judge4:=True;
//
if getCode(cmbx_WhpCode5.Text)<>getCode(AdoQry_Body.fieldbyname('WhPositionCode5').asstring) then
judge5:=True;
if (edt_MoRealqty5.Text<>AdoQry_Body.fieldbyname('realoutqty5').asstring)and(strtofloat(edt_MoRealqty5.Text)<>0) then
begin
judge5:=True;
judge5_1:=True;
end;
if edt_Batchno5.Text<>AdoQry_Body.fieldbyname('Batchno5').asstring then
judge5:=True;
if judge1 then
begin
time1:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
lbl_Requesttime1.Caption:=time1;
end
else
time1:=AdoQry_Body.fieldbyname('Requesttime1').asstring;
if judge2 then
begin
time2:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
lbl_Requesttime2.Caption:=time2;
end
else
time2:=AdoQry_Body.fieldbyname('Requesttime2').asstring;
if judge3 then
begin
time3:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
lbl_Requesttime3.Caption:=time3;
end
else
time3:=AdoQry_Body.fieldbyname('Requesttime3').asstring;
//
if judge4 then
begin
time4:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
lbl_Requesttime4.Caption:=time4;
end
else
time4:=AdoQry_Body.fieldbyname('Requesttime4').asstring;
if judge5 then
begin
time5:=formatdatetime('yyyy.mm.dd hh:nn:ss',now);
lbl_Requesttime5.Caption:=time5;
end
else
time5:=AdoQry_Body.fieldbyname('Requesttime5').asstring;
inherited;
}
Close;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode1Change(Sender: TObject);
begin
inherited;
InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode1,'WhPosition','WhPositionCode',
'WhPositionName','whCode='''+getCode(cmbx_WhCode1.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
btn_ok.Enabled :=True;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode2Change(Sender: TObject);
begin
inherited;
InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode2,'WhPosition','WhPositionCode',
'WhPositionName','whCode='''+getCode(cmbx_WhCode2.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
btn_ok.Enabled :=True;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode3Change(Sender: TObject);
begin
inherited;
InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode3,'WhPosition','WhPositionCode',
'WhPositionName','whCode='''+getCode(cmbx_WhCode3.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
btn_ok.Enabled :=True;
end;
procedure TFrm_Inv_MnListAudit_D.Show_WhCode(ItemCode:string;flag:integer;wCode:string);
var
sqltext:string;
begin
//高级组合提示的设置
if BatchCtrl(AdoQry_tmp,ItemCode) then
sqltext:='select distinct bc.whCode+'''+' '+'''+w.whName whCode,bc.WhPositionCode+'''+' '+''''+
'+whp.WhPositionName WhPositionCode,bc.Batchno,bc.InvQty '+
'from BatchCurrentInv bc,Batch b,Batchline bl,Warehouse w,'+
' WhPosition whp'+
' where bc.whCode=w.whCode and'+
' bc.whCode=whp.whCode and'+
' bc.WhPositionCode=whp.WhPositionCode and'+
' b.Batchid=bl.Batchid and'+
' bc.Batchno=bl.Batchno and'+
' bl.Batchstatus=0 and '+
' b.ItemCode='''+ItemCode+''' and bc.whCode='''+getCode(wCode)+''''
else
sqltext:='select distinct bc.whCode+'''+' '+'''+w.whName whCode,bc.WhPositionCode+'''+' '+''''+
'+whp.WhPositionName WhPositionCode,'''+''+''' Batchno,bc.onhandInv InvQty '+
' from CurrentInv bc,Warehouse w,'+
' WhPosition whp '+
' where bc.whCode=w.whCode and'+
' whp.whCode=bc.whCode and '+
' bc.WhPositionCode=whp.WhPositionCode '+
' and bc.ItemCode='''+ItemCode+''' and bc.whCode='''+getCode(wCode)+'''';
Frm_Sfc_MnListRequest_Hint:=TFrm_Sfc_MnListRequest_Hint.Create(nil);
Frm_Sfc_MnListRequest_Hint.InitForm(AdoQry_tmp.Connection,sqltext);
Frm_Sfc_MnListRequest_Hint.ShowModal ;
if Frm_Sfc_MnListRequest_Hint.ModalResult = mrOk then
begin
if flag=1 then
begin
// InitCmBxText(cmbx_WhCode1,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('whCode').asstring));
// cmbx_WhCode1Change(cmbx_WhCode1);
InitCmBxText(cmbx_WhpCode1,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('WhPositionCode').asstring));
// edt_MoRequestqty1.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('InvQty').asstring;
edt_Batchno1.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('Batchno').asstring;
end;
if flag=2 then
begin
// InitCmBxText(cmbx_WhCode2,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('whCode').asstring));
// cmbx_WhCode2Change(cmbx_WhCode2);
InitCmBxText(cmbx_WhpCode2,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('WhPositionCode').asstring));
// edt_MoRequestqty2.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('InvQty').asstring;
edt_Batchno2.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('Batchno').asstring;
end;
if flag=3 then
begin
// InitCmBxText(cmbx_WhCode3,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('whCode').asstring));
// cmbx_WhCode3Change(cmbx_WhCode3);
InitCmBxText(cmbx_WhpCode3,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('WhPositionCode').asstring));
// edt_MoRequestqty3.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('InvQty').asstring;
edt_Batchno3.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('Batchno').asstring;
end;
if flag=4 then
begin
InitCmBxText(cmbx_WhpCode4,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('WhPositionCode').asstring));
edt_Batchno4.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('Batchno').asstring;
end;
if flag=5 then
begin
InitCmBxText(cmbx_WhpCode5,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('WhPositionCode').asstring));
edt_Batchno5.Text :=Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('Batchno').asstring;
end;
end;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,1,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhpCode1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,1,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.edt_MoRequestqty1KeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,1,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode2KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,2,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhpCode2KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,2,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.edt_MoRequestqty2KeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,2,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode3KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,3,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhpCode3KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,3,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.edt_MoRequestqty3KeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,3,whCode);
end;
procedure TFrm_Inv_MnListAudit_D.edt_Batchno2KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
edt_Batchno2.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,'',whCode,WhPositionCode);
end;
procedure TFrm_Inv_MnListAudit_D.edt_Batchno3KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
edt_Batchno3.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,'',whCode,WhPositionCode);
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhCode1Exit(Sender: TObject);
begin
if activecontrol.Name='btn_Cancel' then
abort;
{ with AdoQry_tmp do
begin
Close;
sql.Text :='select a.whCode+'''+' '+'''+b.whName whCode,b.whName '+
'from Item a,Warehouse b where a.whCode=b.whCode and a.ItemCode='''+Extedt_ItemCode.text+'''';
open;
if fieldbyname('whName').asstring<>'' then
DispInfo('该物料默认仓库为:'''+fieldbyname('whCode').asstring+'''',3);
end;}
if not DefaultWHCheck(AdoQry_tmp,getCode((sender as tcombobox).text),Extedt_ItemCode.text) then
(sender as tcombobox).SetFocus ;
end;
procedure TFrm_Inv_MnListAudit_D.FormActivate(Sender: TObject);
begin
InitCmBx(AdoQry_tmp.Connection,cmbx_WhCode1,'Warehouse','whCode','whName',False);
InitCmBx(AdoQry_tmp.Connection,cmbx_WhCode2,'Warehouse','whCode','whName',False);
InitCmBx(AdoQry_tmp.Connection,cmbx_WhCode3,'Warehouse','whCode','whName',False);
InitCmBx(AdoQry_tmp.Connection,cmbx_WhCode4,'Warehouse','whCode','whName',False);
InitCmBx(AdoQry_tmp.Connection,cmbx_WhCode5,'Warehouse','whCode','whName',False);
inherited;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhpCode1Change(Sender: TObject);
begin
inherited;
whCode:=cmbx_WhCode1.Text ;
WhPositionCode:=cmbx_WhpCode1.Text ;
CurrentInvfields:=getInvfield(AdoQry_tmp,whCode,WhPositionCode,'CurrentInv');
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+getCode(whCode)+''' and WhPositionCode='''+getCode(WhPositionCode)+''' and ItemCode='''+Extedt_ItemCode.text+'''');
open;
if not eof then
lbl_onhandInv.Caption:=fieldbyname('onhandInv').asstring
else
lbl_onhandInv.Caption:='0';
end;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhpCode2Change(Sender: TObject);
begin
inherited;
whCode:=cmbx_WhCode2.Text ;
WhPositionCode:=cmbx_WhpCode2.Text ;
CurrentInvfields:=getInvfield(AdoQry_tmp,whCode,WhPositionCode,'CurrentInv');
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+getCode(whCode)+''' and WhPositionCode='''+getCode(WhPositionCode)+''' and ItemCode='''+Extedt_ItemCode.text+'''');
open;
if not eof then
lbl_onhandInv.Caption:=fieldbyname('onhandInv').asstring
else
lbl_onhandInv.Caption:='0';
end;
end;
procedure TFrm_Inv_MnListAudit_D.cmbx_WhpCode3Change(Sender: TObject);
begin
inherited;
whCode:=cmbx_WhCode3.Text ;
WhPositionCode:=cmbx_WhpCode3.Text ;
CurrentInvfields:=getInvfield(AdoQry_tmp,whCode,WhPositionCode,'CurrentInv');
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select '+CurrentInvfields+ ' as onhandInv from CurrentInv where whCode='''+getCode(whCode)+''' and WhPositionCode='''+getCode(WhPositionCode)+''' and ItemCode='''+Extedt_ItemCode.text+'''');
open;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?