unit u_op_add_ctn; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, StdCtrls, Mask, DBCtrls, bsSkinCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, wwdbdatetimepicker, Grids, DBGrids, XPMenu, Menus, ExtCtrls, wwdblook; type Tfrm_op_add_ctn = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; t_main: TADOQuery; t_main1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinGroupBox1: TbsSkinGroupBox; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; DBEdit1: TDBEdit; DBEdit8: TDBEdit; DBEdit7: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit4: TDBEdit; DBEdit5: TDBEdit; DBEdit6: TDBEdit; DBEdit9: TDBEdit; bsSkinGroupBox2: TbsSkinGroupBox; bsSkinPanel2: TbsSkinPanel; Label1: TLabel; Edit1: TEdit; Label37: TLabel; Edit2: TEdit; Label38: TLabel; Edit3: TEdit; t_fen: TADOQuery; t_fen1: TDataSource; t_fen_no: TADOQuery; t_fen_no1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridDateColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridColumn; XPMenu1: TXPMenu; PopupMenu1: TPopupMenu; N1: TMenuItem; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGrid2Column10: TdxDBGridColumn; dxDBGrid2Column11: TdxDBGridColumn; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; PopupMenu2: TPopupMenu; N2: TMenuItem; dxDBGrid1Column10: TdxDBGridColumn; dxDBGrid2Column12: TdxDBGridColumn; dxDBGrid3Column7: TdxDBGridColumn; dxDBGrid1Column12: TdxDBGridColumn; Panel1: TPanel; bsSkinButton10: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; dxDBGrid3Column8: TdxDBGridColumn; bsSkinPanel3: TbsSkinPanel; Label11: TLabel; Edit4: TEdit; Label12: TLabel; Edit5: TEdit; Label13: TLabel; Edit6: TEdit; Edit7: TEdit; Label14: TLabel; Label125: TLabel; wwDBLookupCombo49: TwwDBLookupCombo; Label124: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_add_ctn: Tfrm_op_add_ctn; implementation uses u_main, u_op_seae, my_sys_function; {$R *.dfm} procedure Tfrm_op_add_ctn.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_add_ctn.bsSkinButton10Click(Sender: TObject); begin t_fen.close; t_main.close; t_main.sql.clear; t_main.sql.add('select * from t_op_seae where 装运方式='+''''+'拼箱主票'+''''); if Edit1.text<>''then t_main.sql.add(' and 业务编号 like '+''''+'%'+Edit1.text+'%'+''''); if Edit2.text<>''then t_main.sql.add(' and 委托编号 like '+''''+'%'+Edit2.text+'%'+''''); if Edit3.text<>''then t_main.sql.add(' and 主提单号 like '+''''+'%'+Edit3.text+'%'+''''); t_main.sql.add(default_sort(53,'t_op_seae','','desc')); t_main.open; t_fen.open; end; procedure Tfrm_op_add_ctn.bsSkinButton2Click(Sender: TObject); var i:integer; begin if t_main.IsEmpty then exit; if t_main.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前拼箱主票业务已经完成,不能加入!!'); exit; end; if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_fen_no.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if t_fen_no['开船日期']=t_main['开船日期'] then begin t_fen_no.Edit; t_fen_no['主编号']:=t_main.fieldbyname('编号').asstring; t_fen_no.post; end else begin showmessage('分单的开船日期与主单的不一致,不能加入!!'); end; end; end else begin if t_fen_no['开船日期']=t_main['开船日期'] then begin t_fen_no.Edit; t_fen_no['主编号']:=t_main.fieldbyname('编号').asstring; t_fen_no.post; end else begin showmessage('分单的开船日期与主单的不一致,不能加入!!'); end; end; t_fen.Requery(); t_fen_no.requery; frm_op_seae.t_op_seae.Requery(); //close; end; procedure Tfrm_op_add_ctn.FormShow(Sender: TObject); begin t_fen_no.close; t_fen_no.sql.clear; t_fen_no.sql.add('select * from t_op_seae where 装运方式=' +''''+'拼箱分票'+''''+' and 编号=主编号' +' and ' +open_data('0001','录入人','操作员','客服员','报关操作','报检操作') +default_sort(53,'t_op_seae','','desc')); t_fen_no.open; t_main.open; t_fen.open; end; procedure Tfrm_op_add_ctn.bsSkinButton1Click(Sender: TObject); var i:integer; begin if t_main.IsEmpty then exit; if t_main.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前拼箱主票业务已经完成,不能取消加入!!'); exit; end; if t_fen.IsEmpty then exit; if dxDBGrid3.SelectedCount>=1 then begin for i:=0 to dxDBGrid3.SelectedCount-1 do begin t_fen.GotoBookmark(pointer(dxDBGrid3.selectedrows[i])); t_fen.edit; t_fen['主编号']:=t_fen['编号']; t_fen.post; end; end else begin t_fen.edit; t_fen['主编号']:=t_fen['编号']; t_fen.post; end; t_fen.Requery(); t_fen_no.Requery(); end; procedure Tfrm_op_add_ctn.bsSkinButton4Click(Sender: TObject); begin Edit4.text:=''; Edit5.text:=''; Edit6.text:=''; Edit7.text:=''; wwDBLookupCombo49.text:=''; wwDBLookupCombo52.text:=''; end; procedure Tfrm_op_add_ctn.bsSkinButton3Click(Sender: TObject); VAR STR:WIDESTRING; begin STR:='select * from t_op_seae where 装运方式=' +''''+'拼箱分票'+''''+' and 编号=主编号' +' and ' +open_data('0001','录入人','操作员','客服员','报关操作','报检操作'); IF Edit4.TEXT<>''THEN STR:=STR+' AND 业务编号 like '+''''+'%'+Edit4.TEXT+'%'+''''; IF Edit5.TEXT<>''THEN STR:=STR+' AND 委托编号 like '+''''+'%'+Edit5.TEXT+'%'+''''; IF Edit6.TEXT<>''THEN STR:=STR+' AND 主提单号 like '+''''+'%'+Edit6.TEXT+'%'+''''; IF Edit7.TEXT<>''THEN STR:=STR+' AND 航次 like '+''''+'%'+Edit7.TEXT+'%'+''''; IF wwDBLookupCombo49.TEXT<>''THEN STR:=STR+' AND 船名 like '+''''+'%'+wwDBLookupCombo49.TEXT+'%'+''''; IF wwDBLookupCombo52.TEXT<>''THEN STR:=STR+' AND 卸货港 like '+''''+'%'+trim(wwDBLookupCombo52.TEXT)+'%'+''''; STR:=STR+default_sort(53,'t_op_seae','','desc'); t_fen_no.close; t_fen_no.sql.clear; t_fen_no.sql.add(str); t_fen_no.open; end; end.