inv_mnlistaudit_d.pas

来自「一个MRPII系统源代码版本」· PAS 代码 · 共 1,613 行 · 第 1/4 页

PAS
1,613
字号
unit Inv_MnListAudit_D;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Entry_Detail, Db, AdODB, ExtCtrls, StdCtrls, ExtEdit;

Type
  TFrm_Inv_MnListAudit_D = Class(TFrm_Base_Entry_Detail)
    Label1: TLabel;
    Label2: TLabel;
    lbl_ItemName: TLabel;
    Extedt_ItemCode: TExtEdit;
    Label4: TLabel;
    lbl_MoCtrlqty: TLabel;
    Label6: TLabel;
    lbl_MoRealqty: TLabel;
    Label8: TLabel;
    lbl_onhandInv: TLabel;
    Label12: TLabel;
    lbl_UomName: TLabel;
    edt_Batchno1: TExtEdit;
    Label7: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    cmbx_WhCode1: TComboBox;
    Label11: TLabel;
    cmbx_WhpCode1: TComboBox;
    Label13: TLabel;
    edt_MoRealqty1: TExtEdit;
    Label15: TLabel;
    Label21: TLabel;
    edt_Batchno2: TExtEdit;
    cmbx_WhCode2: TComboBox;
    cmbx_WhpCode2: TComboBox;
    edt_MoRealqty2: TExtEdit;
    edt_Batchno3: TExtEdit;
    cmbx_WhCode3: TComboBox;
    cmbx_WhpCode3: TComboBox;
    edt_MoRealqty3: TExtEdit;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Label25: TLabel;
    Label27: TLabel;
    Label29: TLabel;
    lbl_Bomqty: TLabel;
    lbl_BomScrAp: TLabel;
    Label3: TLabel;
    Bevel3: TBevel;
    edt_Batchno4: TExtEdit;
    cmbx_WhCode4: TComboBox;
    cmbx_WhpCode4: TComboBox;
    edt_MoRealqty4: TExtEdit;
    Label5: TLabel;
    Bevel4: TBevel;
    edt_Batchno5: TExtEdit;
    cmbx_WhCode5: TComboBox;
    cmbx_WhpCode5: TComboBox;
    edt_MoRealqty5: TExtEdit;
    cmbx_WhCode6: TComboBox;
    cmbx_WhCode10: TComboBox;
    cmbx_WhCode9: TComboBox;
    cmbx_WhCode8: TComboBox;
    cmbx_WhCode7: TComboBox;
    Label14: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    cmbx_WhpCode6: TComboBox;
    cmbx_WhpCode7: TComboBox;
    cmbx_WhpCode8: TComboBox;
    cmbx_WhpCode9: TComboBox;
    cmbx_WhpCode10: TComboBox;
    edt_MoRealqty6: TExtEdit;
    edt_MoRealqty7: TExtEdit;
    edt_MoRealqty8: TExtEdit;
    edt_MoRealqty9: TExtEdit;
    edt_MoRealqty10: TExtEdit;
    edt_Batchno6: TExtEdit;
    edt_Batchno7: TExtEdit;
    edt_Batchno8: TExtEdit;
    edt_Batchno9: TExtEdit;
    edt_Batchno10: TExtEdit;
    Bevel5: TBevel;
    edt_Requesttime1: TExtEdit;
    edt_Requesttime2: TExtEdit;
    edt_Requesttime3: TExtEdit;
    edt_Requesttime4: TExtEdit;
    edt_Requesttime5: TExtEdit;
    edt_Requesttime6: TExtEdit;
    edt_Requesttime7: TExtEdit;
    edt_Requesttime8: TExtEdit;
    edt_Requesttime9: TExtEdit;
    edt_Requesttime10: TExtEdit;
    procedure FormCreate(Sender: TObject);
    procedure InOutItemCodeCheck(Sender: TObject);
    procedure edt_Batchno1KeyDon(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure btn_okClick(Sender: TObject);
    procedure cmbx_WhCode1Change(Sender: TObject);
    procedure cmbx_WhCode2Change(Sender: TObject);
    procedure cmbx_WhCode3Change(Sender: TObject);
    procedure cmbx_WhCode1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhpCode1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_MoRequestqty1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhCode2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhpCode2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_MoRequestqty2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhCode3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhpCode3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_MoRequestqty3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_Batchno2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_Batchno3KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhCode1Exit(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure cmbx_WhpCode1Change(Sender: TObject);
    procedure cmbx_WhpCode2Change(Sender: TObject);
    procedure cmbx_WhpCode3Change(Sender: TObject);
    procedure edt_Batchno1Exit(Sender: TObject);
    procedure edt_Batchno2Exit(Sender: TObject);
    procedure edt_Batchno3Exit(Sender: TObject);
    procedure cmbx_WhCode4KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhCode5KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhpCode4KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure cmbx_WhpCode5KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_Batchno4KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_Batchno5KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edt_MoRealqty1Exit(Sender: TObject);

  private
    tmp_Mono,tmp_MoLineno,tmp_Date,tmp_ItemCode,tmp_MoRequestid,oldmoRequestqty,whCode,WhPositionCode:string;
    tmp_ItemListid,tmp_Parentid,tmp_alterNative,tmp_ShiftType,CurrentInvfields:string;
   tmp_BodymoRequestqty,tmp_MoCtrlqty,tmp_MoRequestqty,tmp_Bomqty,tmp_BomScrAp_Percent:real;
   Itemid:string;     { Private declarations }
   judge1,judge2,judge3,judge4,judge5:boolean;
   judge1_1,judge2_1,judge3_1,judge4_1,judge5_1:boolean;
   oldrealqty1,oldrealqty2,oldrealqty3,oldrealqty4,oldrealqty5:string;
   function check_Bill(MoRealqty:string):boolean;
  public
    procedure InitControls; Override;//根据AdoQry_Body当前值,初始化Form的控件
//    procedure SaveBodyData; Override;//把Form的控件值写入缓存,要Post
    //设置在部分修改状态下,那些控件Enable=True
    procedure SetStatus(CurrentStatus:String;var EnableControls:String);Override;
    procedure SetFormParam(frmParam1,frmParam2,frmParam3,frmParam4,frmParam5,frmParam6:string);Override;
    procedure show_WhCode(ItemCode:string;flag:integer;wCode:string);
    { Public declarations }
  end;

var
  Frm_Inv_MnListAudit_D: TFrm_Inv_MnListAudit_D;

implementation

uses Sys_Global,Inv_Global,Sfc_MnListRequest,Sfc_MnListRequest_Hint;
{$R *.DFM}
procedure TFrm_Inv_MnListAudit_D.InitControls;
var
  i,tmp_Parentid:integer;
  td_Ctrlqty:real;
  tmp_WhCode:string;
  Bookm:tBookmArk;
begin
//  inherited;
  //所有控件的ENABLE的初始化
  if AdoQry_Body.fieldbyname('Parentid').asstring=AdoQry_Body.fieldbyname('ItemListid').asstring then
  begin
    for i:=0 to controlCount-1 do
    begin
      if (controls[i] is tedit) or (controls[i] is tcombobox) then
          controls[i].Enabled :=False;
    end;
  end;
  cmbx_WhCode1.Enabled :=False;
  cmbx_WhCode2.Enabled :=False;
  cmbx_WhCode3.Enabled :=False;
  cmbx_WhCode4.Enabled :=False;
  cmbx_WhCode5.Enabled :=False;
  cmbx_WhCode6.Enabled :=False;
  cmbx_WhCode7.Enabled :=False;
  cmbx_WhCode8.Enabled :=False;
  cmbx_WhCode9.Enabled :=False;
  cmbx_WhCode10.Enabled :=False;
  with AdoQry_Body do
  begin
      Extedt_ItemCode.text:=getCode(fieldbyname('ItemDESC').asstring);
      Extedt_ItemCode.enabled:=False;
      lbl_ItemName.Caption:=getName(fieldbyname('ItemDESC').asstring);
      lbl_UomName.Caption:=fieldbyname('UomName').asstring;
      if fieldbyname('realoutqty1').asstring='' then
        edt_MoRealqty1.Text :=''
      else
        edt_MoRealqty1.Text :=fieldbyname('realoutqty1').asstring;
      if fieldbyname('realoutqty2').asstring='' then
         edt_MoRealqty2.Text :=''
      else
         edt_MoRealqty2.Text :=fieldbyname('realoutqty2').asstring;
      if fieldbyname('realoutqty3').asstring='' then
         edt_MoRealqty3.Text :=''
      else
         edt_MoRealqty3.Text :=fieldbyname('realoutqty3').asstring;
      if fieldbyname('realoutqty4').asstring='' then
         edt_MoRealqty4.Text :=''
      else
         edt_MoRealqty4.Text :=fieldbyname('realoutqty4').asstring;
      if fieldbyname('realoutqty5').asstring='' then
         edt_MoRealqty5.Text :=''
      else
         edt_MoRealqty5.Text :=fieldbyname('realoutqty5').asstring;
      if fieldbyname('realoutqty6').asstring='' then
        edt_MoRealqty6.Text :=''
      else
        edt_MoRealqty6.Text :=fieldbyname('realoutqty6').asstring;
      if fieldbyname('realoutqty7').asstring='' then
        edt_MoRealqty7.Text :=''
      else
        edt_MoRealqty7.Text :=fieldbyname('realoutqty7').asstring;
      if fieldbyname('realoutqty8').asstring='' then
        edt_MoRealqty8.Text :=''
      else
        edt_MoRealqty8.Text :=fieldbyname('realoutqty8').asstring;
      if fieldbyname('realoutqty9').asstring='' then
        edt_MoRealqty9.Text :=''
      else
        edt_MoRealqty9.Text :=fieldbyname('realoutqty9').asstring;
      if fieldbyname('realoutqty10').asstring='' then
        edt_MoRealqty10.Text :=''
      else
        edt_MoRealqty10.Text :=fieldbyname('realoutqty10').asstring;
      edt_Batchno1.Text :=fieldbyname('Batchno1').asstring;
      edt_Batchno2.Text :=fieldbyname('Batchno2').asstring;
      edt_Batchno3.Text :=fieldbyname('Batchno3').asstring;
      edt_Batchno4.Text :=fieldbyname('Batchno4').asstring;
      edt_Batchno5.Text :=fieldbyname('Batchno5').asstring;
      edt_Batchno6.Text :=fieldbyname('Batchno6').asstring;
      edt_Batchno7.Text :=fieldbyname('Batchno7').asstring;
      edt_Batchno8.Text :=fieldbyname('Batchno8').asstring;
      edt_Batchno9.Text :=fieldbyname('Batchno9').asstring;
      edt_Batchno10.Text :=fieldbyname('Batchno10').asstring;
      lbl_MoRealqty.Caption:=fieldbyname('MoRealqty').asstring;
      edt_Requesttime1.text :=fieldbyname('Requesttime1').asstring;
      edt_Requesttime2.text :=fieldbyname('Requesttime2').asstring;
      edt_Requesttime3.text :=fieldbyname('Requesttime3').asstring;
      edt_Requesttime4.text :=fieldbyname('Requesttime4').asstring;
      edt_Requesttime5.text :=fieldbyname('Requesttime5').asstring;
      edt_Requesttime6.text :=fieldbyname('Requesttime6').asstring;
      edt_Requesttime7.text :=fieldbyname('Requesttime7').asstring;
      edt_Requesttime8.text :=fieldbyname('Requesttime8').asstring;
      edt_Requesttime9.text :=fieldbyname('Requesttime9').asstring;
      edt_Requesttime10.text :=fieldbyname('Requesttime10').asstring;
      lbl_Bomqty.Caption :=fieldbyname('Bomqty').asstring;
      lbl_BomScrAp.Caption :=fieldbyname('BomScrAp_Percent').asstring;
 end;
  Itemid:=AdoQry_Body.fieldbyname('ItemListid').asstring;
  if Extedt_ItemCode.Text<>'' then
  begin
  //初始化仓库的COMBOBOX
    if AdoQry_Body.fieldbyname('whCode1').asstring='' then
       cmbx_WhCode1.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode1,getCode(AdoQry_Body.fieldbyname('whCode1').asstring));
    if AdoQry_Body.fieldbyname('whCode2').asstring='' then
       cmbx_WhCode2.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode2,getCode(AdoQry_Body.fieldbyname('whCode2').asstring));
    if AdoQry_Body.fieldbyname('whCode3').asstring='' then
       cmbx_WhCode3.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode3,getCode(AdoQry_Body.fieldbyname('whCode3').asstring));
    if AdoQry_Body.fieldbyname('whCode4').asstring='' then
       cmbx_WhCode4.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode4,getCode(AdoQry_Body.fieldbyname('whCode4').asstring));
    if AdoQry_Body.fieldbyname('whCode5').asstring='' then
       cmbx_WhCode5.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode5,getCode(AdoQry_Body.fieldbyname('whCode5').asstring));
    if AdoQry_Body.fieldbyname('whCode6').asstring='' then
       cmbx_WhCode6.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode6,getCode(AdoQry_Body.fieldbyname('whCode6').asstring));
    if AdoQry_Body.fieldbyname('whCode7').asstring='' then
       cmbx_WhCode7.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode7,getCode(AdoQry_Body.fieldbyname('whCode7').asstring));
    if AdoQry_Body.fieldbyname('whCode8').asstring='' then
       cmbx_WhCode8.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode8,getCode(AdoQry_Body.fieldbyname('whCode8').asstring));
    if AdoQry_Body.fieldbyname('whCode9').asstring='' then
       cmbx_WhCode9.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode9,getCode(AdoQry_Body.fieldbyname('whCode9').asstring));
    if AdoQry_Body.fieldbyname('whCode10').asstring='' then
       cmbx_WhCode10.ItemIndex :=-1
    else
       InitCmBxText(cmbx_WhCode10,getCode(AdoQry_Body.fieldbyname('whCode10').asstring));
  end
  else
  begin
    cmbx_WhCode1.ItemIndex:=-1;
    cmbx_WhCode2.ItemIndex:=-1;
    cmbx_WhCode3.ItemIndex:=-1;
    cmbx_WhCode4.ItemIndex:=-1;
    cmbx_WhCode5.ItemIndex:=-1;
    cmbx_WhCode6.ItemIndex:=-1;
    cmbx_WhCode7.ItemIndex:=-1;
    cmbx_WhCode8.ItemIndex:=-1;
    cmbx_WhCode9.ItemIndex:=-1;
    cmbx_WhCode10.ItemIndex:=-1;
  end;
  //初始化货位的COMBOBOX
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode1,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode1.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode1,getCode(AdoQry_Body.fieldbyname('WhPositionCode1').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode2,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode2.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode2,getCode(AdoQry_Body.fieldbyname('WhPositionCode2').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode3,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode3.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode3,getCode(AdoQry_Body.fieldbyname('WhPositionCode3').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode4,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode4.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode4,getCode(AdoQry_Body.fieldbyname('WhPositionCode4').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode5,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode5.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode5,getCode(AdoQry_Body.fieldbyname('WhPositionCode5').asstring));

  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode6,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode6.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode6,getCode(AdoQry_Body.fieldbyname('WhPositionCode6').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode7,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode7.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode7,getCode(AdoQry_Body.fieldbyname('WhPositionCode7').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode8,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode8.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode8,getCode(AdoQry_Body.fieldbyname('WhPositionCode8').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode9,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode9.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode9,getCode(AdoQry_Body.fieldbyname('WhPositionCode9').asstring));
  InitCmBx_Condition(AdoQry_tmp.Connection,cmbx_WhpCode10,'WhPosition','WhPositionCode',
      'WhPositionName','whCode='''+getCode(cmbx_WhCode10.Text)+''' and not (Backflushwhp=1 or WhPositionType=1)');
  InitCmBxText(cmbx_WhpCode10,getCode(AdoQry_Body.fieldbyname('WhPositionCode10').asstring));
{
    //判断第一次领是否有焦点
    if (strtofloat(edt_MoRealqty1.Text)=0)then
    begin
      edt_MoRealqty1.Enabled :=True;
      edt_Batchno1.Enabled :=True;
    end
    else  if (strtofloat(edt_MoRealqty1.Text)<>0)
             and(strtofloat(edt_MoRealqty2.text)=0)
             and(AdoQry_Body.fieldbyname('tmpflag').asfloat<>0)then
          begin
            edt_MoRealqty1.Enabled :=True;
            edt_Batchno1.Enabled :=True;
          end;
    //判断第二次领是否有焦点
    if edt_MoRealqty1.Enabled then
    else
    begin
      if (strtofloat(edt_MoRealqty2.Text)=0) then
      begin
        edt_MoRealqty2.Enabled :=True;
        edt_MoRealqty2.SetFocus ;
        edt_Batchno2.Enabled :=True;
      end
      else if (strtofloat(edt_MoRealqty2.Text)<>0)
             and(strtofloat(edt_MoRealqty3.text)=0)
             and(AdoQry_Body.fieldbyname('tmpflag').asfloat<>0) then
          begin
            edt_MoRealqty2.Enabled :=True;
            edt_MoRealqty2.SetFocus ;
            edt_Batchno2.Enabled :=True;
          end
    end;
    //判断第三次领是否有焦点
    if edt_MoRealqty2.Enabled then
    else
    begin
      if (strtofloat(edt_MoRealqty3.Text)=0)and(strtofloat(edt_MoRealqty2.text)<>0) then
      begin
        edt_MoRealqty3.Enabled :=True;
        edt_MoRealqty3.SetFocus ;
        edt_Batchno3.Enabled :=True;
      end

⌨️ 快捷键说明

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