mrp_qry_analyzercapacity1_c.pas

来自「一个MRPII系统源代码版本」· PAS 代码 · 共 110 行

PAS
110
字号
unit Mrp_Qry_AnalyzerCapacity1_C;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Condition, Db, AdODB, StdCtrls, Mask;

Type
  TFrm_Mrp_Qry_AnalyzerCapacity1_C = Class(TFrm_Base_Condition)
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    edtwcCodes: TEdit;
    medts: TMaskEdit;
    medte: TMaskEdit;
    edtwcCodee: TEdit;
    edtocrates: TEdit;
    edtocratee: TEdit;
    edtmonos: TEdit;
    edtmonoe: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure btn_okClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_Mrp_Qry_AnalyzerCapacity1_C: TFrm_Mrp_Qry_AnalyzerCapacity1_C;

implementation
  uses  Mrp_Qry_AnalyzerCapacity1,Sys_Global;
{$R *.DFM}

procedure TFrm_Mrp_Qry_AnalyzerCapacity1_C.FormCreate(Sender: TObject);
begin
  inherited;
     medts.Text:=formatdatetime('yyyy.mm.dd',now);
     medte.Text:=formatdatetime('yyyy.mm.dd',now+30);
     edtwcCodes.Text:='0';
     edtmonos.Text:='0';
     edtwcCodee.Text:='ZZZZZ';
     edtmonoe.Text:='ZZZZZ';
     edtocrates.Text:='-100';
     edtocratee.Text:='100';

end;

procedure TFrm_Mrp_Qry_AnalyzerCapacity1_C.btn_okClick(Sender: TObject);
var sqltext:string;
begin
  inherited;
   sqltext:='Select    CAp.WcCode,'+
                      'cAp.mono,'+
                      'cAp.MoLineno,'+
                      'cAp.modate,'+
                      'cAp.moqty,'+
                      'cAp.mohours,'+
                      'it1.Capacityhours,'+
                      'cAp.MpsType,'+
                      'It1.ItemName As WCName,'+
                      'wcflag=cAp.wcCode+'' ''+it1.ItemName,'+
                      'Itemflag=cAp.ItemCode+'' ''+it2.ItemName,'+
                      'cAp.ItemCode,'+
                      'It2.ItemName,'+
                      'OverCapacity=cAp.mohours-it1.Capacityhours,'+
                      'OverCapacityrate=convert(varchAr,case it1.Capacityhours'+
                              ' when 0 then 100'+
                            ' else (cAp.mohours-it1.Capacityhours)*100/it1.Capacityhours'+
                           ' end )+''%'''+
              ' From Capacity CAp(nolock)'+
              '   left outer join Item it1(nolock) on cAp.wcCode=it1.ItemCode'+
              '   left outer join Item it2  on cAp.ItemCode=it2.ItemCode'+
             ' where  cAp.mono between '''+edtmonos.Text+''''+' and '''+edtmonoe.Text+''''+
             ' and  cAp.modate between '''+medts.Text+''''+' and '''+medte.Text+' 23:59:59'+''''+
             ' and  cAp.WCCode between '''+edtwcCodes.Text+''''+' and '''+edtwcCodee.Text+''''+
             ' and  convert(float,case it1.Capacityhours'+
                              ' when 0 then 100'+
                            ' else (cAp.mohours-it1.Capacityhours)*100/it1.Capacityhours'+
                           ' end ) between '+edtocrates.Text+' and '+edtocratee.Text+
                           '  Order by wcCode';
    with    Frm_Mrp_Qry_AnalyzerCapacity1.AdoQry_Main do
        begin
          Close;
          sql.clear;
          sql.Add(sqltext);
          open;
         if recordCount=0 then
         begin
           DispInfo('无符合条件的数据!',3);
           medts.SetFocus;
           exit;
         end;

        end;
   ConditionHint:='工作日期从 '+medts.Text+'到'+medte.Text+' / 工作中心代码从 '+EdtwcCodes.Text+'到'+EdtwcCodee.Text+' / 订单编号从 '+Edtmonos.Text+'到'+Edtmonoe.Text+' / 负荷率从 '+Edtocrates.Text+'%'+'到'+Edtocratee.Text+'%';
   self.ModalResult:=mrOk;


end;

end.

⌨️ 快捷键说明

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