getdepotandberthfrm.~pas

来自「群星医药系统源码」· ~PAS 代码 · 共 120 行

~PAS
120
字号
unit GetDepotAndBerthFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzButton, StdCtrls, Mask, RzEdit, RzBtnEdt, ExtCtrls;

type
  TFmGetDepotAndBerth = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Bevel1: TBevel;
    edDepotID: TRzButtonEdit;
    edBerthNo: TRzButtonEdit;
    btnOK: TRzBitBtn;
    btnCancel: TRzBitBtn;
    procedure edDepotIDButtonClick(Sender: TObject);
    procedure edDepotIDKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure edBerthNoButtonClick(Sender: TObject);
    procedure edBerthNoKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure btnOKClick(Sender: TObject);
    procedure btnCancelClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    FDepotNo: string;
    FDepotName: string;
    procedure SetDepotName(const Value: string);
    procedure SetDepotNo(const Value: string);
    { Private declarations }
  public
    { Public declarations }
    property DepotNo: string read FDepotNo write SetDepotNo;
    property DepotName: string read FDepotName write SetDepotName;
  end;

var
  FmGetDepotAndBerth: TFmGetDepotAndBerth;

implementation
uses  SelectDepotFrm, SelectBerthFrm, ceGlobal;

{$R *.dfm}

procedure TFmGetDepotAndBerth.FormCreate(Sender: TObject);
begin
  Color := FormBackColor;
end;

procedure TFmGetDepotAndBerth.edDepotIDButtonClick(Sender: TObject);
var
  iDepotID: integer;
begin
  iDepotID := edDepotID.Tag;
  if SelectDepot(iDepotID,FDepotNo,FDepotName) then
  begin
    edDepotID.Text := FDepotNo;
    edDepotID.Tag := iDepotID;
    edBerthNo.Text := '';
  end;
end;

procedure TFmGetDepotAndBerth.edDepotIDKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if (key=13)and(ssCtrl in Shift)then
    edDepotIDButtonClick(nil);
end;

procedure TFmGetDepotAndBerth.edBerthNoButtonClick(Sender: TObject);
var
  sBerth: string;
  iDepotID: integer;
begin
  iDepotID := edDepotID.Tag;
  if iDepotID =0 then
    MessageBox(Handle,'请先选择仓库!','提示',MB_ICONWARNING)
  else
    if SelectBerth(iDepotID,sBerth) then
      edBerthNo.Text := sBerth;
end;

procedure TFmGetDepotAndBerth.edBerthNoKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if (key=13)and(ssCtrl in Shift) then
    edBerthNoButtonClick(nil);
end;

procedure TFmGetDepotAndBerth.btnOKClick(Sender: TObject);
begin
  if edDepotID.Text = '' then
    MessageBox(Handle,'请选择一个要盘点的仓库及货位!','警告',MB_ICONWARNING)
  else
  begin
    if edBerthNo.Text = '' then
      if MessageBox(Handle,'你没有选择货位!如果继续,将为你选定仓库的所有货位创建盘点记录。'#13'要继续吗?','警告',MB_ICONWARNING or MB_YESNO)=IDNO then exit;
    ModalResult := mrOK;
  end;
end;

procedure TFmGetDepotAndBerth.btnCancelClick(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TFmGetDepotAndBerth.SetDepotName(const Value: string);
begin
  FDepotName := Value;
end;

procedure TFmGetDepotAndBerth.SetDepotNo(const Value: string);
begin
  FDepotNo := Value;
end;

end.

⌨️ 快捷键说明

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