unit u_op_delete; 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; type Tfrm_op_delete = class(TForm) bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; dxDBGrid1: TdxDBGrid; t_op_delete: TADOQuery; t_op_delete1: TDataSource; dxDBGrid1Column1: TdxDBGridMaskColumn; 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; Label6: TLabel; Edit1: TEdit; Label8: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; Label11: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; Label7: TLabel; RxDBLookupCombo3: TRxDBLookupCombo; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinGroupBox1: TbsSkinGroupBox; DBMemo1: TDBMemo; bsSkinButton1: TbsSkinButton; t_double: TADOQuery; t_op_ctn: TADOQuery; 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); private { Private declarations } public { Public declarations } end; var frm_op_delete: Tfrm_op_delete; implementation uses u_main, my_sys_function, u_op_delete_insert; {$R *.dfm} function Tfrm_op_delete.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_delete.huifu_op; var str,str_sub,str_field,strtemp: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 strtemp:=copy(str_sub,pos(#6,str_sub)+1,pos(#7,str_sub)-pos(#6,str_sub)-1); if strtemp=''then t_double[str_field]:=null else begin if Length(strtemp)>10 then t_double[str_field]:=StrToDateTime(formatdatetime('YYYY-MM-DD HH:MM:SS',strtodate(strtemp))) else t_double[str_field]:=strtodate(formatdatetime('YYYY-MM-DD',strtodate(strtemp))); end; 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_delete.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; {if not huifu_ctn then begin t_double.delete; showmessage('业务恢复失败!!'); exit; end; } t_op_delete.Delete; { except if t_double.State=dsinsert then t_double.cancel; showmessage('业务恢复失败!!'); exit; end; } showmessage('业务恢复成功!!'); end; procedure Tfrm_op_delete.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; {if not huifu_ctn then begin t_double.delete; showmessage('业务恢复失败!!'); exit; end; } t_op_delete.Delete; except if t_double.State=dsinsert then t_double.cancel; showmessage('业务恢复失败!!'); exit; end; showmessage('业务恢复成功!!'); end; procedure Tfrm_op_delete.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_delete.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_delete.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_delete.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_delete.Hide; frm_op_delete.ManualFloat(frm_op_delete.BoundsRect ); frm_main.freeTabs('frm_op_delete'); action:=cafree; frm_op_delete:=nil; end; procedure Tfrm_op_delete.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_op_delete.bsSkinPanel2Resize(Sender: TObject); begin bsSkinButton1.Left:=bsSkinPanel2.Width-bsSkinGroupBox1.Width-bsSkinButton1.Width-26; end; procedure Tfrm_op_delete.bsSkinButton10Click(Sender: TObject); var str:widestring; begin if Edit1.text<>''then str:='where 业务信息 like '+''''+'%'+Edit1.text+'%'+''''; if RxDBLookupCombo3.DisplayValue<>''then begin if str=''then str:='where 删除人='+''''+RxDBLookupCombo3.DisplayValue+'''' else str:=str+' and 删除人='+''''+RxDBLookupCombo3.DisplayValue+''''; 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; t_op_delete.close; t_op_delete.sql.clear; t_op_delete.SQL.add('select * from t_op_delete '+str+' order by 业务种类,业务编号'); t_op_delete.open; end; procedure Tfrm_op_delete.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_delete.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_delete.t_doubleBeforeCancel(DataSet: TDataSet); begin delete_no(t_double); end; end.