unit u_op_vesselvoy_change; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, wwdbdatetimepicker, bsSkinCtrls, BusinessSkinForm, DB,ADODB, Mask, DBCtrls, wwdblook, RxLookup; type Tfrm_op_vesselvoy_change = class(TForm) Label1: TLabel; bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; DataSource1: TDataSource; wwDBLookupCombo49: TwwDBLookupCombo; Label125: TLabel; Label126: TLabel; Button1: TButton; Label2: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; DBEdit63: TEdit; Label3: TLabel; Edit1: TEdit; wwDBLookupCombo52: TwwDBLookupCombo; Label124: TLabel; Label145: TLabel; wwDBLookupCombo17: TwwDBLookupCombo; wwDBDateTimePicker17: TwwDBDateTimePicker; Label197: TLabel; Label25: TLabel; wwDBDateTimePicker6: TwwDBDateTimePicker; wwDBLookupCombo27: TwwDBLookupCombo; Label176: TLabel; RxDBLookupCombo48: TRxDBLookupCombo; Label128: TLabel; procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } BSTYPE:string; end; var frm_op_vesselvoy_change: Tfrm_op_vesselvoy_change; implementation uses my_sys_function, u_op_seae_vessel, u_op_seae, u_data_share; {$R *.dfm} procedure Tfrm_op_vesselvoy_change.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_vesselvoy_change.bsSkinButton1Click(Sender: TObject); var aQuery:TAdoQuery; i:Integer; book1:Tbookmark; dsstr,PostUrl:string; begin if wwDBLookupCombo49.text='' then begin showmessage('请输入新的船名!!'); exit; end; if DBEdit63.text='' then begin showmessage('请输入新的航次!!'); exit; end; try frm_op_seae.t_op_seae.DisableControls; aQuery:=createAdoQuery; try with aQuery do begin for i:=0 to frm_op_seae.dxDBGrid1.SelectedCount-1 do begin frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxDBGrid1.selectedrows[i])); // Close;sql.Clear; frm_op_seae.t_op_seae.Edit; if (frm_op_seae.t_op_seae.FieldByName('费用状态').AsString<>'费用封帐') and (frm_op_seae.t_op_seae.FieldByName('费用状态').AsString<>'提交财务') then begin frm_op_seae.t_op_seae['开船日期']:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date); frm_op_seae.t_op_seae['会计期间']:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date); frm_op_seae.t_op_seae['船名']:=wwDBLookupCombo49.Text; frm_op_seae.t_op_seae['航次']:=DBEdit63.text; if (trim(Edit1.Text)<>'') then frm_op_seae.t_op_seae['内部航次号']:=Edit1.text; if (trim(wwDBLookupCombo52.Text)<>'') then begin frm_op_seae.t_op_seae['卸货港']:=wwDBLookupCombo52.Text; if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then begin frm_op_seae.t_op_seae['卸货代码']:=frm_data_share.t_code_disport['EDI代码']; end else begin frm_op_seae.t_op_seae['卸货代码']:=''; end; end; if (trim(wwDBLookupCombo17.Text)<>'') then begin frm_op_seae.t_op_seae['目的地']:=wwDBLookupCombo17.Text; if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo17.text,[]) then begin frm_op_seae.t_op_seae['目的地代码']:=frm_data_share.t_code_disport['EDI代码']; end else begin frm_op_seae.t_op_seae['目的地代码']:=''; end; end; if (trim(wwDBLookupCombo27.Text)<>'') then begin frm_op_seae.t_op_seae['二程港口']:=wwDBLookupCombo27.Text; end; if (trim(wwDBDateTimePicker6.Text)<>'') then begin frm_op_seae.t_op_seae['截单日期']:=wwDBDateTimePicker6.Text; end; if (trim(wwDBDateTimePicker17.Text)<>'') then begin frm_op_seae.t_op_seae['截港日期']:=wwDBDateTimePicker17.Text; end; if (RxDBLookupCombo48.DisplayValues[0]<>'') then begin frm_op_seae.t_op_seae['发货人编号']:=RxDBLookupCombo48.DisplayValues[0]; end; end; frm_op_seae.t_op_seae.Post; { sql.Add('Update t_op_seae set 开船日期=:开船日期,会计期间=:会计期间,船名=:vsl,航次=:voy'); if (trim(Edit1.Text)<>'') then sql.Add(',内部航次号=:voy2'); if (trim(wwDBLookupCombo52.Text)<>'') then begin sql.Add(',卸货港=:portdischarge'); sql.Add(',卸货代码=:portdischargeid'); end; if (trim(wwDBLookupCombo17.Text)<>'') then begin sql.Add(',目的地=:destination'); sql.Add(',目的地代码=:destinationid'); end; if (trim(wwDBDateTimePicker6.Text)<>'') then begin sql.Add(',截单日期=:closedocdate'); end; if (trim(wwDBDateTimePicker17.Text)<>'') then begin sql.Add(',截港日期=:closedate'); end; sql.Add(' where 编号='''+frm_op_seae.t_op_seae.fieldbyname('编号').AsString+''' and 业务类型=''普通货'' and 费用状态<>''费用封帐'' and 费用状态<>''提交财务'' '); Parameters.ParamByName('vsl').Value:=wwDBLookupCombo49.Text; Parameters.ParamByName('voy').Value:=DBEdit63.text; Parameters.ParamByName('开船日期').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date); Parameters.ParamByName('会计期间').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date); if (trim(Edit1.Text)<>'') then Parameters.ParamByName('voy2').Value:=Edit1.text; if (trim(wwDBLookupCombo52.Text)<>'') then begin Parameters.ParamByName('portdischarge').Value:=wwDBLookupCombo52.Text; if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then begin Parameters.ParamByName('portdischargeid').Value:=frm_data_share.t_code_disport['EDI代码']; end else begin Parameters.ParamByName('portdischargeid').Value:=''; end; end; if (trim(wwDBLookupCombo17.Text)<>'') then begin Parameters.ParamByName('destination').Value:=wwDBLookupCombo17.Text; if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo17.text,[]) then begin Parameters.ParamByName('destinationid').Value:=frm_data_share.t_code_disport['EDI代码']; end else begin Parameters.ParamByName('destinationid').Value:=''; end; end; if (trim(wwDBDateTimePicker6.Text)<>'') then begin Parameters.ParamByName('closedocdate').Value:=wwDBDateTimePicker6.Text; end; if (trim(wwDBDateTimePicker17.Text)<>'') then begin Parameters.ParamByName('closedate').Value:=wwDBDateTimePicker17.Text; end; ExecSQL; } Close;sql.Clear; sql.Add('Update t_op_seae_assistant set 开船日期=:开船日期,船名=:vsl,航次=:voy'); if (trim(wwDBLookupCombo52.Text)<>'') then begin sql.Add(',卸货港=:portdischarge'); end; if (trim(wwDBLookupCombo17.Text)<>'') then begin sql.Add(',目的地=:destination'); end; sql.Add(' where 编号='''+frm_op_seae.t_op_seae.fieldbyname('编号').AsString+''''); Parameters.ParamByName('vsl').Value:=wwDBLookupCombo49.Text; Parameters.ParamByName('voy').Value:=DBEdit63.text; Parameters.ParamByName('开船日期').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date); if (trim(wwDBLookupCombo52.Text)<>'') then begin Parameters.ParamByName('portdischarge').Value:=wwDBLookupCombo52.Text; end; if (trim(wwDBLookupCombo17.Text)<>'') then begin Parameters.ParamByName('destination').Value:=wwDBLookupCombo17.Text; end; ExecSQL; if (frm_op_seae.t_op_seae.FieldByName('船公司').AsString='CMA') and ((frm_op_seae.t_op_seae.FieldByName('订舱状态').AsString='已订舱') or (frm_op_seae.t_op_seae.FieldByName('订舱状态').AsString='已接收') or (frm_op_seae.t_op_seae.FieldByName('确认状态').AsString='已确认')) and (frm_op_seae.t_op_seae.FieldByName('业务类型').AsString<>'更改单') THEN begin dsstr:=frm_op_seae.CreateDjyStr; PostUrl:=get_parameters_value(2121,'http://123.234.225.158:8901')+'/booking/ReceiveBookingData'; if (frm_op_seae.t_op_seae.FieldByName('船公司').asstring<>'东方海外') then begin TDsDjyThread.create(PostUrl,dsstr,''); InsertSysLog('上传大简云',frm_op_seae.t_op_seae.FieldByName('业务编号').asstring); end; END; end; end; finally FreeAndNil(aQuery); end; finally frm_op_seae.t_op_seae.EnableControls; end; book1:=frm_op_seae.t_op_seae.GetBookmark; frm_op_seae.t_op_seae.Refresh; frm_op_seae.t_op_seae.GotoBookmark(book1); showmessage('更改成功!!'); close; end; procedure Tfrm_op_vesselvoy_change.Button1Click(Sender: TObject); begin try frm_op_seae_vessel:=tfrm_op_seae_vessel.Create (self); frm_op_seae_vessel.v_vessel_voyage.open; frm_op_seae_vessel.wwIncrementalSearch1.Text:=wwDBLookupCombo49.text; op_seae_vessel_num:=4; frm_op_seae_vessel.ShowModal; finally frm_op_seae_vessel.Free; frm_op_seae_vessel:=nil; end; end; end.