📄 sfc_mnlistrequest_d.pas
字号:
//对物料进行批次控制检测
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+''''
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+'''';
//高级组合提示窗体的初始化,分别用于货位、请领、批次号的F9起作用
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_WhCode4,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('whCode').asstring));
cmbx_WhCode4Change(cmbx_WhCode4);
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_WhCode5,getCode(Frm_Sfc_MnListRequest_Hint.AdoQuery.fieldbyname('whCode').asstring));
cmbx_WhCode5Change(cmbx_WhCode5);
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_Sfc_MnListRequest_D.cmbx_WhCode1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,1);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,1);
end;
{
procedure TFrm_Sfc_MnListRequest_D.edt_MoRequestqty1KeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,1);
end;
}
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode2KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,2);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode2KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,2);
end;
{
procedure TFrm_Sfc_MnListRequest_D.edt_MoRequestqty2KeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,2);
end;
}
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhCode3KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,3);
end;
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode3KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,3);
end;
{
procedure TFrm_Sfc_MnListRequest_D.edt_MoRequestqty3KeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
show_WhCode(Extedt_ItemCode.text,3);
end;
}
procedure TFrm_Sfc_MnListRequest_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_Sfc_MnListRequest_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_Sfc_MnListRequest_D.cmbx_WhCode1Exit(Sender: TObject);
begin
if activecontrol.Name='btn_Cancel' then
exit;
// if not DefaultWHCheck(AdoQry_tmp,getCode((sender as tcombobox).text),Extedt_ItemCode.text) then
// (sender as tcombobox).SetFocus ;
end;
{
procedure TFrm_Sfc_MnListRequest_D.edt_MoRequestqty2Exit(Sender: TObject);
var
saveplace:tBookmArk;
I:integer;
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
FloatCheck(Sender);
if (strtofloat(edt_MoRequestqty2.text)>strtofloat(lbl_onhandInv.Caption)) then
begin
DispInfo('请领数量不能大于当前货位库存!',1);
twincontrol(sender).setfocus;
abort;
end;
if (strtofloat(edt_MoRequestqty2.text)+strtofloat(lbl_MoRealqty.Caption)>strtofloat(lbl_MoCtrlqty.Caption)) then
begin
DispInfo('请领数量与累计实领之和已大于限额数量!',3);
end;
if (strtofloat(edt_MoRequestqty2.text)<0)and(-strtofloat(edt_MoRequestqty2.text)>strtofloat(lbl_MoRealqty.Caption)) then
begin
DispInfo('请领数量绝对值不大于当前累计实领数!',1);
twincontrol(sender).setfocus;
abort;
end;
selectnext(activecontrol,True,True);
edt_Batchno2.ControlStyle:=[cSclickEvents];
edt_Batchno2.ControlState:=[cSclicked];
if edt_Batchno2.CanFocus then
edt_Batchno2.Setfocus;
end;
procedure TFrm_Sfc_MnListRequest_D.edt_MoRequestqty1Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
FloatCheck(Sender);
if (strtofloat(edt_MoRequestqty1.text)>strtofloat(lbl_onhandInv.Caption)) then
begin
DispInfo('请领数量不能大于当前货位库存!',1);
twincontrol(sender).setfocus;
abort;
end;
if (strtofloat(edt_MoRequestqty1.text)+strtofloat(lbl_MoRealqty.Caption)>strtofloat(lbl_MoCtrlqty.Caption)) then
begin
DispInfo('请领数量与累计实领之和已大于限额数量!',3);
end;
if (strtofloat(edt_MoRequestqty1.text)<0)and(-strtofloat(edt_MoRequestqty1.text)>strtofloat(lbl_MoRealqty.Caption)) then
begin
DispInfo('请领数量绝对值不大于当前累计实领数!',1);
twincontrol(sender).setfocus;
abort;
end;
selectnext(activecontrol,True,True);
edt_Batchno1.ControlStyle:=[cSclickEvents];
edt_Batchno1.ControlState:=[cSclicked];
if edt_Batchno1.CanFocus then
edt_Batchno1.Setfocus;
end;
procedure TFrm_Sfc_MnListRequest_D.edt_MoRequestqty3Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
FloatCheck(Sender);
if (strtofloat(edt_MoRequestqty3.text)>strtofloat(lbl_onhandInv.Caption)) then
begin
DispInfo('请领数量不能大于当前货位库存!',1);
twincontrol(sender).setfocus;
abort;
end;
if (strtofloat(edt_MoRequestqty3.text)+strtofloat(lbl_MoRealqty.Caption)>strtofloat(lbl_MoCtrlqty.Caption)) then
begin
DispInfo('请领数量与累计实领之和已大于限额数量!',3);
end;
if (strtofloat(edt_MoRequestqty3.text)<0)and(-strtofloat(edt_MoRequestqty3.text)>strtofloat(lbl_MoRealqty.Caption)) then
begin
DispInfo('请领数量绝对值不大于当前累计实领数!',1);
twincontrol(sender).setfocus;
abort;
end;
selectnext(activecontrol,True,True);
edt_Batchno3.ControlStyle:=[cSclickEvents];
edt_Batchno3.ControlState:=[cSclicked];
if edt_Batchno3.CanFocus then
edt_Batchno3.Setfocus;
end;
}
procedure TFrm_Sfc_MnListRequest_D.cmbx_WhpCode1Change(Sender: TObject);
begin
inherited;
whCode:=getCode(cmbx_WhCode1.Text) ;
WhPositionCode:=getCode(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='''+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_WhpCode2Change(Sender: TObject);
begin
inherited;
whCode:=getCode(cmbx_WhCode2.Text);
WhPositionCode:=getCode(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='''+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_WhpCode3Change(Sender: TObject);
begin
inherited;
whCode:=getCode(cmbx_WhCode3.Text);
WhPositionCode:=getCode(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='''+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_Batchno1Exit(Sender: TObject);
begin
inherited;
if ActiveControl.Name='btn_Cancel' then
exit;
if (BatchCtrl(AdoQry_tmp,Extedt_ItemCode.text)) then
begin
if edt_Batchno1.Text='' then
begin
DispInfo('该物料需要批次控制,批次号不能为空!',1);
twincontrol(sender).setfocus;
abort;
end
else
if not Batchnocheck(AdoQry_tmp,edt_Batchno1.text,Extedt_ItemCode.text,'',datetimetostr(now)) then
begin
twincontrol(sender).setfocus;
abort;
end;
end
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -