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

📄 pm_enter_dynamicsspoinfo.pas

📁 一个MRPII系统源代码版本
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit Pm_Enter_DynamicSsPoInfo;
   
Interface

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

Type
  TFrm_Pm_Enter_DynamicSsPoInfo = Class(TFrm_Base_Outer)
    AdoQry_MainSSId: TAutoIncField;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainSSSysInfoFlag: TIntegerField;
    AdoQry_MaInOrderNo: TStringField;
    AdoQry_MaInOrderLineNo: TIntegerField;
    AdoQry_MainSSDate: TDateTimeField;
    AdoQry_MainSSQty: TFloatField;
    AdoQry_MainPmType: TIntegerField;
    AdoQry_MainSScheck: TIntegerField;
    AdoQry_MainGrossRequireQty: TFloatField;
    AdoQry_MaInPlanInvQty: TFloatField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainUomCode: TStringField;
    AdoQry_MainUomName: TStringField;
    AdoQry_MaInOrderLineStatus: TIntegerField;
    AdoQry_MainItemflag: TStringField;
    AdoQry_MainSsName: TStringField;
    Label1: TLabel;
    DBText1: TDBText;
    DBText2: TDBText;
    Label2: TLabel;
    Label3: TLabel;
    DBText3: TDBText;
    AdoQry_MainDeptVendorCode: TStringField;
    AdoQry_Loop: TAdoQuery;
    AdoQry_MainPcNo: TStringField;
    AdoQry_MainPmCode: TIntegerField;
    Label4: TLabel;
    DBText4: TDBText;
    AdoQry_MainEmployeeCode: TStringField;
    AdoQry_MainEmployeeName: TStringField;
    AdoQry_MainEmployeeFlag: TStringField;
    AdoQry_Mainduedate: TDateTimeField;
    AdoQry_MainReMainQty: TFloatField;
    AdoQry_MainQclt: TIntegerField;
    AdoQry_MainssreMainqty: TFloatField;
    procedure FormDestroy(Sender: TObject);
    procedure Act_NewExecute(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Act_CheckExecute(Sender: TObject);
    procedure AdoQry_MainBeforeInsert(DataSet: TDataSet);
    procedure Act_DeleteExecute(Sender: TObject);
    procedure AdoQry_MainBeforeEdit(DataSet: TDataSet);
    procedure AdoQry_MainAfterPost(DataSet: TDataSet);
    procedure DBGridEhTitleClick(Column: TColumnEh);
    procedure Act_LookExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    Flag:Integer;
    Checked:Boolean;
    PcNo:String;
    PmCode:Integer;
    Selected:Integer;//选定个数
    { Private declarations }
  public
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;
    procedure Initselect;
    { Public declarations }
  end;

var
  Frm_Pm_Enter_DynamicSsPoInfo: TFrm_Pm_Enter_DynamicSsPoInfo;

implementation
uses Sys_Global, Pm_Enter_AutoPo, Public_Show, Pm_Enter_PoSsParent,
  Pm_Enter_SsPoInfo;
{$R *.DFM}
procedure TFrm_Pm_Enter_DynamicSsPoInfo.InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);
var
  SqlText:String;
