📄 sfc_qry_mounitmnrequestauditing.pas
字号:
TmpAdoQry1.EnableBCD := False;
Try
SqlText := 'Select distinct InvOutBillLine.MoNo,InvOutBillLine.MoLineNo,InvOutBillLine.ite_ItemCode,Item.ItemName '+
'From InvOutBillLine left join Item on InvOutBillLine.ite_ItemCode=Item.ItemCode '+
'Where InvOutBillLine.InvBillId='''+AdoQry_Head.fieldbyname('InvBillId').AsString+''' ';
ExecuteSql(TmpAdoQry1,SqlText,0);
while Not TmpAdoQry1.Eof do
begin
SqlText := 'Select InvOutBillLine.ItemCode,Item.ItemName,Uom.UomName,sum(InvOutBillLine.InvBillSfcQty) as InvBillSfcQty,'+
'sum(MNItemList.MoRealQty) as MoRealQty,sum(MNItemList.MOCtrlQty) as MOCtrlQty,InvOutBillLine.BillLineRemArk,'+
''' '' as BomRemArk '+
'From InvOutBillLine left join Item on Item.ItemCode=InvOutBillLine.ItemCode '+
'left join Uom on Item.UomCode=Uom.UomCode '+
'left join MNItemList On InvOutBillLine.MoNo=MNItemList.MoNo And '+
'InvOutBillLine.MoLineNo=MNItemList.MoLineNo and '+
'InvOutBillLine.ItemCode=MNItemList.ItemCode '+
'Where InvOutBillLine.InvBillId='''+AdoQry_Head.fieldbyname('InvBillId').AsString+''' and '+
'InvOutBillLine.MoNo='''+TmpAdoQry1.fieldbyname('MoNo').AsString+ ''' and '+
'InvOutBillLine.MoLineNO='''+TmpAdoQry1.fieldbyname('MoLineNO').AsString+''' and '+
'InvOutBillLine.ite_ItemCode='''+TmpAdoQry1.fieldbyname('ite_ItemCode').AsString+''' and '+
'InvOutBillLine.InvBillSfcQty>0 '+
'group by InvOutBillLine.ItemCode,Item.ItemName,Uom.UomName,InvOutBillLine.BillLineRemArk '+
'Order by InvOutBillLine.ItemCode';
ExecuteSql(TmpAdoQry,SqlText,0);
Application.CreateForm(TFrm_Sfc_MnOut_NotSave_P,Frm_Sfc_MnOut_NotSave_P);
Frm_Sfc_MnOut_NotSave_P.SetFormParam('',getCode(cmbbx_WhCode.text),'0201','Preview',ModuleCode,'');
Frm_Sfc_MnOut_NotSave_P.QLWHCode.Caption:=cmbbx_WhCode.text;
Frm_Sfc_MnOut_NotSave_P.QLWhPositionCode.Caption:=cmbbx_WhPositionCode.text;
Frm_Sfc_MnOut_NotSave_P.qlWhEmployee.Caption:=cmbbx_WhEmployee.text;
Frm_Sfc_MnOut_NotSave_P.QLInvBillNo.Caption:=edt_Billno.text;
Frm_Sfc_MnOut_NotSave_P.QLDeptCode.Caption:=Edt_Dept.Text;
Frm_Sfc_MnOut_NotSave_P.QLshifttime.Caption:=cmbbx_Shift.text;
Frm_Sfc_MnOut_NotSave_P.QLInvBillDate.Caption:=medt_Date.text;
Frm_Sfc_MnOut_NotSave_P.QLMONo.Caption:=TmpAdoQry1.fieldbyname('MoNo').AsString;
Frm_Sfc_MnOut_NotSave_P.QLMoLineNo.Caption:=TmpAdoQry1.fieldbyname('MoLineNo').AsString;
Frm_Sfc_MnOut_NotSave_P.qlItemCodeName.Caption:=TmpAdoQry1.fieldbyname('ite_ItemCode').AsString+' '+TmpAdoQry1.fieldbyname('ItemName').AsString;
Frm_Sfc_MnOut_NotSave_P.QLWH_EmployeeCodea.Caption:='';
Frm_Sfc_MnOut_NotSave_P.QLWH_EmployeeCode.Caption:='';
Frm_Sfc_MnOut_NotSave_P.qlmemo.Caption:=edt_memo.text;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select EmployeeCode,EmployeeName from Employee where EmployeeCode='''+userCode+'''');
open;
end;
Frm_Sfc_MnOut_NotSave_P.QLEmployeeCodeA.Caption:=AdoQry_tmp.fieldbyname('EmployeeCode').asstring+' '+AdoQry_tmp.fieldbyname('EmployeeName').asstring;
Frm_Sfc_MnOut_NotSave_P.QLEmployeeCode.Caption:=AdoQry_tmp.fieldbyname('EmployeeCode').asstring+' '+AdoQry_tmp.fieldbyname('EmployeeName').asstring;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select moqty from MoLine where mono='''+TmpAdoQry1.fieldbyname('MoNo').AsString+''' and MoLineno='+TmpAdoQry1.fieldbyname('MoLineNo').AsString);
open;
end;
Frm_Sfc_MnOut_NotSave_P.qlmoqty.Caption:=AdoQry_tmp.fieldbyname('moqty').asstring;
Frm_Sfc_MnOut_NotSave_P.QuickRep1.DataSet:=TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText10.DataSet :=TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText10.DataField :='ItemCode';
Frm_Sfc_MnOut_NotSave_P.QRDBText1.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText1.DataField :='moCtrlqty';
// Frm_Sfc_MnOut_NotSave_P.QRExpr2.Expression:='COPY(TmpAdoQry.ItemName,1,44)';
// Frm_Sfc_MnOut_NotSave_P.QRExpr3.Expression :='COPY(TmpAdoQry.ItemName,45,16)';
Frm_Sfc_MnOut_NotSave_P.QRDBText12.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText12.DataField :='UomName';
Frm_Sfc_MnOut_NotSave_P.QRDBText15.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText15.DataField :='InvBillSfcQty';
Frm_Sfc_MnOut_NotSave_P.QRDBText2.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText2.DataField:='MoRealqty';
// Frm_Sfc_MnOut_NotSave_P.QRDBText3.DataSet :=TmpAdoQry;
// Frm_Sfc_MnOut_NotSave_P.QRDBText3.DataField:='RemArk';
Frm_Sfc_MnOut_NotSave_P.SetDBConnect(AdoQry_tmp.Connection);
Frm_Sfc_MnOut_NotSave_P.release;
TmpAdoQry1.Next;
end;
Finally
if Assigned(TmpAdoQry) then TmpAdoQry.free;
if Assigned(TmpAdoQry1) then TmpAdoQry1.free;
end;
end;
procedure TFrm_Sfc_Qry_MoUnitMnRequestAuditing.Button1Click(
Sender: TObject);
var SqlText : String;
TmpAdoQry : TAdoQuery;
TmpAdoQry1 : TAdoQuery;
begin
inherited;
TmpAdoQry := TAdoQuery.Create(self);
TmpAdoQry.Connection := Dbconnect;
TmpAdoQry.EnableBCD := False;
TmpAdoQry1 := TAdoQuery.Create(self);
TmpAdoQry1.Connection := Dbconnect;
TmpAdoQry1.EnableBCD := False;
Try
SqlText := 'Select distinct InvOutBillLine.MoNo,InvOutBillLine.MoLineNo,InvOutBillLine.ite_ItemCode,Item.ItemName '+
'From InvOutBillLine left join Item on InvOutBillLine.ite_ItemCode=Item.ItemCode '+
'Where InvOutBillLine.InvBillId='''+AdoQry_Head.fieldbyname('InvBillId').AsString+''' ';
ExecuteSql(TmpAdoQry1,SqlText,0);
while Not TmpAdoQry1.Eof do
begin
SqlText := 'Select InvOutBillLine.ItemCode,Item.ItemName,Uom.UomName,sum(InvOutBillLine.InvBillSfcQty) as InvBillSfcQty,'+
'sum(MNItemList.MoRealQty) as MoRealQty,sum(MNItemList.MOCtrlQty) as MOCtrlQty,InvOutBillLine.BillLineRemArk,'+
''' '' as BomRemArk '+
'From InvOutBillLine left join Item on Item.ItemCode=InvOutBillLine.ItemCode '+
'left join Uom on Item.UomCode=Uom.UomCode '+
'left join MNItemList On InvOutBillLine.MoNo=MNItemList.MoNo And '+
'InvOutBillLine.MoLineNo=MNItemList.MoLineNo and '+
'InvOutBillLine.ItemCode=MNItemList.ItemCode '+
'Where InvOutBillLine.InvBillId='''+AdoQry_Head.fieldbyname('InvBillId').AsString+''' and '+
'InvOutBillLine.MoNo='''+TmpAdoQry1.fieldbyname('MoNo').AsString+ ''' and '+
'InvOutBillLine.MoLineNO='''+TmpAdoQry1.fieldbyname('MoLineNO').AsString+''' and '+
'InvOutBillLine.ite_ItemCode='''+TmpAdoQry1.fieldbyname('ite_ItemCode').AsString+''' and '+
'InvOutBillLine.InvBillSfcQty>0 '+
'group by InvOutBillLine.ItemCode,Item.ItemName,Uom.UomName,InvOutBillLine.BillLineRemArk '+
'Order by InvOutBillLine.ItemCode';
ExecuteSql(TmpAdoQry,SqlText,0);
Application.CreateForm(TFrm_Sfc_MnOut_NotSave_P,Frm_Sfc_MnOut_NotSave_P);
Frm_Sfc_MnOut_NotSave_P.SetFormParam('',getCode(cmbbx_WhCode.text),'0201','Print',ModuleCode,'');
Frm_Sfc_MnOut_NotSave_P.QLWHCode.Caption:=cmbbx_WhCode.text;
Frm_Sfc_MnOut_NotSave_P.QLWhPositionCode.Caption:=cmbbx_WhPositionCode.text;
Frm_Sfc_MnOut_NotSave_P.qlWhEmployee.Caption:=cmbbx_WhEmployee.text;
Frm_Sfc_MnOut_NotSave_P.QLInvBillNo.Caption:=edt_Billno.text;
Frm_Sfc_MnOut_NotSave_P.QLDeptCode.Caption:=Edt_Dept.Text;
Frm_Sfc_MnOut_NotSave_P.QLshifttime.Caption:=cmbbx_Shift.text;
Frm_Sfc_MnOut_NotSave_P.QLInvBillDate.Caption:=medt_Date.text;
Frm_Sfc_MnOut_NotSave_P.QLMONo.Caption:=TmpAdoQry1.fieldbyname('MoNo').AsString;
Frm_Sfc_MnOut_NotSave_P.QLMoLineNo.Caption:=TmpAdoQry1.fieldbyname('MoLineNo').AsString;
Frm_Sfc_MnOut_NotSave_P.qlItemCodeName.Caption:=TmpAdoQry1.fieldbyname('ite_ItemCode').AsString+' '+TmpAdoQry1.fieldbyname('ItemName').AsString;
Frm_Sfc_MnOut_NotSave_P.QLWH_EmployeeCodea.Caption:='';
Frm_Sfc_MnOut_NotSave_P.QLWH_EmployeeCode.Caption:='';
Frm_Sfc_MnOut_NotSave_P.qlmemo.Caption:=edt_memo.text;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select EmployeeCode,EmployeeName from Employee where EmployeeCode='''+userCode+'''');
open;
end;
Frm_Sfc_MnOut_NotSave_P.QLEmployeeCodeA.Caption:=AdoQry_tmp.fieldbyname('EmployeeCode').asstring+' '+AdoQry_tmp.fieldbyname('EmployeeName').asstring;
Frm_Sfc_MnOut_NotSave_P.QLEmployeeCode.Caption:=AdoQry_tmp.fieldbyname('EmployeeCode').asstring+' '+AdoQry_tmp.fieldbyname('EmployeeName').asstring;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select moqty from MoLine where mono='''+TmpAdoQry1.fieldbyname('MoNo').AsString+''' and MoLineno='+TmpAdoQry1.fieldbyname('MoLineNo').AsString);
open;
end;
Frm_Sfc_MnOut_NotSave_P.qlmoqty.Caption:=AdoQry_tmp.fieldbyname('moqty').asstring;
Frm_Sfc_MnOut_NotSave_P.QuickRep1.DataSet:=TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText10.DataSet :=TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText10.DataField :='ItemCode';
Frm_Sfc_MnOut_NotSave_P.QRDBText1.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText1.DataField :='moCtrlqty';
// Frm_Sfc_MnOut_NotSave_P.QRExpr2.Expression:='COPY(TmpAdoQry.ItemName,1,44)';
// Frm_Sfc_MnOut_NotSave_P.QRExpr3.Expression :='COPY(TmpAdoQry.ItemName,45,16)';
Frm_Sfc_MnOut_NotSave_P.QRDBText12.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText12.DataField :='UomName';
Frm_Sfc_MnOut_NotSave_P.QRDBText15.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText15.DataField :='InvBillSfcQty';
Frm_Sfc_MnOut_NotSave_P.QRDBText2.DataSet := TmpAdoQry;
Frm_Sfc_MnOut_NotSave_P.QRDBText2.DataField:='MoRealqty';
// Frm_Sfc_MnOut_NotSave_P.QRDBText3.DataSet :=TmpAdoQry;
// Frm_Sfc_MnOut_NotSave_P.QRDBText3.DataField:='RemArk';
Frm_Sfc_MnOut_NotSave_P.SetDBConnect(AdoQry_tmp.Connection);
Frm_Sfc_MnOut_NotSave_P.release;
TmpAdoQry1.Next;
end;
Finally
if Assigned(TmpAdoQry) then TmpAdoQry.free;
if Assigned(TmpAdoQry1) then TmpAdoQry1.free;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -