unit u_op_seae_assistant; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, StdCtrls, DBCtrls, RxLookup, bsSkinCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdbdatetimepicker, wwdblook, Menus, DBCtrlsEh, ExtCtrls, ComCtrls, bsSkinTabs, Grids, Wwdbigrd, Wwdbgrid, bsdbctrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP; type Tfrm_op_seae_assistant = class(TForm) t_op_seae_assistant: TADOQuery; t_op_seae_assistant1: TDataSource; p_getMaxHblno: TADOStoredProc; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; t_op_seae_assistant_online: TADOQuery; Panel1: TPanel; bsSkinPanel3: TbsSkinPanel; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridColumn; StaticText1: TStaticText; PopupMenu2: TPopupMenu; N3: TMenuItem; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; Label122: TLabel; Label121: TLabel; Label123: TLabel; Label38: TLabel; Label36: TLabel; Label125: TLabel; Label126: TLabel; Label15: TLabel; Label7: TLabel; Label124: TLabel; Label146: TLabel; Label145: TLabel; Label32: TLabel; Label21: TLabel; Label26: TLabel; Label27: TLabel; Label30: TLabel; Label28: TLabel; Label31: TLabel; Label13: TLabel; Label163: TLabel; Label158: TLabel; Label165: TLabel; Label166: TLabel; Label167: TLabel; Label168: TLabel; Label169: TLabel; Label170: TLabel; Label33: TLabel; Label1: TLabel; Label2: TLabel; Label3: TLabel; bsSkinSpeedButton1: TbsSkinSpeedButton; bsSkinPanel2: TbsSkinPanel; bsSkinButton9: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinButton14: TbsSkinButton; RxDBLookupCombo2: TRxDBLookupCombo; DBMemo33: TDBMemo; DBMemo34: TDBMemo; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo4: TRxDBLookupCombo; DBMemo35: TDBMemo; DBEdit9: TDBEdit; DBEdit7: TDBEdit; wwDBLookupCombo49: TwwDBLookupCombo; DBEdit63: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBLookupCombo3: TwwDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; DBEdit10: TDBEdit; DBEdit11: TDBEdit; wwDBLookupCombo21: TwwDBLookupCombo; wwDBComboBox1: TwwDBComboBox; wwDBDateTimePicker4: TwwDBDateTimePicker; DBEdit25: TDBEdit; RxDBLookupCombo15: TRxDBLookupCombo; DBEdit26: TDBEdit; DBEdit27: TDBEdit; DBEdit5: TDBEdit; DBMemo38: TDBMemo; DBMemo37: TDBMemo; DBMemo39: TDBMemo; DBMemo40: TDBMemo; DBMemo41: TDBMemo; DBMemo42: TDBMemo; DBEdit80: TDBEdit; DBEdit81: TDBEdit; wwDBLookupCombo61: TwwDBLookupCombo; DBEdit82: TDBEdit; DBEdit83: TDBEdit; RxDBLookupCombo19: TRxDBLookupCombo; DBMemo6: TDBMemo; wwDBLookupCombo2: TwwDBLookupCombo; wwDBLookupCombo5: TwwDBLookupCombo; wwDBLookupCombo6: TwwDBLookupCombo; bsSkinButton21: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton11: TbsSkinButton; wwDBLookupCombo1: TwwDBLookupCombo; DBEdit1: TDBEdit; bsSkinPanel10: TbsSkinPanel; lblhbl: TLabel; DBEditEh1: TDBEditEh; Label71: TLabel; DBMemo7: TDBMemo; Label72: TLabel; DBMemo8: TDBMemo; Label75: TLabel; DBMemo11: TDBMemo; DBMemo9: TDBMemo; Label74: TLabel; Label5: TLabel; DBMemo1: TDBMemo; bsSkinGroupBox1: TbsSkinGroupBox; Label103: TLabel; Label104: TLabel; Label105: TLabel; Label108: TLabel; Label6: TLabel; DBEdit77: TDBEdit; DBEdit72: TDBEdit; DBEdit73: TDBEdit; DBEdit74: TDBEdit; DBEdit75: TDBEdit; DBEdit76: TDBEdit; DBEdit36: TDBEdit; DBEdit37: TDBEdit; Label8: TLabel; Label9: TLabel; Label10: TLabel; DBEdit3: TDBEdit; DBEdit4: TDBEdit; Label11: TLabel; DBEdit6: TDBEdit; DBEdit8: TDBEdit; DBEdit12: TDBEdit; DBEdit13: TDBEdit; Label14: TLabel; DBEdit14: TDBEdit; DBEdit15: TDBEdit; DBEdit16: TDBEdit; DBEdit17: TDBEdit; DBEdit18: TDBEdit; DBEdit19: TDBEdit; Label16: TLabel; Label17: TLabel; DBEdit20: TDBEdit; DBEdit21: TDBEdit; DBEdit22: TDBEdit; DBEdit23: TDBEdit; DBEdit24: TDBEdit; DBEdit28: TDBEdit; Label18: TLabel; DBEdit29: TDBEdit; DBEdit30: TDBEdit; DBEdit31: TDBEdit; Label4: TLabel; DBEdit2: TDBEdit; Label35: TLabel; RxDBLookupCombo28: TRxDBLookupCombo; bsSkinSpeedButton2: TbsSkinSpeedButton; OpenDialog1: TOpenDialog; t_op_ctn_fendan1: TDataSource; wwDBLookupCombo4: TwwDBLookupCombo; wwDBLookupCombo7: TwwDBLookupCombo; t_op_ctn_fendan: TADOQuery; t_op_ctn_fendanctn_id: TAutoIncField; t_op_ctn_fendanAS_ID: TIntegerField; t_op_ctn_fendanDSDesigner: TStringField; t_op_ctn_fendanDSDesigner2: TStringField; t_op_ctn_fendanDSDesigner3: TStringField; t_op_ctn_fendanDSDesigner4: TIntegerField; t_op_ctn_fendanTEU: TIntegerField; t_op_ctn_fendanDSDesigner5: TStringField; t_op_ctn_fendanDSDesigner6: TStringField; t_op_ctn_fendanDSDesigner7: TStringField; t_op_ctn_fendanDSDesigner8: TIntegerField; t_op_ctn_fendanDSDesigner9: TStringField; t_op_ctn_fendanDSDesigner10: TBCDField; t_op_ctn_fendanDSDesigner11: TBCDField; t_op_ctn_fendanDSDesigner12: TStringField; t_op_ctn_fendanDSDesigner13: TStringField; t_op_ctn_fendanDSDesigner14: TStringField; t_op_ctn_fendanDSDesigner15: TStringField; t_pt_fendan: TADOQuery; t_pt_fendan1: TDataSource; bsSkinPanel4: TbsSkinPanel; wwDBGrid1: TwwDBGrid; bsSkinPanel5: TbsSkinPanel; bsSkinDBNavigator1: TbsSkinDBNavigator; bsSkinButton15: TbsSkinButton; Label12: TLabel; DBMemo2: TDBMemo; bsSkinButton16: TbsSkinButton; PopupMenu3: TPopupMenu; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; bsSkinButton61: TbsSkinButton; PopupMenu6: TPopupMenu; AFR1: TMenuItem; N180: TMenuItem; N181: TMenuItem; N185: TMenuItem; N186: TMenuItem; N182: TMenuItem; N183: TMenuItem; N184: TMenuItem; t_op_ctn_edi: TADOQuery; strngfld_op_ctnDSDesigner2: TStringField; strngfld_op_ctnDSDesigner6: TStringField; strngfld_op_ctnDSDesigner7: TStringField; strngfld_op_ctnDSDesigner8: TStringField; intgrfld_op_ctnDSDesigner9: TIntegerField; strngfld_op_ctnDSDesigner10: TStringField; bcdfld_op_ctnDSDesigner11: TBCDField; bcdfld_op_ctnDSDesigner12: TBCDField; strngfld_op_ctnDSDesigner14: TStringField; t_op_ctn_ediDSDesigner: TStringField; t_op_ctn_ediPO: TStringField; t_op_ctn_ediSKU: TStringField; t_op_ctn_ediSKU2: TStringField; t_op_ctn_ediUN: TStringField; t_op_ctn_ediHTS: TStringField; t_op_ctn_ediDSDesigner2: TStringField; t_op_ctn_ediDSDesigner3: TBCDField; intgrfld_op_ctnDSDesigner5: TIntegerField; intgrfld_op_ctnTEU: TIntegerField; strngfld_op_ctnDSDesigner4: TStringField; strngfld_op_ctnDSDesigner3: TStringField; atncfld_op_ctnctn_id: TAutoIncField; strngfld_op_ctnDSDesigner: TStringField; t_op_seae_edi: TADOQuery; t_op_ctn_detail_edi: TADOQuery; t_op_ctn_detail_edictn_id: TIntegerField; t_op_ctn_detail_ediDSDesigner: TIntegerField; t_op_ctn_detail_ediDSDesigner2: TStringField; t_op_ctn_detail_ediDSDesigner3: TBCDField; t_op_ctn_detail_ediDSDesigner4: TBCDField; t_op_ctn_detail_ediUN: TStringField; t_op_ctn_detail_ediHTS: TStringField; t_op_ctn_detail_ediDSDesigner5: TBCDField; AFRLCL1: TMenuItem; N9: TMenuItem; t_op_ctn_ediDSDesigner4: TStringField; bsSkinGroupBox17: TbsSkinGroupBox; lbl_1: TLabel; lbl_2: TLabel; lbl_3: TLabel; bsSkinGroupBox14: TbsSkinGroupBox; bsSkinButton67: TbsSkinButton; bsSkinButton69: TbsSkinButton; bsSkinButton70: TbsSkinButton; bsSkinButton68: TbsSkinButton; bsSkinGroupBox15: TbsSkinGroupBox; bsSkinButton71: TbsSkinButton; bsSkinButton72: TbsSkinButton; bsSkinButton73: TbsSkinButton; bsSkinButton65: TbsSkinButton; idhttp1: TIdHTTP; bsSkinButton17: TbsSkinButton; lbl_4: TLabel; lbl_5: TLabel; PopupMenu4: TPopupMenu; N10: TMenuItem; bsSkinGroupBox21: TbsSkinGroupBox; Label438: TLabel; Label440: TLabel; Label447: TLabel; Label450: TLabel; DBEdit243: TDBEdit; DBEdit244: TDBEdit; DBEdit251: TDBEdit; DBEdit254: TDBEdit; bsSkinGroupBox22: TbsSkinGroupBox; Label441: TLabel; Label443: TLabel; Label448: TLabel; Label451: TLabel; DBEdit246: TDBEdit; DBEdit247: TDBEdit; DBEdit252: TDBEdit; DBEdit255: TDBEdit; bsSkinGroupBox23: TbsSkinGroupBox; Label444: TLabel; Label446: TLabel; Label449: TLabel; Label452: TLabel; DBEdit249: TDBEdit; DBEdit250: TDBEdit; DBEdit253: TDBEdit; DBEdit256: TDBEdit; bsSkinSplitter1: TbsSkinSplitter; DBEdit32: TDBEdit; Label19: TLabel; procedure bsSkinPanel2Resize(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure t_op_seae_assistantAfterInsert(DataSet: TDataSet); procedure t_op_seae_assistantBeforeInsert(DataSet: TDataSet); procedure bsSkinButton8Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure DBEdit9KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo49KeyPress(Sender: TObject; var Key: Char); procedure DBEdit63KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); procedure DBEdit10KeyPress(Sender: TObject; var Key: Char); procedure DBEdit11KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo21KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit25KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo15KeyPress(Sender: TObject; var Key: Char); procedure DBEdit26KeyPress(Sender: TObject; var Key: Char); procedure DBEdit27KeyPress(Sender: TObject; var Key: Char); procedure DBEdit5KeyPress(Sender: TObject; var Key: Char); procedure DBEdit81KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo61KeyPress(Sender: TObject; var Key: Char); procedure DBEdit82KeyPress(Sender: TObject; var Key: Char); procedure DBEdit83KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2Change(Sender: TObject); procedure RxDBLookupCombo3Change(Sender: TObject); procedure RxDBLookupCombo4Change(Sender: TObject); procedure DBMemo40Change(Sender: TObject); procedure DBMemo41Change(Sender: TObject); procedure DBMemo41Exit(Sender: TObject); procedure DBMemo42Change(Sender: TObject); procedure DBMemo42Exit(Sender: TObject); procedure wwDBLookupCombo61Change(Sender: TObject); procedure RxDBLookupCombo19Change(Sender: TObject); procedure wwDBLookupCombo2Enter(Sender: TObject); procedure wwDBLookupCombo5Enter(Sender: TObject); procedure wwDBLookupCombo6Enter(Sender: TObject); procedure wwDBLookupCombo2Change(Sender: TObject); procedure wwDBLookupCombo5Change(Sender: TObject); procedure wwDBLookupCombo6Change(Sender: TObject); procedure wwDBLookupCombo2Exit(Sender: TObject); procedure wwDBLookupCombo5Exit(Sender: TObject); procedure wwDBLookupCombo6Exit(Sender: TObject); procedure wwDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure t_op_seae_assistantBeforePost(DataSet: TDataSet); procedure bsSkinButton21Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo19KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo1Enter(Sender: TObject); procedure wwDBLookupCombo1Exit(Sender: TObject); procedure wwDBLookupCombo1Change(Sender: TObject); procedure DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7DblClick(Sender: TObject); procedure DBEdit7Exit(Sender: TObject); procedure RxDBLookupCombo15Change(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure DBEditEh1EditButtons0Click(Sender: TObject; var Handled: Boolean); procedure t_op_seae_assistantAfterPost(DataSet: TDataSet); procedure bsSkinButton14Click(Sender: TObject); procedure dxDBGrid1Column1CustomDraw(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 N3Click(Sender: TObject); procedure bsSkinSpeedButton2Click(Sender: TObject); procedure wwDBLookupCombo4Change(Sender: TObject); procedure t_op_ctn_fendanAfterInsert(DataSet: TDataSet); procedure t_op_seae_assistantAfterScroll(DataSet: TDataSet); procedure t_op_ctn_fendanBeforeInsert(DataSet: TDataSet); procedure bsSkinButton15Click(Sender: TObject); procedure DBMemo33Click(Sender: TObject); procedure DBMemo34Click(Sender: TObject); procedure DBMemo35Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N8Click(Sender: TObject); procedure bsSkinButton61Click(Sender: TObject); procedure AFR1Click(Sender: TObject); procedure bsSkinButton65Click(Sender: TObject); procedure bsSkinGroupBox17Click(Sender: TObject); procedure bsSkinGroupBox17MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure bsSkinGroupBox17MouseEnter(Sender: TObject); procedure bsSkinGroupBox17MouseLeave(Sender: TObject); procedure bsSkinGroupBox17MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure bsSkinButton17Click(Sender: TObject); procedure DBEdit7Change(Sender: TObject); procedure N10Click(Sender: TObject); private updates:boolean; function DoPost(_URL:string;_Referer:string;_Order:TStringList):String; //向网页发送请求 procedure SetState(response:string) ; function GetINFO(_s:string;_time:integer):string; function GetPosition(_Target, _S: String; _Time: Integer): Integer; function formatStr(_Str: String): String; procedure SetCDState(SHSJ,SHHZ,YDSJ,YDHZ,BGZT,TDFX,TDSJ,CKZZ,ZZSJ:string); procedure SaveState(_info, _time,_remark: string;_end:integer); { Private declarations } public { Public declarations } end; var frm_op_seae_assistant: Tfrm_op_seae_assistant; implementation uses u_op_seae, u_main, my_sys_function, u_data_share,u_op_seae_assistant_qr , u_send_msg, u_op_history, u_op_manifest, u_op_seae_hbl ; {$R *.dfm} procedure Tfrm_op_seae_assistant.bsSkinPanel2Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.width/10); bsSkinButton9.width:=i; bsSkinButton1.width:=i; bsSkinButton2.width:=i; bsSkinButton4.width:=i; bsSkinButton3.width:=i; bsSkinButton13.width:=i; bsSkinButton12.width:=i; bsSkinButton14.width:=i; bsSkinButton61.width:=i; end; procedure Tfrm_op_seae_assistant.bsSkinButton1Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seae_assistant.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_seae_assistant); end; procedure Tfrm_op_seae_assistant.bsSkinButton4Click(Sender: TObject); begin table_delete(t_op_seae_assistant); end; procedure Tfrm_op_seae_assistant.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_op_seae_assistant); end; procedure Tfrm_op_seae_assistant.bsSkinButton9Click(Sender: TObject); var i:integer; str:widestring; begin if t_op_seae_assistant.IsEmpty then exit; { if dxDBGrid1.SelectedCount<1 then begin ShowMessage('选择打印分单为0,请选择'); exit; end; if dxDBGrid1.SelectedCount>=0 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae_assistant.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if i=0 then str:='('+t_op_seae_assistant.fieldbyname('AS_ID').asstring else str:=str+','+t_op_seae_assistant.fieldbyname('AS_ID').asstring; end; str:=str+')'; } if dxDBGrid1.SelectedCount>0 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae_assistant.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if i=0 then str:='('+''''+t_op_seae_assistant.fieldbyname('AS_ID').asstring+'''' else str:=str+','+''''+t_op_seae_assistant.fieldbyname('AS_ID').asstring+''''; end; end else begin str:='('+''''+t_op_seae_assistant.fieldbyname('AS_ID').asstring+''''; end; str:=str+')'; t_pt_fendan.close; t_pt_fendan.sql.clear; t_pt_fendan.sql.add('select * from t_op_seae_assistant ' +'where AS_ID in '+str +' order by AS_ID'); t_pt_fendan.open; sys_print('海运出口单证',2,t_pt_fendan1,t_op_seae_assistant.DataSource,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_assistant.t_op_seae_assistantAfterInsert( DataSet: TDataSet); var afield : variant; i: Integer; aAdoQuery,aAdoQuery2:TAdoQuery; begin // 复制业务基本信息内容 if application.MessageBox('您是否要建直单信息,直单将调入发货人\收货人\通知人信息?','敬告:',MB_OKCANCEL)=IDOK then begin for i:=0 to (t_op_seae_assistant.DataSource.DataSet.fieldcount-1) do begin try if t_op_seae_assistant.FindField(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName)<>nil then t_op_seae_assistant[t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName]:= t_op_seae_assistant.DataSource.DataSet.fields[i].value; except ; end; end; t_op_seae_assistant['提交确认']:=td_sate1 ; t_op_seae_assistant['提单类型']:='直单'; aAdoQuery2:=CreateAdoQuery; with aAdoQuery2 do try Close;sql.Clear; sql.Add('select * from t_op_ams'); sql.Add('where 编号=:bsno'); Parameters.ParamByName('bsno').Value:=t_op_seae_assistant.DataSource.DataSet.FieldByName('编号').AsString; Open; if not IsEmpty then begin t_op_seae_assistant['发货人联系电话']:=fieldbyname('发货人联系电话').AsString; t_op_seae_assistant['发货人国家代码']:=fieldbyname('发货人国家代码').AsString; t_op_seae_assistant['发货人邮箱']:=fieldbyname('发货人邮箱').AsString; t_op_seae_assistant['发货人企业代码']:=fieldbyname('发货人企业代码').AsString; t_op_seae_assistant['收货人联系电话']:=fieldbyname('收货人联系电话').AsString; t_op_seae_assistant['收货人国家代码']:=fieldbyname('收货人国家代码').AsString; t_op_seae_assistant['收货人邮箱']:=fieldbyname('收货人邮箱').AsString; t_op_seae_assistant['收货人企业代码']:=fieldbyname('收货人企业代码').AsString; t_op_seae_assistant['通知人联系电话']:=fieldbyname('通知人联系电话').AsString; t_op_seae_assistant['通知人国家代码']:=fieldbyname('通知人国家代码').AsString; t_op_seae_assistant['通知人邮箱']:=fieldbyname('通知人邮箱').AsString; t_op_seae_assistant['通知人企业代码']:=fieldbyname('通知人企业代码').AsString; end; finally FreeAndNil(aAdoQuery2); end; end else begin for i:=0 to (t_op_seae_assistant.DataSource.DataSet.fieldcount-1) do begin try if (t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'发货人') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'发货人代码') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'收货人') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'收货人代码') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'通知人') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'通知人代码')then if t_op_seae_assistant.FindField(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName)<>nil then t_op_seae_assistant[t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName]:= t_op_seae_assistant.DataSource.DataSet.fields[i].value; except ; end; end; t_op_seae_assistant['提交确认']:=td_sate1 ; t_op_seae_assistant['提单类型']:='套单'; aAdoQuery2:=CreateAdoQuery; with aAdoQuery2 do try Close;sql.Clear; sql.Add('select * from t_op_ams'); sql.Add('where 编号=:bsno'); Parameters.ParamByName('bsno').Value:=t_op_seae_assistant.DataSource.DataSet.FieldByName('编号').AsString; Open; if not IsEmpty then begin t_op_seae_assistant['发货人联系电话']:=fieldbyname('发货人联系电话').AsString; t_op_seae_assistant['发货人国家代码']:=fieldbyname('发货人国家代码').AsString; t_op_seae_assistant['发货人邮箱']:=fieldbyname('发货人邮箱').AsString; t_op_seae_assistant['发货人企业代码']:=fieldbyname('发货人企业代码').AsString; t_op_seae_assistant['收货人联系电话']:=fieldbyname('收货人联系电话').AsString; t_op_seae_assistant['收货人国家代码']:=fieldbyname('收货人国家代码').AsString; t_op_seae_assistant['收货人邮箱']:=fieldbyname('收货人邮箱').AsString; t_op_seae_assistant['收货人企业代码']:=fieldbyname('收货人企业代码').AsString; t_op_seae_assistant['通知人联系电话']:=fieldbyname('通知人联系电话').AsString; t_op_seae_assistant['通知人国家代码']:=fieldbyname('通知人国家代码').AsString; t_op_seae_assistant['通知人邮箱']:=fieldbyname('通知人邮箱').AsString; t_op_seae_assistant['通知人企业代码']:=fieldbyname('通知人企业代码').AsString; end; finally FreeAndNil(aAdoQuery2); end; end; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;sql.Clear; sql.Add('select * from t_op_ctn'); sql.Add('where 编号=:bsno'); Parameters.ParamByName('bsno').Value:=t_op_seae_assistant.DataSource.DataSet.FieldByName('编号').AsString; Open;First; while not eof do begin t_op_ctn_fendan.Insert; t_op_ctn_fendan.FieldByName('代码').Value:=FieldByName('代码').Value; t_op_ctn_fendan.FieldByName('尺寸').Value:=FieldByName('尺寸').Value; t_op_ctn_fendan.FieldByName('箱型').Value:=FieldByName('箱型').Value; t_op_ctn_fendan.FieldByName('数量').Value:=FieldByName('数量').Value; t_op_ctn_fendan.FieldByName('TEU').Value:=FieldByName('TEU').Value; t_op_ctn_fendan.FieldByName('表现形式').Value:=FieldByName('表现形式').Value; t_op_ctn_fendan.FieldByName('箱号').Value:=FieldByName('箱号').Value; t_op_ctn_fendan.FieldByName('箱号').Value:=FieldByName('箱号').Value; t_op_ctn_fendan.FieldByName('封号').Value:=FieldByName('封号').Value; t_op_ctn_fendan.FieldByName('件数').Value:=FieldByName('件数').Value; t_op_ctn_fendan.FieldByName('包装').Value:=FieldByName('包装').Value; t_op_ctn_fendan.FieldByName('重量').Value:=FieldByName('重量').Value; t_op_ctn_fendan.FieldByName('尺码').Value:=FieldByName('尺码').Value; t_op_ctn_fendan.post; Next; end; finally Free; end; end; procedure Tfrm_op_seae_assistant.t_op_seae_assistantBeforeInsert( DataSet: TDataSet); begin if t_op_seae_assistant.DataSource.DataSet.State=dsinsert then t_op_seae_assistant.DataSource.DataSet.post; if t_op_seae_assistant.DataSource.DataSet.ISEMPTY then abort; end; procedure Tfrm_op_seae_assistant.bsSkinButton8Click(Sender: TObject); var afield : variant; i: Integer; begin // 刷新复制业务基本信息内容 if t_op_seae_assistant.IsEmpty then exit; t_op_seae_assistant.edit; if application.MessageBox('您是否要调入直单信息,直单信息包括发货人\收货人\通知人信息?','敬告:',MB_OKCANCEL)=IDOK then begin for i:=0 to (t_op_seae_assistant.DataSource.DataSet.fieldcount-1) do begin try if t_op_seae_assistant.FindField(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName)<>nil then t_op_seae_assistant[t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName]:= t_op_seae_assistant.DataSource.DataSet.fields[i].value; except ; end; end; end else begin for i:=0 to (t_op_seae_assistant.DataSource.DataSet.fieldcount-1) do begin try if (t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'发货人') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'发货人代码') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'收货人') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'收货人代码') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'通知人') and(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName<>'通知人代码')then if t_op_seae_assistant.FindField(t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName)<>nil then t_op_seae_assistant[t_op_seae_assistant.DataSource.DataSet.fields[i].FieldName]:= t_op_seae_assistant.DataSource.DataSet.fields[i].value; except ; end; end; end; end; procedure Tfrm_op_seae_assistant.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_op_seae_assistant.Hide; frm_op_seae_assistant.ManualFloat(frm_op_seae_assistant.BoundsRect ); action:=cafree; frm_op_seae_assistant:=nil; end; procedure Tfrm_op_seae_assistant.FormShow(Sender: TObject); begin if not t_op_seae_assistant.active then t_op_seae_assistant.open; if not t_op_ctn_fendan.active then t_op_ctn_fendan.Open; try if strtobool(get_parameters_value(154,'false')) then t_op_seae_assistant_online.Open; except on E: Exception do begin ShowMessage(e.Message); end; end; updates:=false; end; procedure Tfrm_op_seae_assistant.DBEdit9KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit7); end; procedure Tfrm_op_seae_assistant.DBEdit7KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit1); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo49KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit63); end; procedure Tfrm_op_seae_assistant.DBEdit63KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker2); end; procedure Tfrm_op_seae_assistant.wwDBDateTimePicker2KeyPress( Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo3); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo52); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit10); end; procedure Tfrm_op_seae_assistant.DBEdit10KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit11); end; procedure Tfrm_op_seae_assistant.DBEdit11KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo21); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo21KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox1); end; procedure Tfrm_op_seae_assistant.wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit25); end; procedure Tfrm_op_seae_assistant.DBEdit25KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker4); end; procedure Tfrm_op_seae_assistant.wwDBDateTimePicker4KeyPress( Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo15); end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo15KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit26); end; procedure Tfrm_op_seae_assistant.DBEdit26KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit27); end; procedure Tfrm_op_seae_assistant.DBEdit27KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo28); end; procedure Tfrm_op_seae_assistant.DBEdit5KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo38); end; procedure Tfrm_op_seae_assistant.DBEdit81KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo61); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo61KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit82); end; procedure Tfrm_op_seae_assistant.DBEdit82KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit83); end; procedure Tfrm_op_seae_assistant.DBEdit83KeyPress(Sender: TObject; var Key: Char); begin key_dbedit(Key,DBEdit80); end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo2Change(Sender: TObject); begin if (t_op_seae_assistant.State=dsinsert)or(t_op_seae_assistant.State=dsedit)then begin if RxDBLookupCombo2.DisplayValue<>'' then t_op_seae_assistant['发货人代码']:=frm_data_share.t_crm_client_shiper.fieldbyname('快捷代码').asstring; t_op_seae_assistant['发货人联系电话']:=frm_data_share.t_crm_client_shiper.fieldbyname('电话').asstring; t_op_seae_assistant['发货人邮箱']:=frm_data_share.t_crm_client_shiper.fieldbyname('邮箱').asstring; t_op_seae_assistant['发货人电传']:=frm_data_share.t_crm_client_shiper.fieldbyname('传真').asstring; t_op_seae_assistant['发货人国家代码']:=frm_data_share.t_crm_client_shiper.fieldbyname('国家代码').asstring; t_op_seae_assistant['发货人企业代码']:=frm_data_share.t_crm_client_shiper.fieldbyname('企业代码').asstring; end; end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo3Change(Sender: TObject); begin if (t_op_seae_assistant.State=dsinsert)or(t_op_seae_assistant.State=dsedit)then begin if RxDBLookupCombo3.DisplayValue<>'' then t_op_seae_assistant['收货人代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('快捷代码').asstring; t_op_seae_assistant['收货人联系电话']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('电话').asstring; t_op_seae_assistant['收货人邮箱']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('邮箱').asstring; t_op_seae_assistant['收货人电传']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('传真').asstring; t_op_seae_assistant['收货人国家代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('国家代码').asstring; t_op_seae_assistant['收货人企业代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('企业代码').asstring; end; end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo4Change(Sender: TObject); begin if (t_op_seae_assistant.State=dsinsert)or(t_op_seae_assistant.State=dsedit)then begin if RxDBLookupCombo4.DisplayValue<>'' then t_op_seae_assistant['通知人代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('快捷代码').asstring; t_op_seae_assistant['通知人联系电话']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('电话').asstring; t_op_seae_assistant['通知人邮箱']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('邮箱').asstring; t_op_seae_assistant['通知人电传']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('传真').asstring; t_op_seae_assistant['通知人国家代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('国家代码').asstring; t_op_seae_assistant['通知人企业代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('企业代码').asstring; end; end; procedure Tfrm_op_seae_assistant.DBMemo40Change(Sender: TObject); begin if (t_op_seae_assistant.state=dsedit)or(t_op_seae_assistant.state=dsinsert)then begin t_op_seae_assistant['件数']:=total_num(DBMemo40); t_op_seae_assistant['包装']:=total_package(dbmemo40); t_op_seae_assistant['件数大写'] :='SAY:'+ntoc(t_op_seae_assistant.FieldByName('件数').asfloat,true) +t_op_seae_assistant.FieldByName('包装').asstring+' ONLY.'; end; end; procedure Tfrm_op_seae_assistant.DBMemo41Change(Sender: TObject); begin if (t_op_seae_assistant.state=dsedit)or(t_op_seae_assistant.state=dsinsert)then begin t_op_seae_assistant['重量']:=total_num(DBMemo41); end; end; procedure Tfrm_op_seae_assistant.DBMemo41Exit(Sender: TObject); begin if (t_op_seae_assistant.state=dsedit)or(t_op_seae_assistant.state=dsinsert)then begin kgs_cbm(DBMemo41,'KGS'); t_op_seae_assistant['货物重量']:=DBMemo41.text; end; end; procedure Tfrm_op_seae_assistant.DBMemo42Change(Sender: TObject); begin if (t_op_seae_assistant.state=dsedit)or(t_op_seae_assistant.state=dsinsert)then begin t_op_seae_assistant['尺码']:=total_num(DBMemo42); end; end; procedure Tfrm_op_seae_assistant.DBMemo42Exit(Sender: TObject); begin if (t_op_seae_assistant.state=dsedit)or(t_op_seae_assistant.state=dsinsert)then begin kgs_cbm(DBMemo42,'CBM'); t_op_seae_assistant['货物尺码']:=DBMemo42.text; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo61Change(Sender: TObject); begin if (t_op_seae_assistant.state=dsedit)or(t_op_seae_assistant.state=dsinsert)then begin t_op_seae_assistant['件数大写'] :='SAY:'+ntoc(t_op_seae_assistant.FieldByName('件数').asfloat,true) +wwDBLookupCombo61.text+' ONLY.'; end; end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo19Change(Sender: TObject); begin if (t_op_seae_assistant.state=dsinsert)or(t_op_seae_assistant.state=dsedit)then begin if RxDBLookupCombo19.DisplayValue='' then exit; t_op_seae_assistant['代理内容']:=frm_data_share.t_crm_client_daili['快捷代码']; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo2Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='发货人=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo5Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='收货人=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo6Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='通知人=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo2Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo2.text,[]) then begin t_op_seae_assistant.edit; t_op_seae_assistant['发货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; t_op_seae_assistant['发货人联系电话']:=frm_data_share.t_code_code.fieldbyname('电话').asstring; t_op_seae_assistant['发货人邮箱']:=frm_data_share.t_code_code.fieldbyname('邮箱').asstring; t_op_seae_assistant['发货人电传']:=frm_data_share.t_code_code.fieldbyname('传真').asstring; t_op_seae_assistant['发货人国家代码']:=frm_data_share.t_code_code.fieldbyname('国家代码').asstring; t_op_seae_assistant['发货人企业代码']:=frm_data_share.t_code_code.fieldbyname('企业代码').asstring; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo5Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo5.text,[]) then begin t_op_seae_assistant.edit; t_op_seae_assistant['收货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; t_op_seae_assistant['收货人联系电话']:=frm_data_share.t_code_code.fieldbyname('电话').asstring; t_op_seae_assistant['收货人邮箱']:=frm_data_share.t_code_code.fieldbyname('邮箱').asstring; t_op_seae_assistant['收货人电传']:=frm_data_share.t_code_code.fieldbyname('传真').asstring; t_op_seae_assistant['收货人国家代码']:=frm_data_share.t_code_code.fieldbyname('国家代码').asstring; t_op_seae_assistant['收货人企业代码']:=frm_data_share.t_code_code.fieldbyname('企业代码').asstring; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo6Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo6.text,[]) then begin t_op_seae_assistant.edit; t_op_seae_assistant['通知人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; t_op_seae_assistant['通知人联系电话']:=frm_data_share.t_code_code.fieldbyname('电话').asstring; t_op_seae_assistant['通知人邮箱']:=frm_data_share.t_code_code.fieldbyname('邮箱').asstring; t_op_seae_assistant['通知人电传']:=frm_data_share.t_code_code.fieldbyname('传真').asstring; t_op_seae_assistant['通知人国家代码']:=frm_data_share.t_code_code.fieldbyname('国家代码').asstring; t_op_seae_assistant['通知人企业代码']:=frm_data_share.t_code_code.fieldbyname('企业代码').asstring; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo2Exit(Sender: TObject); begin wwDBLookupCombo2.Clear; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo5Exit(Sender: TObject); begin wwDBLookupCombo5.Clear; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo6Exit(Sender: TObject); begin wwDBLookupCombo6.Clear; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo33); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo34); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo35); end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo2); end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo5); end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo6); end; procedure Tfrm_op_seae_assistant.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_seae_assistant,'主提单号'); end; procedure Tfrm_op_seae_assistant.t_op_seae_assistantBeforePost( DataSet: TDataSet); begin t_op_seae_assistant['英文船期']:=date_eng(t_op_seae_assistant.fieldbyname('开船日期').AsDateTime); try if t_op_seae_assistant.state in [dsedit] then if (t_op_seae_assistant.FieldByName('件数').Value<>t_op_seae_assistant.FieldByName('件数').oldValue) or (t_op_seae_assistant.FieldByName('包装').Value<>t_op_seae_assistant.FieldByName('包装').oldValue) or (t_op_seae_assistant.FieldByName('尺码').Value<>t_op_seae_assistant.FieldByName('尺码').oldValue) or (t_op_seae_assistant.FieldByName('重量').Value<>t_op_seae_assistant.FieldByName('重量').oldValue) or (t_op_seae_assistant.FieldByName('唛头').Value<>t_op_seae_assistant.FieldByName('唛头').oldValue) or (t_op_seae_assistant.FieldByName('箱号封号').Value<>t_op_seae_assistant.FieldByName('箱号封号').oldValue) then begin updates:=true; end; except end; end; procedure Tfrm_op_seae_assistant.bsSkinButton21Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'货物描述'); end; procedure Tfrm_op_seae_assistant.bsSkinButton7Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'唛头'); end; procedure Tfrm_op_seae_assistant.bsSkinButton6Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'箱号封号'); end; procedure Tfrm_op_seae_assistant.bsSkinButton5Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'件数包装'); end; procedure Tfrm_op_seae_assistant.bsSkinButton10Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'货物重量'); end; procedure Tfrm_op_seae_assistant.bsSkinButton11Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'货物尺码'); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo6); end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo19KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo1); end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo1Enter(Sender: TObject); begin with frm_data_share do begin t_code_code.Filtered:=false; t_code_code.Filter:='代理=1'; t_code_code.Filtered:=true; end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo1Exit(Sender: TObject); begin wwDBLookupCombo1.Clear; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo1Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo1.text,[]) then begin t_op_seae_assistant.edit; t_op_seae_assistant['代理内容']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seae_assistant.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo49); end; procedure Tfrm_op_seae_assistant.DBEdit7DblClick(Sender: TObject); begin with p_getMaxHblno do begin close; Parameters.ParamByName('@hblhead').value:=DBEdit7.text+'%'; open; if (not IsEmpty) and (FieldByName('分提单号').AsString<>'') then begin lblhbl.Caption:=FieldByName('分提单号').AsString; bsSkinPanel10.Visible:=true; end; end; end; procedure Tfrm_op_seae_assistant.DBEdit7Exit(Sender: TObject); begin bsSkinPanel10.Visible:=false; end; procedure Tfrm_op_seae_assistant.RxDBLookupCombo15Change(Sender: TObject); begin if RxDBLookupCombo15.DisplayValues[1]='FREIGHT PREPAID' then begin t_op_seae_assistant1.DataSet['预付地点']:=t_op_seae_assistant1.DataSet['装货港']; t_op_seae_assistant1.DataSet['到付地点']:=''; end; if RxDBLookupCombo15.DisplayValues[1]='FREIGHT COLLECT' then begin t_op_seae_assistant1.DataSet['预付地点']:=''; t_op_seae_assistant1.DataSet['到付地点']:='DESTINATION'; end; end; procedure Tfrm_op_seae_assistant.bsSkinButton12Click(Sender: TObject); var i:integer ; myfield:string ; begin //提交网上提单确认数据 if t_op_seae_assistant.IsEmpty then exit ; if t_op_seae_assistant.State in [dsedit,dsinsert] then t_op_seae_assistant.post ; if (t_op_seae_assistant['提交确认']<>td_sate1) then exit ; if t_op_seae_assistant.fieldbyname('主提单号').AsString='' then begin showmessage('主提单号为空不能提交确认!'); exit ; end ; try t_op_seae_assistant_online.Close ; t_op_seae_assistant_online.Open; while t_op_seae_assistant_online.RecordCount>0 do t_op_seae_assistant_online.Delete ; t_op_seae_assistant.Edit ; t_op_seae_assistant['提交确认']:=td_sate2 ; t_op_seae_assistant.Post ; ////add 网上 数据库 t_op_seae_assistant_online.Insert ; for i:=0 to (t_op_seae_assistant_online.fieldcount-1) do begin try myfield:=t_op_seae_assistant_online.Fields[i].fieldName ; if t_op_seae_assistant.FindField(myfield)<>nil then t_op_seae_assistant_online[myfield]:=t_op_seae_assistant[myfield]; except ; end; end ; t_op_seae_assistant_online['提交确认']:=td_assate1 ; t_op_seae_assistant_online.post ; except showmessage('提交失败'); exit ; end ; //给客户发送提醒 if (yctx<>'启用') then exit ; if (trim(get_parameters_value(136,'无'))='无') then exit; frm_send_msg:=Tfrm_send_msg.Create(self); try frm_data_share.t_crm_client_all.Locate('客户简称',t_op_seae_assistant1.DataSet['委托单位'],[]); frm_send_msg.t_crm_client_link.Open; frm_send_msg.memmsg.open; frm_send_msg.memmsg.insert; frm_send_msg.memmsg.FieldByName('收件单位').AsString:=t_op_seae_assistant1.DataSet['委托单位']; if not frm_send_msg.t_crm_client_link.IsEmpty then begin frm_send_msg.t_crm_client_link.first; frm_send_msg.memmsg.FieldByName('收件人').AsString:=frm_send_msg.t_crm_client_link['姓名']; end; frm_send_msg.memmsg.FieldByName('内容').AsString:='主提单号:'+t_op_seae_assistant1.DataSet['主提单号']+',' +'开船日期:'+t_op_seae_assistant1.DataSet.Fieldbyname('开船日期').AsString+',' +'船名:'+t_op_seae_assistant1.DataSet.Fieldbyname('船名').AsString+',' +'航次:'+t_op_seae_assistant1.DataSet.Fieldbyname('航次').AsString+' '+'请您确认'; if trim(get_parameters_value(136,'无'))='MSN' then frm_send_msg.checkboxMSN.Checked:=true; if trim(get_parameters_value(136,'无'))='邮件' then frm_send_msg.checkboxMAIL.Checked:=true; if trim(get_parameters_value(136,'无'))='短信' then frm_send_msg.checkboxMSG.Checked:=true; frm_send_msg.ShowModal; finally FreeAndNil(frm_send_msg); end; end; procedure Tfrm_op_seae_assistant.bsSkinButton13Click(Sender: TObject); begin //更改网上提单确认 状态 if t_op_seae_assistant.IsEmpty then exit ; if t_op_seae_assistant['提交确认']=td_sate3 then begin showmessage('当前状态不能取消确认!'); exit ; end ; t_op_seae_assistant.Edit ; t_op_seae_assistant['提交确认']:=td_sate1 ; t_op_seae_assistant.Post ; ////del 网上 数据库 with frm_main.qryTmp,sql do begin close ; clear ; add('delete from t_op_seae_assistant_on where as_id=:as_id'); parameters.ParamByName('as_id').value:=t_op_seae_assistant.Fieldbyname('as_id').AsInteger ; execsql ; end ; end; procedure Tfrm_op_seae_assistant.DBEditEh1EditButtons0Click( Sender: TObject; var Handled: Boolean); begin //网上提单确认更新到本地数据 if t_op_seae_assistant['提交确认']=td_sate1 then exit ; if t_op_seae_assistant.State in [dsedit,dsinsert] then t_op_seae_assistant.post ; frm_op_seae_assistant_qr:=Tfrm_op_seae_assistant_qr.Create(self); frm_op_seae_assistant_qr.showasid(t_op_seae_assistant,t_op_seae_assistant.FieldByName('as_id').asinteger) ; frm_op_seae_assistant_qr.Free ; t_op_seae_assistant.Refresh ; if (t_op_seae_assistant.DataSource.DataSet<>nil)and (t_op_seae_assistant.DataSource.DataSet.Active) then t_op_seae_assistant.DataSource.DataSet.Refresh ; end; procedure Tfrm_op_seae_assistant.t_op_seae_assistantAfterPost( DataSet: TDataSet); begin // TAdoQuery(t_op_seae_assistant.DataSource.DataSet).Refresh; //更改件重尺更新基本信息内容 try if updates then if MessageDlg('件、重、尺或唛头、箱封号已发生改变,是否更基本信息内容?',mtWarning,[mbYes,mbNo],0)=mrYes then begin t_op_seae_assistant.DataSource.DataSet.Edit; t_op_seae_assistant.DataSource.DataSet['件数']:=t_op_seae_assistant['件数']; t_op_seae_assistant.DataSource.DataSet['包装']:=t_op_seae_assistant['包装']; t_op_seae_assistant.DataSource.DataSet['尺码']:=t_op_seae_assistant['尺码']; t_op_seae_assistant.DataSource.DataSet['重量']:=t_op_seae_assistant['重量']; t_op_seae_assistant.DataSource.DataSet['件数包装']:=t_op_seae_assistant['件数包装']; t_op_seae_assistant.DataSource.DataSet['货物重量']:=t_op_seae_assistant['货物重量']; t_op_seae_assistant.DataSource.DataSet['货物尺码']:=t_op_seae_assistant['货物尺码']; t_op_seae_assistant.DataSource.DataSet['唛头']:=t_op_seae_assistant['唛头']; t_op_seae_assistant.DataSource.DataSet['箱号封号']:=t_op_seae_assistant['箱号封号']; t_op_seae_assistant.DataSource.DataSet['件数大写']:=t_op_seae_assistant['件数大写']; frm_op_seae.assup:=true; t_op_seae_assistant.DataSource.DataSet.post; updates:=false; end; finally frm_op_seae.assup:=false; end; end; procedure Tfrm_op_seae_assistant.bsSkinButton14Click(Sender: TObject); begin //更新到基本信息内容 try if MessageDlg('确实要更新基本信息所有内容吗?',mtWarning,[mbYes,mbNo],0)=mrYes then begin t_op_seae_assistant.DataSource.DataSet.Edit; if t_op_seae_assistant.FieldByName('提单类型').AsString='直单' then begin t_op_seae_assistant.DataSource.DataSet['发货人代码']:=t_op_seae_assistant['发货人代码']; t_op_seae_assistant.DataSource.DataSet['收货人代码']:=t_op_seae_assistant['收货人代码']; t_op_seae_assistant.DataSource.DataSet['通知人代码']:=t_op_seae_assistant['通知人代码']; end; t_op_seae_assistant.DataSource.DataSet['代理内容']:=t_op_seae_assistant['代理内容']; t_op_seae_assistant.DataSource.DataSet['货物描述']:=t_op_seae_assistant['货物描述']; t_op_seae_assistant.DataSource.DataSet['件数大写']:=t_op_seae_assistant['件数大写']; t_op_seae_assistant.DataSource.DataSet['船名']:=t_op_seae_assistant['船名']; t_op_seae_assistant.DataSource.DataSet['航次']:=t_op_seae_assistant['航次']; t_op_seae_assistant.DataSource.DataSet['开船日期']:=t_op_seae_assistant['开船日期']; t_op_seae_assistant.DataSource.DataSet['装货港']:=t_op_seae_assistant['装货港']; t_op_seae_assistant.DataSource.DataSet['卸货港']:=t_op_seae_assistant['卸货港']; t_op_seae_assistant.DataSource.DataSet['交货地点']:=t_op_seae_assistant['交货地点']; t_op_seae_assistant.DataSource.DataSet['目的地']:=t_op_seae_assistant['目的地']; t_op_seae_assistant.DataSource.DataSet['运输条款']:=t_op_seae_assistant['运输条款']; t_op_seae_assistant.DataSource.DataSet['提单份数']:=t_op_seae_assistant['提单份数']; t_op_seae_assistant.DataSource.DataSet['签单地点']:=t_op_seae_assistant['签单地点']; t_op_seae_assistant.DataSource.DataSet['签单日期']:=t_op_seae_assistant['签单日期']; t_op_seae_assistant.DataSource.DataSet['付费方式']:=t_op_seae_assistant['付费方式']; t_op_seae_assistant.DataSource.DataSet['预付地点']:=t_op_seae_assistant['预付地点']; t_op_seae_assistant.DataSource.DataSet['到付地点']:=t_op_seae_assistant['到付地点']; t_op_seae_assistant.DataSource.DataSet['唛头']:=t_op_seae_assistant['唛头']; t_op_seae_assistant.DataSource.DataSet['箱号封号']:=t_op_seae_assistant['箱号封号']; t_op_seae_assistant.DataSource.DataSet['件数']:=t_op_seae_assistant['件数']; t_op_seae_assistant.DataSource.DataSet['包装']:=t_op_seae_assistant['包装']; t_op_seae_assistant.DataSource.DataSet['尺码']:=t_op_seae_assistant['尺码']; t_op_seae_assistant.DataSource.DataSet['重量']:=t_op_seae_assistant['重量']; t_op_seae_assistant.DataSource.DataSet['件数包装']:=t_op_seae_assistant['件数包装']; t_op_seae_assistant.DataSource.DataSet['货物重量']:=t_op_seae_assistant['货物重量']; t_op_seae_assistant.DataSource.DataSet['货物尺码']:=t_op_seae_assistant['货物尺码']; t_op_seae_assistant.DataSource.DataSet.post; end; except end; end; procedure Tfrm_op_seae_assistant.dxDBGrid1Column1CustomDraw( 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[dxDBGrid1Column3.Index])='直单' then AColor:=clgreen; AFont.Color:=clblack; end; procedure Tfrm_op_seae_assistant.N3Click(Sender: TObject); begin //强制转换成大写 if t_op_seae_assistant.state in [dsedit,dsinsert] then t_op_seae_assistant.post; if t_op_seae_assistant.IsEmpty then exit; t_op_seae_assistant.Edit; t_op_seae_assistant.FieldByName('委托编号').AsString:=UpperCase(t_op_seae_assistant.FieldByName('委托编号').AsString); t_op_seae_assistant.FieldByName('主提单号').AsString:=UpperCase(t_op_seae_assistant.FieldByName('主提单号').AsString); t_op_seae_assistant.FieldByName('分提单号').AsString:=UpperCase(t_op_seae_assistant.FieldByName('分提单号').AsString); t_op_seae_assistant.FieldByName('发货人代码').AsString:=UpperCase(t_op_seae_assistant.FieldByName('发货人代码').AsString); t_op_seae_assistant.FieldByName('收货人代码').AsString:=UpperCase(t_op_seae_assistant.FieldByName('收货人代码').AsString); t_op_seae_assistant.FieldByName('通知人代码').AsString:=UpperCase(t_op_seae_assistant.FieldByName('通知人代码').AsString); t_op_seae_assistant.FieldByName('代理内容').AsString:=UpperCase(t_op_seae_assistant.FieldByName('代理内容').AsString); t_op_seae_assistant.FieldByName('唛头').AsString:=UpperCase(t_op_seae_assistant.FieldByName('唛头').AsString); t_op_seae_assistant.FieldByName('箱号封号').AsString:=UpperCase(t_op_seae_assistant.FieldByName('箱号封号').AsString); t_op_seae_assistant.FieldByName('货物描述').AsString:=UpperCase(t_op_seae_assistant.FieldByName('货物描述').AsString); t_op_seae_assistant.FieldByName('件数包装').AsString:=UpperCase(t_op_seae_assistant.FieldByName('件数包装').AsString); t_op_seae_assistant.FieldByName('件数大写').AsString:=UpperCase(t_op_seae_assistant.FieldByName('件数大写').AsString); t_op_seae_assistant.FieldByName('船名').AsString:=UpperCase(t_op_seae_assistant.FieldByName('船名').AsString); t_op_seae_assistant.FieldByName('航次').AsString:=UpperCase(t_op_seae_assistant.FieldByName('航次').AsString); t_op_seae_assistant.FieldByName('装货港').AsString:=UpperCase(t_op_seae_assistant.FieldByName('装货港').AsString); t_op_seae_assistant.FieldByName('卸货港').AsString:=UpperCase(t_op_seae_assistant.FieldByName('卸货港').AsString); t_op_seae_assistant.FieldByName('交货地点').AsString:=UpperCase(t_op_seae_assistant.FieldByName('交货地点').AsString); t_op_seae_assistant.FieldByName('到付地点').AsString:=UpperCase(t_op_seae_assistant.FieldByName('到付地点').AsString); t_op_seae_assistant.FieldByName('目的地').AsString:=UpperCase(t_op_seae_assistant.FieldByName('目的地').AsString); t_op_seae_assistant.FieldByName('签单地点').AsString:=UpperCase(t_op_seae_assistant.FieldByName('签单地点').AsString); t_op_seae_assistant.FieldByName('预付地点').AsString:=UpperCase(t_op_seae_assistant.FieldByName('预付地点').AsString); t_op_seae_assistant.post; end; procedure Tfrm_op_seae_assistant.bsSkinSpeedButton2Click(Sender: TObject); var Edistring:TStrings; filenames:string; begin EdiString:=TStringList.Create; try OpenDialog1.Execute; FileNames:=OpenDialog1.FileName; if FileNames<>'' then begin EdiString.LoadFromFile(FileNames); NewEdiSEAE(EdiString,t_op_seae_assistant1); end; finally FreeAndNil(EdiString); end; end; procedure Tfrm_op_seae_assistant.wwDBLookupCombo4Change(Sender: TObject); begin if (t_op_ctn_fendan.State=dsedit)or(t_op_ctn_fendan.State=dsinsert) then begin if frm_data_share.t_code_ctn.Locate('代码',wwDBLookupCombo4.text,[]) then begin t_op_ctn_fendan['表现形式']:=frm_data_share.t_code_ctn['表现形式']; t_op_ctn_fendan['箱型']:=frm_data_share.t_code_ctn['箱型']; t_op_ctn_fendan['尺寸']:=frm_data_share.t_code_ctn['尺寸']; end else begin t_op_ctn_fendan['表现形式']:=''; t_op_ctn_fendan['箱型']:=''; t_op_ctn_fendan['尺寸']:=''; end; end; end; procedure Tfrm_op_seae_assistant.t_op_ctn_fendanAfterInsert( DataSet: TDataSet); begin t_op_ctn_fendan['编号']:=t_op_seae_assistant.FieldByName('AS_ID').AsInteger; t_op_ctn_fendan['数量']:=1; end; procedure Tfrm_op_seae_assistant.t_op_seae_assistantAfterScroll( DataSet: TDataSet); begin t_op_ctn_fendan.Open; end; procedure Tfrm_op_seae_assistant.t_op_ctn_fendanBeforeInsert( DataSet: TDataSet); begin if t_op_seae_assistant.IsEmpty then begin ShowMessage('请先点添加分单按钮,添加分单'); Abort; end; if t_op_seae_assistant.State in [dsEdit,dsInsert] then t_op_seae_assistant.Post; end; procedure Tfrm_op_seae_assistant.bsSkinButton15Click(Sender: TObject); begin frm_main.view_momo(t_op_ctn_fendan1,'品名'); end; procedure Tfrm_op_seae_assistant.DBMemo33Click(Sender: TObject); begin wwDBLookupCombo2.Text:='Num:'+IntToStr(Length(DBMemo33.Lines[DBMemo33.CaretPos.Y])); end; procedure Tfrm_op_seae_assistant.DBMemo34Click(Sender: TObject); begin wwDBLookupCombo5.Text:='Num:'+IntToStr(Length(DBMemo34.Lines[DBMemo34.CaretPos.Y])); end; procedure Tfrm_op_seae_assistant.DBMemo35Click(Sender: TObject); begin wwDBLookupCombo6.Text:='Num:'+IntToStr(Length(DBMemo35.Lines[DBMemo35.CaretPos.Y])); end; procedure Tfrm_op_seae_assistant.bsSkinButton16Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_assistant1,'EDI备注'); end; procedure Tfrm_op_seae_assistant.N4Click(Sender: TObject); begin t_op_seae_assistant.insert; end; procedure Tfrm_op_seae_assistant.N5Click(Sender: TObject); var afield : variant; i,old_AS_ID: Integer; aAdoQuery:TAdoQuery; begin if t_op_seae_assistant.IsEmpty then begin showmessage('没有复制母体,不能复制新建!'); exit; end; try t_op_seae_assistant.AfterInsert:=nil; old_AS_ID:=t_op_seae_assistant.FieldByName('AS_ID').AsInteger; afield := vararraycreate([0,t_op_seae_assistant.fieldcount-1],varvariant); for i := 0 to (t_op_seae_assistant.fieldcount-1) do begin afield[i] :=t_op_seae_assistant.fields[i].value ; end; t_op_seae_assistant.append; for i := 0 to (t_op_seae_assistant.fieldcount-1) do begin if (t_op_seae_assistant.fields[i].FieldName<>'AS_ID') then t_op_seae_assistant.fields[i].value := afield[i] ; end; t_op_seae_assistant.Post; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;sql.Clear; sql.Add('select * from t_op_ctn_fendan'); sql.Add('where AS_ID=:AS_ID'); Parameters.ParamByName('AS_ID').Value:=old_AS_ID; Open;First; while not eof do begin t_op_ctn_fendan.Insert; t_op_ctn_fendan.FieldByName('代码').Value:=FieldByName('代码').Value; t_op_ctn_fendan.FieldByName('尺寸').Value:=FieldByName('尺寸').Value; t_op_ctn_fendan.FieldByName('箱型').Value:=FieldByName('箱型').Value; t_op_ctn_fendan.FieldByName('数量').Value:=FieldByName('数量').Value; t_op_ctn_fendan.FieldByName('TEU').Value:=FieldByName('TEU').Value; t_op_ctn_fendan.FieldByName('表现形式').Value:=FieldByName('表现形式').Value; t_op_ctn_fendan.FieldByName('箱号').Value:=FieldByName('箱号').Value; t_op_ctn_fendan.FieldByName('箱号').Value:=FieldByName('箱号').Value; t_op_ctn_fendan.FieldByName('封号').Value:=FieldByName('封号').Value; t_op_ctn_fendan.FieldByName('件数').Value:=FieldByName('件数').Value; t_op_ctn_fendan.FieldByName('包装').Value:=FieldByName('包装').Value; t_op_ctn_fendan.FieldByName('重量').Value:=FieldByName('重量').Value; t_op_ctn_fendan.FieldByName('尺码').Value:=FieldByName('尺码').Value; t_op_ctn_fendan.post; Next; end; finally Free; end; finally t_op_seae_assistant.AfterInsert:=t_op_seae_assistantAfterInsert; end; end; procedure Tfrm_op_seae_assistant.N8Click(Sender: TObject); begin try t_op_seae_assistant.AfterInsert:=nil; if not assigned(frm_op_history) then frm_op_history:=tfrm_op_history.Create (self); frm_op_history.op_type.text:='1'; frm_op_history.t_do_fee.Enabled:=false; frm_op_history.t_do_fee.DataSet:=t_op_seae_assistant; frm_op_history.t_do_fee.Enabled:=true; frm_op_history.t_op_ctn_fendan1.Enabled:=false; frm_op_history.t_op_ctn_fendan1.DataSet:=t_op_ctn_fendan; frm_op_history.t_op_ctn_fendan1.Enabled:=true; frm_op_history.bsSkinNotebook1.PageIndex:=1; frm_op_history.bsno:=t_op_seae_assistant.DataSource.DataSet.FieldByName('编号').AsString; frm_op_history.bsCardNo:=t_op_seae_assistant.DataSource.DataSet.FieldByName('业务编号').AsString; frm_op_history.bsSkinNotebook1.PageIndex:=1; frm_op_history.ShowModal; finally t_op_seae_assistant.AfterInsert:=t_op_seae_assistantAfterInsert; frm_op_history.free; frm_op_history:=nil; end; end; procedure Tfrm_op_seae_assistant.bsSkinButton61Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton61.ClientToScreen(Point(0,bsSkinButton61.Height)); PopupMenu6.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seae_assistant.AFR1Click(Sender: TObject); var str:widestring; i:integer; id,strbsno:string; TempStr:TStringlist; aQuery,aQuery2,aQuerycuststr,aQueryPort,aQueryShipper:TADOQuery; function getcustedi(cust:string):string; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; result:=''; try aQuery.Close; aQuery.SQL.Text:='select EDI代码 from t_crm_client where 客户简称='''+cust+''''; aQuery.Open; if not aQuery.IsEmpty then result:=aQuery.fieldbyname('EDI代码').AsString; finally FreeAndNil(aQuery); end; end; function GetvesselEdi(avessel: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 船舶呼号 from t_code_vessel where 英文船名='''+avessel+''''); Open; if IsEmpty then Result:='a' else Result:=FieldByName('船舶呼号').AsString; end; finally FreeAndNil(aQuery); end; end; begin if t_op_seae_assistant.IsEmpty then exit; if (t_op_seae_assistant.State=dsinsert)or(t_op_seae_assistant.State=dsedit) then t_op_seae_assistant.post; if MessageDlg('确实要将选中的业务生成EDI数据吗?',mtWarning,[mbyes,mbno],0)=mryes then begin if not t_op_seae_edi.active then t_op_seae_edi.Open; if not t_op_ctn_detail_edi.active then t_op_ctn_detail_edi.Open; try TempStr:=TStringList.Create; aQuery:=CreateAdoQuery; aQuery2:=CreateAdoQuery; aQueryPort:=CreateAdoQuery; aQueryShipper:=CreateAdoQuery; aQuery.sql.Text:='select * from t_op_ctn where 编号=:编号'; t_op_ctn_edi.close; t_op_ctn_edi.sql.Text:='select * from t_op_ctn_edi where 编号=:编号'; aQueryPort.sql.Text:='select 船公司,装货港,装港代码,卸货港,卸货代码,目的地,目的地代码,危险品分类,危险品编号,冷藏通风量,温度单位,设置温度,最低温度,最高温度,货物标识,运费协议号,湿度,订舱单号 from t_op_seae where 编号=:编号'; aQueryPort.Parameters.ParamByName('编号').Value:=t_op_seae_assistant['编号']; aQueryPort.open; aQuerycuststr:=CreateAdoQuery; aQuerycuststr.sql.text:=' select 电话,国家,洲,城市 from t_crm_client where 客户简称=:客户简称'; aQueryShipper.sql.Text:='select * from t_code_edicode where 客户简称=:客户简称'; id:=get_id; t_op_seae_edi.Insert; t_op_seae_edi['编号']:=id; t_op_seae_edi['主编号']:=t_op_seae_assistant['编号']; t_op_seae_edi['EDI类型']:='AFR'; t_op_seae_edi['EDI状态']:='未发送'; t_op_seae_edi['录入人']:=employee; t_op_seae_edi['录入日期']:=Date; t_op_seae_edi['业务编号']:=t_op_seae_assistant['业务编号']; t_op_seae_edi['主提单号']:=t_op_seae_assistant['主提单号']; t_op_seae_edi['分提单号']:=t_op_seae_assistant['分提单号']; { if length(t_op_seae_assistant.FieldByName('主提单号').AsString)<=12 then t_op_seae_edi['主提单号']:=t_op_seae_assistant['主提单号'] else begin strbsno:=t_op_seae_assistant.FieldByName('主提单号').AsString; t_op_seae_edi['主提单号']:=Copy(strbsno,Length(strbsno)-11,12) ; end; if length(t_op_seae_assistant.FieldByName('分提单号').AsString)<=12 then t_op_seae_edi['分提单号']:=t_op_seae_assistant['分提单号'] else begin strbsno:=t_op_seae_assistant.FieldByName('分提单号').AsString; t_op_seae_edi['分提单号']:=Copy(strbsno,Length(strbsno)-11,12) ; end; } t_op_seae_edi['发货人代码']:=t_op_seae_assistant['发货人代码']; t_op_seae_edi['船公司代码']:=getcustedi(aQueryPort.fieldbyname('船公司').AsString); TempStr.Text:=t_op_seae_assistant.fieldbyname('发货人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['发货人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['发货人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['发货人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['发货人地址3']:=TempStr.Strings[3]; t_op_seae_edi['发货人']:=t_op_seae_assistant.FieldByName('发货人').AsString; if t_op_seae_assistant.FieldByName('发货人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seae_assistant.FieldByName('发货人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('发货人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('发货人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('发货人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('发货人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('发货人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('发货人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('发货人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('发货人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('发货人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('发货人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seae_assistant.FieldByName('发货人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['发货人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['发货人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['发货人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['发货人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; TempStr.Text:=t_op_seae_assistant.fieldbyname('收货人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['收货人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['收货人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['收货人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['收货人地址3']:=TempStr.Strings[3]; t_op_seae_edi['收货人']:=t_op_seae_assistant.FieldByName('收货人').AsString; if t_op_seae_assistant.FieldByName('收货人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seae_assistant.FieldByName('收货人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('收货人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('收货人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('收货人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('收货人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('收货人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('收货人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('收货人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('收货人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('收货人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('收货人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seae_assistant.FieldByName('收货人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['收货人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['收货人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['收货人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['收货人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; TempStr.Text:=t_op_seae_assistant.fieldbyname('通知人代码').AsString; if TempStr.Count>=1 then t_op_seae_edi['通知人名称']:=TempStr.Strings[0]; if TempStr.Count>=2 then t_op_seae_edi['通知人地址1']:=TempStr.Strings[1]; if TempStr.Count>=3 then t_op_seae_edi['通知人地址2']:=TempStr.Strings[2]; if TempStr.Count>=4 then t_op_seae_edi['通知人地址3']:=TempStr.Strings[3]; t_op_seae_edi['通知人']:=t_op_seae_assistant.FieldByName('通知人').AsString; if t_op_seae_assistant.FieldByName('通知人').AsString<>'' then begin aQueryShipper.Close; aQueryShipper.Parameters.ParamByName('客户简称').Value:=t_op_seae_assistant.FieldByName('通知人').AsString; aQueryShipper.Open; if not aQueryShipper.IsEmpty then begin t_op_seae_edi.fieldbyname('通知人名称').AsString:=aQueryShipper.FieldByName('名称').AsString; t_op_seae_edi.fieldbyname('通知人地址1').AsString:=aQueryShipper.FieldByName('地址1').AsString; t_op_seae_edi.fieldbyname('通知人地址2').AsString:=aQueryShipper.FieldByName('地址2').AsString; t_op_seae_edi.fieldbyname('通知人地址3').AsString:=aQueryShipper.FieldByName('地址3').AsString; t_op_seae_edi.fieldbyname('通知人城市').AsString:=aQueryShipper.FieldByName('城市').AsString; t_op_seae_edi.fieldbyname('通知人邮编').AsString:=aQueryShipper.FieldByName('邮编').AsString; t_op_seae_edi.fieldbyname('通知人国家代码').AsString:=aQueryShipper.FieldByName('国家代码').AsString; t_op_seae_edi.fieldbyname('通知人联系人').AsString:=aQueryShipper.FieldByName('联系人').AsString; t_op_seae_edi.fieldbyname('通知人电话').AsString:=aQueryShipper.FieldByName('电话').AsString; t_op_seae_edi.fieldbyname('通知人州').AsString:=aQueryShipper.FieldByName('州').AsString; end else begin aQuerycuststr.close; aQuerycuststr.Parameters.ParamByName('客户简称').Value:=t_op_seae_assistant.FieldByName('通知人').AsString; aQuerycuststr.Open; if not aQuerycuststr.IsEmpty then begin t_op_seae_edi['通知人城市']:=aQuerycuststr.fieldbyname('城市').AsString; t_op_seae_edi['通知人国家代码']:=aQuerycuststr.fieldbyname('国家').AsString; t_op_seae_edi['通知人电话']:=aQuerycuststr.fieldbyname('电话').AsString; t_op_seae_edi['通知人州']:=aQuerycuststr.fieldbyname('洲').AsString; end; end; end; t_op_seae_edi['船名']:=t_op_seae_assistant['船名']; t_op_seae_edi['船舶IMO']:=GetvesselEdi(t_op_seae_assistant.fieldbyname('船名').AsString); t_op_seae_edi['航次']:=t_op_seae_assistant['航次']; t_op_seae_edi['开船日期']:=t_op_seae_assistant['开船日期']; t_op_seae_edi['预抵日期']:=t_op_seae_assistant['预抵日期']; t_op_seae_edi['装货港']:=aQueryPort['装货港']; t_op_seae_edi['装港代码']:=aQueryPort['装港代码']; t_op_seae_edi['卸货港']:=aQueryPort['卸货港']; t_op_seae_edi['卸货代码']:=aQueryPort['卸货代码']; t_op_seae_edi['交货地点']:=aQueryPort['装货港']; t_op_seae_edi['交货代码']:=aQueryPort['装港代码']; t_op_seae_edi['目的地']:=aQueryPort['目的地']; t_op_seae_edi['目的代码']:=aQueryPort['目的地代码']; t_op_seae_edi['运输条款']:=t_op_seae_assistant['运输条款']; t_op_seae_edi['唛头']:=t_op_seae_assistant['唛头']; t_op_seae_edi['货物描述']:=t_op_seae_assistant['货物描述']; t_op_seae_edi['件数']:=t_op_seae_assistant['件数']; t_op_seae_edi['包装']:=t_op_seae_assistant['包装']; t_op_seae_edi['重量']:=t_op_seae_assistant['重量']; t_op_seae_edi['尺码']:=t_op_seae_assistant['尺码']; t_op_seae_edi['危险品分类']:=aQueryPort['危险品分类']; t_op_seae_edi['危险品编号']:=aQueryPort['危险品编号']; t_op_seae_edi['冷藏通风量']:=aQueryPort['冷藏通风量']; t_op_seae_edi['温度单位']:=aQueryPort['温度单位']; t_op_seae_edi['设置温度']:=aQueryPort['设置温度']; t_op_seae_edi['最低温度']:=aQueryPort['最低温度']; t_op_seae_edi['最高温度']:=aQueryPort['最高温度']; t_op_seae_edi['货物标识']:=aQueryPort['货物标识']; t_op_seae_edi['运费协议号']:=aQueryPort['运费协议号']; t_op_seae_edi['湿度']:=aQueryPort['湿度']; t_op_seae_edi['订舱号码']:=aQueryPort['订舱单号']; t_op_seae_edi['传输目的']:='A'; if TMenuItem(Sender).tag=1 then begin t_op_seae_edi['装运类型']:='LCL'; t_op_seae_edi['是否最后分票']:=0; end else begin t_op_seae_edi['装运类型']:='FCL'; t_op_seae_edi['是否最后分票']:=1; end; t_op_seae_edi['运输方式']:='PortToPort'; t_op_seae_edi['文件类型']:='House'; t_op_seae_edi.Post; t_op_ctn_fendan.First; t_op_ctn_edi.Close; t_op_ctn_edi.Parameters.ParamByName('编号').Value:=id; t_op_ctn_edi.Open; while not t_op_ctn_fendan.Eof do begin t_op_ctn_edi.Insert; t_op_ctn_edi['编号']:=id; t_op_ctn_edi['代码']:=t_op_ctn_fendan['代码']; t_op_ctn_edi['尺寸']:=t_op_ctn_fendan['尺寸']; t_op_ctn_edi['箱型']:=t_op_ctn_fendan['箱型']; t_op_ctn_edi['数量']:=1; t_op_ctn_edi['表现形式']:=t_op_ctn_fendan['表现形式']; t_op_ctn_edi['箱号']:=t_op_ctn_fendan['箱号']; t_op_ctn_edi['封号']:=t_op_ctn_fendan['封号']; if t_op_ctn_fendan.FieldByName('品名').AsString<>'' then t_op_ctn_edi['货描']:=t_op_ctn_fendan['品名'] else t_op_ctn_edi['货描']:=t_op_seae_assistant['货物描述']; if t_op_ctn_fendan.FieldByName('唛头').AsString<>'' then t_op_ctn_edi['唛头']:=t_op_ctn_fendan['唛头'] else t_op_ctn_edi['唛头']:=t_op_seae_assistant['唛头']; if frm_data_share.t_code_ctn.Locate('代码',t_op_ctn_edi.fieldbyname('代码').asstring,[]) then begin if frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='20'then t_op_ctn_edi['TEU']:=1; if (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='40')OR (frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='45')then t_op_ctn_edi['TEU']:=2; end; t_op_ctn_edi.Post; t_op_ctn_detail_edi.Insert; t_op_ctn_detail_edi['ctn_id']:=t_op_ctn_edi['ctn_id']; t_op_ctn_detail_edi['件数']:=t_op_ctn_fendan['件数']; t_op_ctn_detail_edi['包装']:=t_op_ctn_fendan['包装']; t_op_ctn_detail_edi['重量']:=t_op_ctn_fendan['重量']; t_op_ctn_detail_edi['尺码']:=t_op_ctn_fendan['尺码']; t_op_ctn_detail_edi.Post; t_op_ctn_fendan.Next; end; ShowMessage('生成成功,请到EDI通信模块查看!'); finally FreeAndNil(TempStr); FreeAndNil(aQuery); freeandnil(aQueryShipper); end; end; end; procedure Tfrm_op_seae_assistant.bsSkinButton65Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin if t_op_seae_assistant.DataSource.dataset.fieldbyname('场站').asstring='' then begin showmessage('场站不能为空'); exit; end; if t_op_seae_assistant.fieldbyname('主提单号').asstring='' then begin showmessage('主提单号不能为空'); exit; end; if t_op_seae_assistant.DataSource.dataset.fieldbyname('船公司').asstring='' then begin showmessage('船公司不能为空'); exit; end; if t_op_seae_assistant.fieldbyname('货物描述').asstring='' then begin showmessage('货物描述不能为空'); exit; end; if t_op_seae_assistant.fieldbyname('分提单号').asstring='' then begin showmessage('分提单号不能为空'); exit; end; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close;sql.clear; sql.Add('select sum(CONVERT(DECIMAL(18,2),件数)) 件数,sum(CONVERT(DECIMAL(18,2),重量)) 重量 ,sum(CONVERT(DECIMAL(18,2),尺码)) 尺码 from t_op_seae_assistant where 编号=:编号'); Parameters.ParamByName('编号').Value:=t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('编号').AsString; open; if t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('件数').AsFloat<>aAdoQuery.FieldByName('件数').AsFloat then begin showmessage('总件数:'+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('件数').AsString+' 不等于明细件数:'+aAdoQuery.FieldByName('件数').AsString); exit; end; if t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('重量').AsFloat<>aAdoQuery.FieldByName('重量').AsFloat then begin showmessage('总重量:'+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('重量').AsString+' 不等于明细重量:'+aAdoQuery.FieldByName('重量').AsString); exit; end; if t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('尺码').AsFloat<>aAdoQuery.FieldByName('尺码').AsFloat then begin if MessageDlg('总尺码:'+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('尺码').AsString+' 不等于明细尺码:'+aAdoQuery.FieldByName('尺码').AsString,mtWarning,[mbYes,mbNo],0)=mrYes then else begin exit; end; end; close;sql.clear; sql.Add('select sum(CONVERT(DECIMAL(18,2),件数)) 件数,sum(CONVERT(DECIMAL(18,2),重量)) 重量 ,sum(CONVERT(DECIMAL(18,2),尺码)) 尺码'); sql.Add('from t_op_ctn_fendan where as_id in (select as_id from t_op_seae_assistant where 编号='+''''+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('编号').AsString+''')'); open; if t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('件数').AsFloat<>aAdoQuery.FieldByName('件数').AsFloat then begin showmessage('装箱总件数:'+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('件数').AsString+' 不等于明细件数:'+aAdoQuery.FieldByName('件数').AsString); exit; end; if t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('重量').AsFloat<>aAdoQuery.FieldByName('重量').AsFloat then begin showmessage('装箱总重量:'+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('重量').AsString+' 不等于明细重量:'+aAdoQuery.FieldByName('重量').AsString); exit; end; if t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('尺码').AsFloat<>aAdoQuery.FieldByName('尺码').AsFloat then begin if MessageDlg('装箱总尺码:'+t_op_seae_assistant1.DataSet.DataSource.DataSet.FieldByName('尺码').AsString+' 不等于明细尺码:'+aAdoQuery.FieldByName('尺码').AsString,mtWarning,[mbYes,mbNo],0)=mrYes then else begin exit; end; end; finally Free; end; try if not assigned(frm_op_manifest) then frm_op_manifest:=Tfrm_op_manifest.Create(application); frm_op_manifest.t_op_seae1:=t_op_seae_assistant1; frm_op_manifest.t_op_seae2:=t_op_seae_assistant1.DataSet.DataSource; frm_op_manifest.ifmaster:=false; frm_op_manifest.RxDBLookupCombo1.Value:=t_op_seae_assistant1.DataSet.DataSource.DataSet.fieldbyname('船公司').asstring; frm_op_manifest.ShowModal; finally frm_op_manifest.free; frm_op_manifest:=nil; end; end; procedure Tfrm_op_seae_assistant.SetState(response: string); var _eventstart,_eventend,_statestart,_stateend:integer; _temp:string; begin _eventstart:=pos('name="__VIEWSTATE" id="',response); _temp:=copy(response,_eventstart+43,3000); _eventend:=pos('" />',_temp); _temp:=copy(_temp,0,_eventend-1); STATE:=_temp; //edit1.text:=_eventstart.Tostring(); _statestart:=pos('id="__EVENTVALIDATION" value="',response); _temp:=copy(response,_statestart+30,3000); _stateend:=pos('" />',_temp); _temp:=copy(_temp,0,_stateend-1); EVENT:=_temp; end; function Tfrm_op_seae_assistant.DoPost(_URL:string;_Referer:string;_order:TStringList):String; var Param:TStringList; RStream:TStringStream; post:AnsiString; begin Param:=TStringList.Create; RStream:=TStringStream.Create(''); Param:=_order; IdHTTP1.ProtocolVersion:=pv1_1; IdHTTP1.HTTPOptions:=IdHTTP1.HTTPOptions+[hoTreat302Like303]; IdHTTP1.Request.Accept:='text/html, application/xhtml+xml, */*'; IdHTTP1.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'; IdHTTP1.Request.AcceptEncoding:='gzip, deflate'; IdHTTP1.Request.Host:='56.qdcdc.com'; IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded'; IdHTTP1.Request.Referer:=_Referer; try IdHTTP1.Post(_URL,Param,RStream); except on e:Exception do//抛出所有异常 begin //doing something raise; end; end; result:=UTF8Decode(RStream.DataString); end; function Tfrm_op_seae_assistant.GetINFO(_s: string; _time: integer): string; var _i,start1,end1:Integer; _temp,str:string; begin _i:=pos('查询结果',_s); _temp:=copy(_S,_i,10000); //Memo1.Text:=_temp; start1:=GetPosition('',_temp,_time); end1:=GetPosition('',_temp,_time+2); str:=trim(formatstr(copy(_temp,start1,end1-start1))); result:=str; end; function Tfrm_op_seae_assistant.GetPosition(_Target, _S: String; _Time: Integer): Integer; var _i,_j,_k,_L,Position:integer; _temp:String; begin _temp:=_s; _L:=Length(_Target); Position:=0; for _j := 0 to _Time-1 do begin _i:=pos(_Target,_temp); if _j<>_Time-1 then begin _temp:=copy(_temp,_i+_L,Length(_temp)-_i-_L); Position:=Position+_i+_L; end else begin Position:=Position+_i; end; end; result:=Position; end; function Tfrm_op_seae_assistant.formatStr(_Str: String): String; var _S:String; begin _S:=StringReplace(_Str, '', '', [rfReplaceAll]); _S:=StringReplace(_S, '', '', [rfReplaceAll]); _S:=StringReplace(_S, '
', ' ', [rfReplaceAll]); _S:=trim(_S); if (pos(' ',_S)>0) then begin _S:=StringReplace(_S, ' ', '', [rfReplaceAll]); end; result:=_S; end; procedure Tfrm_op_seae_assistant.SetCDState(SHSJ, SHHZ, YDSJ, YDHZ, BGZT,TDFX,TDSJ,CKZZ,ZZSJ: string); begin if (SHSJ='')and (SHHZ='') then lbl_1.Caption:='' else lbl_1.Caption:='预配舱单:'+SHHZ+#13+' 时间:'+SHSJ ; if (YDSJ='') and (YDHZ='') then lbl_2.Caption:='' else lbl_2.Caption:='运抵状态:'+YDHZ+#13+' 时间:'+YDSJ ; if (BGZT='') then lbl_3.Caption:='' else lbl_3.Caption:='放行:'+BGZT ; if (TDFX='') and (TDSJ='') then lbl_4.Caption:='' else lbl_4.Caption:='提单放行:'+TDFX+#13+' 时间:'+TDSJ ; if (CKZZ='') and (ZZSJ='') then lbl_5.Caption:='' else lbl_5.Caption:='出口装载:'+CKZZ+#13+' 时间:'+ZZSJ ; if (Pos('接受申报',SHHZ)=0) then begin lbl_1.font.color := clred ; end else begin lbl_1.font.color := clBlack ; end; if (Pos('正常',YDHZ)=0) then begin lbl_2.font.color := clred ; end else begin lbl_2.font.color := clBlack ; end; if (Pos('单证放行',BGZT)=0) then begin lbl_3.font.color := clred ; end else begin lbl_3.font.color := clBlack ; end; if (Pos('已放行',TDFX)=0) then begin lbl_4.font.color := clred ; end else begin lbl_4.font.color := clBlack ; end; if (Pos('同意装载',CKZZ)=0) then begin lbl_5.font.color := clred ; end else begin lbl_5.font.color := clBlack ; end; end; procedure Tfrm_op_seae_assistant.SaveState(_info, _time,_remark: string;_end:integer); var aAdoQuery:TAdoQuery; STATUS:string; AYear,AMonth,ADay,AHour,AMinute,ASecond, AMilliSecond:string; bsno,_date:String; begin bsno:=t_op_seae_assistant.FieldByName('as_id').AsString; aAdoQuery:=CreateAdoQuery; if _time<>'' then begin AYear:=inttostr(strtoint(Copy(_time,1,4))); AMonth:=(Copy(_time,GetPosition('-',_time,1)+1,GetPosition('-',_time,2)-GetPosition('-',_time,1)-2)); ADay:=(Trim(Copy(_time,GetPosition('-',_time,2),2))); AHour:=(trim(Copy(_time,GetPosition(':',_time,1)-2,2))); AMinute:=(Copy(_time,GetPosition(':',_time,1)+1,GetPosition(':',_time,2)-GetPosition(':',_time,1)-2)); AMilliSecond:='.000'; ASecond:='00'; _date:=''''+AYear+'-'+AMonth+'-'+ADay+' '+AHour+':'+AMinute+':'+ASecond+AMilliSecond+''''; end else _date:='null'; aAdoQuery.Close; aAdoQuery.Sql.Clear; aAdoQuery.SQL.Add(' if (select count(*) from t_op_state_assistant where as_id='''+bsno+''' and 业务状态='''+_info+''')=0'); aAdoQuery.SQL.Add(' begin Insert Into t_op_state_assistant (as_id ,业务状态 ,是否完成,完成时间,完成人,录入人 ,录入日期,系统加入,备注)'); aAdoQuery.SQL.Add(' values ('''+bsno+''','''+_info+''' ,'+inttostr(_end)+','+_date+','''+employee+''','''+employee+''',getdate(),1,'''+_remark+''') end'); aAdoQuery.SQL.Add(' else begin update t_op_state_assistant set 是否完成='+inttostr(_end)+',完成时间='+_date+',录入日期=getdate(),备注='''+_remark+''' '); aAdoQuery.SQL.Add(' where as_id='''+bsno+''' and 业务状态='''+_info+''' end'); aAdoQuery.Close; { aAdoQuery.Parameters.ParamByName('完成时间').Value:=EncodeDatetime(AYear,AMonth,ADay,AHour,AMinute,ASecond, AMilliSecond); //DATASTR aAdoQuery.Parameters.ParamByName('录入人').Value:=employee; aAdoQuery.Parameters.ParamByName('录入日期').Value:=FormatDateTime('YYYY-MM-DD',Now); aAdoQuery.Parameters.ParamByName('系统加入').Value:=True; aAdoQuery.Parameters.ParamByName('备注').Value:=_remark; } //ShowMessage(aAdoQuery.SQL.text); aAdoQuery.ExecSQL; end; procedure Tfrm_op_seae_assistant.bsSkinGroupBox17Click(Sender: TObject); var Param:TStringList; response,MBLNO,s,s_val:string; RStream:TStringStream; SHSJ,SHHZ,YDSJ,YDHZ,BGZT,TDFX,TDSJ,CKZZ,ZZSJ:string; str_memo:Tmemo; Str:TStrings; SenderHandphone,SenderEmail, SenderFax:string; basecnt,i,beginpos,endpos,baseid:Integer; alist:TStringList; QYT,WEIGHT,ctncount:Double; aAdoQuery:TAdoQuery; begin //打开登录页面 baseid:=-1; MBLNO:=t_op_seae_assistant.fieldbyname('分提单号').asstring; if Trim(MBLNO)='' then begin ShowMessage('分提单号不能为空'); exit; end; Param:=TStringList.Create; response:=DoPost('http://56.qdcdc.com/cnm/login.aspx','',Param) ; SetState(response); ////////////////// //输入帐号密码 点击登陆 RStream:=TStringStream.Create(''); Param.Clear; Param.Add('__VIEWSTATE='+state ); Param.Add('__EVENTVALIDATION=' + EVENT); Param.Add('user_name=sdeport'); Param.Add('password=sdeport'); Param.Add('hdSuccess=true'); response:=DoPost('http://56.qdcdc.com/cnm/Login.aspx','http://56.qdcdc.com/cnm/Login.aspx',Param); SetState(response); //////////////////// //点击查询页面 Param.Clear; response:=DoPost('http://56.qdcdc.com/cnm/MftQuery/BillExportQuery.aspx','',Param) ; SetState(response); ///////////////////// Param.Clear; Param.Add('__VIEWSTATE='+state ); Param.Add('__EVENTVALIDATION=' + EVENT); Param.Add('txtIMO=' ); Param.Add('txtTransportName=' ); Param.Add('txtVoyageNo=' ); Param.Add('txtBillNo='+MBLNO ); Param.Add('LinkButtonQuery=%E6%9F%A5%E8%AF%A2' ); Param.Add('hdSelectRow=' ); Param.Add('hdData=' ); Param.Add('hdCols=%E5%BA%8F%E5%8F%B7%2C%E5%87%BA%E5%8F%A3%E6%8F%90%E5%8D%95%E5%8F%B7%2C%E9%A2%84%E9%85%8D%E8%88%B1%E5%8D%95%2C%E5%87%BA%E5%8F%A3%E8%BF%90%E6%8A%B5%E6%8A'); Param[Param.Count-1]:=Param[Param.Count-1]+'%A5%E5%91%8A%2C%E5%87%BA%E5%8F%A3%E8%A3%85%E8%BD%BD%2C%E5%87%BA%E5%8F%A3%E7%90%86%E8%B4%A7%2C%E5%87%BA%E5%8F%A3%E6%8A%A5%E5%85%B3%E7%8A%B6%E6%80%81%2C%E7%A9%BA%E7%AE%B1%E9%AA%8C%E6%94%BE%2C%E6%8F%90%E5%8D%95%E6%94%BE%E8%A1%8C'; Param.Add('hdChildHide=' ); Param.Add('hdColsHide=' ); Param.Add('hdColSpan=%E6%8F%90%E5%8D%95%E5%8F%B7' ); Param.Add('hdMutiQuery=' ); Param.Add('hdReturnResult=' ); Param.Add('hdLoadMarkText=' ); Param.Add('hdArrivalMarkText=' ); Param.Add('hdEmptyResult=' ); Param.Add('hdTalMarkText=' ); response:=DoPost('http://56.qdcdc.com/cnm/MftQuery/BillExportQuery.aspx' ,'http://56.qdcdc.com/cnm/MftQuery/BillExportQuery.aspx',Param); idhttp1.Disconnect; _s:=response; //处理查询结果 //ShowMessage(GetPosition(edt1.Text,Memo1.Text,8).ToString()); if (Pos('没有查到结果',_s)>0) then begin ShowMessage('没有查到结果'); end else begin //1 审核时间 basecnt:=10; beginpos:=Pos('',_s); _s:=Copy(_s,beginpos,endpos-beginpos); alist:=TStringList.Create; for i:=0 to 25 do begin if _s<>'' then begin beginpos:=Pos('',_s); endpos:=Pos('',_s); s:=Copy(_s,beginpos+4,endpos-beginpos-4); _s:=Trim(Copy(_s,endpos+5,Length(_s))); alist.Add(StringReplace(Trim(s), #13#10, '', [rfReplaceAll])); end; end; // Memo1.Lines.AddStrings(alist); //Memo1.Lines.Add(IntToStr(alist.Count)); { SHSJ:=GetINFO(_s,35); //预配舱单 SHHZ:=GetINFO(_s,36); // 运抵状态 YDSJ:=GetINFO(_s,37); //运抵数据 YDHZ:=GetINFO(_s,38); //运抵 BGZT:=GetINFO(_s,46); //报关状态 } SHSJ:=alist[11+baseid]; //预配舱单 时间 SHHZ:=alist[12+baseid]; // YDSJ:=alist[13+baseid]; // 运抵状态 时间 YDHZ:=alist[14+baseid]; if alist[15+baseid]<>'-' then BGZT:=alist[15+baseid]; //单证放行 TDFX:=alist[17+baseid]; //装船放行 TDSJ:=alist[16+baseid]; CKZZ:=alist[20+baseid]; //装载 ZZSJ:=alist[19+baseid]; IF Trim(alist[9+baseid])<>'' THEN QYT:=strtofloat(alist[9+baseid]); IF Trim(alist[10+baseid])<>'' THEN WEIGHT:=strtofloat(alist[10+baseid]); IF Trim(alist[8+baseid])<>'' THEN ctncount:=strtofloat(alist[8+baseid]); if (Pos('接受申报',SHHZ)=0) then begin lbl_1.font.color := clred ; end else begin lbl_1.font.color := clBlack ; end; if (Pos('正常',YDHZ)=0) then begin lbl_2.font.color := clred ; end else begin lbl_2.font.color := clBlack ; end; if (Pos('单证放行',BGZT)=0) then begin lbl_3.font.color := clred ; end else begin lbl_3.font.color := clBlack ; end; if (Pos('已放行',YDHZ)=0) then begin lbl_4.font.color := clred ; end else begin lbl_4.font.color := clBlack ; end; if (Pos('同意装载',BGZT)=0) then begin lbl_5.font.color := clred ; end else begin lbl_5.font.color := clBlack ; end; SetCDState(SHSJ,SHHZ,YDSJ,YDHZ,BGZT,TDFX,TDSJ,CKZZ,ZZSJ); if lbl_1.font.Color=clred then begin SaveState('预配舱单',SHSJ,SHHZ,0); end else begin SaveState('预配舱单',SHSJ,SHHZ,1); end; if lbl_2.font.Color=clred then begin SaveState('运抵状态',YDSJ,YDHZ,0); end else begin SaveState('运抵状态',YDSJ,YDHZ,1); end; if lbl_3.font.Color=clred then begin SaveState('放行','',BGZT,0); end else begin SaveState('放行','',BGZT,1); end; if lbl_4.font.Color=clred then begin SaveState('已放行',TDSJ,TDFX,0); end else begin SaveState('已放行',TDSJ,TDFX,1); end; if lbl_5.font.Color=clred then begin SaveState('同意装载',ZZSJ,CKZZ,0); end else begin SaveState('同意装载',ZZSJ,CKZZ,1); end; end; aAdoQuery:=createAdoQuery; with aAdoQuery do try Close;sql.Clear; sql.Add('select sum(数量) 数量'); sql.Add('from t_op_ctn_fendan'); sql.Add('where as_id=:as_id'); Parameters.ParamByName('as_id').Value:=t_op_seae_assistant.FieldByName('as_id').AsInteger; Open;First; if ctncount<>FieldByName('数量').AsFloat then s_val:=' 箱量 '; finally free; end; if QYT<>t_op_seae_assistant.FieldByName('件数').AsFloat then s_val:=s_val+' 件数' ; if WEIGHT<>t_op_seae_assistant.FieldByName('重量').AsFloat then s_val:=s_val+' 重量'; if s_val<>'' then showmessage('申报箱量为:'+alist[8+baseid]+' 申报件数为:'+alist[9+baseid]+' 申报重量为:'+alist[10+baseid]+#13#10+ '对比结果:'+s_val+'不相等'); { str_memo:=Tmemo.create(application); str_memo.visible:=false; str_memo.Parent:=frm_op_seae; str_memo.Lines.Add('公司名称:'+frm_data_share.t_sys_company.fieldByName('简称').AsString); str_memo.Lines.Add('申请人:'+employee); str_memo.Lines.Add('邮箱:'+frm_data_share.t_load_employee.fieldByName('邮箱').AsString); str_memo.Lines.Add('电话:'+frm_data_share.t_load_employee.fieldByName('固定电话').AsString); str_memo.Lines.Add('主提单号:'+t_op_seae_assistant.fieldByName('主提单号').AsString+' 分提单号:'+t_op_seae_assistant.fieldByName('分提单号').AsString); try if Trim(str_memo.lines.Text)<>'' then begin SMTP1.AuthType := satDefault; SMTP1.username:='admin@dongshengsoft.com'; SMTP1.Password :='ds!@#)(*'; SMTP1.Host :='smtpcom.263xmail.com'; SMTP1.Port :=25; try SMTP1.Connect; except on e : Exception do begin ShowMessage('连接邮箱出错:'+E.Message); end; end; if not SMTP1.Connected then begin Sleep(1000); SMTP1.Connect; end; try with IdMsg do begin body.Clear; ContentType:='us-ascii'; CharSet:='GB2312'; Body.Text :=str_memo.lines.Text; From.address :='admin@dongshengsoft.com'; Recipients.EMailAddresses :='dongshengsoft@dongshengsoft.com'; Subject:=frm_data_share.t_sys_company.fieldByName('简称').AsString+' 通关数据查询'; end; if not SMTP1.Connected then begin Sleep(1000); SMTP1.Connect; end; SMTP1.Send(IdMsg); // MessageDlg('发送成功',mtConfirmation,[mbOK],0) finally SMTP1.Disconnect; end; end; except end; str_memo.free; } end; procedure Tfrm_op_seae_assistant.bsSkinGroupBox17MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin // showmessage('bsSkinGroupBox17MouseDown'); bsSkinGroupBox17.DefaultFont.Color:=clred; end; procedure Tfrm_op_seae_assistant.bsSkinGroupBox17MouseEnter( Sender: TObject); begin // showmessage('bsSkinGroupBox17MouseEnter'); bsSkinGroupBox17.DefaultFont.Name:='宋体'; bsSkinGroupBox17.DefaultFont.Color:=clNavy; bsSkinGroupBox17.Cursor:=crHandPoint; end; procedure Tfrm_op_seae_assistant.bsSkinGroupBox17MouseLeave( Sender: TObject); begin bsSkinGroupBox17.DefaultFont.Name:='Arial'; bsSkinGroupBox17.DefaultFont.Color:=clBlack; bsSkinGroupBox17.Cursor:=crDefault; end; procedure Tfrm_op_seae_assistant.bsSkinGroupBox17MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin bsSkinGroupBox17.DefaultFont.Color:=clNavy; end; procedure Tfrm_op_seae_assistant.bsSkinButton17Click(Sender: TObject); var bok:Tbookmark; if_first:boolean; pkgs:integer; kgs,cbm:double; s,package:string; list1,list2,list3,list4:TStringList; begin if t_op_ctn_fendan.IsEmpty then exit; t_op_seae_assistant.AfterPost:=nil; t_op_ctn_fendan.First; if_first:=true; pkgs:=0; kgs:=0.00; cbm:=0.00; bok:=t_op_ctn_fendan.GetBookmark; try list1:=TStringList.Create; list2:=TStringList.Create; list3:=TStringList.Create; list4:=TStringList.Create; t_op_ctn_fendan.DisableControls; while not t_op_ctn_fendan.Eof do begin if if_first then begin if (Trim(t_op_ctn_fendan.fieldbyname('箱号').asstring)<>'') then list1.Text:=t_op_ctn_fendan.fieldbyname('箱号').asstring+'/'+t_op_ctn_fendan.fieldbyname('封号').asstring; list2.Text:=t_op_ctn_fendan.fieldbyname('件数').asstring+t_op_ctn_fendan.fieldbyname('包装').asstring; list3.Text:=t_op_ctn_fendan.fieldbyname('重量').asstring+'KGS'; list4.Text:=t_op_ctn_fendan.fieldbyname('尺码').asstring+'CBM'; pkgs:=t_op_ctn_fendan.fieldbyname('件数').asinteger; kgs:=t_op_ctn_fendan.fieldbyname('重量').asfloat; cbm:=t_op_ctn_fendan.fieldbyname('尺码').asfloat; package:=t_op_ctn_fendan.fieldbyname('包装').asstring; if_first:=false; end else begin if (Trim(t_op_ctn_fendan.fieldbyname('箱号').asstring)<>'') then list1.Add(t_op_ctn_fendan.fieldbyname('箱号').asstring+'/'+t_op_ctn_fendan.fieldbyname('封号').asstring); list2.Add(t_op_ctn_fendan.fieldbyname('件数').asstring+t_op_ctn_fendan.fieldbyname('包装').asstring); list3.Add(t_op_ctn_fendan.fieldbyname('重量').asstring+'KGS'); list4.Add(t_op_ctn_fendan.fieldbyname('尺码').asstring+'CBM'); pkgs:=pkgs+t_op_ctn_fendan.fieldbyname('件数').asinteger; kgs:=kgs+t_op_ctn_fendan.fieldbyname('重量').asfloat; cbm:=cbm+t_op_ctn_fendan.fieldbyname('尺码').asfloat; package:=t_op_ctn_fendan.fieldbyname('包装').asstring; end; t_op_ctn_fendan.next; end; t_op_seae_assistant.edit; t_op_seae_assistant.FieldByName('箱号封号').asstring:=list1.Text; t_op_seae_assistant.FieldByName('件数包装').asstring:=list2.Text; t_op_seae_assistant.FieldByName('货物重量').asstring:=list3.Text; t_op_seae_assistant.FieldByName('货物尺码').asstring:=list4.Text; t_op_seae_assistant.post; finally t_op_seae_assistant.AfterPost:=t_op_seae_assistantAfterPost; t_op_ctn_fendan.EnableControls; t_op_ctn_fendan.GotoBookmark(bok); list1.Free; list2.Free; list3.Free; list4.Free; end; end; procedure Tfrm_op_seae_assistant.DBEdit7Change(Sender: TObject); var aAdoQuery:TAdoQuery; SHSJ, SHHZ, YDSJ, YDHZ, BGZT,TDFX,TDSJ,CKZZ,ZZSJ: string; i:integer; begin SHSJ:=''; SHHZ:=''; YDSJ:=''; YDHZ:=''; BGZT:=''; TDFX:='';TDSJ:='';CKZZ:='';ZZSJ:=''; SetCDState(SHSJ,SHHZ,YDSJ,YDHZ,BGZT,TDFX,TDSJ,CKZZ,ZZSJ); aAdoQuery:=CreateAdoQuery; aAdoQuery.Close; aAdoQuery.Sql.Clear; aAdoQuery.SQL.Add(' select * from t_op_state_assistant where as_id=:as_id and 业务状态 in (''预配舱单'',''运抵状态'',''放行'',''已放行'',''同意装载'') '); aAdoQuery.Parameters.ParamByName('as_id').Value:=t_op_seae_assistant.FieldByName('as_id').AsInteger; SHSJ:=''; SHHZ:=''; YDSJ:=''; YDHZ:=''; BGZT:=''; aAdoQuery.open; with aAdoQuery do if Recordcount>0 then begin for i:=0 to Recordcount-1 do begin if FieldByName('业务状态').AsString='预配舱单' then begin SHHZ:=FieldByName('备注').AsString; SHSJ:=FieldByName('完成时间').AsString; end; if FieldByName('业务状态').AsString='运抵状态' then begin YDHZ:=FieldByName('备注').AsString; YDSJ:=FieldByName('完成时间').AsString; end; if FieldByName('业务状态').AsString='放行' then begin BGZT:=FieldByName('备注').AsString; end; if FieldByName('业务状态').AsString='已放行' then begin TDFX:=FieldByName('备注').AsString; TDSJ:=FieldByName('完成时间').AsString; end; if FieldByName('业务状态').AsString='同意装载' then begin CKZZ:=FieldByName('备注').AsString; ZZSJ:=FieldByName('完成时间').AsString; end; Next; end; SetCDState(SHSJ,SHHZ,YDSJ,YDHZ,BGZT,TDFX,TDSJ,CKZZ,ZZSJ); end; end; procedure Tfrm_op_seae_assistant.N10Click(Sender: TObject); var t_op_seae_Hbl,t_op_ctn_hbl ,t_op_ctn_fendan,t_op_ctn_fendan_sum ,t_op_ctn_fendan_Desc,t_op_ctn_fendan_Marks,t_op_ctn_fendan_ctnno:TADOQuery; i:integer; id,str,desc,marks:widestring; bsno:string; begin begin if t_op_seae_assistant.IsEmpty then exit; if (t_op_seae_assistant.State=dsinsert)or(t_op_seae_assistant.State=dsedit) then t_op_seae_assistant.post; if MessageDlg('确实要将选中的业务合票出单吗?',mtWarning,[mbyes,mbno],0)<>mryes then exit; try t_op_seae_Hbl:=CreateAdoQuery; t_op_ctn_hbl:=CreateAdoQuery; t_op_ctn_fendan:=CreateAdoQuery; t_op_ctn_fendan_sum:=CreateAdoQuery; t_op_ctn_fendan_Desc:=CreateAdoQuery; t_op_ctn_fendan_Marks:=CreateAdoQuery; with t_op_seae_Hbl do begin Close;SQL.Clear; sql.Add('select * from t_op_seae_hbl where 编号='''''); open; end; if dxDBGrid1.SelectedCount>0 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae_assistant.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if i=0 then str:='('+''''+t_op_seae_assistant.fieldbyname('AS_ID').asstring+'''' else str:=str+','+''''+t_op_seae_assistant.fieldbyname('AS_ID').asstring+''''; end; end else begin str:='('+''''+t_op_seae_assistant.fieldbyname('AS_ID').asstring+''''; end; str:=str+')'; t_op_ctn_fendan.close; t_op_ctn_fendan.sql.clear; t_op_ctn_fendan.sql.add('select 代码,尺寸,箱型,表现形式,箱号,封号,包装,sum(件数) 件数,sum(重量) 重量,sum(尺码) 尺码 from t_op_ctn_fendan ' +'where AS_ID in '+str +' Group by 代码,尺寸,箱型,表现形式,箱号,封号,包装 ' +' '); t_op_ctn_fendan.open;t_op_ctn_fendan.First; t_op_ctn_fendan_sum.close; t_op_ctn_fendan_sum.sql.clear; t_op_ctn_fendan_sum.sql.add('select sum(件数) 件数,sum(重量) 重量,sum(尺码) 尺码 from t_op_ctn_fendan ' +'where AS_ID in '+str +' '); t_op_ctn_fendan_sum.open;t_op_ctn_fendan_sum.First; t_op_ctn_fendan_Desc.close; t_op_ctn_fendan_Desc.sql.clear; t_op_ctn_fendan_Desc.sql.add('select distinct 货物描述 from t_op_seae_assistant ' +'where AS_ID in '+str +' '); t_op_ctn_fendan_Desc.open;t_op_ctn_fendan_Desc.First; while not t_op_ctn_fendan_Desc.Eof do begin desc:=desc+' '+t_op_ctn_fendan_Desc.FieldByName('货物描述').AsString; t_op_ctn_fendan_Desc.Next; end; t_op_ctn_fendan_Marks.close; t_op_ctn_fendan_Marks.sql.clear; t_op_ctn_fendan_Marks.sql.add('select distinct 唛头 from t_op_seae_assistant ' +'where AS_ID in '+str +' '); t_op_ctn_fendan_Marks.open;t_op_ctn_fendan_Marks.First; while not t_op_ctn_fendan_Marks.Eof do begin marks:=marks+t_op_ctn_fendan_Marks.FieldByName('唛头').AsString; t_op_ctn_fendan_Marks.Next; end; t_op_ctn_hbl.close; t_op_ctn_hbl.sql.Text:='select * from t_op_ctn_hbl where 编号=:编号'; id:=get_id; t_op_seae_Hbl.Insert; t_op_seae_Hbl['编号']:=id; bsno:=t_op_seae_Hbl['编号']; t_op_seae_Hbl['主编号']:=t_op_seae_assistant['编号']; t_op_seae_Hbl['EDI状态']:='未打印'; t_op_seae_Hbl['录入人']:=employee; t_op_seae_Hbl['录入日期']:=Date; t_op_seae_Hbl['业务编号']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('业务编号').AsString; t_op_seae_Hbl['主提单号']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('主提单号').AsString; t_op_seae_Hbl['分提单号']:=t_op_seae_assistant.FieldByName('分提单号').AsString; t_op_seae_Hbl['发货人代码']:=t_op_seae_assistant['发货人代码']; t_op_seae_Hbl['收货人代码']:=t_op_seae_assistant['收货人代码']; t_op_seae_Hbl['通知人代码']:=t_op_seae_assistant['通知人代码']; t_op_seae_Hbl['代理内容']:=t_op_seae_assistant['代理内容']; t_op_seae_Hbl['船名']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('船名').AsString; t_op_seae_Hbl['航次']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('航次').AsString; t_op_seae_Hbl['开船日期']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('开船日期').value; // t_op_seae_Hbl['英文船期']:=date_eng(t_op_seae_assistant.DataSource.DataSet.FieldByName('开船日期').AsDateTime); t_op_seae_Hbl['装货港']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('装货港').AsString; t_op_seae_Hbl['卸货港']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('卸货港').AsString; t_op_seae_Hbl['目的地']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('目的地').AsString; t_op_seae_Hbl['运输条款']:=t_op_seae_assistant.DataSource.DataSet.FieldByName('运输条款').AsString; t_op_seae_Hbl['唛头']:=marks; t_op_seae_Hbl['货物描述']:=desc; t_op_seae_Hbl['件数']:=t_op_ctn_fendan_sum['件数']; t_op_seae_Hbl['包装']:=t_op_seae_assistant['包装']; t_op_seae_Hbl['重量']:=t_op_ctn_fendan_sum['重量']; t_op_seae_Hbl['尺码']:=t_op_ctn_fendan_sum['尺码']; t_op_seae_Hbl['签单地点']:=t_op_seae_assistant['签单地点']; //t_op_seae_Hbl['到付地点']:=t_op_seae_assistant['到付地点']; t_op_seae_Hbl['预付地点']:=t_op_seae_assistant['预付地点']; t_op_seae_Hbl['提单份数']:=t_op_seae_assistant['提单份数']; t_op_seae_Hbl['付费方式']:=t_op_seae_assistant['付费方式']; t_op_seae_Hbl['集装箱']:=t_op_seae_assistant['集装箱']; t_op_seae_Hbl['件数大写'] :='SAY TOTAL '+ntoc(t_op_ctn_fendan_sum.FieldByName('件数').asfloat,true) +t_op_seae_assistant.FieldByName('包装').asstring+' ONLY.'; t_op_seae_Hbl.Post; t_op_ctn_hbl.Close; t_op_ctn_hbl.Parameters.ParamByName('编号').Value:=id; t_op_ctn_hbl.Open; while not t_op_ctn_fendan.Eof do begin t_op_ctn_hbl.Insert; t_op_ctn_hbl['编号']:=id; t_op_ctn_hbl['代码']:=t_op_ctn_fendan['代码']; t_op_ctn_hbl['尺寸']:=t_op_ctn_fendan['尺寸']; t_op_ctn_hbl['箱型']:=t_op_ctn_fendan['箱型']; t_op_ctn_hbl['数量']:=1; t_op_ctn_hbl['表现形式']:=t_op_ctn_fendan['表现形式']; t_op_ctn_hbl['箱号']:=t_op_ctn_fendan['箱号']; t_op_ctn_hbl['封号']:=t_op_ctn_fendan['封号']; t_op_ctn_hbl['件数']:=t_op_ctn_fendan['件数']; t_op_ctn_hbl['包装']:=t_op_ctn_fendan['包装']; t_op_ctn_hbl['重量']:=t_op_ctn_fendan['重量']; t_op_ctn_hbl['尺码']:=t_op_ctn_fendan['尺码']; t_op_ctn_hbl.Post; t_op_ctn_fendan.next; end; // ShowMessage('合票成功,请到合票出单模块查看!'); finally FreeAndNil(t_op_seae_Hbl); FreeAndNil(t_op_ctn_hbl); FreeAndNil(t_op_ctn_fendan); freeandnil(t_op_ctn_fendan_sum); freeandnil(t_op_ctn_fendan_Desc); freeandnil(t_op_ctn_fendan_Marks); end; if not assigned(frm_op_seae_hbl) then frm_op_seae_hbl:=tfrm_op_seae_hbl.Create(self); if frm_op_seae_hbl.t_op_seae.Active then begin frm_op_seae_hbl.t_op_seae.Requery(); frm_op_seae_hbl.t_op_seae.Locate('编号',bsno,[loPartialKey]); frm_op_seae_hbl.ManualDock(frm_main.SearchTabs('frm_op_seae_hbl',frm_op_seae_hbl.caption,'1084'),nil,alClient); frm_op_seae_hbl.show; frm_op_seae_hbl.Notebook1.PageIndex:=1; frm_op_seae_hbl.bsSkinButton11.Caption:='返回列表'; frm_op_seae_hbl.bsSkinButton15.OnClick(frm_op_seae_hbl.bsSkinButton15); end else begin frm_op_seae_hbl.ManualDock(frm_main.SearchTabs('frm_op_seae_hbl',frm_op_seae_hbl.caption,'1084'),nil,alClient); frm_op_seae_hbl.show; frm_op_seae_hbl.t_op_seae.Locate('编号',bsno,[loPartialKey]); frm_op_seae_hbl.Notebook1.PageIndex:=1; frm_op_seae_hbl.bsSkinButton11.Caption:='返回列表'; frm_op_seae_hbl.bsSkinButton15.OnClick(frm_op_seae_hbl.bsSkinButton15); end; end; end; end.