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

📄 bas_invbalance_c.pas

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

Interface

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

Type
  TFrm_Bas_InvBalance_C = Class(TFrm_Base_Condition)
    cmbbx_WhCode: TComboBox;
    cmbbx_WhPositionCode:TComboBox;
    medt_Month: TMaskEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    procedure btn_okClick(Sender: TObject);
    procedure cmbbx_WhPositionCodeExit(Sender: TObject);
    procedure cmbbx_WhCodeChange(Sender: TObject);
  private
    old_WhCode:string;
    procedure InitCmbbx_WhPositionCode(whCode:string);
    { Private declarations }
  public
    onlyQuery:boolean;
    procedure InitForm(Adocnnct:tAdoConnection;UserCode:String;LoginDate:string);
    { Public declarations }
  end;

var
  Frm_Bas_InvBalance_C: TFrm_Bas_InvBalance_C;

implementation

uses Sys_Global;

{$R *.DFM}

procedure TFrm_Bas_InvBalance_C.InitForm(Adocnnct:tAdoConnection;UserCode:String;LoginDate:string);
begin
  onlyQuery:=False;
  old_WhCode:='';
  AdoQry_Tmp.Connection:=Adocnnct;
  InitUsableWHCmBx(AdoQry_tmp,UserCode,cmbbx_WhCode,False);
  cmbbx_WhCodeChange(cmbbx_WhCode);
  medt_Month.text:=LoginDate;
end;

procedure TFrm_Bas_InvBalance_C.InitCmbbx_WhPositionCode(whCode:string);
begin
  with AdoQry_tmp do
  begin
    Close;
    sql.clear;
    sql.Add('select WhPositionCode,WhPositionName '+
            ' from WhPosition  '+
            ' where whCode='''+whCode+'''');
    open;
    cmbbx_WhPositionCode.clear;
    if not Eof then
    begin
      First;
      while not Eof do
      begin
        cmbbx_WhPositionCode.Items.Add(fieldbyname('WhPositionCode').asstring+' '+fieldbyname('WhPositionName').asstring);
        Next;
      end;
      cmbbx_WhPositionCode.Itemindex:=0;
    end;
  end;
end;

procedure TFrm_Bas_InvBalance_C.btn_okClick(Sender: TObject);
begin
  inherited;
  if cmbbx_WhCode.text='' then
  begin
    DispInfo('没有可用仓库!',1);
    twincontrol(sender).setfocus;
    abort;
  end;
  if cmbbx_WhPositionCode.text='' then
  begin
    DispInfo('没有可用的货位!',1);
    twincontrol(sender).setfocus;
    abort;
  end;

  if cmbbx_WhCode.text<>'' then
  begin
     condition:=' InvBalance.whCode='''+getCode(cmbbx_WhCode.text)+'''';
  end;
  if cmbbx_WhPositionCode.text<>'' then
  begin
     condition:=condition+' and InvBalance.WhPositionCode='''+getCode(cmbbx_WhPositionCode.text)+'''';
  end;

  if medt_Month.text<>'' then
  begin
     condition:=condition+' and InvMonth='''+medt_Month.text+'''';
  end;

  if old_WhCode<>cmbbx_WhCode.text then
  begin
    onlyQuery:=False;
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select Count(*) as record from InvOutBill where whCode='''+getCode(cmbbx_WhCode.text)+'''');
      open;
      if fieldbyname('record').asinteger>0 then
         onlyQuery:=True;
    end;
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select Count(*) as record from InvInBill where whCode='''+getCode(cmbbx_WhCode.text)+''' and InitData=0 ');
      open;
      if fieldbyname('record').asinteger>0 then
         onlyQuery:=True;
    end;
    with AdoQry_tmp do
    begin
      Close;
      sql.clear;
      sql.Add('select Count(*) as record from oncheckBill where whCode='''+getCode(cmbbx_WhCode.text)+'''');
      open;
      if fieldbyname('record').asinteger>0 then
         onlyQuery:=True;
    end;

    if onlyQuery=True then
    begin
      // DispInfo('该仓库已经有出入库数据发生,不允许进行期初余额维护,只能查询!',3);
       DispInfo('该仓库已经有出入库数据发生,只能查询!',3);
       twincontrol(sender).setfocus;
    end;
    old_WhCode:=cmbbx_WhCode.text;
  end;
  modalResult:=mrok;
end;

procedure TFrm_Bas_InvBalance_C.cmbbx_WhPositionCodeExit(Sender: TObject);
begin
  inherited;
  if ActiveControl.Name='btn_Cancel' then
    exit;


end;

procedure TFrm_Bas_InvBalance_C.cmbbx_WhCodeChange(Sender: TObject);
begin
  inherited;
  initcmbbx_WhPositionCode(getCode(cmbbx_WhCode.text));
end;

end.

⌨️ 快捷键说明

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