📄 inv_enter_whtowh.pas
字号:
AdoQry_tmp.First;
CmBx_OWhPosition.clear;
while not AdoQry_tmp.Eof do
begin
//CmBx_WhPosition.Items.Add(AdoQry_tmp.fieldbyname('WhPositionCodeName').AsString);
CmBx_OWhPosition.Items.Add(AdoQry_tmp.fieldbyname('WhPositionCodeName').AsString);
AdoQry_tmp.Next;
end;
//InitCmBxText(CmBx_WhPosition,AdoQry_Head.fieldbyname('WhPositionCode').AsString);
InitCmBxText(CmBx_OWhPosition,AdoQry_Head.fieldbyname('TOWhPositionCode').AsString);
end;
procedure TFrm_Inv_Enter_WhToWh.SaveCheck;
begin
if Trim(Ledt_DeptCode.text)='' then
begin
DispInfo('移出部门不能为空!',3);
Ledt_DeptCode.SetFocus ;
abort;
end;
if Trim(Ledt_ToDeptCode.text)='' then
begin
DispInfo('移入部门不能为空!',3);
Ledt_ToDeptCode.SetFocus ;
abort;
end;
{if Trim(Ledt_DeptCode.text)= Trim(Ledt_ToDeptCode.text) then
begin
DispInfo('移入部门与移出部门不能相同!',3);
Ledt_ToDeptCode.SetFocus ;
abort;
end;}
if Trim(CmBx_Warehouse.text)='' then
begin
DispInfo('移出仓库不能为空!',3);
CmBx_Warehouse.SetFocus ;
abort;
end;
if Trim(CmBx_OWarehouse.text)='' then
begin
DispInfo('移入仓库不能为空!',3);
CmBx_OWarehouse.SetFocus ;
abort;
end;
if Trim(CmBx_Warehouse.text)= Trim(CmBx_OWarehouse.text) then
begin
DispInfo('移入仓库与移出仓库不能相同!',3);
CmBx_OWarehouse.SetFocus ;
abort;
end;
if Trim(CmBx_WhPosition.text)='' then
begin
DispInfo('移出货位不能为空!',3);
CmBx_WhPosition.SetFocus ;
abort;
end;
if Trim(CmBx_OWhPosition.text)='' then
begin
DispInfo('移入货位不能为空!',3);
CmBx_OWhPosition.SetFocus ;
abort;
end;
{if Trim(CmBx_WhPosition.text)= Trim(CmBx_OWhPosition.text) then
begin
DispInfo('移入货位与移出货位不能相同!',3);
CmBx_OWhPosition.SetFocus ;
abort;
end;}
if Trim(edt_Billno.text)='' then
begin
DispInfo('单据号不能为空!',3);
edt_Billno.SetFocus ;
abort;
end;
with AdoQry_tmp do
begin
Close ;
Sql.clear;
Sql.text:='select BillID from Inv_WhToWh '+
'where Billno='''+Trim(edt_Billno.text)+'''';
open;
if recordCount<>0 then
begin
DispInfo('此单据号已存在,请重新输入!',3);
edt_Billno.SetFocus ;
abort;
end;
end;
end;
procedure TFrm_Inv_Enter_WhToWh.Act_InsertLineExecute(Sender: TObject);
begin
savecheck;
TFrm_Inv_Enter_WhToWh_D(Frm_Entry_Detail).SetUserParam1(getCode(CmBx_Warehouse.text),getCode(CmBx_WhPosition.text));
inherited;
end;
function TFrm_Inv_Enter_WhToWh.GetInvOutBillNo: string;
begin
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.text:=' select InvOutBillNo from Inv_WhToWh where Billno='''+Trim(Edt_BillNo.text)+'''';
open;
Result:=fieldbyname('InvOutBillNo').asstring;
end;
end;
procedure TFrm_Inv_Enter_WhToWh.WhToWhBillPrint(
DBConnection: TAdoConnection; WHCode, BillNo, BillTypeCode,
ModuleCode: string; Preview, MultiBill, PrintPrinted: Boolean;
PrintCondition: string);
var
BillNoChAr:String;//BillNoChAr='R'或'C',
InvBill:String;//InvBill='InvInBill'或'InvOutBill'
Common_Report:TFrm_Base_Common;
AdoQry_BillTmp:TAdoQuery;
tmp_BillTypeCode:string; //标识是否为待检入库
iSall_Condition:boolean; //0201
begin
AdoQry_BillTmp:=TAdoQuery.Create(nil);
AdoQry_BillTmp.EnableBCD:=False;
AdoQry_BillTmp.Connection:=DBConnection ;
try
AdoQry_BillTmp.Close;
AdoQry_BillTmp.SQL.Text:='Drop Table #tmp';
AdoQry_BillTmp.ExecSQL;
except
end;
Common_Report:=nil;
tmp_BillTypeCode:='';
if BillTypeCode='1101' then
begin
tmp_BillTypeCode:='1101';
Application.CreateForm(TFrm_Inv_WhToWh_P,Frm_Inv_WhToWh_P);
Common_Report:=Frm_Inv_WhToWh_P;
end;
if Common_Report=nil then
begin
AdoQry_BillTmp.free;
Common_Report.Release;
Exit;
end;
if(not MultiBill)and(Billno='')then
begin
DispInfo('没有保存的单据不能打印',1);
AdoQry_BillTmp.free;
Common_Report.Release;
Exit;
end;
common_Report.Caption:='注意:使用预览中的打印按钮,不影响单据的打印次数.';
AdoQry_BillTmp.Close;
AdoQry_BillTmp.SQL.Text:='Select IO From BillType'
+' Where BillTypeCode='''+BillTypeCode+'''';
AdoQry_BillTmp.Open;
if AdoQry_BillTmp.fieldbyname('IO').AsInteger=0 then
begin
BillNoChAr:='R';
InvBill:='InvInBill';
end
else if AdoQry_BillTmp.fieldbyname('IO').AsInteger=1 then
begin
BillNoChAr:='C';
InvBill:='InvOutBill';
end;
if not MultiBill then//单份单据
begin
if not Preview then
begin
if tmp_BillTypeCode='' then
begin
AdoQry_BillTmp.Close;
AdoQry_BillTmp.SQL.Text:='Select PrintTimes From '+InvBill
+' Where WHCode='''+WHCode+''''
+' And InvBillNo='''+BillNo+'''';
AdoQry_BillTmp.Open;
//if AdoQry_BillTmp.fieldbyname('PrintTimes').AsInteger>=1 then
//if DispInfo('该单据已经打印过'+AdoQry_BillTmp.fieldbyname('PrintTimes').
//AsString+'次,还需要打印吗?',2)='n' then
//Exit;
Common_Report.SetFormParam(Edt_BillNo.text,WHCode,BillTypeCode,'Print',ModuleCode,CmBx_OWarehouse.text);
Common_Report.SetDBConnect(AdoQry_BillTmp.Connection);
AdoQry_BillTmp.Close;
AdoQry_BillTmp.SQL.Text:='Update '+InvBill+' Set PrintTimes=PrintTimes+1'
+' Where WHCode='''+WHCode+''''
+' And InvBillNo='''+BillNo+'''';
AdoQry_BillTmp.ExecSQL;
end
else
begin
Common_Report.SetFormParam(Edt_BillNo.text,WHCode,BillTypeCode,'Print',ModuleCode,CmBx_OWarehouse.text);
Common_Report.SetDBConnect(AdoQry_BillTmp.Connection);
end;
end
else
begin
Common_Report.SetFormParam(Edt_BillNo.text,WHCode,BillTypeCode,'Preview',ModuleCode,CmBx_OWarehouse.text);
Common_Report.SetDBConnect(AdoQry_BillTmp.Connection);
end;
end
else
begin
Frm_Inv_BillPrint:=TFrm_Inv_BillPrint.Create(nil);
if Frm_Inv_BillPrint.ShowModal=mrOk then
begin
AdoQry_BillTmp.Close;
AdoQry_BillTmp.SQL.Text:='Select InvBillNo From '+InvBill
+' Where WHCode='''+WHCode+''''
+' And InvBillNo>='''+Frm_Inv_BillPrint.begInBillNo+''''
+' And InvBillNo<='''+Frm_Inv_BillPrint.endBillNo+''''
+' And BillTypeCode='''+BillTypeCode+'''';
if not PrintPrinted then
AdoQry_BillTmp.SQL.Text:=AdoQry_BillTmp.SQL.Text
+' And PrintTimes=0';
AdoQry_BillTmp.Open;
while not AdoQry_BillTmp.Eof do
begin
BillNo:=AdoQry_BillTmp.fieldbyname('InvBillNo').AsString;
if not preview then
begin
Common_Report.SetFormParam(Edt_BillNo.text,WHCode,BillTypeCode,'Print',ModuleCode,CmBx_OWarehouse.text);
Common_Report.SetDBConnect(AdoQry_BillTmp.Connection);
end
else
begin
Common_Report.SetFormParam(Edt_BillNo.text,WHCode,BillTypeCode,'Preview',ModuleCode,CmBx_OWarehouse.text);
Common_Report.SetDBConnect(AdoQry_BillTmp.Connection);
end;
AdoQry_BillTmp.Next;
end;
AdoQry_BillTmp.Close;
AdoQry_BillTmp.SQL.Text:='Update '+InvBill+' Set PrintTimes=PrintTimes+1'
+' Where WHCode='''+WHCode+''''
+' And InvBillNo>='''+Frm_Inv_BillPrint.begInBillNo+''''
+' And InvBillNo<='''+Frm_Inv_BillPrint.endBillNo+''''
+' And BillTypeCode='''+BillTypeCode+'''';
if not PrintPrinted then
AdoQry_BillTmp.SQL.Text:=AdoQry_BillTmp.SQL.Text
+' And PrintTimes=0';
AdoQry_BillTmp.ExecSQL;
end;
Frm_Inv_BillPrint.Release;
end;
Common_Report.Release;
AdoQry_BillTmp.free;
end;
procedure TFrm_Inv_Enter_WhToWh.LEdt_DeptCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if(Key=120)then
CommonHint(Sender,AdoQry_Tmp,'DeptName','部门名称','DeptCode','部门代码','Dept');
end;
procedure TFrm_Inv_Enter_WhToWh.LEdt_DeptCodeButtonClick(Sender: TObject);
begin
inherited;
CommonHint(Sender,AdoQry_Tmp,'DeptName','部门名称','DeptCode','部门代码','Dept');
end;
procedure TFrm_Inv_Enter_WhToWh.LEdt_ToDeptCodeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if(Key=120)then
CommonHint(Sender,AdoQry_Tmp,'DeptName','部门名称','DeptCode','部门代码','Dept');
end;
procedure TFrm_Inv_Enter_WhToWh.LEdt_ToDeptCodeButtonClick(
Sender: TObject);
begin
inherited;
CommonHint(Sender,AdoQry_Tmp,'DeptName','部门名称','DeptCode','部门代码','Dept');
end;
procedure TFrm_Inv_Enter_WhToWh.LEdt_DeptCodeExit(Sender: TObject);
begin
inherited;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.text:='select DeptName from Dept where DeptCode='''+Trim(LEdt_DeptCode.text)+'''';
open;
if not eof then
edt_DeptName.text:=fieldbyname('DeptName').asstring;
end;
end;
procedure TFrm_Inv_Enter_WhToWh.LEdt_ToDeptCodeExit(Sender: TObject);
begin
inherited;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.text:='select DeptName from Dept where DeptCode='''+Trim(LEdt_ToDeptCode.text)+'''';
open;
if not eof then
edt_ToDeptName.text:=fieldbyname('DeptName').asstring;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -