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_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('