⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sfc_bcpmonthqty.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Sfc_BcPMonthqty;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Outer, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
  StdCtrls, ExtCtrls, ComCtrls, ToolWin;

Type
  TFrm_Sfc_BcPMonthqty = Class(TFrm_Base_Outer)
  private
    { Private declarations }
  public
    { Public declarations }
    function  SetDeleteSql:String;Override;
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
    procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);Override;
  end;

var
  Frm_Sfc_BcPMonthqty: TFrm_Sfc_BcPMonthqty;

implementation
uses Sfc_BcPMonthqty_D, Sfc_BcPMonthqty_C;
{$R *.DFM}
procedure TFrm_Sfc_BcPMonthqty.InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);
var
  Monthtmp:string;
begin
  ExtendCaption:=False;
  inherited;
  FreeFields:='sonqty,sonScrAp,wipqty,' ;
  Frm_Sfc_BcPMonthqty_C:=TFrm_Sfc_BcPMonthqty_C.Create(self);
  Frm_Sfc_BcPMonthqty_C.Showmodal;
  if Frm_Sfc_BcPMonthqty_C.isok then
  begin
     Monthtmp:='where wiPMonth='+QuotedStr(Frm_Sfc_BcPMonthqty_C.maskedit1.text);
  end
  else
  begin
    Monthtmp:='';
  end;
  Frm_Sfc_BcPMonthqty_C.Release;
  try
    with AdoQry_tmp do
    begin
      Close;
      sql.text:='drop table #wiptmp';
      ExecSQL;
    end;
  except
  end;
  with AdoQry_tmp do
  begin
    Close;
    sql.text:='create table #wiptmp(wipid int,wiPMonth chAr(7),'+
              'DeptCode varchAr(8),ItemCode varchAr(16),wipqty decimal(20,8),'+
              'sonItemCode varchAr(16),sonqty decimal(20,8),sonScrAp decimal(20,8))';
    ExecSQL;
    Close;
    sql.text:='insert #wiptmp(wipid,wiPMonth,'+
              'DeptCode,ItemCode,wipqty,'+
              'sonItemCode,sonqty,sonScrAp) '+
              'select wipid,wiPMonth,DeptCode,ItemCode,'+
              'wipqty,sonItemCode,sonqty,sonScrAp from wipProduction '+Monthtmp;
    ExecSQL;
  end;
  SelectFromSQL:='Select #wiptmp.wipid,#wiptmp.wiPMonth,#wiptmp.DeptCode,Dept.DeptName,'
    +' #wiptmp.ItemCode,#wiptmp.sonItemCode,Item.ItemName,Uom.UomName,'
    +' #wiptmp.sonqty,#wiptmp.sonScrAp,'
    +' #wiptmp.wipqty,i.ItemName as sonItemName '
    +' From #wiptmp '
    +' left Join Item On Item.ItemCode=#wiptmp.ItemCode '
    +' left Join Item i On i.ItemCode=#wiptmp.sonItemCode '
    +' left join Dept on Dept.DeptCode=#wiptmp.DeptCode '
    +' left join Uom on Uom.UomCode=Item.UomCode ';
  OrderByFields:='wiPMonth,ItemCode';
  Frm_Sys_Detail:=TFrm_Sfc_BcPMonthqty_D.Create(self);
  AdoQry_Main.DisableControls;
  AdoQry_Main.Close;
  AdoQry_Main.SQL.clear;
  AdoQry_Main.SQL.Add(SelectFromSQL);
  AdoQry_Main.Open;
  AdoQry_Main.Sort:=OrderByFields;
  AdoQry_Main.EnableControls;
end;
function TFrm_Sfc_BcPMonthqty.SetDeleteSql:String;
begin
  Result:='Delete WipProduction'
    +' Where wipid='+AdoQry_Main.fieldbyname('wipid').AsString;
end;
procedure TFrm_Sfc_BcPMonthqty.SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,FrmParam6:String);
begin
  inherited;
  Frm_Sys_Detail.SetFormParam(FrmParam1,FrmParam2,'','','','');
  if FrmParam3='ReadOnly' then
  begin
    Act_New.Visible:=False;
    Act_Modify.Visible:=False;
    Act_Delete.Visible:=False;
    Act_New.Enabled:=False;
    Act_Modify.Enabled:=False;
    Act_Delete.Enabled:=False;
    Act_Look.Enabled:=True;
    Act_Look.Visible:=True;
  end
  else
  begin
    Act_New.Visible:=True;
    Act_Modify.Visible:=True;
    Act_Delete.Visible:=True;
    Act_New.Enabled:=True;
    Act_Modify.Enabled:=True;
    Act_Delete.Enabled:=True;
    Act_Look.Enabled:=False;
    Act_Look.Visible:=False;
  end;

end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -