U_ckdakp.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:2k
- unit U_ckdakp;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ComCtrls, ExtCtrls, Buttons, StdCtrls, Mask, DBCtrls, Db, DBClient;
- type
- TfrmCkxx_KP = class(TForm)
- Panel1: TPanel;
- Panel2: TPanel;
- StatusBar1: TStatusBar;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- Label1: TLabel;
- DBEdit1: TDBEdit;
- Label2: TLabel;
- DBEdit2: TDBEdit;
- Label3: TLabel;
- DBEdit3: TDBEdit;
- Label4: TLabel;
- DBEdit4: TDBEdit;
- Label5: TLabel;
- DBEdit5: TDBEdit;
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- frmCkxx_KP: TfrmCkxx_KP;
- implementation
- uses U_ckxxwh, U_mainform, WzglDB;
- {$R *.DFM}
- procedure TfrmCkxx_KP.SpeedButton1Click(Sender: TObject);
- var
- s_ckmc: string;
- begin
- if trim(dbedit1.text) = '' then
- begin
- application.messagebox('仓库名称不能为空', '物资管理系统', mb_iconinformation + mb_defbutton1);
- dbedit1.setfocus;
- exit;
- end;
- //重复编号
- s_ckmc := dbedit1.Text;
- DM.CDS_CKXX_INDEX.IndexFieldNames := '仓库名称';
- DM.CDS_CKXX_INDEX.Refresh;
- if DM.CDS_CKXX.state = dsinsert then
- begin
- if DM.CDS_CKXX_INDEX.FindKey([s_ckmc]) then
- begin
- application.MessageBox('仓库名称已重复', '物资管理系统', mb_iconinformation + mb_defbutton1);
- dbedit1.SetFocus;
- exit;
- end;
- end;
- if trim(dbedit2.text) = '' then
- begin
- application.messagebox('仓库地点不能为空', '物资管理系统', mb_iconinformation + mb_defbutton1);
- dbedit2.setfocus;
- exit;
- end;
- DM.CDS_CKXX.post;
- DM.CDS_CKXX.ApplyUpdates(0);
- close;
- end;
- procedure TfrmCkxx_KP.SpeedButton2Click(Sender: TObject);
- begin
- close;
- end;
- procedure TfrmCkxx_KP.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- DM.CDS_CKXX.cancel;
- DM.CDS_CKXX.cancelupdates;
- end;
- end.