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

📄 inv_wipwastercount_c.pas

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

Interface

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

Type
  TFrm_Inv_WipWasterCount_C = Class(TFrm_Base_Condition)
    medt_Date1: TMaskEdit;
    Label3: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    cmbx_WipWaster: TComboBox;
    Label5: TLabel;
    medt_Date2: TMaskEdit;
    cmbx_Shift: TComboBox;
    Label6: TLabel;
    Label7: TLabel;
    LEdt_DeptCode: TLinkEdit;
    Edt_DeptName: TEdit;
    LEdt_StArt_MoNo: TLinkEdit;
    LEdt_End_MoNo: TLinkEdit;
    procedure btn_okClick(Sender: TObject);
    procedure medt_Date2Exit(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure medt_Date1Exit(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure LEdt_DeptCodeExit(Sender: TObject);
  private
    { Private declarations }
  public
    onlyQuery:boolean;
    condition_tmp:string;
    WipWaster_Condition:string;
    procedure InitForm(Adocnnct:tAdoConnection;UserCode:String;LoginDate:string);
    procedure initcmbbx_DeptCode(tmp_userCode:string);    
    { Public declarations }
  end;

var
  Frm_Inv_WipWasterCount_C: TFrm_Inv_WipWasterCount_C;

implementation

uses Sys_Global,Inv_Global;

{$R *.DFM}
procedure TFrm_Inv_WipWasterCount_C.initcmbbx_DeptCode(tmp_userCode:string);
var
  DeptCode:string;
begin
{  if Cmbx_DeptDESC.Items.Count=0 then
  begin
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text:='Select DeptCode From Employee'
      +' Where EmployeeCode='''+UserCode+'''';
    AdoQry_Tmp.Open;
    DeptCode:=AdoQry_Tmp.fieldbyname('DeptCode').AsString;
    AdoQry_Tmp.Close;
    AdoQry_Tmp.SQL.Text:='Select DeptCode+'' ''+DeptName As DeptCodeName'
      +' From Dept'
      +' Where DeptCode Like '''+DeptCode+'%''';
    AdoQry_Tmp.Open;
    cmbx_DeptDESC.Items.clear ;
    cmbx_DeptDESC.Items.Add('');
    while not AdoQry_Tmp.Eof do
    begin
      Cmbx_DeptDESC.Items.Add(AdoQry_Tmp.fieldbyname('DeptCodeName').AsString);
      AdoQry_Tmp.Next;
    end;
    Cmbx_DeptDESC.ItemIndex:=0;
  end;   }
end;

procedure TFrm_Inv_WipWasterCount_C.InitForm(Adocnnct:tAdoConnection;UserCode:String;LoginDate:string);
begin
  medt_Date1.Text :=FormatDateTime('yyyy.mm',now)+'.01';
  medt_Date2.Text :=FormatDateTime('yyyy.mm.dd',now);
//  onlyQuery:=False;
  AdoQry_Tmp.Connection:=Adocnnct;
  InitShiftCmBx(AdoQry_tmp,cmbx_Shift,True);
  Cmbx_Shift.ItemIndex:=0;
  Cmbx_WipWaster.ItemIndex:=2;
end;

procedure TFrm_Inv_WipWasterCount_C.btn_okClick(Sender: TObject);
begin
  condition:='1=1';                 //用于保存工废条件
  conditionHint:='';
  condition_tmp:=' i.WipWaster<>1 and i.WipWaster<>2 ';  //用于保存领料条件
  WipWaster_Condition:='';
  if cmbx_WipWaster.ItemIndex=0 then
  begin
//     Condition:=' I.WipWaster=1 ';
     WipWaster_Condition:=' WasterType=2';
     conditionHint:=' 工(料)废:工废 '
  end;
  if cmbx_WipWaster.ItemIndex=1 then
  begin
     Condition:=' I.WipWaster=2 ';  // 为料废型
     conditionHint:=' 工(料)废:料废 ';
  end;
  if cmbx_WipWaster.ItemIndex=2 then
  begin
    conditionHint:=' 工(料)废:全部 ';
  end;
  condition_tmp:=condition_tmp+' and i.InvBilldate>='''+medt_Date1.text+'''';
  Condition:=condition+' and i.InvBilldate>='''+medt_Date1.text+'''';
  WipWaster_Condition:=WipWaster_Condition+' and i.wipdate>='''+medt_Date1.text+'''';
  ConditionHint:=ConditionHint+',日期大于等于:'+medt_Date1.text;
  condition_tmp:=condition_tmp+' and i.InvBilldate<='''+medt_Date2.text+'''';
  Condition:=condition+' and i.InvBilldate<='''+medt_Date2.text+'''';
  WipWaster_Condition:=WipWaster_Condition+' and i.wipdate<='''+medt_Date2.text+'''';
  ConditionHint:=ConditionHint+',日期小于等于:'+medt_Date2.text;
  If Trim(LEdt_DeptCode.text)<>'' Then
  begin
    condition_tmp:=condition_tmp+' and i.DeptCode like '+quotedstr(LEdt_DeptCode.text+'%');
    Condition:=condition+' and i.DeptCode like '+quotedstr(LEdt_DeptCode.text+'%');
    WipWaster_Condition:=WipWaster_Condition+' and i.DeptCode like '+quotedstr(LEdt_DeptCode.text+'%');
    ConditionHint:=ConditionHint+',部门:'+Edt_DeptName.Text ;
  end;
  if cmbx_Shift.Text<>'' then
  begin
    condition_tmp:=condition_tmp+' and i.shiftType='''+cmbx_Shift.text+'''';
    Condition:=condition+' and i.shiftType='''+cmbx_Shift.text+'''';
    WipWaster_Condition:=WipWaster_Condition+' and i.shiftType='''+cmbx_Shift.text+'''';
    ConditionHint:=ConditionHint+',班别:'+cmbx_Shift.text;
  end;
  condition_tmp:=condition_tmp+' and i.mono>='''+LEdt_StArt_MoNo.text+''' And  i.mono<='''+LEdt_End_MoNo.Text+'''';
  Condition:=condition+' and i.mono>='''+LEdt_StArt_MoNo.text+''' And  i.mono<='''+LEdt_End_MoNo.Text+'''';
  WipWaster_Condition:=WipWaster_Condition+' and i.mono>='''+LEdt_StArt_MoNo.text+''' And  i.mono<='''+LEdt_End_MoNo.Text+'''';
  ConditionHint:=ConditionHint+',单据号>="'+LEdt_StArt_Mono.text+'",单据号<="'+LEdt_End_Mono.text+'"';

  modalResult:=mrok;
end;


procedure TFrm_Inv_WipWasterCount_C.medt_Date2Exit(Sender: TObject);
begin
  inherited;
  if length(Trim(medt_Date2.text))=4 then
     abort;
  datecheck(sender);
  if medt_Date2.Text<medt_Date1.Text then
  begin
    DispInfo('最后的日期不能小于最初的日期!',3);
    abort;
  end;
end;

procedure TFrm_Inv_WipWasterCount_C.FormActivate(Sender: TObject);
begin
  inherited;
  btn_ok.Enabled :=True;
end;

procedure TFrm_Inv_WipWasterCount_C.medt_Date1Exit(Sender: TObject);
begin
  inherited;
  if length(Trim(medt_Date1.text))=4 then
     abort;
  datecheck(sender);
end;

procedure TFrm_Inv_WipWasterCount_C.FormCreate(Sender: TObject);
begin
  inherited;
  cmbx_WipWaster.ItemIndex:=0;
end;

procedure TFrm_Inv_WipWasterCount_C.LEdt_DeptCodeExit(Sender: TObject);
begin
  inherited;
  If ActiveControl.Name='btn_Cancel' Then
    Exit;
  If Trim(TEdit(Sender).Text)='' Then
    Exit;
  DeptCodeCheck(Sender);
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.Text:=' Select * From Dept Where DeptCode='''+TEdit(Sender).Text+'''';
  AdoQry_Tmp.Open;
  Edt_DeptName.Text:=AdoQry_Tmp.fieldbyname('DeptName').AsString;  
end;

end.

⌨️ 快捷键说明

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