📄 sfc_mnrequest_b1.pas
字号:
end;
AdoQry_SwAp.EnableControls;
end;
}
//生产单据号
Billno:=getno(AdoQry_Body.Connection,getCode(cmbbx_WhCode.text)+'C'+copy(medt_Date.text,3,2)+copy(medt_Date.text,6,2),'InvBill');
//增加InvOutBill
AdoQry_tmp.Close;
AdoQry_tmp.sql.clear;
AdoQry_tmp.sql.Add('insert InvOutBill'+
'(InvBillno,'+
'whCode,'+
'InvBilldate,'+
'InvBillMonth,'+
'DeptCode,'+
'mono,'+
'MoLineno,'+
'BillTypeCode,'+
'EmployeeCode,'+
'Sfc_EmployeeCode,'+
'wh_EmployeeCode2,'+
'WhPositionCode,'+
'shiftType,'+
'WipWaster,'+
'InvBillremArk)'+
'Values('''+Billno+''','+
''''+getCode(cmbbx_WhCode.text)+''','+
''''+medt_Date.text+''','+
''''+copy(medt_Date.text,1,7)+''','+
''''+getCode(lbl_Dept.Caption)+''','+
''''+lbl_Mono.Caption+''','+
lbl_MoLineno.Caption+','+
''''+BillTypeCode+''','+
''''+userCode+''','+
''''+userCode+''','+
''''+getCode(cmbbx_WhEmployee.text)+''','+
''''+getCode(cmbbx_WhPositionCode.text)+''','+
''''+cmbbx_Shift.text+''','+
inttostr(cmbx_WipWaster.Itemindex)+','+
''''+Extedt_memo.text+''')');
AdoQry_tmp.execsql;
//取InvBillID
AdoQry_tmp.Close;
AdoQry_tmp.sql.clear;
AdoQry_tmp.sql.Add(' select @@IDENTITY as Billid ');
AdoQry_tmp.open;
Billid:=AdoQry_tmp.fieldbyname('Billid').asstring;
with AdoQry_Body do
begin
First;
N:=1;
for M:=0 to recordCount-1 do
begin
//增加表InvOutBillLINE 只增加不为零为的数量
{ if(copy(fieldbyname('tmpItemCode').asstring,1,1)<>'+') and
(copy(fieldbyname('tmpItemCode').asstring,1,1)<>'-') then
} if fieldbyname('alterNative').asinteger=0 then
begin
if checkbox3.Checked then
begin
if (abs(fieldbyname('moRequestqty').asfloat)>0) or
(((fieldbyname('moRequestqty').asstring='0') or
(fieldbyname('moRequestqty').asstring='')) and
(fieldbyname('onhandInv').asstring='0'))
then
begin
AdoQry_tmp.Close;
AdoQry_tmp.sql.clear;
AdoQry_tmp.sql.Add(
'insert InvOutBillline'+
'(InvBillid,'+
'InvBilllineno,'+
'mono,'+
'MoLineno,'+
'ItemCode,'+
'ite_ItemCode,'+
'BilllineremArk,'+
'Batchno,'+
'ItemListid,'+
'InvBillSfcqty)'+
'Values('+Billid+','+
''''+inttostr(N)+''','+
''''+lbl_Mono.Caption+''','+
fieldbyname('MoLineno').asstring+','+
''''+fieldbyname('ItemCode').asstring+''','+
''''+fieldbyname('ite_ItemCode').asstring+''','+
''''+fieldbyname('BilllineremArk').asstring+''','+
''''+fieldbyname('Batchno').asstring+''','+
fieldbyname('ItemListid').asstring+','+
fieldbyname('moRequestqty').asstring+')');
AdoQry_tmp.ExecSQL;
N:=N+1;
end;
end
else
begin
if (abs(fieldbyname('moRequestqty').asfloat)>0)
then
begin
AdoQry_tmp.Close;
AdoQry_tmp.sql.clear;
AdoQry_tmp.sql.Add(
'insert InvOutBillline'+
'(InvBillid,'+
'InvBilllineno,'+
'mono,'+
'MoLineno,'+
'ItemCode,'+
'ite_ItemCode,'+
'BilllineremArk,'+
'Batchno,'+
'ItemListid,'+
'InvBillSfcqty)'+
'Values('+Billid+','+
''''+inttostr(N)+''','+
''''+lbl_Mono.Caption+''','+
fieldbyname('MoLineno').asstring+','+
''''+fieldbyname('ItemCode').asstring+''','+
''''+fieldbyname('ite_ItemCode').asstring+''','+
''''+fieldbyname('BilllineremArk').asstring+''','+
''''+fieldbyname('Batchno').asstring+''','+
fieldbyname('ItemListid').asstring+','+
fieldbyname('moRequestqty').asstring+')');
AdoQry_tmp.ExecSQL;
N:=N+1;
end;
end;
end;
next;
end;
end;
AdoQry_Body.GotoBookmArk(saveplace);
AdoQry_Body.FreeBookmArk(saveplace);
AdoQry_Body.EnableControls;
{ AdoQry_SwAp.Filtered:=False;
saveplace:=AdoQry_SwAp.GetBookmArk;
AdoQry_SwAp.DisableControls;
with AdoQry_SwAp do
begin
First;
for M:=0 to recordCount-1 do
begin
//增加表InvOutBillLINE 只增加不为零的数量
if checkbox3.Checked then
begin
if (abs(fieldbyname('moRequestqty').asfloat)>0) or
(((fieldbyname('moRequestqty').asstring='0') or (fieldbyname('moRequestqty').asstring='')) and
(fieldbyname('onhandInv').asstring='0'))
then
begin
AdoQry_tmp.Close;
AdoQry_tmp.sql.clear;
AdoQry_tmp.sql.Add(
'insert InvOutBillline'+
'(InvBillid,'+
'InvBilllineno,'+
'mono,'+
'MoLineno,'+
'ItemCode,'+
'ite_ItemCode,'+
'BilllineremArk,'+
'Batchno,'+
'InvBillSfcqty,'+
'ItemListid,'+
'alterNative,'+
'Parentid)'+
'Values('+Billid+','+
''''+inttostr(N)+''','+
''''+lbl_Mono.Caption+''','+
fieldbyname('MoLineno').asstring+','+
''''+fieldbyname('ItemCode').asstring+''','+
''''+fieldbyname('ite_ItemCode').asstring+''','+
''''+fieldbyname('BilllineremArk').asstring+''','+
''''+fieldbyname('Batchno').asstring+''','+
fieldbyname('moRequestqty').asstring+','+
fieldbyname('ItemListid').asstring+','+
fieldbyname('alterNative').asstring+','+
fieldbyname('Parentid').asstring+')');
AdoQry_tmp.execsql;
N:=N+1;
end;
next;
end
else
begin
if (abs(fieldbyname('moRequestqty').asfloat)>0) then
begin
AdoQry_tmp.Close;
AdoQry_tmp.sql.clear;
AdoQry_tmp.sql.Add(
'insert InvOutBillline'+
'(InvBillid,'+
'InvBilllineno,'+
'mono,'+
'MoLineno,'+
'ItemCode,'+
'ite_ItemCode,'+
'BilllineremArk,'+
'Batchno,'+
'InvBillSfcqty,'+
'ItemListid,'+
'alterNative,'+
'Parentid)'+
'Values('+Billid+','+
''''+inttostr(N)+''','+
''''+lbl_Mono.Caption+''','+
fieldbyname('MoLineno').asstring+','+
''''+fieldbyname('ItemCode').asstring+''','+
''''+fieldbyname('ite_ItemCode').asstring+''','+
''''+fieldbyname('BilllineremArk').asstring+''','+
''''+fieldbyname('Batchno').asstring+''','+
fieldbyname('moRequestqty').asstring+','+
fieldbyname('ItemListid').asstring+','+
fieldbyname('alterNative').asstring+','+
fieldbyname('Parentid').asstring+')');
AdoQry_tmp.execsql;
N:=N+1;
end;
next;
end;
end;
end;
AdoQry_SwAp.GotoBookmArk(saveplace);
AdoQry_SwAp.FreeBookmArk(saveplace);
AdoQry_SwAp.EnableControls;
} AdoQry_Body.Connection.CommitTrans;
act_auto.Enabled :=False;
dbgrideh.ReadOnly :=True;
// dbgrideh1.ReadOnly :=True;
Extedt_Billno.text:=Billno;
///////
with AdoQry_Body do
begin
First;
while not eof do
begin
if checkbox3.Checked then
begin
if not((copy(fieldbyname('tmpItemCode').asstring,1,1)<>'+') and
(copy(fieldbyname('tmpItemCode').asstring,1,1)<>'-')and
((abs(fieldbyname('moRequestqty').asfloat)>0) or
(((fieldbyname('moRequestqty').asstring='0') or
(fieldbyname('moRequestqty').asstring='')) and
(fieldbyname('onhandInv').asstring='0'))))then
begin
delete;
continue;
end;
next;
end
else
begin
if abs(fieldbyname('moRequestqty').asfloat)=0
then
begin
delete;
continue;
end
else
next;
end;
end;
end;
except
begin
AdoQry_Body.Connection.RollBackTrans;
AdoQry_Body.EnableControls ;
DispInfo(' 存盘不成功,请稍后再试! ',1);
end;
end;
end;
procedure TFrm_Sfc_MnRequest_B1.Act_NewExecute(Sender: TObject);
begin
Extedt_Billno.text:='';
IsAfterprint:=False;
inherited;
end;
procedure TFrm_Sfc_MnRequest_B1.DBGridEhExit(Sender: TObject);
begin
inherited;
if AdoQry_Body.State in [dsEdit, dsInsert] then
AdoQry_Body.Post;
end;
procedure TFrm_Sfc_MnRequest_B1.Extedt_BillnoChange(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnRequest_B1.medt_DateChange(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnRequest_B1.DataSourceDataChange(Sender: TObject;
Field: TField);
begin
inherited;
if status='ReadOnly' then
act_Save.Enabled :=False
else
act_Save.Enabled :=True;
if AdoQry_SwAp.state in [dsEdit,dsInsert] then
begin
exit;
end;
//如果是替代件,则对两个DBGRID进行数据关取过滤
if swApflag>0 then
begin
AdoQry_SwAp.Filtered:=False;
AdoQry_SwAp.Filter:=' Parentid='+inttostr(AdoQry_Body.fieldbyname('ItemListid').asinteger);
AdoQry_SwAp.Filtered:=True;
end;
end;
procedure TFrm_Sfc_MnRequest_B1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
try
Executesql(AdoQry_tmp,'drop table #Sfcmo',1);
except
end;
Extedt_Billno.text:='';
if AdoQry_Body.state in [dsEdit] then AdoQry_Body.Cancel;
AdoQry_SwAp.Close;
AdoQry_Body.Close;
end;
procedure TFrm_Sfc_MnRequest_B1.cmbbx_WhCodeChange(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnRequest_B1.cmbbx_WhPositionCodeChange(Sender: TObject);
begin
inherited;
//
end;
procedure TFrm_Sfc_MnRequest_B1.Act_SaveExecute(Sender: TObject);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -