unit u_op_delhistry; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, dxExEdtr, StdCtrls, DBCtrls, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, RxLookup, wwdbdatetimepicker, ExtCtrls, wwdblook, Menus; type Tfrm_op_delhistry = class(TForm) bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; dxDBGrid1: TdxDBGrid; t_op_delete: TADOQuery; t_op_delete1: TDataSource; 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: TdxDBGridDateColumn; Label8: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; Label11: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; dxDBGrid1Column15: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridColumn; dxDBGrid1Column19: TdxDBGridColumn; lbl1: TLabel; wwDBLookupCombo49: TwwDBLookupCombo; lbl2: TLabel; edt1: TEdit; lbl3: TLabel; RxDBLookupCombo6: TRxDBLookupCombo; lbl4: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; lbl5: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; lbl6: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; lbl7: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; lbl8: TLabel; RxDBLookupCombo4: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; lbl9: TLabel; lbl10: TLabel; RxDBLookupCombo20: TRxDBLookupCombo; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid1Column26: TdxDBGridColumn; dxDBGrid1Column27: TdxDBGridColumn; dxDBGrid1Column28: TdxDBGridColumn; dxDBGrid1Column29: TdxDBGridColumn; dxDBGrid1Column30: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; bsSkinButton9: TbsSkinButton; dxDBGrid1Column33: TdxDBGridColumn; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; dxDBGrid1Column34: TdxDBGridColumn; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinPanel2Resize(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure huifu_op; function huifu_ctn:boolean; procedure huifu_1; procedure huifu_2; procedure huifu_3; procedure huifu_4; procedure t_doublePostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_doubleBeforeCancel(DataSet: TDataSet); procedure bsSkinButton9Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_delhistry: Tfrm_op_delhistry; implementation uses u_main, my_sys_function, u_op_delete_insert, u_op_delete; {$R *.dfm} function Tfrm_op_delhistry.huifu_ctn:boolean; var str,str_sub,str_field:widestring; begin { try t_op_ctn.close; t_op_ctn.open; str:=t_op_delete.fieldbyname('箱量信息').asstring; while pos(#4,str)<>0 do begin str_sub:=copy(str,1,pos(#7,str)); if pos(#7,str)=length(str) then str:='' else str:=copy(str,pos(#7,str)+1,length(str)-pos(#7,str)); str_field:=copy(str_sub,pos(#4,str_sub)+1,pos(#5,str_sub)-1-pos(#4,str_sub)); if str_field='ctn_id' then t_op_ctn.insert else case strtoint(copy(str_sub,pos(#5,str_sub)+1,pos(#6,str_sub)-pos(#5,str_sub)-1)) of 1: begin if copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)='True'then t_op_ctn[str_field]:=1 else t_op_ctn[str_field]:=0; end; 2: begin if copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)=''then t_op_ctn[str_field]:=null else t_op_ctn[str_field]:=strtodate(copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)); end; 3: begin if copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)=''then t_op_ctn[str_field]:=0 else t_op_ctn[str_field]:=strtofloat(copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)); end; 4: begin t_op_ctn[str_field]:=copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1); end; end; end; if t_op_ctn.State=dsinsert then t_op_ctn.post; result:=true; except while not t_op_ctn.eof do t_op_ctn.delete; result:=false; end; } end; procedure Tfrm_op_delhistry.huifu_op; var str,str_sub,str_field:widestring; begin { str:=t_op_delete.fieldbyname('业务信息').asstring; while pos(#4,str)<>0 do begin str_sub:=copy(str,1,pos(#7,str)); if pos(#7,str)=length(str) then str:='' else str:=copy(str,pos(#7,str)+1,length(str)-pos(#7,str)); str_field:=copy(str_sub,pos(#4,str_sub)+1,pos(#5,str_sub)-1-pos(#4,str_sub)); case strtoint(copy(str_sub,pos(#5,str_sub)+1,pos(#6,str_sub)-pos(#5,str_sub)-1)) of 1: begin if copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)='True'then t_double[str_field]:=1 else t_double[str_field]:=0; end; 2: begin if copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)=''then t_double[str_field]:=null else t_double[str_field]:=strtodate(copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)); end; 3: begin if copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)=''then t_double[str_field]:=0 else t_double[str_field]:=strtofloat(copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1)); end; 4: begin t_double[str_field]:=copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1); end; end; end; } end; procedure Tfrm_op_delhistry.huifu_1; var str:widestring; str_main,str_fen,str_wei,str_kuaiji:string; if_main,if_fen,if_wei,if_do:boolean; begin { if strtobool(get_parameters_value(31,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then str:='where 主提单号='+''''+t_op_delete.fieldbyname('主提单号').asstring+''''; end; if strtobool(get_parameters_value(32,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if str=''then str:='where 分提单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+'''' else str:=str+' or 分提单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+''''; end; end; if strtobool(get_parameters_value(33,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if str=''then str:='where 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+'''' else str:=str+' or 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+''''; end; end; t_double.close; t_double.sql.clear; if str<>''then t_double.sql.add('select * from t_op_seae '+str) else t_double.sql.add('select top 0 * from t_op_seae '); t_double.open; if not t_double.IsEmpty then begin if strtobool(get_parameters_value(31,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then begin if t_op_delete.fieldbyname('主提单号').asstring=t_double.fieldbyname('主提单号').asstring then begin if_main:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='主提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='主提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_main:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(32,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if t_op_delete.fieldbyname('分提单号').asstring=t_double.fieldbyname('分提单号').asstring then begin if_fen:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='分提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='分提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_fen:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(33,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if t_op_delete.fieldbyname('委托编号').asstring=t_double.fieldbyname('委托编号').asstring then begin if_wei:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='委托编号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='委托编号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_wei:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; end; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='输入会计期间!!'; frm_op_delete_insert.wwDBDateTimePicker1.Visible:=true; frm_op_delete_insert.Label1.Caption:='会计期间'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_kuaiji:=frm_op_delete_insert.wwDBDateTimePicker1.text; if str_kuaiji=''then begin if_do:=false; showmessage('会计期间不能为空!'); end else if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; try t_double.insert; frm_op_delete.huifu_op; t_double['主编号']:=t_double['编号']; t_double['会计期间']:=strtodate(str_kuaiji); t_double['业务编号']:=get_no(t_double.fieldbyname('会计期间').AsDateTime,'SE'); if if_main then t_double['主提单号']:=str_main; if if_fen then t_double['分提单号']:=str_fen; if if_wei then t_double['委托编号']:=str_wei; if strtobool(get_parameters_value(31,'false')) then begin if trim(t_double.fieldbyname('主提单号').asstring)='' then begin t_double['主提单标准']:=t_double['编号']; end else begin t_double['主提单标准']:=t_double['主提单号']; end; end else begin t_double['主提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(32,'false')) then begin if trim(t_double.fieldbyname('分提单号').asstring)='' then begin t_double['分提单标准']:=t_double['编号']; end else begin t_double['分提单标准']:=t_double['分提单号']; end; end else begin t_double['分提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(33,'false')) then begin if trim(t_double.fieldbyname('委托编号').asstring)='' then begin t_double['委托标准']:=t_double['编号']; end else begin t_double['委托标准']:=t_double['委托编号']; end; end else begin t_double['委托标准']:=t_double['编号']; end; t_double.post; t_op_delete.Delete; except if t_double.State=dsinsert then t_double.cancel; showmessage('业务恢复失败!!'); exit; end; showmessage('业务恢复成功!!'); } end; procedure Tfrm_op_delhistry.huifu_2; var str:widestring; str_main,str_fen,str_wei,str_kuaiji:string; if_main,if_fen,if_wei,if_do:boolean; begin { if strtobool(get_parameters_value(34,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then str:='where 主提单号='+''''+t_op_delete.fieldbyname('主提单号').asstring+''''; end; if strtobool(get_parameters_value(35,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if str=''then str:='where 分提单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+'''' else str:=str+' or 分提单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+''''; end; end; if strtobool(get_parameters_value(36,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if str=''then str:='where 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+'''' else str:=str+' or 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+''''; end; end; t_double.close; t_double.sql.clear; if str<>''then t_double.sql.add('select * from t_op_seai '+str) else t_double.sql.add('select top 0 * from t_op_seai '); t_double.open; if not t_double.IsEmpty then begin if strtobool(get_parameters_value(34,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then begin if t_op_delete.fieldbyname('主提单号').asstring=t_double.fieldbyname('主提单号').asstring then begin if_main:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='主提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='主提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_main:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(35,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if t_op_delete.fieldbyname('分提单号').asstring=t_double.fieldbyname('分提单号').asstring then begin if_fen:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='分提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='分提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_fen:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(36,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if t_op_delete.fieldbyname('委托编号').asstring=t_double.fieldbyname('委托编号').asstring then begin if_wei:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='委托编号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='委托编号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_wei:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; end; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='输入会计期间!!'; frm_op_delete_insert.wwDBDateTimePicker1.Visible:=true; frm_op_delete_insert.Label1.Caption:='会计期间'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_kuaiji:=frm_op_delete_insert.wwDBDateTimePicker1.text; if str_kuaiji=''then begin if_do:=false; showmessage('会计期间不能为空!'); end else if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; try t_double.insert; frm_op_delete.huifu_op; t_double['会计期间']:=strtodate(str_kuaiji); t_double['业务编号']:=get_no(t_double.fieldbyname('会计期间').AsDateTime,'SI'); if if_main then t_double['主提单号']:=str_main; if if_fen then t_double['分提单号']:=str_fen; if if_wei then t_double['委托编号']:=str_wei; if strtobool(get_parameters_value(34,'false')) then begin if trim(t_double.fieldbyname('主提单号').asstring)='' then begin t_double['主提单标准']:=t_double['编号']; end else begin t_double['主提单标准']:=t_double['主提单号']; end; end else begin t_double['主提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(35,'false')) then begin if trim(t_double.fieldbyname('分提单号').asstring)='' then begin t_double['分提单标准']:=t_double['编号']; end else begin t_double['分提单标准']:=t_double['分提单号']; end; end else begin t_double['分提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(36,'false')) then begin if trim(t_double.fieldbyname('委托编号').asstring)='' then begin t_double['委托标准']:=t_double['编号']; end else begin t_double['委托标准']:=t_double['委托编号']; end; end else begin t_double['委托标准']:=t_double['编号']; end; t_double.post; t_op_delete.Delete; except if t_double.State=dsinsert then t_double.cancel; showmessage('业务恢复失败!!'); exit; end; showmessage('业务恢复成功!!'); } end; procedure Tfrm_op_delhistry.huifu_3; var str:widestring; str_main,str_fen,str_wei,str_kuaiji:string; if_main,if_fen,if_wei,if_do:boolean; begin { if strtobool(get_parameters_value(40,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then str:='where 主运单号='+''''+t_op_delete.fieldbyname('主提单号').asstring+''''; end; if strtobool(get_parameters_value(41,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if str=''then str:='where 分运单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+'''' else str:=str+' or 分运单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+''''; end; end; if strtobool(get_parameters_value(42,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if str=''then str:='where 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+'''' else str:=str+' or 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+''''; end; end; t_double.close; t_double.sql.clear; if str<>''then t_double.sql.add('select * from t_op_aire '+str) else t_double.sql.add('select top 0 * from t_op_aire '); t_double.open; if not t_double.IsEmpty then begin if strtobool(get_parameters_value(40,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then begin if t_op_delete.fieldbyname('主提单号').asstring=t_double.fieldbyname('主运单号').asstring then begin if_main:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='主提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='主提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_main:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(41,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if t_op_delete.fieldbyname('分提单号').asstring=t_double.fieldbyname('分运单号').asstring then begin if_fen:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='分提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='分提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_fen:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(42,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if t_op_delete.fieldbyname('委托编号').asstring=t_double.fieldbyname('委托编号').asstring then begin if_wei:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='委托编号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='委托编号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_wei:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; end; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='输入会计期间!!'; frm_op_delete_insert.wwDBDateTimePicker1.Visible:=true; frm_op_delete_insert.Label1.Caption:='会计期间'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_kuaiji:=frm_op_delete_insert.wwDBDateTimePicker1.text; if str_kuaiji=''then begin if_do:=false; showmessage('会计期间不能为空!'); end else if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; try t_double.insert; frm_op_delete.huifu_op; t_double['会计期间']:=strtodate(str_kuaiji); t_double['业务编号']:=get_no(t_double.fieldbyname('会计期间').AsDateTime,'AE'); if if_main then t_double['主运单号']:=str_main; if if_fen then t_double['分运单号']:=str_fen; if if_wei then t_double['委托编号']:=str_wei; if strtobool(get_parameters_value(40,'false')) then begin if trim(t_double.fieldbyname('主运单号').asstring)='' then begin t_double['主提单标准']:=t_double['编号']; end else begin t_double['主提单标准']:=t_double['主运单号']; end; end else begin t_double['主提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(41,'false')) then begin if trim(t_double.fieldbyname('分运单号').asstring)='' then begin t_double['分提单标准']:=t_double['编号']; end else begin t_double['分提单标准']:=t_double['分运单号']; end; end else begin t_double['分提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(42,'false')) then begin if trim(t_double.fieldbyname('委托编号').asstring)='' then begin t_double['委托标准']:=t_double['编号']; end else begin t_double['委托标准']:=t_double['委托编号']; end; end else begin t_double['委托标准']:=t_double['编号']; end; t_double.post; t_op_delete.Delete; except if t_double.State=dsinsert then t_double.cancel; showmessage('业务恢复失败!!'); exit; end; showmessage('业务恢复成功!!'); } end; procedure Tfrm_op_delhistry.huifu_4; var str:widestring; str_main,str_fen,str_wei,str_kuaiji:string; if_main,if_fen,if_wei,if_do:boolean; begin { if strtobool(get_parameters_value(43,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then str:='where 主运单号='+''''+t_op_delete.fieldbyname('主提单号').asstring+''''; end; if strtobool(get_parameters_value(44,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if str=''then str:='where 分运单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+'''' else str:=str+' or 分运单号='+''''+t_op_delete.fieldbyname('分提单号').asstring+''''; end; end; if strtobool(get_parameters_value(45,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if str=''then str:='where 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+'''' else str:=str+' or 委托编号='+''''+t_op_delete.fieldbyname('委托编号').asstring+''''; end; end; t_double.close; t_double.sql.clear; if str<>''then t_double.sql.add('select * from t_op_airi '+str) else t_double.sql.add('select top 0 * from t_op_airi '); t_double.open; if not t_double.IsEmpty then begin if strtobool(get_parameters_value(43,'false')) then begin if t_op_delete.fieldbyname('主提单号').asstring<>''then begin if t_op_delete.fieldbyname('主提单号').asstring=t_double.fieldbyname('主运单号').asstring then begin if_main:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='主提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='主提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_main:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(44,'false')) then begin if t_op_delete.fieldbyname('分提单号').asstring<>''then begin if t_op_delete.fieldbyname('分提单号').asstring=t_double.fieldbyname('分运单号').asstring then begin if_fen:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='分提单号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='分提单号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_fen:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; if strtobool(get_parameters_value(45,'false')) then begin if t_op_delete.fieldbyname('委托编号').asstring<>''then begin if t_op_delete.fieldbyname('委托编号').asstring=t_double.fieldbyname('委托编号').asstring then begin if_wei:=true; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='委托编号重复!!'; frm_op_delete_insert.Edit2.Visible:=true; frm_op_delete_insert.Label1.Caption:='委托编号'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_wei:=frm_op_delete_insert.Edit2.text; if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; end; end; end; end; try frm_op_delete_insert:=Tfrm_op_delete_insert.Create(application); frm_op_delete_insert.caption:='输入会计期间!!'; frm_op_delete_insert.wwDBDateTimePicker1.Visible:=true; frm_op_delete_insert.Label1.Caption:='会计期间'; frm_op_delete_insert.ShowModal; if_do:=false; if frm_op_delete_insert.ModalResult = mrOk then begin str_kuaiji:=frm_op_delete_insert.wwDBDateTimePicker1.text; if str_kuaiji=''then begin if_do:=false; showmessage('会计期间不能为空!'); end else if_do:=true; end else begin if_do:=false; end; finally frm_op_delete_insert.Free; frm_op_delete_insert:=nil; end; if not if_do then exit; try t_double.insert; frm_op_delete.huifu_op; t_double['会计期间']:=strtodate(str_kuaiji); t_double['业务编号']:=get_no(t_double.fieldbyname('会计期间').AsDateTime,'AI'); if if_main then t_double['主运单号']:=str_main; if if_fen then t_double['分运单号']:=str_fen; if if_wei then t_double['委托编号']:=str_wei; if strtobool(get_parameters_value(43,'false')) then begin if trim(t_double.fieldbyname('主运单号').asstring)='' then begin t_double['主提单标准']:=t_double['编号']; end else begin t_double['主提单标准']:=t_double['主运单号']; end; end else begin t_double['主提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(44,'false')) then begin if trim(t_double.fieldbyname('分运单号').asstring)='' then begin t_double['分提单标准']:=t_double['编号']; end else begin t_double['分提单标准']:=t_double['分运单号']; end; end else begin t_double['分提单标准']:=t_double['编号']; end; if strtobool(get_parameters_value(45,'false')) then begin if trim(t_double.fieldbyname('委托编号').asstring)='' then begin t_double['委托标准']:=t_double['编号']; end else begin t_double['委托标准']:=t_double['委托编号']; end; end else begin t_double['委托标准']:=t_double['编号']; end; t_double.post; t_op_delete.Delete; except if t_double.State=dsinsert then t_double.cancel; showmessage('业务恢复失败!!'); exit; end; showmessage('业务恢复成功!!'); } end; procedure Tfrm_op_delhistry.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_delhistry.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_delhistry.Hide; frm_op_delhistry.ManualFloat(frm_op_delhistry.BoundsRect ); frm_main.freeTabs('frm_op_delhistry'); action:=cafree; frm_op_delhistry:=nil; end; procedure Tfrm_op_delhistry.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_op_delhistry.bsSkinPanel2Resize(Sender: TObject); begin // bsSkinButton1.Left:=bsSkinPanel2.Width-bsSkinGroupBox1.Width-bsSkinButton1.Width-26; end; procedure Tfrm_op_delhistry.bsSkinButton10Click(Sender: TObject); var str:widestring; begin if RxDBLookupCombo6.DisplayValue<>''then begin if str=''then str:='where 操作员='+''''+RxDBLookupCombo6.DisplayValue+'''' else str:=str+' and 操作员='+''''+RxDBLookupCombo6.DisplayValue+''''; end; if RxDBLookupCombo1.DisplayValue<>''then begin if str=''then str:='where 揽货人='+''''+RxDBLookupCombo1.DisplayValue+'''' else str:=str+' and 揽货人='+''''+RxDBLookupCombo1.DisplayValue+''''; end; if wwDBLookupCombo49.Text<>'' then begin if str=''then str:='where 船名='+''''+wwDBLookupCombo49.Text+'''' else str:=str+' and 船名='+''''+wwDBLookupCombo49.Text+''''; end; if edt1.Text<>'' then begin if str=''then str:='where 航次='+''''+edt1.Text+'''' else str:=str+' and 航次='+''''+edt1.Text+''''; end; if RxDBLookupCombo2.DisplayValue<>''then begin if str=''then str:='where 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; end; if RxDBLookupCombo4.DisplayValue<>''then begin if str=''then str:='where 船公司='+''''+RxDBLookupCombo4.DisplayValues[1]+'''' else str:=str+' and 船公司='+''''+RxDBLookupCombo4.DisplayValues[1]+''''; end; if RxDBLookupCombo8.DisplayValue<>''then begin if str=''then str:='where 货代公司='+''''+RxDBLookupCombo8.DisplayValues[1]+'''' else str:=str+' and 货代公司='+''''+RxDBLookupCombo8.DisplayValues[1]+''''; end; if RxDBLookupCombo20.DisplayValue<>''then begin if str=''then str:='where 航线='+''''+RxDBLookupCombo20.DisplayValues[1]+'''' else str:=str+' and 航线='+''''+RxDBLookupCombo20.DisplayValues[1]+''''; end; if wwDBDateTimePicker3.text<>''then begin if str=''then str:='where 删除日期>='+''''+wwDBDateTimePicker3.text+'''' else str:=str+' and 删除日期>='+''''+wwDBDateTimePicker3.text+''''; end; if wwDBDateTimePicker4.text<>''then begin if str=''then str:='where 删除日期<='+''''+wwDBDateTimePicker4.text+'''' else str:=str+' and 删除日期<='+''''+wwDBDateTimePicker4.text+''''; end; if wwDBDateTimePicker1.text<>''then begin if str=''then str:='where 业务日期>='+''''+wwDBDateTimePicker1.text+'''' else str:=str+' and 业务日期>='+''''+wwDBDateTimePicker1.text+''''; end; if wwDBDateTimePicker2.text<>''then begin if str=''then str:='where 业务日期<='+''''+wwDBDateTimePicker2.text+'''' else str:=str+' and 业务日期<='+''''+wwDBDateTimePicker2.text+''''; end; if trim(str)='' then begin str:='where '+open_data('0041','t_op_delete.揽货人','t_op_delete.操作员','no','no','no'); end else begin str:=str+' and '+open_data('0041','t_op_delete.揽货人','t_op_delete.操作员','no','no','no'); end; t_op_delete.close; t_op_delete.sql.clear; t_op_delete.SQL.add('select t_op_delete.OD_ID,t_op_delete.编号,t_op_delete.业务种类,t_op_delete.业务编号,t_op_delete.委托编号,t_op_delete.主提单号,'); t_op_delete.SQL.add('t_op_delete.分提单号,t_op_delete.委托单位,t_op_delete.港口信息,t_op_delete.集装箱,t_op_delete.录入人,t_op_delete.操作员,'); t_op_delete.SQL.add('t_op_delete.客服员,t_op_delete.揽货人,t_op_delete.删除人,t_op_delete.删除日期,t_op_delete.业务日期,t_op_delete.船名,t_op_delete.航次,'); t_op_delete.SQL.add('t_op_delete.箱型1,t_op_delete.箱型2,t_op_delete.箱型3,t_op_delete.箱型4,t_op_delete.箱型5,t_op_delete.箱型6,t_op_delete.箱型7,t_op_delete.箱型8,'); t_op_delete.SQL.add('t_op_delete.箱型9,t_op_delete.箱型10,t_op_delete.其他箱型,t_op_delete.箱TEU,t_op_delete.航线,t_op_delete.船公司,t_op_delete.货代公司,t_op_delnote.申请原因,t_crm_client_class.客户等级'); t_op_delete.SQL.add(' from t_op_delete left join t_op_delnote on (t_op_delnote.编号=t_op_delete.编号) '); t_op_delete.SQL.add(' left join t_crm_client_class on t_op_delete.委托单位=t_crm_client_class.客户简称 and t_crm_client_class.开始日期<=t_op_delete.业务日期 and t_op_delete.业务日期<=t_crm_client_class.结束日期 '); t_op_delete.SQL.add(str+' order by 业务编号'); t_op_delete.open; end; procedure Tfrm_op_delhistry.bsSkinButton1Click(Sender: TObject); begin if t_op_delete.isempty then exit; if t_op_delete.FieldByName('删除人').asstring<>employee then begin showmessage('对不起,当前删除业务不是你删除的,你无权恢复!!'); exit; end; if t_op_delete.fieldbyname('业务种类').asstring='海运出口'then begin huifu_1; end; if t_op_delete.fieldbyname('业务种类').asstring='海运进口'then begin huifu_2; end; if t_op_delete.fieldbyname('业务种类').asstring='空运出口'then begin huifu_3; end; if t_op_delete.fieldbyname('业务种类').asstring='空运进口'then begin huifu_4; end; end; procedure Tfrm_op_delhistry.t_doublePostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); var str:widestring; begin { if t_op_delete.fieldbyname('业务种类').asstring='海运出口'then begin if pos('主提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seae where 主提单标准='+''''+t_double['主提单标准']+''''; double_seae(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seae where 分提单标准='+''''+t_double['分提单标准']+''''; double_seae(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seae where 委托标准='+''''+t_double['委托标准']+''''; double_seae(str,3); abort; end; end; if t_op_delete.fieldbyname('业务种类').asstring='海运进口'then begin if pos('主提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 主提单标准='+''''+t_double['主提单标准']+''''; double_seai(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 分提单标准='+''''+t_double['分提单标准']+''''; double_seai(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 委托标准='+''''+t_double['委托标准']+''''; double_seai(str,3); abort; end; end; if t_op_delete.fieldbyname('业务种类').asstring='空运出口'then begin if pos('主提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seae where 主提单标准='+''''+t_double['主提单标准']+''''; double_aire(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seae where 分提单标准='+''''+t_double['分提单标准']+''''; double_aire(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seae where 委托标准='+''''+t_double['委托标准']+''''; double_aire(str,3); abort; end; end; if t_op_delete.fieldbyname('业务种类').asstring='空运进口'then begin if pos('主提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 主提单标准='+''''+t_double['主提单标准']+''''; double_airi(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 分提单标准='+''''+t_double['分提单标准']+''''; double_airi(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_seai where 委托标准='+''''+t_double['委托标准']+''''; double_airi(str,3); abort; end; end; } end; procedure Tfrm_op_delhistry.t_doubleBeforeCancel(DataSet: TDataSet); begin // delete_no(t_double); end; procedure Tfrm_op_delhistry.bsSkinButton9Click(Sender: TObject); begin sys_print('海运出口退舱统计',2,nil,nil,nil,nil,t_op_delete1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_delhistry.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_delhistry.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_delhistry.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,113); end; procedure Tfrm_op_delhistry.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; end.