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

📄 inv_enter_mounitmnrequestauditingh.pas

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

Interface

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

Type
  TFrm_Inv_Enter_MoUnitMnRequestAuditingH = Class(TFrm_Base_Check_Head)
    InvBilltmpflag: TIntegerField;
    AdoQry_HeadInvBillid: TFloatField;
    AdoQry_HeadwhCode: TStringField;
    AdoQry_HeadwhCodeName: TStringField;
    AdoQry_HeadWhPositionCode: TStringField;
    AdoQry_HeadWhPositionCodeName: TStringField;
    AdoQry_HeadDeptCode: TStringField;
    AdoQry_HeadDeptCodeName: TStringField;
    AdoQry_HeadshiftType: TStringField;
    AdoQry_HeadInvBillno: TStringField;
    AdoQry_HeadInvBilldate: TDateTimeField;
    AdoQry_HeadSfc_EmployeeCodeName: TStringField;
    AdoQry_HeadWhEmployeeCode: TStringField;
    AdoQry_HeadInvBillRemArk: TStringField;
    AdoQry_HeadInvBilltmpflag: TIntegerField;
    procedure FormDestroy(Sender: TObject);
    procedure DBGridEhTitleClick(Column: TColumnEh);
    procedure AdoQry_HeadInvBilltmpflagChange(Sender: TField);
    procedure Act_LookExecute(Sender: TObject);
    procedure Act_PreviewExecute(Sender: TObject);
    procedure Act_PrintExecute(Sender: TObject);
    procedure Act_ExcelExecute(Sender: TObject);
  private
    { Private declarations }
    Flag : Boolean;
    SelectedCount : Integer;
  public
    { Public declarations }
    tmp_MoRequestshift:string;
    tmp_DeptCode:string;
    procedure InitForm(AdOConnection:TAdOConnection;ReadOnly:Boolean);Override;    
  end;

var
  Frm_Inv_Enter_MoUnitMnRequestAuditingH: TFrm_Inv_Enter_MoUnitMnRequestAuditingH;

implementation

uses Inv_Enter_MoUnitMnRequestAuditing, Sys_Global;

{$R *.DFM}

{ TFrm_Inv_Enter_MoUnitMnRequestAuditingH }

procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.InitForm(
  AdOConnection: TAdOConnection; ReadOnly: Boolean);
