📄 sfc_mnlistrequest_d.pas
字号:
if edt_Batchno1.Text<>'' then
begin
DispInfo('该物料无需批次控制!',1);
twincontrol(sender).setfocus;
abort;
end;
{ if not BatchInvcheck(AdoQry_tmp,edt_Batchno1.text,'r',whCode,WhPositionCode,strtofloat(edt_MoRequestqty1.text)) then
begin
twincontrol(sender).setfocus;
abort;
end; }
end;
procedure TFrm_Sfc_MnListRequest_D.edt_Batchno2Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
if (BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
begin
if edt_Batchno2.Text='' then
begin
DispInfo('该物料需要批次控制,批次号不能为空!',1);
twincontrol(sender).setfocus;
abort;
end
else
if not Batchnocheck(AdoQry_tmp,edt_Batchno2.text,Extedt_ItemCode.text,'',datetimetostr(now)) then
begin
twincontrol(sender).setfocus;
abort;
end;
end
else
if edt_Batchno2.Text<>'' then
begin
DispInfo('该物料无需批次控制!',1);
twincontrol(sender).setfocus;
abort;
end;
{ if not BatchInvcheck(AdoQry_tmp,edt_Batchno2.text,'r',whCode,WhPositionCode,strtofloat(edt_MoRequestqty2.text)) then
begin
twincontrol(sender).setfocus;
abort;
end; }
end;
procedure TFrm_Sfc_MnListRequest_D.edt_Batchno3Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
if (BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
begin
if edt_Batchno3.Text='' then
begin
DispInfo('该物料需要批次控制,批次号不能为空!',1);
twincontrol(sender).setfocus;
abort;
end
else
if not Batchnocheck(AdoQry_tmp,edt_Batchno3.text,Extedt_ItemCode.text,'',datetimetostr(now)) then
begin
twincontrol(sender).setfocus;
abort;
end;
end
else
if edt_Batchno3.Text<>'' then
begin
DispInfo('该物料无需批次控制!',1);
twincontrol(sender).setfocus;
abort;
end;
{ if not BatchInvcheck(AdoQry_tmp,edt_Batchno3.text,'r',whCode,WhPositionCode,strtofloat(edt_MoRequestqty3.text)) then
begin
twincontrol(sender).setfocus;
abort;
end; }
end;
procedure TFrm_Sfc_MnListRequest_D.FormActivate(Sender: TObject);
begin
if status<>'Add' then
Extedt_ItemCode.Text :=getCode(AdoQry_Body.fieldbyname('ItemDESC').asstring);
InitCmBx1(cmbx_WhCode1,Extedt_ItemCode.text,'wh');
InitCmBx1(cmbx_WhCode2,Extedt_ItemCode.text,'wh');
InitCmBx1(cmbx_WhCode3,Extedt_ItemCode.text,'wh');
InitCmBx1(cmbx_WhCode4,Extedt_ItemCode.text,'wh');
InitCmBx1(cmbx_WhCode5,Extedt_ItemCode.text,'wh');
inherited;
if (status<>'Add') and (AdoQry_Body.fieldbyname('Parentid').asstring<>AdoQry_Body.fieldbyname('ItemListid').asstring) then
btn_ok.Enabled :=True;
// btn_ok.Enabled :=True;
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode4Change(Sender: TObject);
begin
inherited;
// InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode4,'WhPosition','WhPositionCode',
// 'WhPositionName','whCode='''+getCode(cmbx_WhCode4.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
initcmbx1(cmbx_WhpCode4,Extedt_ItemCode.text,'nwh',getCode(cmbx_WhCode4.Text));
btn_ok.Enabled :=True;
whCode:=getCode(cmbx_WhCode4.Text) ;
WhPositionCode:=getCode(cmbx_WhpCode4.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='''+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';
end;
show_WhName;
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode4KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,4);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode4Change(Sender: TObject);
begin
inherited;
whCode:=getCode(cmbx_WhCode4.Text) ;
WhPositionCode:=getCode(cmbx_WhpCode4.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='''+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';
end;
show_WhName;
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode4KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,4);
end;
procedure TFrm_Sfc_MnListRequest_D.edt_Batchno4Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
if (BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
begin
if edt_Batchno4.Text='' then
begin
DispInfo('该物料需要批次控制,批次号不能为空!',1);
twincontrol(sender).setfocus;
abort;
end
else
if not Batchnocheck(AdoQry_tmp,edt_Batchno4.text,Extedt_ItemCode.text,'',datetimetostr(now)) then
begin
twincontrol(sender).setfocus;
abort;
end;
end
else
if edt_Batchno4.Text<>'' then
begin
DispInfo('该物料无需批次控制!',1);
twincontrol(sender).setfocus;
abort;
end;
end;
procedure TFrm_Sfc_MnListRequest_D.edt_Batchno4KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
edt_Batchno4.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,'',whCode,WhPositionCode);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode5Change(Sender: TObject);
begin
inherited;
// InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode5,'WhPosition','WhPositionCode',
// 'WhPositionName','whCode='''+getCode(cmbx_WhCode5.text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
initcmbx1(cmbx_WhpCode5,Extedt_ItemCode.text,'nwh',getCode(cmbx_WhCode5.Text));
btn_ok.Enabled :=True;
whCode:=getCode(cmbx_WhCode5.Text) ;
WhPositionCode:=getCode(cmbx_WhpCode5.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='''+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';
end;
show_WhName;
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode5KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,5);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode5KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,4);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode5Change(Sender: TObject);
begin
inherited;
whCode:=getCode(cmbx_WhCode5.Text);
WhPositionCode:=getCode(cmbx_WhpCode5.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='''+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';
end;
show_WhName;
end;
procedure TFrm_Sfc_MnListRequest_D.edt_Batchno5KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
edt_Batchno5.text:=BatchHint(AdoQry_tmp.Connection,Extedt_ItemCode.text,'',whCode,WhPositionCode);
end;
procedure TFrm_Sfc_MnListRequest_D.edt_Batchno5Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
if (BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
begin
if edt_Batchno5.Text='' then
begin
DispInfo('该物料需要批次控制,批次号不能为空!',1);
twincontrol(sender).setfocus;
abort;
end
else
if not Batchnocheck(AdoQry_tmp,edt_Batchno5.text,Extedt_ItemCode.text,'',datetimetostr(now)) then
begin
twincontrol(sender).setfocus;
abort;
end;
end
else
if edt_Batchno5.Text<>'' then
begin
DispInfo('该物料无需批次控制!',1);
twincontrol(sender).setfocus;
abort;
end;
end;
procedure TFrm_Sfc_MnListRequest_D.InitCmBx1(var InputCmBx:TcomboBox;ItemCode:string;whjudge:string;condition:string='');
//根据数据表的内容初始化ComboBox的内容
var
sql:string;
begin
inputcmbx.clear;
if whjudge='wh' then
sql:='select w.whCode aa,isnull(c.onhandInv,0) onhandInv,w.whName bb from Warehouse w '+
'left join (select whCode,sum(onhandInv) as onhandInv from CurrentInv '+
' where ItemCode='''+ItemCode+''' group by whCode) c on w.whCode=c.whCode';
if whjudge='nwh' then
sql:='select w.whCode,w.WhPositionCode aa,isnull(wh.onhandInv,0) onhandInv,w.WhPositionName bb from WhPosition w left join '+
' (select WhPositionCode,sum(onhandInv) as onhandInv,whCode from CurrentInv '+
' where ItemCode='''+ItemCode+''' group by whCode,WhPositionCode) wh '+
' on w.whCode=wh.whCode and w.WhPositionCode=wh.WhPositionCode where w.whCode='''+condition+'''';
AdoQry_tmp.Close;
AdoQry_tmp.SQL.clear;
AdoQry_tmp.SQL.Add(sql);
AdoQry_tmp.Open;
if not AdoQry_tmp.Eof then
while not AdoQry_tmp.Eof do
begin
inputcmbx.Items.Add(AdoQry_tmp.fieldbyname('aa').asstring+' '+AdoQry_tmp.fieldbyname('onhandInv').asstring+' '+AdoQry_tmp.fieldbyname('bb').asstring);
AdoQry_tmp.Next;
end;
inputcmbx.ItemIndex:=0;
end;
procedure TFrm_Sfc_MnListRequest_D.Show_WhName ;
begin
with AdoQry_tmp do
begin
Close;
sql.Text:='select * from Warehouse where whCode='''+whCode+'''';
open;
lbl_CurwhCode.Caption :=fieldbyname('whName').asstring;
Close;
sql.Text:=' select * from WhPosition where whCode='+quotedstr(whCode)
+' and WhPositionCode='''+WhPositionCode+'''';
open;
lbl_CurWhPosition.Caption :=fieldbyname('WhPositionName').asstring;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -