📄 mrp_qry_analyzermo6_mopoline.pas
字号:
unit Mrp_Qry_AnalyzerMo6_MoPoLine;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
StdCtrls, ExtCtrls, ComCtrls, ToolWin;
Type
TFrm_Mrp_Qry_AnalyzerMo6_MoPoLine = Class(TFrm_Base_Qry)
AdoQry_Mainmono: TStringField;
AdoQry_MainMoLineno: TIntegerField;
AdoQry_MainIte_ItemCode: TStringField;
AdoQry_MainItemCode: TStringField;
AdoQry_MainMOQty: TFloatField;
AdoQry_MainTotalQty: TFloatField;
AdoQry_MainSjdg: TFloatField;
AdoQry_Mainbzdg: TFloatField;
AdoQry_Mainsjdgcb: TFloatField;
AdoQry_Mainbzdgcb: TFloatField;
AdoQry_MainDgbl: TStringField;
procedure Act_LookExecute(Sender: TObject);
private
{ Private declarations }
public
procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
procedure ShowDate(ItemCode,ite_ItemCode:string);
{ Public declarations }
end;
var
Frm_Mrp_Qry_AnalyzerMo6_MoPoLine: TFrm_Mrp_Qry_AnalyzerMo6_MoPoLine;
implementation
uses Mrp_Qry_AnalyzerMo6, Mrp_Qry_AnalyzerMo6_Po_D,
Mrp_Qry_AnalyzerMo6_Mo_D, Sys_Global;
{$R *.DFM}
{ TFrm_Mrp_Qry_AnalyzerMo6_MoPo }
procedure TFrm_Mrp_Qry_AnalyzerMo6_MoPoLine.InitForm(
AdOConnection: TAdOConnection; ReadOnly: Boolean);
begin
inherited;
end;
procedure TFrm_Mrp_Qry_AnalyzerMo6_MoPoLine.Act_LookExecute(Sender: TObject);
{var
SqlText:String;
poType:string;
linesta:string;}
begin
inherited;
{ if AdoQry_Main.fieldbyname('falg').asinteger=0 then
begin
try
with TFrm_Mrp_Qry_AnalyzerMo6_Mo_D.Create(Application) do
begin
AdoQry_Tmp.Connection:=dbconnect;
SqlText:=' Select Mo.* ,MoLine.* from Mo join MoLine on Mo.Mono=MoLine.MoNO '
+' and MoLine.Mono='''+AdoQry_Main.fieldbyname('mono').asstring+''' '
+' and MoLine.MoLineno='''+AdoQry_Main.fieldbyname('MoLineno').asstring+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:= SqlText;
AdoQry_tmp.Open;
case AdoQry_tmp.fieldbyname('MoLinestatus').asinteger of
5: linesta:='5 准备';
6: linesta:='6 下达';
7: linesta:='7 关闭';
end;
maskedit1.Text:=AdoQry_tmp.fieldbyname('modate').asstring;
if AdoQry_tmp.fieldbyname('StandardFlag').asinteger=0 then
edit1.Text:='否'
else edit1.Text:='是';
edit2.Text:=AdoQry_tmp.fieldbyname('SaleType').asstring;
edit3.Text:=AdoQry_tmp.fieldbyname('mono').asstring;
edit4.Text:=AdoQry_tmp.fieldbyname('DeptCode').asstring;
edit5.Text:=AdoQry_tmp.fieldbyname('MOSpecial').asstring;
edit6.Text:=inttostr(AdoQry_tmp.fieldbyname('MoLineno').asinteger);
edit7.Text:=AdoQry_tmp.fieldbyname('ItemCode').asstring;
edit8.Text:=AdoQry_tmp.fieldbyname('mostArtworkdate').asstring;
edit9.Text:=AdoQry_tmp.fieldbyname('MoLinedate').asstring;
edit10.Text:=floattostr(AdoQry_tmp.fieldbyname('moqty').asfloat);
edit11.Text:=floattostr(AdoQry_tmp.fieldbyname('MoNoFinishqty').asfloat);
edit12.Text:=linesta;
if AdoQry_tmp.fieldbyname('ByProduct').asinteger=0 then
edit13.Text:='否'
else edit13.Text:='是';
edit15.Text:=floattostr(AdoQry_tmp.fieldbyname('ssqty').asfloat);
edit16.Text:=floattostr(AdoQry_tmp.fieldbyname('MoRealInQty').asfloat);
edit17.Text:=floattostr(AdoQry_tmp.fieldbyname('MoRealInQty').asfloat);
showmodal;
end;
finally
Frm_Mrp_Qry_AnalyzerMo6_Mo_D.Free;
end;
end
else
begin
try
with TFrm_Mrp_Qry_AnalyzerMo6_Po_D.Create(Application) do
begin
AdoQry_Tmp.Connection:=dbconnect;
SqlText:=' Select Po.* ,PoLine.* from Po join Poline on Po.Pono=PoLine.PoNO '
+' and Poline.pono='''+AdoQry_Main.fieldbyname('mono').asstring+''' '
+' and POline.polineno='''+AdoQry_Main.fieldbyname('MoLineno').asstring+''' ';
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:= SqlText;
AdoQry_tmp.Open;
case AdoQry_tmp.fieldbyname('poType').asinteger of
0: poType:='普通采购';
1: poType:='进口采购';
2: poType:='委外加工';
end;
case AdoQry_tmp.fieldbyname('polinestatus').asinteger of
5: linesta:='5 准备';
6: linesta:='6 下达';
7: linesta:='7 关闭';
end;
maskedit1.Text:=AdoQry_tmp.fieldbyname('podate').asstring;
edit1.Text:=AdoQry_tmp.fieldbyname('EmployeeCode').asstring;
edit2.Text:=AdoQry_tmp.fieldbyname('pcno').asstring;
edit3.Text:=AdoQry_tmp.fieldbyname('pono').asstring;
edit4.Text:=AdoQry_tmp.fieldbyname('VendorCode').asstring;
edit6.Text:=poType;
edit6.Text:=inttostr(AdoQry_tmp.fieldbyname('polineno').asinteger);
edit7.Text:=AdoQry_tmp.fieldbyname('ItemCode').asstring;
edit8.Text:=AdoQry_tmp.fieldbyname('postArtworkdate').asstring;
edit9.Text:=AdoQry_tmp.fieldbyname('polinedate').asstring;
edit10.Text:=floattostr(AdoQry_tmp.fieldbyname('poqty').asfloat);
edit11.Text:=floattostr(AdoQry_tmp.fieldbyname('ponoFinishqty').asfloat);
edit12.Text:=linesta;
if AdoQry_tmp.fieldbyname('poreferencedPrice').asinteger=0 then
edit13.Text:='否'
else edit13.Text:='是';
edit14.Text:=floattostr(AdoQry_tmp.fieldbyname('potaxPrice').asfloat);
edit16.Text:=floattostr(AdoQry_tmp.fieldbyname('potaxAmount').asfloat);
edit16.Text:=floattostr(AdoQry_tmp.fieldbyname('ponotaxPrice').asfloat);
edit17.Text:=floattostr(AdoQry_tmp.fieldbyname('ponotaxAmount').asfloat);
showmodal;
end;
finally
Frm_Mrp_Qry_AnalyzerMo6_Po_D.Free;
end;
end;}
end;
procedure TFrm_Mrp_Qry_AnalyzerMo6_MoPoLine.ShowDate(ItemCode,
ite_ItemCode: string);
var
SqlText1: string;
begin
SqlText1:=' Select mono,MoLineno,Ite_ItemCode,ItemCode,MOQty,TotalQty,Sjdg,bzdg,sjdgcb,bzdgcb,'
+' Case when Isnull(bzdgcb,0) <>0 then'
+' Convert(varchAr,round((sjdgcb-bzdgcb)/bzdgcb*100,1))+''%'''
+' else ''0%'''
+' end Dgbl'
+' from '
+' (Select Tmp3.mono,Tmp3.MoLineno, Tmp3.Ite_ItemCode,Tmp3.ItemCode,Tmp3.MoQty,Tmp3.TotalQty,Tmp3.Sjdg,#TmpOpenBom6Last.BomQty As Bzdg, '
+' Tmp3.Sjdgcb,Case when Isnull(Tmp3.Sjdg,0)<>0 Then #TmpOpenBom6Last.BomQty/Tmp3.Sjdg*Tmp3.Sjdgcb '
+' Else 0 end Bzdgcb '
+' From '
+' (Select Tmp1.mono,Tmp1.MoLineno,Tmp1.Ite_ItemCode,Tmp1.ItemCode,Tmp2.MoQty,Tmp1.TotalQty,case when isnull(Tmp2.MoQty,0)<>0 then round(convert(float,isNull(Tmp1.TotalQty,0))/IsNull(Tmp2.MoQty,0),4) '
+' else 0 end Sjdg, '
+' Tmp1.Sjdgcb from '
+' (Select #TmPMoLine6.mono,#TmPMoLine6.MoLineno, #TmPMoLine6.ItemCode as Ite_ItemCode,#TmpInvOutBillLine6.ItemCode, Sum(isnull(#TmpInvOutBillLine6.InvBillQty,0)) As TotalQty,'
+' Sum(isNull(#TmpInvOutBillLine6.InvBillQty*#TmpInvOutBillLine6.InvBillNoTaxPrice,0)) As SjdgCb '
+' From #TmPMoLine6 Join #TmpInvOutBillLine6 '
+' On #TmPMoLine6.MoNo+Convert(ChAr,#TmPMoLine6.MoLineNO)=#TmpInvOutBillLine6.MoNo+Convert(chAr,#TmpInvOutBillLine6.MoLineNo)'
+' Group By #TmPMoLine6.mono,#TmPMoLine6.MoLineno,#TmPMoLine6.ItemCode,#TmpInvOutBillLine6.ItemCode ) Tmp1 '
+' join '
+' (Select #TmPMoLine6.mono,#TmPMoLine6.MoLineno,ItemCode As Ite_ItemCode,Sum(IsNull(MoRealInQty,0)) As MoQty From #TmPMoLine6 '
+' Group By #TmPMoLine6.mono,#TmPMoLine6.MoLineno,ItemCode)Tmp2 '
+' On Tmp1.Ite_ItemCode=Tmp2.Ite_ItemCode ) Tmp3 '
+' Join #TmpOpenBom6Last On Tmp3.Ite_ItemCode=#TmpOpenBom6Last.Ite_ItemCode '
+' and Tmp3.ItemCode=#TmpOpenBom6Last.ItemCode) tmp4'
+' where Tmp4.ItemCode='''+ItemCode+''' and Tmp4.Ite_ItemCode='''+Ite_ItemCode+''''
+' Order By Ite_ItemCode ,ItemCode ';
ExecuteSql(AdoQry_Main,SqlText1,0);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -