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

📄 unitgoodsnametypeform.pas

📁 手机批发商进销存管理
💻 PAS
字号:
unit UnitGoodsNameTypeForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzTabs, Grids, DBGrids, DB, ADODB, StdCtrls, Mask, DBCtrls,
  Buttons, ExtCtrls, DBActns, ActnList;

type
  TGoodsNameTypeForm = class(TForm)
    ADODataSet1: TADODataSet;
    DataSource1: TDataSource;
    ActionList1: TActionList;
    DataSetCancel1: TDataSetCancel;
    DataSetDelete1: TDataSetDelete;
    DataSetEdit1: TDataSetEdit;
    DataSetInsert1: TDataSetInsert;
    DataSetPost1: TDataSetPost;
    Panel1: TPanel;
    Panel2: TPanel;
    PanelInput: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    BitBtn5: TBitBtn;
    DBGrid1: TDBGrid;
    DBEdit1: TDBEdit;
    Label1: TLabel;
    DBGrid2: TDBGrid;
    DataSource2: TDataSource;
    ADODataSet2: TADODataSet;
    ADODataSet1GoodsName: TWideStringField;
    ADODataSet2GoodsType: TWideStringField;
    ADODataSet2GoodsNameTypeID: TAutoIncField;
    ADODataSet2GoodsName: TWideStringField;
    ADODataSet2HelpCode: TWideStringField;
    Panel3: TPanel;
    Label2: TLabel;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    BitBtn8: TBitBtn;
    BitBtn9: TBitBtn;
    BitBtn10: TBitBtn;
    DBEdit2: TDBEdit;
    DataSetCancel2: TDataSetCancel;
    DataSetDelete2: TDataSetDelete;
    DataSetEdit2: TDataSetEdit;
    DataSetInsert2: TDataSetInsert;
    DataSetPost2: TDataSetPost;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure DBGrid1DblClick(Sender: TObject);
    procedure ADODataSet1AfterPost(DataSet: TDataSet);
    procedure ADODataSet2AfterPost(DataSet: TDataSet);
  private
    { Private declarations }
    ParentFormName: String;
  public
    { Public declarations }
    constructor Create(AOwner: TComponent; PFormName: String);
  end;

implementation

uses UnitDM, UnitGj;

{$R *.dfm}

procedure TGoodsNameTypeForm.FormCreate(Sender: TObject);
begin
  ADODataSet1.Open;
  ADODataSet2.Open;
end;

procedure TGoodsNameTypeForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  ADODataSet1.Close;
  ADODataSet2.Close;
  Action := caFree;
end;

procedure TGoodsNameTypeForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=27 then Close;
end;

constructor TGoodsNameTypeForm.Create(AOwner: TComponent; PFormName: String);
begin
  ParentFormName := PFormName;
  inherited Create(AOwner);  
end;

procedure TGoodsNameTypeForm.DBGrid1DblClick(Sender: TObject);
begin
  if (not ADODataSet1.Active)or(not ADODataSet2.Active)or(ADODataSet1.RecordCount<=0)or(ADODataSet2.RecordCount<=0) then
  begin
    Close;
    Exit;
  end;

  if ParentFormName='GjForm' then
  begin
    GjForm.ComboBox1.Text := ADODataSet1.FieldByName('GoodsName').AsString;
    GjForm.ComboBox2.Text := ADODataSet2.FieldByName('GoodsType').AsString;
  end
  else if ParentFormName='' then
  begin
  end;
  Close;
end;

procedure TGoodsNameTypeForm.ADODataSet1AfterPost(DataSet: TDataSet);
begin
  DM1.GetGoodsNameType;
end;

procedure TGoodsNameTypeForm.ADODataSet2AfterPost(DataSet: TDataSet);
begin
  DM1.GetGoodsNameType;
end;

end.

⌨️ 快捷键说明

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