var SqlText , Tmp_DeptCode : String;
begin
  inherited;
  Application.ProcessMessages;
  Flag := False;
  Tmp_DeptCode := '';
  SelectedCount := 0;
  //设置表头SQL
  Try
    ExecuteSql(AdoQry_Tmp,'Drop Table  #TmPMoLine1',1);
  except
  end;

  SqlText := {'select CheckFlag=0,'+
                    ' MoLine.MoNo,'+
                    ' MoLine.MoLineNo,'+
                    ' MoLine.MoLineStatus,'+
                    ' Mo.DeptCode, '+
                    ' Dept.DeptName, ' +
                    ' Mo.DeptCode+'' ''+Dept.DeptName as DeptFlag, '+
                    ' Mo.MoSpecial, '  +
                    ' MoLine.ItemCode,'+
                    ' Item.ItemName,'+
                    ' MoLine.MoQty,'+
                    ' MoLine.MoNoFinishQty,'+
                    ' MoLine.MoStArtWorkDate,'+
                    ' MoLine.MoLineDate '+
                  ' Into #TmPMoLine1 '+
                  ' from MoLine '+
                  ' Join Mo On MoLine.MoNo=Mo.MoNo '+
                  ' left join Item  on MoLine.ItemCode=Item.ItemCode '+
                  ' left join Dept On Mo.DeptCode=Dept.DeptCode '+
                  ' Where BackFlush<>1 and MoQty>0 and MoLineStatus=6  and InvOutBill.MoUnitRquest=1';}
                  '  select '+
                    'InvBilltmpflag=0,'+
                    'InvOutBill.InvBillWhchck,'  +
                    'InvOutBill.InvBillid,'+
                    'InvOutBill.whCode,'+
                    'InvOutBill.whCode+'+' '' '' '+'+Warehouse.whName as whCodeName,'+
                    'InvOutBill.WhPositionCode,'+
                    'InvOutBill.WhPositionCode+'+' '' '' '+'+WhPosition.WhPositionName as WhPositionCodeName,'+
                    'InvOutBill.DeptCode,'+
                    'InvOutBill.DeptCode+'+''' '''+'+DeptName as DeptCodeName,'+
                    'InvOutBill.shiftType,'+
                    'InvOutBill.InvBillno,'+
                    'InvOutBill.InvBilldate,'+
                    'InvOutBill.Sfc_EmployeeCode+''  ''+Employee.EmployeeName  As Sfc_EmployeeCodeName,'+
                    'InvOutBill.WH_EmployeeCode +''  ''+Employee.EmployeeName as WhEmployeeCode  ,'+
                    'InvOutBill.InvBillRemArk ,'+
                    //'InvOutBillline.ite_ItemCode as ItemCode,'+
                    //' Item.ItemName,'+
                    'InvOutBillline.mono,'+
                    'InvOutBillline.MoLineno '+
                    ' Into #TmPMoLine1 '+
                 ' from InvOutBill  left join InvOutBillline  on InvOutBillline.InvBillid=InvOutBill.InvBillid  '+
                 //'  left join Item on InvOutBillline.ite_ItemCode=Item.ItemCode ' +
                 '  left join Warehouse  '+
                       ' on  InvOutBill.whCode=Warehouse.whCode '+
                 '  left join WhPosition '+
                 '       on InvOutBill.WhPositionCode=WhPosition.WhPositionCode'+
                 '       and InvOutBill.whCode=WhPosition.whCode  '+
                 '  left join Dept on  InvOutBill.DeptCode=Dept.DeptCode '+
                 '  left join Employee on InvOutBill.Sfc_EmployeeCode=Employee.EmployeeCode '+
                 ' left join (select * from Employee) t1 on InvOutBill.WH_EmployeeCode=t1.EmployeeCode '+
                 '  where (InvOutBill.ISMoUnitRequest=1) And (InvBillWhchck=0)'+
                 '        and ( InvOutBill.whCode in (select whCode '+
                                              '  from whAccessCtrl '+
                                              ' where EmployeeCode='''+userCode+''') )';
  ExecuteSql(AdoQry_Tmp,SqlText,1);
  SelectFromSql :='select  distinct '+
                   'InvBilltmpflag,' +
                   'InvBillWhchck,'+
                   'InvBillid,'+
                   'whCode,'+
                   ' whCodeName,'+
                   'WhPositionCode,'+
                   ' WhPositionCodeName,'+
                   'DeptCode,'+
                   'DeptCodeName,'+
                   'shiftType,'+
                   'InvBillno,'+
                   'InvBilldate,'+
                   ' Sfc_EmployeeCodeName,'+
                   'WhEmployeeCode,' +
                   'InvBillRemArk '+
                   ' from #TmPMoLine1';
                   //ConditionUserDefine:='InvBillWhchck=0';
  //设置排序字段信息
  OrderByFields := 'DeptCode,InvBillno';
  //固定条件为不是拉式领料且数量不为零
  Frm_Check_Body := TFrm_Inv_Enter_MoUnitMnRequestAuditing.Create(Self);
  Act_Filter.Execute;
  // GetData;
end;


procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.FormDestroy(
  Sender: TObject);
begin
  inherited;
  Frm_Inv_Enter_MoUnitMnRequestAuditingH:=nil;
end;

procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.DBGridEhTitleClick(
  Column: TColumnEh);
{var
  BookMArk:String;}
begin
  inherited;
  {If Trim(Column.Title.Caption)<>'标记' Then
    Abort;
  If AdoQry_Head.RecordCount=0 Then
    Abort;
  BookMArk:=AdoQry_Head.BookmArk;
  If Not Flag Then
  begin
    AdoQry_Head.First;
    While Not AdoQry_Head.Eof Do
    begin
      AdoQry_Head.Edit;
      AdoQry_Head.fieldbyname('InvBilltmpflag').AsInteger:=1;
      AdoQry_Head.Post;
      AdoQry_Head.Next;
    end;
  end
  Else
  begin
    AdoQry_Head.First;
    While Not AdoQry_Head.Eof Do
    begin
      AdoQry_Head.Edit;
      AdoQry_Head.fieldbyname('InvBilltmpflag').AsInteger:=0;
      AdoQry_Head.Post;
      AdoQry_Head.Next;
    end;
  end;
  AdoQry_Head.BookmArk:=BookMArk;
  Flag:=Not Flag;}
end;


procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.AdoQry_HeadInvBilltmpflagChange(
  Sender: TField);
//var
//  sqltext:string;
begin
  inherited;
{  If AdoQry_Head.fieldbyname('InvBilltmpflag').AsInteger =1 Then
  begin
    Tmp_DeptCode := AdoQry_Head.fieldbyname('InvBilltmpflag').AsString;
    Inc(SelectedCount);
  end
  Else
  if SelectedCount>0 Then
  Dec(SelectedCount);
  SqlText := 'Update #TmPMoLine1 '
            +'   set InvBilltmpflag='+AdoQry_Head.fieldbyname('InvBilltmpflag').AsString
            +'  Where MoNo='+QuotedStr(AdoQry_Head.fieldbyname('MoNo').AsString)
            +'    and MoLineNo='+AdoQry_Head.fieldbyname('MoLineNo').AsString;
  ExecuteSql(AdoQry_Tmp,SqlText,1);}
end;

procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.Act_LookExecute(
  Sender: TObject);
var
  i:integer;
begin
  {I:=0;
  with AdoQry_Head do
  begin
    DisableControls ;
    First;
    while not eof do
    begin
      if AdoQry_Head.fieldbyname('InvBillWhchck').asinteger=1 then
         i:=i+1;
      next;
    end;
    EnableControls ;
  end;
  if i>1 then
  begin
    DispInfo('只能核定当前选定的领料单:'+AdoQry_Head.fieldbyname('InvBillno').asstring+'!',3);
  end;}
  if AdoQry_Head.fieldbyname('InvBillWhchck').asinteger=1 then
  begin
    DispInfo('此领料单已核定    !',3);
    abort;
  end;

  inherited;

  //getdata;
end;

procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.Act_PreviewExecute(
  Sender: TObject);
begin
  try
    dbgrideh.Columns [1].Visible :=False;
    inherited;
  finally
    dbgrideh.Columns [1].Visible :=True;
  end;

end;

procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.Act_PrintExecute(
  Sender: TObject);
begin
  try
    dbgrideh.Columns [1].Visible :=False;
    inherited;
  finally
    dbgrideh.Columns [1].Visible :=True;
  end;

end;

procedure TFrm_Inv_Enter_MoUnitMnRequestAuditingH.Act_ExcelExecute(
  Sender: TObject);
begin
  try
    dbgrideh.Columns [1].Visible :=False;
    inherited;
  finally
    dbgrideh.Columns [1].Visible :=True;
  end;
end;

end.

⌨️ 快捷键说明

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