📄 mrp_qry_analyzermo5_mopoline.pas
字号:
unit Mrp_Qry_AnalyzerMo5_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_AnalyzerMo5_MoPoLine = Class(TFrm_Base_Qry)
AdoQry_Mainmono: TStringField;
AdoQry_MainMoLineno: TIntegerField;
AdoQry_MainIte_ItemCode: TStringField;
AdoQry_MainItemCode: TStringField;
AdoQry_MainMoQty: TFloatField;
AdoQry_MainRationQty: TFloatField;
AdoQry_MainOverAgeQty: TFloatField;
AdoQry_MainSjdg: TFloatField;
AdoQry_MainBzdg: 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_AnalyzerMo5_MoPoLine: TFrm_Mrp_Qry_AnalyzerMo5_MoPoLine;
implementation
uses Mrp_Qry_AnalyzerMo5, Mrp_Qry_AnalyzerMo5_Po_D,
Mrp_Qry_AnalyzerMo5_Mo_D, Sys_Global;
{$R *.DFM}
{ TFrm_Mrp_Qry_AnalyzerMo5_MoPo }
procedure TFrm_Mrp_Qry_AnalyzerMo5_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_AnalyzerMo5_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_AnalyzerMo5_Mo_D.Free;
end;
end
else
begin
try
with TFrm_Mrp_Qry_AnalyzerMo5_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;
edit5.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);
edit15.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_AnalyzerMo5_Po_D.Free;
end;
end;}
end;
procedure TFrm_Mrp_Qry_AnalyzerMo5_MoPoLine.InitForm(
AdOConnection: TAdOConnection; ReadOnly: Boolean);
begin
inherited;
end;
procedure TFrm_Mrp_Qry_AnalyzerMo5_MoPoLine.ShowDate(ItemCode,
ite_ItemCode: string);
var
SqlText:string;
begin
AdoQry_Main.Connection :=dbconnect;
sqlText:= ' Select Tmp6.mono,Tmp6.MoLineno,Tmp6.Ite_ItemCode,Tmp6.ItemCode,Tmp6.MoQty,Tmp6.RationQty,Tmp6.OverAgeQty,Tmp6.Sjdg,Tmp6.Bzdg, '
+' Case When IsNull(Tmp6.Bzdg,0)<>0 Then Convert(varChAr,round((Tmp6.Sjdg-Tmp6.Bzdg)/Tmp6.Bzdg*100,1))+''%'''
+' else ''0%'''
+' end as Dgbl '
+' From '
+' (Select Tmp5.mono,Tmp5.MoLineno,Tmp5.Ite_ItemCode,Tmp5.ItemCode,Tmp5.MoQty,Tmp5.RationQty,Tmp5.OverAgeQty, '
+' Case When IsNull(Tmp5.MoQty,0)<> 0 Then (IsNull(Tmp5.RationQty,0)+IsNull(Tmp5.OverAgeQty,0))/Tmp5.Moqty '
+' Else 0 end Sjdg,#TmpOpenBomLast.BomQty as Bzdg '
+' From '
+' (Select Tmp3.mono,Tmp3.MoLineno, Tmp3.Ite_ItemCode,Tmp4.ItemCode,IsNull(Tmp3.MoQty,0) As MoQty,IsNull(Tmp4.RationQty,0) as RationQty ,isNull(Tmp4.OverAgeQty,0) as OverAgeQty '
+' From '
+' (Select #TmPMoLine.MoNO as MoNO ,#TmPMoLine.MoLineNO as MoLineNO,#TmPMoLine.ItemCode as Ite_ItemCode,Sum(isnull(#TmPMoLine.MoRealInQty,0)) As MoQty From #TmPMoLine'
+' Group By #TmPMoLine.MoNO,#TmPMoLine.MoLineNO, #TmPMoLine.ItemCode) Tmp3 '
+' Left Join '
+' (Select Tmp2.mono,Tmp2.MoLineno,Tmp1.Ite_ItemCode,Tmp1.ItemCode,Tmp1.RationQty,Tmp2.OverAgeQty From '
+' (Select #TmpInvOutBillline.mono,#TmpInvOutBillline.MoLineno,#TmPMoLine.ItemCode As Ite_ItemCode,#TmpInvOutBillline.ItemCode As ItemCode, '
+' Sum(Isnull(#TmpInvOutBillline.InvBillQty,0)) As RationQty '
+' From #TmpInvOutBillline Join #TmPMoLine '
+' On #TmpInvOutBillline.MoNo+Convert(ChAr,#TmpInvOutBillline.MoLineNo)=#TmPMoLine.MoNo+Convert(chAr,#TmPMoLine.MoLineNo)'
+' and #TmpInvOutBillline.OverPlan=0 '
+' Group By #TmpInvOutBillline.mono,#TmpInvOutBillline.MoLineno, #TmPMoLine.ItemCode ,#TmpInvOutBillline.ItemCode)Tmp1 '
+' Left Join '
+' (Select #TmpInvOutBillline.mono,#TmpInvOutBillline.MoLineno,#TmPMoLine.ItemCode As Ite_ItemCode,#TmpInvOutBillline.ItemCode As ItemCode, '
+' Sum(Isnull(#TmpInvOutBillline.InvBillQty,0)) As OverAgeQty '
+' From #TmpInvOutBillline Join #TmPMoLine '
+' On #TmpInvOutBillline.MoNo+Convert(ChAr,#TmpInvOutBillline.MoLineNo)=#TmPMoLine.MoNo+Convert(chAr,#TmPMoLine.MoLineNo)'
+' and #TmpInvOutBillline.OverPlan=1 '
+' Group By #TmpInvOutBillline.mono,#TmpInvOutBillline.MoLineno, #TmPMoLine.ItemCode ,#TmpInvOutBillline.ItemCode)tmp2 '
+' On Tmp1.Ite_ItemCode=Tmp2.Ite_ItemCode '
+' and Tmp1.ItemCode=Tmp2.ItemCode '
// +' and Tmp1.mono=Tmp2.mono '
// +' and Tmp1.MoLineno=Tmp2.MoLineno'
+' ) Tmp4 '
+' On Tmp3.Ite_ItemCode=Tmp4.Ite_ItemCode '
// +' and Tmp3.mono=Tmp4.mono '
// +' and Tmp3.MoLineno=Tmp4.MoLineno'
+' ) Tmp5 '
+' join #TmpOpenBomLast on #TmpOpenBomLast.ItemCode=Tmp5.ItemCode '
+' And #TmpOpenBomLast.Ite_ItemCode=Tmp5.Ite_ItemCode) Tmp6 '
+' where Tmp6.ItemCode='''+ItemCode+''' and Tmp6.Ite_ItemCode='''+Ite_ItemCode+'''';
ExecuteSql(AdoQry_Main,SqlText,0);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -