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

📄 inv_batchhint.pas

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

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Dialog, Grids, DBGridEh, Db, AdODB, StdCtrls;

Type
  TFrm_Inv_BatchHint = Class(TFrm_Base_Dialog)
    DBGridEh: TDBGridEh;
    DataSource: TDataSource;
    Btn_AddBatchNo: TButton;
    procedure DBGridEhDblClick(Sender: TObject);
    procedure Btn_AddBatchNoClick(Sender: TObject);
  private
    { Private declarations }
    ItemCode,VendorCode:String;
  public
    { Public declarations }
    procedure InitForm(AdOConnection:TAdOConnection;ItemCode,VendorCode
      ,WhCode,WhPositionCode:String);
  end;

var
  Frm_Inv_BatchHint: TFrm_Inv_BatchHint;

implementation

uses Inv_BatchHint_Add;

{$R *.DFM}

procedure TFrm_Inv_BatchHint.InitForm(AdOConnection:TAdOConnection;
  ItemCode,VendorCode,WhCode,WhPositionCode:String);
begin
  SetDBConnect(AdOConnection);
  AdoQry_Tmp.Close;
  if VendorCode<>'' then
  begin
    AdoQry_Tmp.SQL.Text:='Select BatchLine.BatchNo,BatchLine.BatchName'
      +',BatchLine.UsefulDate,BatchCurrentInv.InvQty,BatchLine.FirstInDate'
      +',BatchLine.CurrentInDate,BatchLine.FirstOutDate,BatchLine.CurrentOutDate'
      +' From BatchLine Join Batch On BatchLine.BatchId=Batch.BatchId'
      +' Left Join BatchCurrentInv On BatchLine.BatchNo=BatchCurrentInv.BatchNo'
      +' And BatchCurrentInv.WhCode='''+WhCode+''''
      +' And BatchLine.BatchStatus=0'
      +' And BatchCurrentInv.WhPositionCode='''+WhPositionCode+''''
      +' Where Batch.ItemCode='''+ItemCode+''''
      +' And BatchLine.VendorCode='''+VendorCode+'''';
    Btn_AddBatchNo.Enabled:=True;
  end
  else
  begin
    AdoQry_Tmp.SQL.Text:='Select BatchLine.BatchNo,BatchLine.BatchName'
      +',BatchLine.UsefulDate,BatchCurrentInv.InvQty,BatchLine.FirstInDate'
      +',BatchLine.CurrentInDate,BatchLine.FirstOutDate,BatchLine.CurrentOutDate'
      +' From BatchLine Join Batch On BatchLine.BatchId=Batch.BatchId'
      +' Left Join BatchCurrentInv On BatchLine.BatchNo=BatchCurrentInv.BatchNo'
      +' And BatchCurrentInv.WhCode='''+WhCode+''''
      +' And BatchLine.BatchStatus=0'
      +' And BatchCurrentInv.WhPositionCode='''+WhPositionCode+''''
      +' Where Batch.ItemCode='''+ItemCode+'''';
    Btn_AddBatchNo.Enabled:=False;
  end;
  AdoQry_Tmp.Open;
  Self.ItemCode:=ItemCode;
  Self.VendorCode:=VendorCode;
end;

procedure TFrm_Inv_BatchHint.DBGridEhDblClick(Sender: TObject);
begin
  inherited;
  btn_ok.Click;
end;

procedure TFrm_Inv_BatchHint.Btn_AddBatchNoClick(Sender: TObject);
begin
  inherited;
  with TFrm_Inv_BatchHint_Add.Create(nil) do
  begin
    InitForm(DBConnect,ItemCode,VendorCode);
    if ShowModal=mrOk then
    begin
      Self.AdoQry_Tmp.DisableControls;
      Self.AdoQry_Tmp.Close;
      Self.AdoQry_Tmp.Open;
      Self.AdoQry_Tmp.Last;
      Self.AdoQry_Tmp.EnableControls;
    end;
    Release;
  end;
end;

end.

⌨️ 快捷键说明

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