unit u_op_seae_cangdan_templet; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, bsSkinCtrls, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, DB, ADODB, StdCtrls; type Tfrm_op_seae_cangdan_templet = class(TForm) bsSkinPanel1: TbsSkinPanel; dxDBGrid1: TdxDBGrid; ds_t_op_cangdan_templet: TDataSource; t_op_cangdan_templet: TADOQuery; t_op_cangdan_templettempletid: TAutoIncField; t_op_cangdan_templetDSDesigner: TStringField; t_op_cangdan_templetDSDesigner2: TStringField; t_op_cangdan_templetDSDesigner3: TStringField; t_op_cangdan_templetDSDesigner4: TStringField; t_op_cangdan_templetDSDesigner5: TStringField; t_op_cangdan_templetDSDesigner6: TStringField; t_op_cangdan_templetDSDesigner7: TStringField; t_op_cangdan_templetDSDesigner8: TStringField; t_op_cangdan_templetDSDesigner9: TStringField; t_op_cangdan_templetDSDesigner10: TStringField; t_op_cangdan_templetDSDesigner11: TStringField; t_op_cangdan_templetDSDesigner12: TStringField; t_op_cangdan_templetDSDesigner13: TStringField; t_op_cangdan_templetDSDesigner14: TStringField; t_op_cangdan_templetDSDesigner15: TStringField; t_op_cangdan_templetDSDesigner16: TStringField; t_op_cangdan_templetDSDesigner17: TStringField; t_op_cangdan_templetDSDesigner18: TStringField; t_op_cangdan_templetDSDesigner19: TStringField; t_op_cangdan_templetDSDesigner20: TStringField; t_op_cangdan_templetDSDesigner21: TDateTimeField; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridDateColumn; bsSkinPanel2: TbsSkinPanel; bsSkinButton1: TbsSkinButton; Label1: TLabel; Edit1: TEdit; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; procedure dxDBGrid1DblClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); private { Private declarations } public { Public declarations } AMSID:Integer; AMSNO:string; end; var frm_op_seae_cangdan_templet: Tfrm_op_seae_cangdan_templet; implementation uses u_main,u_data_share, my_sys_function,u_op_seae; {$R *.dfm} procedure Tfrm_op_seae_cangdan_templet.dxDBGrid1DblClick(Sender: TObject); var aQuery:TADOQuery; SQLStr:string; begin aQuery:=CreateAdoQuery; if AMSID=0 then begin SQLStr:= 'insert into t_op_ams ' +' (发货人联系电话,发货人国家代码,发货人代码类型,发货人邮箱,发货人企业代码,舱单发货人代码' +',收货人联系电话,收货人国家代码,收货人代码类型,收货人邮箱,收货人企业代码,舱单收货人代码' +',通知人联系电话,通知人国家代码,通知人代码类型,通知人邮箱,通知人企业代码,舱单通知人代码' +',编号) values (' + QuotedStr(t_op_cangdan_templet.fieldbyname('发货人电话').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('发货人国家代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('发货人代码类型').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('发货人邮箱').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('发货人企业代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('舱单发货人代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('收货人电话').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('收货人国家代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('收货人代码类型').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('收货人邮箱').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('收货人企业代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('舱单收货人代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('通知人电话').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('通知人国家代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('通知人代码类型').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('通知人邮箱').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('通知人企业代码').AsString)+',' + QuotedStr(t_op_cangdan_templet.fieldbyname('舱单通知人代码').AsString)+',' + QuotedStr(amsno)+')'; end else begin SQLStr:= 'update t_op_ams set ' +'发货人联系电话='+QuotedStr(t_op_cangdan_templet.fieldbyname('发货人电话').AsString) +',发货人国家代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('发货人国家代码').AsString) +',发货人代码类型='+QuotedStr(t_op_cangdan_templet.fieldbyname('发货人代码类型').AsString) +',发货人邮箱='+QuotedStr(t_op_cangdan_templet.fieldbyname('发货人邮箱').AsString) +',发货人企业代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('发货人企业代码').AsString) +',舱单发货人代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('舱单发货人代码').AsString) +',收货人联系电话='+QuotedStr(t_op_cangdan_templet.fieldbyname('收货人电话').AsString) +',收货人国家代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('收货人国家代码').AsString) +',收货人代码类型='+QuotedStr(t_op_cangdan_templet.fieldbyname('收货人代码类型').AsString) +',收货人邮箱='+QuotedStr(t_op_cangdan_templet.fieldbyname('收货人邮箱').AsString) +',收货人企业代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('收货人企业代码').AsString) +',舱单收货人代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('舱单收货人代码').AsString) +',通知人联系电话='+QuotedStr(t_op_cangdan_templet.fieldbyname('通知人电话').AsString) +',通知人国家代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('通知人国家代码').AsString) +',通知人代码类型='+QuotedStr(t_op_cangdan_templet.fieldbyname('通知人代码类型').AsString) +',通知人邮箱='+QuotedStr(t_op_cangdan_templet.fieldbyname('通知人邮箱').AsString) +',通知人企业代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('通知人企业代码').AsString) +',舱单通知人代码='+QuotedStr(t_op_cangdan_templet.fieldbyname('舱单通知人代码').AsString) +' where id='+IntToStr(AMSID) end; with aQuery do begin Close; SQL.Clear; SQL.Add(SQLStr); ExecSQL; end; FreeAndNil(aQuery); frm_op_seae.t_op_ams.Requery(); Self.Close; end; procedure Tfrm_op_seae_cangdan_templet.FormShow(Sender: TObject); begin with t_op_cangdan_templet do begin Close; SQL.Clear; SQL.Add('select * from t_op_cangdan_templet where 操作员='+QuotedStr(employee)); Open; end; end; procedure Tfrm_op_seae_cangdan_templet.bsSkinButton3Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_cangdan_templet.bsSkinButton1Click(Sender: TObject); begin if trim(Edit1.Text)<>'' then begin with t_op_cangdan_templet do begin Close; SQL.Clear; SQL.Add('select * from t_op_cangdan_templet where 模板名称 like ''%'+trim(Edit1.Text)+'%'''); Open; end; end else begin with t_op_cangdan_templet do begin Close; SQL.Clear; SQL.Add('select * from t_op_cangdan_templet'); Open; end; end; end; procedure Tfrm_op_seae_cangdan_templet.bsSkinButton2Click(Sender: TObject); var aQuery:TADOQuery; begin if MessageDlg('您确定要删除 模板名称为:'+t_op_cangdan_templet.fieldbyname('模板名称').AsString+'?删除后不可恢复!',mtWarning,[mbYes,mbNo],0)=mrYes then begin aQuery:=CreateAdoQuery; with aQuery do begin Close; SQL.Clear; SQL.Add('delete t_op_cangdan_templet where templetid='+QuotedStr(t_op_cangdan_templet.fieldbyname('templetid').AsString)); ExecSQL; end; FreeAndNil(aQuery); t_op_cangdan_templet.Requery(); end; end; end.