begin
  Application.ProcessMessages;
  inherited;
  SqlText:=' select *,ssreMainqty=reMainqty  into #ss from ss '
          +' where ssSysInfoflag=1 '
          +' and ((PmType=1) or (PmType=2) or (PmType=3)) '
          +' union '
          +' select *,ssreMainqty=0 from ss '
          +' where ssSysInfoflag=3 '
          +' and Orderlinestatus<>7 '
          +' and exists(select pono from poline where Orderno=poline.pono) '
          +' union '
          +' select ssid,ss.ItemCode,ssSysInfoflag, '
          +'       Orderno,Orderlineno,ssdate, '
          +'        PmType,             '
          +'        sScheck,            '
          +'        OrderLineStatus,    '
          +'        DeptVendorCode,     '
          +'        duedate,            '
          +'       ssqty=case  when ss.reMainqty<poline.poqty then poline.poqty-ss.reMainqty '
          +'             else ss.ssqty  '
          + '             end,          '
          +'        GrossRequireQty,    '
          +'        PlanInvQty,         '
          +'        ReMainQty,          '
          +'        ssreMainqty=0       '
          +'  from ss,poline            '
          +'  where ssSysInfoflag=2     '
          +'  and Orderlinestatus<>7    '
          +'  and exists(select pono from poline where Orderno=poline.pono) '
          +'  and ss.Orderno=poline.pono          '
          +'  and ss.Orderlineno=poline.polineno  ';
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.clear;
  AdoQry_Tmp.SQL.Text := SqlText;
  AdoQry_Tmp.ExecSQL;
  Initselect;


  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:='Select MrpParamValueN from MrpParam '
                      +' where MrpParamCode='''+'SSForwArdDay'+'''';
  AdoQry_Tmp.Open;
  Lbl_Condition.Caption:='系统建议下达(约定开工日-'+FormatDateTime('yyyy.mm.dd',Date())+')'
                        +'<=建议可见提前天数('+IntToStr(AdoQry_Tmp.fieldbyname('MrpParamValueN').AsInteger)+')    其它(全部)';
  AdoQry_Tmp.Close;
  Checked:=False;
end;


procedure TFrm_Pm_Enter_DynamicSsPoInfo.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Pm_Enter_SsPoInfo:=Nil;
end;

procedure TFrm_Pm_Enter_DynamicSsPoInfo.Act_NewExecute(Sender: TObject);
var
  I:Boolean;
  BookMArk:String;
begin
  inherited;
  If AdoQry_Main.RecordCount=0  Then
  begin
    Abort;
  end;
  I:=False;
  AdoQry_Main.First;
  While Not AdoQry_Main.Eof do
  begin
    If AdoQry_Main.fieldbyname('sScheck').AsInteger>0 Then
    begin
     I:=True;
     Break;
    end;
    AdoQry_Main.Next;
  end;
  If I=True Then
  begin
    Frm_Pm_Enter_AutoPo:=TFrm_Pm_Enter_AutoPo.Create(Application);
    Frm_Pm_Enter_AutoPo.InitForm(DbConnect,'Add',AdoQry_Main);
    Frm_Pm_Enter_AutoPo.SetFormParam(PcNo,IntToStr(PmCode),'','','','');
    Frm_Pm_Enter_AutoPo.SetSysParam(UserCode,ModuleCode,MenuId,LoginDate);
    Frm_Pm_Enter_AutoPo.ShowModal;
    Frm_Pm_Enter_AutoPo.Free;
  end
  Else
  begin
    DispInfo('没有选定记录,不能执行新增操作!',3);
    Abort;
  end;
  BookMArk:=AdoQry_Main.BookmArk ;
  AdoQry_Main.First;
  While Not AdoQry_Main.Eof Do
  begin
    If AdoQry_Main.fieldbyname('SScheck').AsInteger=1 Then
    begin
      PcNo:=AdoQry_Main.fieldbyname('PcNo').AsString;
      PmCode:=AdoQry_Main.fieldbyname('PmType').AsInteger;
      Break;
    end
    Else
      AdoQry_Main.Next;
  end;
  If AdoQry_Main.Eof Then
  begin
    PcNo:='';
    PmCode:=0;
  end;
  AdoQry_Main.BookmArk:=BookMArk;
end;

procedure TFrm_Pm_Enter_DynamicSsPoInfo.FormCreate(Sender: TObject);
begin
  inherited;
  ExtendCaption:=False;
//  TlBtn_Copy.Action:=Act_Check;
  PcNo:='';
  PmCode:=0;
  PmCode:=0;
  Selected:=0;
end;

procedure TFrm_Pm_Enter_DynamicSsPoInfo.Act_CheckExecute(Sender: TObject);
begin
  inherited;
  If AdoQry_Main.RecordCount=0 Then
    Abort;
  AdoQry_Main.First;
  While Not AdoQry_Main.Eof Do
  begin
    AdoQry_Main.Edit;
    AdoQry_Main.fieldbyname('SScheck').AsInteger:=1;
    AdoQry_Main.Post;
    Selected:=Selected+1;
    AdoQry_Main.Next;
  end;

⌨️ 快捷键说明

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