unit u_op_mblsign; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, bsSkinCtrls, DB, ADODB, ExtCtrls, RxLookup, StdCtrls, wwdbdatetimepicker, wwdblook, Menus, Mask, bsSkinBoxCtrls, bsdbctrls,DateUtils, kbmMemTable, DBCtrlsEh, ComCtrls, bsSkinTabs, dxDBTLCl, dxGrClms; type Tfrm_op_mblsign = class(TForm) t_op_seae: TADOQuery; t_op_seae1: TDataSource; kbmMemTable1: TkbmMemTable; kbmMemTable1Field: TStringField; kbmMemTable1Field3: TStringField; kbmMemTable1Field4: TStringField; kbmMemTable1Field5: TStringField; kbmMemTable1Field6: TStringField; kbmMemTable1Field7: TStringField; kbmMemTable1Field2: TStringField; kbmMemTable1Field9: TStringField; kbmMemTable1Field10: TStringField; kbmMemTable1Field8: TStringField; PopupMenu1: TPopupMenu; N1: TMenuItem; kbmMemTable1Field11: TStringField; kbmMemTable1Field12: TStringField; kbmMemTable1Field13: TStringField; kbmMemTable1Field14: TStringField; kbmMemTable1Field15: TStringField; kbmMemTable1Field16: TStringField; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; bsSkinButton9: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinPanel2: TbsSkinPanel; Label6: TLabel; Label3: TLabel; Label1: TLabel; Label10: TLabel; Label5: TLabel; Label9: TLabel; Label30: TLabel; Label125: TLabel; Label124: TLabel; Label2: TLabel; Label4: TLabel; Label7: TLabel; Edit1: TEdit; Edit4: TEdit; Edit2: TEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; RxDBLookupCombo2: TRxDBLookupCombo; Edit7: TEdit; wwDBLookupCombo49: TwwDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; DBComboBoxEh1: TDBComboBoxEh; dxDBGrid2: TdxDBGrid; dxDBGrid2Column13: TdxDBGridColumn; dxDBGrid2Column14: TdxDBGridColumn; dxDBGrid2Column1: TdxDBGridColumn; dxDBGrid2Column2: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridColumn; dxDBGrid2Column11: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; dxDBGrid2Column5: TdxDBGridColumn; dxDBGrid2Column6: TdxDBGridColumn; dxDBGrid2Column8: TdxDBGridColumn; dxDBGrid2Column10: TdxDBGridColumn; dxDBGrid2Column12: TdxDBGridColumn; bsSkinPanel3: TbsSkinPanel; bsSkinButton4: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinButton14: TbsSkinButton; bsSkinPanel4: TbsSkinPanel; Label13: TLabel; Label14: TLabel; wwDBDateTimePicker5: TwwDBDateTimePicker; wwDBDateTimePicker6: TwwDBDateTimePicker; dxDBGrid1: TdxDBGrid; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGridColumn7: TdxDBGridColumn; dxDBGridColumn8: TdxDBGridColumn; kbmMemTable3: TkbmMemTable; StringField1: TStringField; StringField3: TStringField; StringField4: TStringField; StringField5: TStringField; StringField6: TStringField; StringField8: TStringField; PopupMenu2: TPopupMenu; MenuItem1: TMenuItem; DataSource1: TDataSource; kbmMemTable3Field: TStringField; kbmMemTable3Field2: TStringField; kbmMemTable3Field3: TStringField; kbmMemTable3Field4: TStringField; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; Edit6: TEdit; Label8: TLabel; ADOQUERY_TZFD: TADOQuery; ADOQUERY_TDQR: TADOQuery; ADOQUERY_TDQC: TADOQuery; ADOQUERY_TDQF: TADOQuery; ADOQUERY_TSFD: TADOQuery; kbmMemTable1Field17: TStringField; dxDBGrid2Column15: TdxDBGridColumn; kbmMemTable1Field18: TStringField; kbmMemTable1Field19: TStringField; kbmMemTable1Field20: TStringField; dxDBGrid2Column16: TdxDBGridColumn; dxDBGrid2Column17: TdxDBGridColumn; dxDBGrid2Column18: TdxDBGridColumn; dxDBGrid2Column19: TdxDBGridColumn; kbmMemTable1Field21: TStringField; kbmMemTable1Field22: TBooleanField; dxDBGrid2Column20: TdxDBGridCheckColumn; CheckBox1: TCheckBox; Label35: TLabel; RxDBLookupCombo28: TRxDBLookupCombo; kbmMemTable1Field23: TStringField; dxDBGrid2Column21: TdxDBGridColumn; ADOQUERY_TDQH: TADOQuery; bsSkinButton7: TbsSkinButton; kbmMemTable1Field24: TStringField; Label11: TLabel; Edit3: TEdit; procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinPanel1Resize(Sender: TObject); procedure dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure bsSkinButton1Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure dxDBGrid2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure dxDBGrid2DblClick(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure dxDBGrid2Column13CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure bsSkinButton3Click(Sender: TObject); procedure dxDBGrid2Column14CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure bsSkinButton13Click(Sender: TObject); procedure MenuItem1Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure RxDBLookupCombo28Enter(Sender: TObject); procedure RxDBLookupCombo28Exit(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); private { Private declarations } public { Public declarations } op:integer; function GetmblState(bsno:string):Boolean; function GetmblzbState(bsno:string):Boolean; function GetmblStateOut(bsno:string):Boolean; procedure UpateSeaeState(bsno,billstate:string); function GetSeaeStateDate(bsno,billstate:string):string; function _GetmblStateout(bsno,bsstatus:string):string; procedure Initsql(AdoQuery:TAdoQuery;str,s:string); procedure Initsql_ts(AdoQuery:TAdoQuery); end; var frm_op_mblsign: Tfrm_op_mblsign; implementation uses u_main,my_sys_function, u_op_seae_teshufandan,u_sys_progress; {$R *.dfm} // function Tfrm_op_mblsign._GetmblStateout(bsno,bsstatus:string):string; var aAdoQuery:TAdoQuery; begin result:=''; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select 编号,业务状态,录入日期'); SQL.Add('from t_op_state where 编号=:bsNo1 and 业务状态=:bsstatus '); Parameters.ParamByName('bsNo1').value:=bsno; Parameters.ParamByName('bsstatus').value:=bsstatus; Open; if not IsEmpty then result:=FieldByName('业务状态').AsString; finally aAdoQuery.Free; end; end; function Tfrm_op_mblsign.GetSeaeStateDate(bsno,billstate:string):string; var aAdoQuery:TAdoQuery; begin Result:=''; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select 编号,录入日期 处理日期 from t_op_state'); SQL.Add('where 编号=:bsNo and 业务状态=:billstate'); Parameters.ParamByName('bsNo').value:=bsno; Parameters.ParamByName('billstate').value:=billstate; open; if not IsEmpty then Result:=FormatDateTime('YYYY-MM-DD',FieldByName('处理日期').AsDateTime); finally aAdoQuery.Free; end; end; procedure Tfrm_op_mblsign.UpateSeaeState(bsno,billstate:string); var aAdoQuery:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('Update t_op_Seae'); SQL.Add('set 提单签发状态=:billstate where 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Parameters.ParamByName('billstate').value:=billstate; execsql; finally aAdoQuery.Free; end; end; function Tfrm_op_mblsign.GetmblState(bsno:string):Boolean; var aAdoQuery:TAdoQuery; b1,b2,b3:Boolean; begin result:=false; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''通知放单'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b1:=RecordCount>=1; Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''提单签出'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b2:=RecordCount>=1; Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''提单签发'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b3:= isempty or (RecordCount=0); result:=(b1 or b2) and b3; finally aAdoQuery.Free; end; end; function Tfrm_op_mblsign.GetmblzbState(bsno:string):Boolean; // var aAdoQuery:TAdoQuery; b1,b2,b3,b4:Boolean; begin result:=false; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''通知放单'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b1:=RecordCount>=1; Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''提单签入'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b2:=RecordCount>=1; Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''提单签出'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b3:=RecordCount>=1; Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''提单签发'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; b4:= isempty or (RecordCount=0); result:=(b1 or b2 or b3) and b4; finally aAdoQuery.Free; end; end; function Tfrm_op_mblsign.GetmblStateOut(bsno:string):Boolean; var aAdoQuery:TAdoQuery; begin result:=false; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select 编号,业务状态'); SQL.Add('from t_op_state where 业务状态=''提单签出'' and 编号=:bsNo'); Parameters.ParamByName('bsNo').value:=bsno; Open; result:=RecordCount=1; finally aAdoQuery.Free; end; end; procedure Tfrm_op_mblsign.bsSkinButton5Click(Sender: TObject); begin Close; end; procedure Tfrm_op_mblsign.FormShow(Sender: TObject); var str,mblstatus:string; begin wwDBDateTimePicker5.Date:=StrToDateTime(Formatdatetime('YYYY-MM-DD',date)); wwDBDateTimePicker6.Date:=StrToDateTime(Formatdatetime('YYYY-MM-DD',date)); loadreggrid(dxdbgrid2,true,caption); { str:='where 装运方式<>''拼箱分票'' and 业务类型=''普通货'' and 主提单号<>'''' and 签单方式<>'''''; str:=str+' and 开船日期>='+''''+wwDBDateTimePicker1.text+''''; str:=str+' and 开船日期<='+''''+wwDBDateTimePicker2.text+''''; with t_op_seae do begin close;sql.clear; sql.add('select top 100 编号,业务编号,委托单位,船名,航次,主提单号,签单方式,开船日期,操作员,提单签发状态,结费类型'); sql.add('from t_op_seae'); sql.add('where 装运方式<>''拼箱分票'' and 业务类型=''普通货'' and 主提单号<>'''' and 签单方式<>'''''); sql.add('Order By 主提单号'); kbmMemTable1.EmptyTable; kbmMemTable1.Open; open;First; while not Eof do begin if FieldByName('签单方式').AsString='正本' then begin if GetmblzbState(FieldByName('编号').AsString) then begin kbmMemTable1.Insert; kbmMemTable1.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable1.FieldByName('业务编号').AsString:=FieldByName('业务编号').AsString; kbmMemTable1.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable1.FieldByName('船名').AsString:=FieldByName('船名').AsString; kbmMemTable1.FieldByName('航次').AsString:=FieldByName('航次').AsString; kbmMemTable1.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable1.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable1.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable1.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable1.FieldByName('提单签发状态').AsString:=FieldByName('提单签发状态').AsString; kbmMemTable1.FieldByName('结费类型').AsString:=FieldByName('结费类型').AsString; kbmMemTable1.FieldByName('处理日期').AsString:=GetSeaeStateDate(FieldByName('编号').AsString,FieldByName('提单签发状态').AsString); mblstatus:=GetShenheStatus(FieldByName('编号').AsString); if mblstatus='' then kbmMemTable1.FieldByName('特殊放单').AsString:='没有特殊申请' else kbmMemTable1.FieldByName('特殊放单').AsString:=mblstatus; kbmMemTable1.Post; end; end else begin if GetmblState(FieldByName('编号').AsString) then begin kbmMemTable1.Insert; kbmMemTable1.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable1.FieldByName('业务编号').AsString:=FieldByName('业务编号').AsString; kbmMemTable1.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable1.FieldByName('船名').AsString:=FieldByName('船名').AsString; kbmMemTable1.FieldByName('航次').AsString:=FieldByName('航次').AsString; kbmMemTable1.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable1.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable1.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable1.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable1.FieldByName('提单签发状态').AsString:=FieldByName('提单签发状态').AsString; kbmMemTable1.FieldByName('结费类型').AsString:=FieldByName('结费类型').AsString; mblstatus:=GetShenheStatus(FieldByName('编号').AsString); if mblstatus='' then kbmMemTable1.FieldByName('特殊放单').AsString:='没有特殊申请' else kbmMemTable1.FieldByName('特殊放单').AsString:=mblstatus; kbmMemTable1.Post; end; end; next; end; end; } end; procedure Tfrm_op_mblsign.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid2,caption); frm_op_mblsign.Hide; frm_op_mblsign.ManualFloat(frm_op_mblsign.BoundsRect ); frm_main.freeTabs('frm_op_mblsign'); action:=cafree; frm_op_mblsign:=nil; end; procedure Tfrm_op_mblsign.bsSkinButton12Click(Sender: TObject); begin Edit1.text:=''; Edit4.text:=''; Edit2.text:=''; wwDBDateTimePicker1.text:=''; wwDBDateTimePicker2.text:=''; wwDBDateTimePicker3.text:=''; wwDBDateTimePicker4.text:=''; RxDBLookupCombo2.ClearValue; wwDBLookupCombo49.text:=''; DBComboBoxEh1.text:=''; Edit7.text:=''; wwDBLookupCombo52.text:=''; end; procedure Tfrm_op_mblsign.Initsql(AdoQuery:TAdoQuery;str,s:string); begin with AdoQuery do begin Close;sql.Clear; sql.add('select t_op_seae.编号,t_op_state.业务状态,t_op_state.录入日期'); sql.add('from t_op_state'); sql.add('left JOIN t_op_seae on t_op_state.编号 = t_op_seae.编号 ' +str); sql.add('and t_op_state.业务状态='''+s+''''); sql.add('order by t_op_seae.编号'); Open;First; end; end; procedure Tfrm_op_mblsign.Initsql_ts(AdoQuery:TAdoQuery); begin with AdoQuery do begin Close;Sql.Clear; SQL.Add('Select 编号,放单状态 from t_op_fangdan'); sql.add('order by 编号'); Open;First; end; end; procedure Tfrm_op_mblsign.bsSkinButton8Click(Sender: TObject); var str,mblstatus:widestring; begin if DBComboBoxEh1.text='' then begin str:='where 装运方式<>''拼箱分票'' and 业务类型=''普通货'' and 主提单号<>'''' and 签单方式<>'''''; if Edit1.text<>''then str:=str+' and 业务编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit4.text<>''then str:=str+' and 委托编号 like '+''''+'%'+Edit4.text+'%'+''''; if Edit2.text<>''then str:=str+' and 主提单号 like '+''''+'%'+Edit2.text+'%'+''''; if Edit3.text<>''then str:=str+' and 分提单号 like '+''''+'%'+Edit3.text+'%'+''''; if wwDBDateTimePicker1.text<>''then str:=str+' and 开船日期>='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker2.text<>''then str:=str+' and 开船日期<='+''''+wwDBDateTimePicker2.text+''''; if RxDBLookupCombo2.DisplayValues[1]<>''then str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if RxDBLookupCombo28.DisplayValues[1]<>''then str:=str+' and 签单方式='+''''+RxDBLookupCombo28.DisplayValues[1]+''''; if wwDBLookupCombo49.text<>''then str:=str+' and 船名 like '+''''+'%'+wwDBLookupCombo49.text+'%'+''''; if Edit7.text<>''then str:=str+' and 航次 like '+''''+'%'+Edit7.text+'%'+''''; if wwDBLookupCombo52.text<>''then str:=str+' and 卸货港 like '+''''+'%'+wwDBLookupCombo52.text+'%'+''''; // str:=str+' and 编号 not in (select 编号 from t_op_state where ) ; Initsql(ADOQUERY_TDQH,str,'提单签回'); Initsql(ADOQUERY_TZFD,str,'通知放单'); Initsql(ADOQUERY_TDQR,str,'提单签入'); Initsql(ADOQUERY_TDQC,str,'提单签出'); Initsql(ADOQUERY_TDQF,str,'提单签发'); Initsql_ts(ADOQUERY_TSFD); // Initsql(ADOQUERY_TSFD,str,'副总审核'); with t_op_seae do begin try close;sql.clear; sql.add('select 编号,业务编号,委托单位,船名,航次,船公司,主提单号,签单方式,开船日期,操作员,提单签发状态,结费类型,发票号,备案号,集团成本,香港付费'); sql.add('from t_op_seae '+str+default_sort(53,'t_op_seae','','desc')); kbmMemTable1.EmptyTable; kbmMemTable1.Open; kbmMemTable1.DisableControls; open;First; if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='正在检索数据。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=RecordCount; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; while not Eof do begin frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; kbmMemTable1.Insert; kbmMemTable1.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable1.FieldByName('业务编号').AsString:=FieldByName('业务编号').AsString; kbmMemTable1.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable1.FieldByName('船名').AsString:=FieldByName('船名').AsString; kbmMemTable1.FieldByName('航次').AsString:=FieldByName('航次').AsString; kbmMemTable1.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable1.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable1.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable1.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable1.FieldByName('提单签发状态').AsString:=FieldByName('提单签发状态').AsString; kbmMemTable1.FieldByName('结费类型').AsString:=FieldByName('结费类型').AsString; kbmMemTable1.FieldByName('发票').AsString:=FieldByName('发票号').AsString; kbmMemTable1.FieldByName('帐单号').AsString:=FieldByName('备案号').AsString; kbmMemTable1.FieldByName('船公司').AsString:=FieldByName('船公司').AsString; kbmMemTable1.FieldByName('提醒').AsString:=FieldByName('集团成本').AsString; kbmMemTable1.FieldByName('香港付费').AsBoolean:=FieldByName('香港付费').AsBoolean; if ADOQUERY_TZFD.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable1.FieldByName('通知放单').AsString:='通知放单'; if not ADOQUERY_TZFD.FieldByName('录入日期').IsNull then kbmMemTable1.FieldByName('处理日期').AsString:=ADOQUERY_TZFD.FieldByName('录入日期').AsString; end; if ADOQUERY_TDQH.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable1.FieldByName('提单签回').AsString:='提单签回'; if not ADOQUERY_TDQH.FieldByName('录入日期').IsNull then kbmMemTable1.FieldByName('处理日期').AsString:=ADOQUERY_TDQH.FieldByName('录入日期').AsString; end; if ADOQUERY_TDQR.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable1.FieldByName('提单签入').AsString:='提单签入'; if not ADOQUERY_TDQR.FieldByName('录入日期').IsNull then kbmMemTable1.FieldByName('处理日期').AsString:=ADOQUERY_TDQR.FieldByName('录入日期').AsString; end; if ADOQUERY_TDQC.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable1.FieldByName('提单签出').AsString:='提单签出'; if not ADOQUERY_TDQC.FieldByName('录入日期').IsNull then kbmMemTable1.FieldByName('处理日期').AsString:=ADOQUERY_TDQC.FieldByName('录入日期').AsString; end; if ADOQUERY_TDQF.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable1.FieldByName('提单签发').AsString:='提单签发'; if not ADOQUERY_TDQF.FieldByName('录入日期').IsNull then kbmMemTable1.FieldByName('处理日期').AsString:=ADOQUERY_TDQF.FieldByName('录入日期').AsString; end; if ADOQUERY_TSFD.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable1.FieldByName('特殊放单').AsString:=ADOQUERY_TSFD.FieldByName('放单状态').AsString; end else begin kbmMemTable1.FieldByName('特殊放单').AsString:='没有特殊申请'; end; kbmMemTable1.Post; next; end; finally kbmMemTable1.EnableControls; frm_sys_progress.close; frm_sys_progress:=nil; end; end; end else begin str:='where t_op_seae.装运方式<>''拼箱分票'' and t_op_seae.业务类型=''普通货'' and t_op_seae.主提单号<>'''' and t_op_seae.签单方式<>'''''; if Edit1.text<>''then str:=str+' and t_op_seae.业务编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit4.text<>''then str:=str+' and t_op_seae.委托编号 like '+''''+'%'+Edit4.text+'%'+''''; if Edit2.text<>''then str:=str+' and t_op_seae.主提单号 like '+''''+'%'+Edit2.text+'%'+''''; if wwDBDateTimePicker1.text<>''then str:=str+' and t_op_seae.开船日期>='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker2.text<>''then str:=str+' and t_op_seae.开船日期<='+''''+wwDBDateTimePicker2.text+''''; if RxDBLookupCombo2.DisplayValues[1]<>''then str:=str+' and t_op_seae.委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if wwDBLookupCombo49.text<>''then str:=str+' and t_op_seae.船名 like '+''''+'%'+wwDBLookupCombo49.text+'%'+''''; if Edit7.text<>''then str:=str+' and t_op_seae.航次 like '+''''+'%'+Edit7.text+'%'+''''; if wwDBLookupCombo52.text<>''then str:=str+' and t_op_seae.卸货港 like '+''''+'%'+wwDBLookupCombo52.text+'%'+''''; if DBComboBoxEh1.text<>'' then str:=str+' and t_op_state.业务状态 like '+''''+'%'+DBComboBoxEh1.text+'%'+''''; if wwDBDateTimePicker3.text<>''then str:=str+' and t_op_state.录入日期>='+''''+wwDBDateTimePicker3.text+''''; if wwDBDateTimePicker4.text<>''then str:=str+' and t_op_state.录入日期<='+''''+wwDBDateTimePicker4.text+''''; with t_op_seae do begin try close;sql.clear; sql.add('select t_op_state.业务状态,t_op_seae.编号,t_op_seae.业务编号,t_op_seae.委托单位,t_op_seae.船名,t_op_seae.航次'); sql.add(',t_op_seae.主提单号,t_op_seae.签单方式,t_op_seae.开船日期,t_op_seae.船公司'); sql.add(',t_op_seae.操作员,t_op_seae.提单签发状态,t_op_seae.结费类型,t_op_seae.集团成本,t_op_seae.香港付费'); sql.add('from t_op_state'); sql.add('left JOIN t_op_seae on t_op_state.编号 = t_op_seae.编号 ' +str); kbmMemTable1.EmptyTable; kbmMemTable1.DisableControls; kbmMemTable1.Open; open;First; while not Eof do begin kbmMemTable1.Insert; kbmMemTable1.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable1.FieldByName('业务编号').AsString:=FieldByName('业务编号').AsString; kbmMemTable1.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable1.FieldByName('船名').AsString:=FieldByName('船名').AsString; kbmMemTable1.FieldByName('航次').AsString:=FieldByName('航次').AsString; kbmMemTable1.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable1.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable1.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable1.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable1.FieldByName('提单签发状态').AsString:=FieldByName('提单签发状态').AsString; kbmMemTable1.FieldByName('结费类型').AsString:=FieldByName('结费类型').AsString; kbmMemTable1.FieldByName('处理日期').AsString:=GetSeaeStateDate(FieldByName('编号').AsString,FieldByName('提单签发状态').AsString); kbmMemTable1.FieldByName('业务状态').AsString:=FieldByName('业务状态').AsString; kbmMemTable1.FieldByName('提醒').AsString:=FieldByName('集团成本').AsString; kbmMemTable1.FieldByName('香港付费').AsBoolean:=FieldByName('香港付费').AsBoolean; kbmMemTable1.FieldByName('船公司').AsString:=FieldByName('船公司').AsString; mblstatus:=GetShenheStatus(FieldByName('编号').AsString); if mblstatus='' then kbmMemTable1.FieldByName('特殊放单').AsString:='没有特殊申请' else kbmMemTable1.FieldByName('特殊放单').AsString:=mblstatus; kbmMemTable1.Post; next; end; finally kbmMemTable1.EnableControls; end; end; end; end; { if FieldByName('签单方式').AsString='正本' then begin if GetmblzbState(FieldByName('编号').AsString) then begin kbmMemTable1.Insert; kbmMemTable1.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable1.FieldByName('业务编号').AsString:=FieldByName('业务编号').AsString; kbmMemTable1.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable1.FieldByName('船名').AsString:=FieldByName('船名').AsString; kbmMemTable1.FieldByName('航次').AsString:=FieldByName('航次').AsString; kbmMemTable1.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable1.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable1.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable1.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable1.FieldByName('提单签发状态').AsString:=FieldByName('提单签发状态').AsString; kbmMemTable1.FieldByName('结费类型').AsString:=FieldByName('结费类型').AsString; kbmMemTable1.FieldByName('发票').AsString:=FieldByName('发票号').AsString; kbmMemTable1.FieldByName('帐单号').AsString:=FieldByName('备案号').AsString; kbmMemTable1.FieldByName('处理日期').AsString:=GetSeaeStateDate(FieldByName('编号').AsString,FieldByName('提单签发状态').AsString); mblstatus:=GetShenheStatus(FieldByName('编号').AsString); if mblstatus='' then kbmMemTable1.FieldByName('特殊放单').AsString:='没有特殊申请' else kbmMemTable1.FieldByName('特殊放单').AsString:=mblstatus; kbmMemTable1.Post; end; end else begin if GetmblState(FieldByName('编号').AsString) then begin kbmMemTable1.Insert; kbmMemTable1.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable1.FieldByName('业务编号').AsString:=FieldByName('业务编号').AsString; kbmMemTable1.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable1.FieldByName('船名').AsString:=FieldByName('船名').AsString; kbmMemTable1.FieldByName('航次').AsString:=FieldByName('航次').AsString; kbmMemTable1.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable1.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable1.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable1.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable1.FieldByName('提单签发状态').AsString:=FieldByName('提单签发状态').AsString; kbmMemTable1.FieldByName('结费类型').AsString:=FieldByName('结费类型').AsString; kbmMemTable1.FieldByName('处理日期').AsString:=GetSeaeStateDate(FieldByName('编号').AsString,FieldByName('提单签发状态').AsString); kbmMemTable1.FieldByName('发票').AsString:=FieldByName('发票号').AsString; kbmMemTable1.FieldByName('帐单号').AsString:=FieldByName('备案号').AsString; mblstatus:=GetShenheStatus(FieldByName('编号').AsString); if mblstatus='' then kbmMemTable1.FieldByName('特殊放单').AsString:='没有特殊申请' else kbmMemTable1.FieldByName('特殊放单').AsString:=mblstatus; kbmMemTable1.Post; end; end; } procedure Tfrm_op_mblsign.bsSkinPanel1Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel1.Width/11); bsSkinButton9.Width:=i; bsSkinButton1.Width:=i; end; procedure Tfrm_op_mblsign.dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_seae,'业务编号'); end; procedure Tfrm_op_mblsign.bsSkinButton1Click(Sender: TObject); var str,bsno:widestring; i:integer; aQuery:TAdoQuery; amt:Double; begin if kbmMemTable1.IsEmpty then exit; if dxDBGrid2.SelectedCount<1 then begin exit; end; if not GetStatus_notice(kbmMemTable1.FieldByName('编号').AsString,'提单签回') then begin showmessage('请先做提单签回'); exit; end; if not GetStatus_notice(kbmMemTable1.FieldByName('编号').AsString,'通知放单') then begin showmessage('请先做通知放单'); exit; end; try frm_main.db.BeginTrans; kbmMemTable1.DisableControls; for i:=0 to dxDBGrid2.SelectedCount-1 do begin kbmMemTable1.GotoBookmark(pointer(dxDBGrid2.selectedrows[i])); if (kbmMemTable1.FieldByName('签单方式').AsString='正本') OR (kbmMemTable1.FieldByName('签单方式').AsString='电子提单') then begin if GetmblStateOut(kbmMemTable1.FieldByName('编号').AsString) then begin InsertSeaeStatus(kbmMemTable1.FieldByName('编号').AsString,'提单签发',employee,FormatDateTime('YYYY-MM-DD hh:mm:ss',Now)); UpateSeaeState(kbmMemTable1.FieldByName('编号').AsString,'提单签发'); if (kbmMemTable1.FieldByName('签单方式').AsString='电子提单') and ((kbmMemTable1.FieldByName('船公司').AsString='MAERSK') or (kbmMemTable1.FieldByName('船公司').AsString='MCC')) THEN begin UpWebDZTD(kbmMemTable1.FieldByName('船公司').AsString,kbmMemTable1.FieldByName('主提单号').AsString); end; end else begin ShowMessage('提单:'+kbmMemTable1.FieldByName('主提单号').AsString+' 还没有签出,不能签发'); end; end else begin if GetmblStateOut(kbmMemTable1.FieldByName('编号').AsString) then begin InsertSeaeStatus(kbmMemTable1.FieldByName('编号').AsString,'提单签发',employee,FormatDateTime('YYYY-MM-DD hh:mm:ss',Now)); UpateSeaeState(kbmMemTable1.FieldByName('编号').AsString,'提单签发'); end else begin ShowMessage('提单:'+kbmMemTable1.FieldByName('主提单号').AsString+' 还没有签出,不能签发'); end; end; end; frm_main.db.CommitTrans; finally kbmMemTable1.EnableControls; bsSkinButton8.onClick(bsSkinButton8); if frm_main.db.InTransaction then frm_main.db.RollbackTrans; end; end; procedure Tfrm_op_mblsign.N1Click(Sender: TObject); begin grid_save_xls(dxdbgrid2); end; procedure Tfrm_op_mblsign.dxDBGrid2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if ANode.Strings[dxDBGrid2Column10.Index]='副总审核' then begin AFont.Color:=clGreen; end else if ANode.Strings[dxDBGrid2Column10.Index]='主管审核' then begin AFont.Color:=clred; end else if ANode.Strings[dxDBGrid2Column10.Index]='销售审核' then begin AFont.Color:=clred; end else if ANode.Strings[dxDBGrid2Column10.Index]='申请放单' then begin AFont.Color:=clred; end else AFont.Color:=clblack; end; procedure Tfrm_op_mblsign.Edit2KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton8Click(Sender); end; end; procedure Tfrm_op_mblsign.dxDBGrid2DblClick(Sender: TObject); begin // end; procedure Tfrm_op_mblsign.bsSkinButton2Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;Sql.Clear; SQL.Add('update t_op_seae set 发票号=:发票号'); SQL.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=kbmMemTable1.FieldByName('编号').AsString; if trim(kbmMemTable1.FieldByName('发票').AsString)='' then Parameters.ParamByName('发票号').Value:='是' else Parameters.ParamByName('发票号').Value:=''; ExecSQL; finally Free; end; end; procedure Tfrm_op_mblsign.dxDBGrid2Column13CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if Trim(ANode.Strings[dxDBGrid2Column13.Index])<>'' then AColor:=clred; AFont.Color:=clblack; end; procedure Tfrm_op_mblsign.bsSkinButton3Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;Sql.Clear; SQL.Add('update t_op_seae set 备案号=:备案号'); SQL.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=kbmMemTable1.FieldByName('编号').AsString; if trim(kbmMemTable1.FieldByName('帐单号').AsString)='' then Parameters.ParamByName('备案号').Value:='是' else Parameters.ParamByName('备案号').Value:=''; ExecSQL; finally Free; end; end; procedure Tfrm_op_mblsign.dxDBGrid2Column14CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if Trim(ANode.Strings[dxDBGrid2Column14.Index])<>'' then AColor:=clred; AFont.Color:=clblack; end; procedure Tfrm_op_mblsign.bsSkinButton13Click(Sender: TObject); var str,mblstatus,s,bsno:widestring; alist:TStringlist; begin s:=''; str:='where 1=1'; if wwDBDateTimePicker5.text<>''then str:=str+' and t_op_state.录入日期>='+''''+wwDBDateTimePicker5.text+''''; if wwDBDateTimePicker6.text<>''then str:=str+' and t_op_state.录入日期<='+''''+wwDBDateTimePicker6.text+''''; try kbmMemTable3.DisableControls; alist:=TStringlist.Create; with t_op_seae do begin close;sql.clear; sql.add('select'); sql.add('t_op_seae.编号,t_op_seae.业务编号,t_op_seae.委托单位,t_op_seae.船名'); sql.add(',t_op_seae.航次,t_op_seae.主提单号,t_op_seae.签单方式,t_op_seae.开船日期'); sql.add(',t_op_seae.操作员,t_op_seae.结费类型,t_op_seae.提单签发状态'); sql.add('from t_op_state'); sql.add('Left join t_op_seae on t_op_state.编号=t_op_seae.编号'); sql.add(str); sql.add('and t_op_state.业务状态=''提单签入'''); kbmMemTable3.EmptyTable; kbmMemTable3.Open; open;First; while not Eof do begin kbmMemTable3.Insert; kbmMemTable3.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable3.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable3.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable3.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable3.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable3.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; // kbmMemTable3.FieldByName('通知放单').AsString:=_GetmblStateout(FieldByName('编号').AsString,'通知放单'); kbmMemTable3.FieldByName('提单签入').AsString:='是'; //kbmMemTable3.FieldByName('提单签出').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签出'); //kbmMemTable3.FieldByName('提单签发').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签发'); kbmMemTable3.Post; if bsno='' then bsno:=''''+FieldByName('编号').AsString+'''' else bsno:=bsno+','+''''+FieldByName('编号').AsString+''''; Next; end; end; if bsno<>'' then with t_op_seae do begin close;sql.clear; sql.add('select 编号'); sql.add('from t_op_state'); sql.add('where 编号 in('+bsno+')'); sql.add('and 业务状态=''提单签出'''); open;First; while not eof do begin if kbmMemTable3.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable3.Edit; kbmMemTable3.FieldByName('提单签出').AsString:='是'; kbmMemTable3.Post; end; Next; end; end; if bsno<>'' then with t_op_seae do begin close;sql.clear; sql.add('select 编号'); sql.add('from t_op_state'); sql.add('where 编号 in('+bsno+')'); sql.add('and 业务状态=''提单签发'''); open;First; while not eof do begin if kbmMemTable3.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable3.Edit; kbmMemTable3.FieldByName('提单签发').AsString:='是'; kbmMemTable3.Post; end; Next; end; end; if bsno<>'' then with t_op_seae do begin close;sql.clear; sql.add('select 编号'); sql.add('from t_op_state'); sql.add('where 编号 in('+bsno+')'); sql.add('and 业务状态=''通知放单'''); open;First; while not eof do begin if kbmMemTable3.Locate('编号',FieldByName('编号').AsString,[]) then begin kbmMemTable3.Edit; kbmMemTable3.FieldByName('通知放单').AsString:='是'; kbmMemTable3.Post; end; Next; end; end; finally kbmMemTable3.EnableControls; end; end; {var str,mblstatus,s:widestring; begin s:=''; str:='where t_op_seae.装运方式<>''拼箱分票'' and t_op_seae.业务类型=''普通货'' and t_op_seae.主提单号<>'''' and t_op_seae.签单方式<>'''''; if wwDBDateTimePicker5.text<>''then str:=str+' and t_op_seae.开船日期>='+''''+wwDBDateTimePicker5.text+''''; if wwDBDateTimePicker6.text<>''then str:=str+' and t_op_seae.开船日期<='+''''+wwDBDateTimePicker6.text+''''; if trim(Edit6.text)<>'' then begin str:=str+' and t_op_seae.操作员='+''''+ trim(Edit6.text)+''''; end; if CheckBox1.Checked then begin str:=str+' and t_op_seae.签单方式=''正本'''; end; try kbmMemTable3.DisableControls; with t_op_seae do begin close;sql.clear; sql.add('select'); sql.add('t_op_seae.编号,t_op_seae.业务编号,t_op_seae.委托单位,t_op_seae.船名'); sql.add(',t_op_seae.航次,t_op_seae.主提单号,t_op_seae.签单方式,t_op_seae.开船日期'); sql.add(',t_op_seae.操作员,t_op_seae.结费类型,t_op_seae.提单签发状态'); sql.add('from t_op_seae'); sql.add(str); kbmMemTable3.EmptyTable; kbmMemTable3.Open; open;First; while not Eof do begin if CheckBox1.Checked then begin if (_GetmblStateout(FieldByName('编号').AsString,'提单签入')<>'') and (_GetmblStateout(FieldByName('编号').AsString,'提单签出')='') then begin kbmMemTable3.Insert; kbmMemTable3.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable3.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable3.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable3.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable3.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable3.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable3.FieldByName('通知放单').AsString:=_GetmblStateout(FieldByName('编号').AsString,'通知放单'); kbmMemTable3.FieldByName('提单签入').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签入'); kbmMemTable3.FieldByName('提单签出').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签出'); kbmMemTable3.FieldByName('提单签发').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签发'); kbmMemTable3.Post; end end else begin kbmMemTable3.Insert; kbmMemTable3.FieldByName('编号').AsString:=FieldByName('编号').AsString; kbmMemTable3.FieldByName('委托单位').AsString:=FieldByName('委托单位').AsString; kbmMemTable3.FieldByName('主提单号').AsString:=FieldByName('主提单号').AsString; kbmMemTable3.FieldByName('签单方式').AsString:=FieldByName('签单方式').AsString; kbmMemTable3.FieldByName('开船日期').AsString:=FieldByName('开船日期').AsString; kbmMemTable3.FieldByName('操作员').AsString:=FieldByName('操作员').AsString; kbmMemTable3.FieldByName('通知放单').AsString:=_GetmblStateout(FieldByName('编号').AsString,'通知放单'); kbmMemTable3.FieldByName('提单签入').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签入'); kbmMemTable3.FieldByName('提单签出').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签出'); kbmMemTable3.FieldByName('提单签发').AsString:=_GetmblStateout(FieldByName('编号').AsString,'提单签发'); kbmMemTable3.Post; end; next; end; end; finally kbmMemTable3.EnableControls; end; } procedure Tfrm_op_mblsign.MenuItem1Click(Sender: TObject); begin grid_save_xls(dxDBGrid1); end; procedure Tfrm_op_mblsign.bsSkinButton6Click(Sender: TObject); begin Close; end; procedure Tfrm_op_mblsign.RxDBLookupCombo28Enter(Sender: TObject); begin RxDBLookupCombo28.LookupDisplay:='代码;签单方式'; end; procedure Tfrm_op_mblsign.RxDBLookupCombo28Exit(Sender: TObject); begin // RxDBLookupCombo28.LookupDisplay:='签单方式'; end; procedure Tfrm_op_mblsign.bsSkinButton7Click(Sender: TObject); var i:Integer; begin if kbmMemTable1.IsEmpty then exit; if dxDBGrid2.SelectedCount<1 then begin exit; end; if not (kbmMemTable1.FieldByName('签单方式').AsString<>'电子提单') then begin showmessage('签单方式必须为 电子提单 才允许退回'); exit; end; try frm_main.db.BeginTrans; kbmMemTable1.DisableControls; for i:=0 to dxDBGrid2.SelectedCount-1 do begin kbmMemTable1.GotoBookmark(pointer(dxDBGrid2.selectedrows[i])); if (kbmMemTable1.FieldByName('签单方式').AsString='电子提单') then begin DelteSeaeStatus(kbmMemTable1.fieldbyname('编号').AsString,'提单签回'); DelteSeaeStatus(kbmMemTable1.fieldbyname('编号').AsString,'通知放单'); DelteSeaeStatus(kbmMemTable1.fieldbyname('编号').AsString,'提单签发'); UpdateMblStatus(kbmMemTable1.FieldByName('编号').AsString,''); end end; frm_main.db.CommitTrans; finally kbmMemTable1.EnableControls; bsSkinButton8.onClick(bsSkinButton8); if frm_main.db.InTransaction then frm_main.db.RollbackTrans; end; end; end.