unit u_op_seae_edi_data; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,IdFTP,IdFTPCommon,DateUtils, Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, ComCtrls, bsSkinTabs, RxLookup, StdCtrls, Mask,inifiles, DBCtrls, wwdbdatetimepicker, wwdblook, u_op_sate, u_fee, u_op_card, Menus, dxDBTLCl, dxGrClms, bsdbctrls, XPMenu, wwdbedit, Wwdotdot, Wwdbcomb, Grids, Wwdbigrd, Wwdbgrid, FtpCli, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdIntercept, IdLogBase, IdLogEvent,DBClient, IdAntiFreezeBase, IdAntiFreeze, dxEditor, dxEdLib, dxDBELib, DBCtrlsEh ,ComObj,DsWebService,SoapHTTPClient,InvokeRegistry,XMLIntf,XMLDoc, xmldom, Xmlxform, msxmldom, bsSkinBoxCtrls,DyxtService,Service,jfczService,myService,CaragtQuery_Cxwl,IdHTTP, kbmMemTable, cxControls, cxContainer, cxCheckListBox, cxDBCheckListBox, IdExplicitTLSClientServerBase; type Tfrm_op_seae_edi_data = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton38: TbsSkinButton; Notebook1: TNotebook; t_op_seae: TADOQuery; t_op_seae1: TDataSource; dxDBGrid1: TdxDBGrid; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label38: TLabel; DBEdit1: TDBEdit; DBEdit9: TDBEdit; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N62: TMenuItem; N25: TMenuItem; N64: TMenuItem; N63: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridDateColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridColumn; XPMenu1: TXPMenu; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; bsSkinPanel2: TbsSkinPanel; Label47: TLabel; Label49: TLabel; Label51: TLabel; wwDBDateTimePicker9: TwwDBDateTimePicker; wwDBDateTimePicker11: TwwDBDateTimePicker; Edit3: TEdit; wwDBDateTimePicker12: TwwDBDateTimePicker; Label52: TLabel; wwDBDateTimePicker13: TwwDBDateTimePicker; Label53: TLabel; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; Label60: TLabel; DBEdit10: TDBEdit; bsSkinButton14: TbsSkinButton; PopupMenu1: TPopupMenu; N1: TMenuItem; dxDBGrid1Column65: TdxDBGridColumn; dxDBGrid1Column67: TdxDBGridColumn; wwDBComboBoxType: TwwDBComboBox; Label45: TLabel; Label48: TLabel; wwDBComboBox2: TwwDBComboBox; bsSkinGroupBox4: TbsSkinGroupBox; Label54: TLabel; DBEdit46: TDBEdit; Label55: TLabel; DBEdit48: TDBEdit; Label56: TLabel; DBEdit50: TDBEdit; Label59: TLabel; t_op_ctn1: TDataSource; t_op_ctn: TADOQuery; strngfld_op_ctnDSDesigner2: TStringField; strngfld_op_ctnDSDesigner6: TStringField; intgrfld_op_ctnDSDesigner5: TIntegerField; 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; intgrfld_op_ctnTEU: TIntegerField; strngfld_op_ctnDSDesigner4: TStringField; strngfld_op_ctnDSDesigner3: TStringField; atncfld_op_ctnctn_id: TAutoIncField; strngfld_op_ctnDSDesigner: TStringField; wwDBComboBox3: TwwDBComboBox; t_op_ctnDSDesigner: TStringField; t_op_ctnPO: TStringField; t_op_ctnSKU: TStringField; t_op_ctnSKU2: TStringField; t_op_ctnUN: TStringField; t_op_ctnHTS: TStringField; t_op_ctnDSDesigner2: TStringField; t_op_ctnDSDesigner3: TBCDField; bsSkinPanel5: TbsSkinPanel; bsSkinGroupBox1: TbsSkinGroupBox; Label6: TLabel; Label7: TLabel; Label8: TLabel; bsSkinSpeedButton1: TbsSkinSpeedButton; DBEdit5: TDBEdit; DBEdit6: TDBEdit; DBEdit7: TDBEdit; bsSkinGroupBox2: TbsSkinGroupBox; Label16: TLabel; Label17: TLabel; Label18: TLabel; bsSkinSpeedButton2: TbsSkinSpeedButton; DBEdit17: TDBEdit; DBEdit19: TDBEdit; DBEdit20: TDBEdit; bsSkinGroupBox3: TbsSkinGroupBox; Label26: TLabel; Label27: TLabel; Label28: TLabel; bsSkinSpeedButton3: TbsSkinSpeedButton; DBEdit28: TDBEdit; DBEdit29: TDBEdit; DBEdit30: TDBEdit; bsSkinGroupBox5: TbsSkinGroupBox; DBMemo3: TDBMemo; bsSkinGroupBox7: TbsSkinGroupBox; DBMemo1: TDBMemo; bsSkinGroupBox8: TbsSkinGroupBox; DBMemo2: TDBMemo; t_op_ctnDSDesigner4: TStringField; SaveDialog1: TSaveDialog; t_op_ctn_detail: TADOQuery; IntegerField1: TIntegerField; StringField8: TStringField; BCDField1: TBCDField; BCDField2: TBCDField; StringField12: TStringField; StringField13: TStringField; BCDField3: TBCDField; t_op_ctn_detail1: TDataSource; t_op_ctn_detailctn_id: TIntegerField; bsSkinButton19: TbsSkinButton; Label73: TLabel; bsSkinButton20: TbsSkinButton; Label74: TLabel; bsSkinButton21: TbsSkinButton; Label75: TLabel; RxDBLookupCombo16: TRxDBLookupCombo; RxDBLookupCombo1: TRxDBLookupCombo; RxDBLookupCombo2: TRxDBLookupCombo; t_code_shiper: TADOQuery; t_code_shiper1: TDataSource; t_code_consignee: TADOQuery; t_code_consignee1: TDataSource; t_code_notifyparty: TADOQuery; t_code_notifyparty1: TDataSource; bsSkinGroupBox11: TbsSkinGroupBox; Label61: TLabel; Label62: TLabel; Label70: TLabel; Label71: TLabel; Label72: TLabel; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Edit7: TEdit; EditType: TEdit; bsSkinButton16: TbsSkinButton; bsSkinButton17: TbsSkinButton; bsSkinButton18: TbsSkinButton; FtpClient1: TFtpClient; lblstatus: TLabel; IdFTP1: TIdFTP; IdAntiFreeze1: TIdAntiFreeze; IdLogEvent1: TIdLogEvent; DebugListBox: TListBox; StatusBar1: TStatusBar; ProgressBar1: TProgressBar; Label76: TLabel; bsSkinButton22: TbsSkinButton; PopupMenu4: TPopupMenu; NZY: TMenuItem; wwDBDateTimePicker3: TwwDBDateTimePicker; Label77: TLabel; Label78: TLabel; bsSkinButton23: TbsSkinButton; N4: TMenuItem; NZT: TMenuItem; NWD2101: TMenuItem; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; N7: TMenuItem; NWD1101: TMenuItem; Label80: TLabel; Edit1: TEdit; Label217: TLabel; wwDBLookupCombo26: TwwDBLookupCombo; Label218: TLabel; Edit8: TEdit; Label81: TLabel; Edit2: TEdit; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; NWY: TMenuItem; NLD: TMenuItem; NHG: TMenuItem; NYD: TMenuItem; wwDBLookupCombo21: TwwDBLookupCombo; RxDBLookupCombo15: TRxDBLookupCombo; wwDBLookupCombo20: TwwDBLookupCombo; N3: TMenuItem; NHF: TMenuItem; Label58: TLabel; wwDBComboBoxOP: TwwDBComboBox; N5: TMenuItem; NZH: TMenuItem; bsSkinButton25: TbsSkinButton; wwDBLookupCombo3: TwwDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; wwDBLookupCombo17: TwwDBLookupCombo; N6: TMenuItem; NHGYDT: TMenuItem; OpenDialog1: TOpenDialog; t_op_state1: TDataSource; t_op_state: TADOQuery; N20: TMenuItem; Panel1: TPanel; bsSkinGroupBox9: TbsSkinGroupBox; Label68: TLabel; Label169: TLabel; Label63: TLabel; Label64: TLabel; Label65: TLabel; Label66: TLabel; Label67: TLabel; Label106: TLabel; Label105: TLabel; Label109: TLabel; Label108: TLabel; Label69: TLabel; Label83: TLabel; wwDBComboBox15: TwwDBComboBox; DBEdit81: TDBEdit; wwDBLookupCombo61: TwwDBLookupCombo; DBEdit82: TDBEdit; DBEdit83: TDBEdit; DBMemo38: TDBMemo; DBMemo39: TDBMemo; DBEdit55: TDBEdit; wwDBComboBox6: TwwDBComboBox; DBEdit56: TDBEdit; DBEdit57: TDBEdit; bsSkinButton47: TbsSkinButton; bsSkinButton24: TbsSkinButton; bsSkinButton26: TbsSkinButton; DBEdit2: TDBEdit; bsSkinGroupBox6: TbsSkinGroupBox; wwDBGrid1: TwwDBGrid; bsSkinPanel9: TbsSkinPanel; bsSkinButton56: TbsSkinButton; bsSkinButton57: TbsSkinButton; bsSkinButton58: TbsSkinButton; bsSkinButton59: TbsSkinButton; btnMarks: TbsSkinButton; btnDesc: TbsSkinButton; btnSeal: TbsSkinButton; bsSkinButton15: TbsSkinButton; bsSkinButton28: TbsSkinButton; wwDBLookupCombo16: TwwDBLookupCombo; wwDBLookupComboctn: TwwDBLookupCombo; wwDBComboBoxOwner: TwwDBComboBox; bsSkinExPanel1: TbsSkinExPanel; bsSkinPanel6: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton13: TbsSkinButton; wwDBGrid2: TwwDBGrid; N22: TMenuItem; bsSkinComboBox1: TbsSkinComboBox; Label3: TLabel; N2: TMenuItem; N21: TMenuItem; N23: TMenuItem; bsSkinButton29: TbsSkinButton; bsSkinButton30: TbsSkinButton; bsSkinLabel1: TbsSkinLabel; bsSkinLabel2: TbsSkinLabel; bsSkinLabel3: TbsSkinLabel; bsSkinLabel4: TbsSkinLabel; bsSkinLabel5: TbsSkinLabel; DBEdit3: TDBEdit; PopupMenu5: TPopupMenu; ABC1: TMenuItem; bsSkinButton27: TbsSkinButton; dxDBGrid1Column23: TdxDBGridColumn; bsSkinLabel6: TbsSkinLabel; bsSkinButton33: TbsSkinButton; kbmMemTable1: TkbmMemTable; kbmMemTable1StringField: TStringField; kbmMemTable1StringField2: TStringField; kbmMemTable1IntegerField: TIntegerField; kbmMemTable1StringField3: TStringField; kbmMemTable1FloatField: TFloatField; kbmMemTable1FloatField2: TFloatField; kbmMemTable1StringField4: TStringField; kbmMemTable1StringField5: TStringField; kbmMemTable1StringField6: TStringField; Label12: TLabel; RxDBLookupCombo9: TRxDBLookupCombo; cxDBCheckListBox1: TcxDBCheckListBox; Label36: TLabel; Label37: TLabel; Label39: TLabel; Label44: TLabel; Label46: TLabel; DBEdit38: TDBEdit; DBEdit39: TDBEdit; DBEdit40: TDBEdit; DBEdit43: TDBEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; bsSkinButton32: TbsSkinButton; bsSkinButton31: TbsSkinButton; bsSkinExPanel2: TbsSkinExPanel; dxDBGrid3: TdxDBGrid; dxDBGrid3Column2: TdxDBGridColumn; dxDBGridColumn1: TdxDBGridColumn; Label4: TLabel; DBEdit4: TDBEdit; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton14Click(Sender: TObject); procedure bsSkinSpeedButton1Click(Sender: TObject); procedure bsSkinSpeedButton2Click(Sender: TObject); procedure bsSkinSpeedButton3Click(Sender: TObject); procedure bsSkinButton56Click(Sender: TObject); procedure bsSkinButton57Click(Sender: TObject); procedure bsSkinButton58Click(Sender: TObject); procedure bsSkinButton59Click(Sender: TObject); procedure wwDBLookupComboctnChange(Sender: TObject); procedure btnMarksClick(Sender: TObject); procedure btnDescClick(Sender: TObject); procedure t_op_ctnAfterInsert(DataSet: TDataSet); procedure wwDBGrid1ColEnter(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure t_op_ctn_detailAfterInsert(DataSet: TDataSet); procedure t_op_ctn_detailBeforePost(DataSet: TDataSet); procedure t_op_ctn_detailBeforeInsert(DataSet: TDataSet); procedure bsSkinButton17Click(Sender: TObject); procedure bsSkinButton19Click(Sender: TObject); procedure bsSkinButton20Click(Sender: TObject); procedure bsSkinButton21Click(Sender: TObject); procedure RxDBLookupCombo16Enter(Sender: TObject); procedure RxDBLookupCombo16Exit(Sender: TObject); procedure RxDBLookupCombo1Enter(Sender: TObject); procedure RxDBLookupCombo1Exit(Sender: TObject); procedure RxDBLookupCombo2Enter(Sender: TObject); procedure RxDBLookupCombo2Exit(Sender: TObject); procedure RxDBLookupCombo16Change(Sender: TObject); procedure RxDBLookupCombo1Change(Sender: TObject); procedure RxDBLookupCombo2Change(Sender: TObject); procedure IdFTP1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); procedure IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer); procedure IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer); procedure IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode); procedure bsSkinButton22Click(Sender: TObject); procedure NZYClick(Sender: TObject); procedure bsSkinButton23Click(Sender: TObject); procedure NZTClick(Sender: TObject); procedure NWD2101Click(Sender: TObject); procedure t_op_ctnBeforePost(DataSet: TDataSet); procedure NWD1101Click(Sender: TObject); procedure NYDClick(Sender: TObject); procedure NLDClick(Sender: TObject); procedure NWYClick(Sender: TObject); procedure NHGClick(Sender: TObject); procedure btnSealClick(Sender: TObject); procedure NHFClick(Sender: TObject); procedure wwDBComboBoxOPDropDown(Sender: TObject); procedure NZHClick(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); procedure bsSkinButton47Click(Sender: TObject); procedure bsSkinButton24Click(Sender: TObject); procedure bsSkinButton25Click(Sender: TObject); procedure bsSkinButton26Click(Sender: TObject); procedure wwDBLookupCombo3Change(Sender: TObject); procedure wwDBLookupCombo3Exit(Sender: TObject); procedure wwDBLookupCombo52Change(Sender: TObject); procedure wwDBLookupCombo52Exit(Sender: TObject); procedure wwDBLookupCombo17Change(Sender: TObject); procedure wwDBLookupCombo17Exit(Sender: TObject); procedure N1Click(Sender: TObject); procedure bsSkinButton28Click(Sender: TObject); procedure NHGYDTClick(Sender: TObject); procedure bsSkinButton29Click(Sender: TObject); procedure t_op_seaeBeforeEdit(DataSet: TDataSet); procedure t_op_ctnBeforeEdit(DataSet: TDataSet); procedure N20Click(Sender: TObject); procedure bsSkinButton30Click(Sender: TObject); procedure bsSkinComboBox1Change(Sender: TObject); procedure bsSkinButton31Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure bsSkinButton32Click(Sender: TObject); procedure t_op_seaeBeforeDelete(DataSet: TDataSet); procedure DBEdit3Change(Sender: TObject); procedure bsSkinLabel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure bsSkinLabel2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure bsSkinLabel3MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure bsSkinLabel4MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure bsSkinLabel5MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure bsSkinButton27Click(Sender: TObject); procedure bsSkinLabel6MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure t_op_seaeAfterInsert(DataSet: TDataSet); procedure bsSkinButton33Click(Sender: TObject); procedure RxDBLookupCombo9Enter(Sender: TObject); procedure RxDBLookupCombo9KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo9Exit(Sender: TObject); private { Private declarations } AbortTransfer: Boolean; TransferrignData: Boolean; BytesToTransfer: LongWord; STime: TDateTime; mServiceSoap_Ds:DsWebServiceSoap; mHttpRIO_ds:THTTPRIO; mServiceSoap_dy:DyxtServiceSoap; mServiceSoap_yzh:ServiceSoap; mServiceSoap_zc:CaragtQuery_CxwlSoap; mHttpRIO_dy,mHttpRIO_yzh,mHttpRIO_zc:THTTPRIO; procedure getwebservice_dy; //获取 procedure getwebservice_yzh; //获取 procedure getwebservice_zc; //获取 procedure dewebservice; //关闭 procedure GetdyczInfo_dy(s_caragt,s_key,s_billno,bsno:String); procedure GetdyczInfo_yzh(s_caragt,s_key,s_billno,bsno:String); procedure GetdyczInfo_jfcz(s_caragt,s_key,s_billno,bsno:String); procedure GetdyczInfo_lhcz(s_caragt,s_key,s_billno,bsno:String); procedure GetdyczInfo_zc(s_caragt,s_key,s_billno,bsno:String); procedure getssczinfor(mblno:string); procedure setconcolor; //设置控件的颜色 function getCtnAfr(code:string):string; function getPkgAfr(code:string):string; function formatAfrstr(str:string):string; procedure PutToDebugLog(Operation, S1: String); function isEditrue(DataSet:TDataSet): boolean; public { Public declarations } dbserver:string; function GetStrChar(str:String):string; function GetStrChar_1(str:String):string; function GetpkgsEdi(pkgs: String): String; procedure UpdateCTN(BSNO:STRING); procedure getwebservice_ds; function IsZhongwen(Str: String): Boolean; function CreateSIEdiFile_XML:TStrings; function GetCtnCode(ctnkind,ctnsize:String): String; procedure UpdateInfor; procedure SelectReciveData(bsno,mblno:string); end; var frm_op_seae_edi_data: Tfrm_op_seae_edi_data; AverageSpeed: Double = 0; implementation uses u_main,u_data_share, my_sys_function, u_sys_progress, u_code_edicode, u_op_seae_edi_custom_cosco, u_op_seae_edi_custom_zt, u_op_seae_edi_custom_WaiDai, u_op_seae_edi_custom_WaiDai_1101, u_op_seae_edi_custom_yd, u_op_seae_edi_custom_LD, u_op_seae_edi_custom_wy, u_op_seae_edi_custom_hg, u_op_seae_edi_custom_zh, u_op_seae_edi_custom_hgydt; {$R *.dfm} procedure Tfrm_op_seae_edi_data.getwebservice_dy; begin try mHttpRIO_dy:=THTTPRIO.Create(nil); mHttpRIO_dy.WSDLLocation:='http://www.yydy.com/GacoWebService/DyxtService.asmx?WSDL'; mHttpRIO_dy.URL:='http://www.yydy.com/GacoWebService/DyxtService.asmx'; mHttpRIO_dy.Port:='DyxtServiceSoap'; mHttpRIO_dy.Service:='DyxtWebService'; mHttpRIO_dy.HTTPWebNode.UseUTF8InHeader:=true; mServiceSoap_dy:=mHttpRIO_dy as DyxtServiceSoap; InvRegistry.RegisterInvokeOptions(TypeInfo(DyxtServiceSoap),ioDocument );//就是这一行 except on E:Exception do begin ShowMessage(e.Message); exit; end; end; end; procedure Tfrm_op_seae_edi_data.getwebservice_zc; begin try mHttpRIO_zc:=THTTPRIO.Create(nil); mHttpRIO_zc.WSDLLocation:='http://www.cmlog.com.cn:8003/cmlwebservice/CaragtQuery_Cxwl.asmx?WSDL'; mHttpRIO_zc.URL:='http://www.cmlog.com.cn:8003/cmlwebservice/CaragtQuery_Cxwl.asmx'; mHttpRIO_zc.Port:='CaragtQuery_CxwlSoap'; mHttpRIO_zc.Service:='CaragtQuery_Cxwl'; mHttpRIO_zc.HTTPWebNode.UseUTF8InHeader:=true; mServiceSoap_zc:=mHttpRIO_zc as CaragtQuery_CxwlSoap; InvRegistry.RegisterInvokeOptions(TypeInfo(CaragtQuery_CxwlSoap),ioDocument );//就是这一行 except on E:Exception do begin ShowMessage(e.Message); exit; end; end; end; procedure Tfrm_op_seae_edi_data.getwebservice_yzh; begin try mHttpRIO_yzh:=THTTPRIO.Create(nil); mHttpRIO_yzh.WSDLLocation:='http://222.173.95.170:78/Service.asmx?WSDL'; mHttpRIO_yzh.URL:='http://222.173.95.170:78/Service.asmx'; mHttpRIO_yzh.Port:='ServiceSoap'; mHttpRIO_yzh.Service:='WebService'; mHttpRIO_yzh.HTTPWebNode.UseUTF8InHeader:=true; mServiceSoap_yzh:=mHttpRIO_yzh as ServiceSoap; InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap),ioDocument );//就是这一行 { mHttpRIO_yzh:=THTTPRIO.Create(nil); mHttpRIO_yzh.WSDLLocation:='http://www.eimskipdepot.com:78/Service.asmx?WSDL'; mHttpRIO_yzh.URL:='http://www.eimskipdepot.com:78/Service.asmx'; mHttpRIO_yzh.Port:='ServiceSoap'; mHttpRIO_yzh.Service:='WebService'; mHttpRIO_yzh.HTTPWebNode.UseUTF8InHeader:=true; mServiceSoap_yzh:=mHttpRIO_yzh as ServiceSoap; InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap),ioDocument );//就是这一行 } except on E:Exception do begin ShowMessage(e.Message); exit; end; end; end; procedure Tfrm_op_seae_edi_data.dewebservice; begin mHttpRIO_dy.Free; end; procedure Tfrm_op_seae_edi_data.GetdyczInfo_jfcz(s_caragt,s_key,s_billno,bsno:String); var b:Boolean; s_web: WideString; xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_ctnno,s_ctnType:string; smartWS:jfczServiceSoap; begin try t_op_ctn.DisableControls; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; smartWS:=GetServiceSoapJFCZ(True,'',nil); s_web:=smartWS.GetBLNoInfo(s_billno); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\JFCZ.xml'); // ShowMessage('\\'+dbserver+'\jfcz\jfcz.xtr'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\jfcz\jfcz.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; kbmMemTable1.EmptyTable; kbmMemTable1.Open; with cds do begin First; while not Eof do begin if kbmMemTable1.Locate('箱号',Trim(FieldByName('CNTRNO').AsString),[]) then begin kbmMemTable1.Edit; s_ctnno:=Trim(FieldByName('CNTRSIZE').AsString); s_ctnType:=Trim(FieldByName('CNTRTYPE').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin kbmMemTable1.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; kbmMemTable1.FieldByName('尺寸').AsString:=FieldByName('CNTRSIZE').AsString; kbmMemTable1.FieldByName('箱型').AsString:=FieldByName('CNTRTYPE').AsString; kbmMemTable1.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; kbmMemTable1.FieldByName('件数').AsInteger:=kbmMemTable1.FieldByName('件数').AsInteger+FieldByName('CARGOQTY').AsInteger; kbmMemTable1.FieldByName('包装').AsString:=FieldByName('CO_PKGCODE').AsString; kbmMemTable1.FieldByName('重量').AsFloat:=kbmMemTable1.FieldByName('重量').AsFloat+FieldByName('CARGOWEIGHT').AsFloat; kbmMemTable1.FieldByName('尺码').AsFloat:=kbmMemTable1.FieldByName('尺码').AsFloat+FieldByName('CARGOVOLUME').AsFloat; kbmMemTable1.Post; end else begin kbmMemTable1.append; s_ctnno:=Trim(FieldByName('CNTRSIZE').AsString); s_ctnType:=Trim(FieldByName('CNTRTYPE').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin kbmMemTable1.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; kbmMemTable1.FieldByName('尺寸').AsString:=FieldByName('CNTRSIZE').AsString; kbmMemTable1.FieldByName('箱型').AsString:=FieldByName('CNTRTYPE').AsString; kbmMemTable1.FieldByName('箱号').AsString:=FieldByName('CNTRNO').AsString; kbmMemTable1.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; kbmMemTable1.FieldByName('件数').AsInteger:=FieldByName('CARGOQTY').AsInteger; kbmMemTable1.FieldByName('包装').AsString:=FieldByName('CO_PKGCODE').AsString; kbmMemTable1.FieldByName('重量').AsFloat:=FieldByName('CARGOWEIGHT').AsFloat; kbmMemTable1.FieldByName('尺码').AsFloat:=FieldByName('CARGOVOLUME').AsFloat; kbmMemTable1.Post; end; Next; end; end; with kbmMemTable1 do begin First; while not Eof do begin if t_op_ctn.Locate('箱号',Trim(FieldByName('箱号').AsString),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(FieldByName('尺寸').AsString); s_ctnType:=Trim(FieldByName('箱型').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('封号').AsString:=FieldByName('封号').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('件数').AsInteger; t_op_ctn.FieldByName('包装').AsString:=FieldByName('包装').AsString; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('尺码').AsFloat; t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Trim(FieldByName('尺寸').AsString); s_ctnType:=Trim(FieldByName('箱型').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=FieldByName('箱号').AsString; t_op_ctn.FieldByName('封号').AsString:=FieldByName('封号').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('件数').AsInteger; t_op_ctn.FieldByName('包装').AsString:=FieldByName('包装').AsString; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('尺码').AsFloat; t_op_ctn.Post; end; Next; end; end; finally t_op_ctn.EnableControls; cds.Free; end; end; procedure Tfrm_op_seae_edi_data.GetdyczInfo_dy(s_caragt,s_key,s_billno,bsno:String); var b:Boolean; s_web: WideString; xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_ctnno,s_ctnType:string; begin try t_op_ctn.DisableControls; getwebservice_dy; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); // s_billno:='HLCUTA1130371756'; //QDJY000476 cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; s_web:=mServiceSoap_dy.GetCtnChargeXml(s_caragt,s_key,s_billno,'','1'); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\提箱.xml'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\大亚场站\提箱.xtr'; // XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\提箱.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; with cds do begin First; while not Eof do begin if t_op_ctn.Locate('箱号',Trim(FieldByName('CTNNO').AsString),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(FieldByName('CTNSZ').AsString); s_ctnType:=Trim(FieldByName('CTNTP').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('发箱日期').AsString:=StringReplace(Copy(FieldByName('EMFUEDT').AsString,1,Pos('.',FieldByName('EMFUEDT').AsString)-1),'T',' ',[]); t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Trim(FieldByName('CTNSZ').AsString); s_ctnType:=Trim(FieldByName('CTNTP').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=Trim(FieldByName('CTNNO').AsString); // t_op_ctn.FieldByName('发箱日期').AsString:=StringReplace(Copy(FieldByName('EMFUEDT').AsString,1,Pos('.',FieldByName('EMFUEDT').AsString)-1),'T',' ',[]); { t_op_ctn.FieldByName('封号').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,3].Value); t_op_ctn.FieldByName('件数').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,6].Value); t_op_ctn.FieldByName('包装').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,7].Value); t_op_ctn.FieldByName('重量').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,8].Value); t_op_ctn.FieldByName('尺码').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,9].Value); } t_op_ctn.Post; end; Next; end; end; s_web:=mServiceSoap_dy.GetBackFCtnInfoXml(s_caragt,s_key,s_billno,'','1'); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\重箱返场.xml'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\大亚场站\重箱返场.xtr'; // XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\重箱返场.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; with cds do begin First; while not Eof do begin if t_op_ctn.Locate('箱号',Trim(FieldByName('CTNNO').AsString),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(FieldByName('CTNSZ').AsString); s_ctnType:=Trim(FieldByName('CTNTP').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('PKGS').AsInteger; t_op_ctn.FieldByName('包装').AsString:=''; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('ALKWGT').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('ALCUBAGE').AsFloat; t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Trim(FieldByName('CTNSZ').AsString); s_ctnType:=Trim(FieldByName('CTNTP').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('PKGS').AsInteger; t_op_ctn.FieldByName('包装').AsString:=''; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('ALKWGT').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('ALCUBAGE').AsFloat; t_op_ctn.Post; end; Next; end; end; // 包装 s_web:=mServiceSoap_dy.GetLoadCargoInfoXml(s_caragt,s_key,s_billno,'','1'); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\包装.xml'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\大亚场站\包装.xtr'; // XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\包装.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; if not cds.IsEmpty then begin try with t_op_ctn do begin First; while not Eof do begin Edit; FieldByName('包装').AsString:=cds.FieldByName('PKTP').AsString; Post; Next; end; end; finally end; end; { s_web:=mServiceSoap_dy.GetEnterPortInfoXml(s_caragt,s_key,s_billno,'','1'); xmldoc.LoadFromXML(s_web); /// xmldoc.SaveToFile('c:\集港.xml'); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\集港.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; cds.Close; cds.ProviderName:='XMLTransformProvider1'; cds.Data:=XMLTransformProvider1.Data; cds.Active:=True; // ShowMessage(IntToStr(cds.RecordCount)); s_web:=mServiceSoap_dy.GetCusediInfoXml(s_caragt,s_key,s_billno); xmldoc.LoadFromXML(s_web); /// xmldoc.SaveToFile('c:\放行.xml'); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\放行.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; BoolToStr(mServiceSoap_dy.GetBillInfo(s_caragt,s_key,s_billno),True); } finally // dewebservice; t_op_ctn.EnableControls; // ShowMessage('导入完成,请仔细核对箱数,手工录入的集装箱可以删除'); end; end; procedure Tfrm_op_seae_edi_data.getssczinfor(mblno:string);//qqctu获取运抵报告和报关信息 var sl:tstringlist; IdHTTP1:TidHTTP; i,j,k,m,n:integer; istrue,QQCT,inmsg:boolean; sldata:Array [1..13] of string[50]; s,s_ctnno,s_ctnType:widestring; begin sl:=tstringlist.Create; IdHTTP1 := TidHTTP.Create(nil); IdHTTP1.HandleRedirects:=true; QQCT:=false; istrue:=true; for i:=1 to 13 do begin sldata[i]:=''; end; n:=0; try istrue:=true; inmsg:=false; sl.text:=idhttp1.get('http://www.ssqd.cn/agentui.aspx?bl='+mblno); j:=0; for i:=0 to sl.Count-1 do begin s:=Utf8ToAnsi(sl[i]); if pos('',sl[i])>0 then begin s:=Copy(s,Pos('',s)+16,Length(s)-1); s:=StringReplace(s,'/tr>','/tr>'+#13#10,[rfReplaceAll]); n:=1; sl.text:=s; end; end; for i:=0 to sl.Count-1 do begin if pos('',sl[i])>0 then begin istrue:=false; Exit; end; if pos('箱号',sl[i])>0 then begin j:=i; end; if istrue and (i=j) then begin sldata[1]:=twsou('<箱号>','',sl[i]); end; if istrue and (i=j+1) then begin sldata[2]:=twsou('<尺寸>','',sl[i]); end; if istrue and (i=j+2) then begin sldata[3]:=twsou('<箱型>','',sl[i]); end; if istrue and (i=j+3) then begin sldata[4]:=twsou('<车号>','',sl[i]); end; if istrue and (i=j+4) then begin sldata[5]:=twsou('<背箱时间>','',sl[i]); end; if istrue and (i=j+5) then begin sldata[6]:=twsou('<皮重>','',sl[i]); end; if istrue and (i=j+6) then begin sldata[7]:=twsou('<总件数>','',sl[i]); end; if istrue and (i=j+7) then begin sldata[8]:=twsou('<重量>','',sl[i]); end; if istrue and (i=j+8) then begin sldata[9]:=twsou('<总尺码>','',sl[i]); end; if istrue and (i=j+9) then begin sldata[10]:=twsou('<铅封号>','',sl[i]); end; if istrue and (i=j+10) then begin sldata[11]:=twsou('<集港时间>','',sl[i]); if t_op_ctn.Locate('箱号',Trim(sldata[1]),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(sldata[2]); s_ctnType:=Trim(sldata[3]); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=sldata[1]; t_op_ctn.FieldByName('封号').AsString:=sldata[10]; if sldata[7]<>'' then t_op_ctn.FieldByName('件数').AsInteger:=StrToInt(sldata[7]); t_op_ctn.FieldByName('包装').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('包装').AsString; if sldata[8]<>'' then t_op_ctn.FieldByName('重量').AsFloat:=StrToFloat(sldata[8]); if sldata[9]<>'' then t_op_ctn.FieldByName('尺码').AsFloat:=StrToFloat(sldata[9]); t_op_ctn.Post; end else begin t_op_ctn.Append; s_ctnno:=Trim(sldata[2]); s_ctnType:=Trim(sldata[3]); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=sldata[1]; t_op_ctn.FieldByName('封号').AsString:=sldata[10]; if sldata[7]<>'' then t_op_ctn.FieldByName('件数').AsInteger:=StrToInt(sldata[7]); t_op_ctn.FieldByName('包装').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('包装').AsString; if sldata[8]<>'' then t_op_ctn.FieldByName('重量').AsFloat:=StrToFloat(sldata[8]); if sldata[9]<>'' then t_op_ctn.FieldByName('尺码').AsFloat:=StrToFloat(sldata[9]); t_op_ctn.Post; end; end; end; finally freeandnil(sl); end; end; procedure Tfrm_op_seae_edi_data.GetdyczInfo_zc(s_caragt,s_key,s_billno,bsno:String); var b:Boolean; s_web: WideString; xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_ctnno,s_ctnType:string; begin try t_op_ctn.DisableControls; getwebservice_zc; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); // s_billno:='HLCUTA1130371756'; //QDJY000476 cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; s_web:=mServiceSoap_zc.GetInfo(s_billno,s_key); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\提箱.xml'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\中创场站\集装箱信息.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; with cds do begin First; while not Eof do begin if t_op_ctn.Locate('箱号',Trim(FieldByName('箱号').AsString),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(FieldByName('尺寸').AsString); s_ctnType:=Trim(FieldByName('箱型').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('封号').AsString:=FieldByName('铅封号').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('总件数').AsInteger; t_op_ctn.FieldByName('包装').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('包装').AsString; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('总尺码').AsFloat; t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Trim(FieldByName('尺寸').AsString); s_ctnType:=Trim(FieldByName('箱型').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=FieldByName('箱号').AsString; t_op_ctn.FieldByName('封号').AsString:=FieldByName('铅封号').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('总件数').AsInteger; t_op_ctn.FieldByName('包装').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('包装').AsString; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('总尺码').AsFloat; t_op_ctn.Post; end; Next; end; end; { s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'FX');; xmldoc.LoadFromXML(s_web); // xmldoc.SaveToFile('c:\集装箱信息.xml'); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\怡之航场站\放行.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; } finally // dewebservice; t_op_ctn.EnableControls; end; end; procedure Tfrm_op_seae_edi_data.GetdyczInfo_yzh(s_caragt,s_key,s_billno,bsno:String); var b:Boolean; s_web: WideString; xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_ctnno,s_ctnType:string; begin try t_op_ctn.DisableControls; getwebservice_yzh; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); // s_billno:='HLCUTA1130371756'; //QDJY000476 cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'YT'); // ShowMessage(s_web); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\集装箱信息.xml'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\怡之航场站\集装箱信息.xtr'; // XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\怡之航场站\集装箱信息.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; with cds do begin First; while not Eof do begin if t_op_ctn.Locate('箱号',Trim(FieldByName('箱号').AsString),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(FieldByName('尺寸').AsString); s_ctnType:=Trim(FieldByName('箱型').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('封号').AsString:=FieldByName('铅封号').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('总件数').AsInteger; t_op_ctn.FieldByName('包装').AsString:=''; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('总尺码').AsFloat; t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Trim(FieldByName('尺寸').AsString); s_ctnType:=Trim(FieldByName('箱型').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=FieldByName('箱号').AsString; t_op_ctn.FieldByName('封号').AsString:=FieldByName('铅封号').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('总件数').AsInteger; t_op_ctn.FieldByName('包装').AsString:=''; t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('总尺码').AsFloat; t_op_ctn.Post; end; Next; end; end; { s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'FX');; xmldoc.LoadFromXML(s_web); // xmldoc.SaveToFile('c:\集装箱信息.xml'); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\怡之航场站\放行.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; } finally // dewebservice; t_op_ctn.EnableControls; end; end; procedure Tfrm_op_seae_edi_data.GetdyczInfo_lhcz(s_caragt,s_key,s_billno,bsno:String); var testService:myServicePortType; strmsg:string; s_web: WideString; xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_ctnno,s_ctnType:string; begin testService:=GetmyServicePortType(false,'http://www.lhl.cn:8190/WebServiceTest/services/myService?wsdl',nil); try t_op_ctn.DisableControls; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; s_web:=testService.CntrMess(s_billno) ; // ShowMessage(s_web); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\集装箱信息.xml'); //ShowMessage('1'); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\陆海场站\集装箱信息.xtr'; //ShowMessage('\\'+dbserver+'\陆海场站\重箱返场.xtr'); XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; // ShowMessage('3'); cds.Data:=XMLTransformProvider1.Data; // ShowMessage('4'); cds.Active:=true; with cds do begin First; while not Eof do begin if t_op_ctn.Locate('箱号',Trim(FieldByName('CTNNO').AsString),[]) then begin t_op_ctn.Edit; s_ctnno:=Trim(FieldByName('CTNSZ').AsString); s_ctnType:=Trim(FieldByName('CTNTP').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; if FieldByName('PKGS').Value<>'null' then t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('PKGS').AsInteger; t_op_ctn.FieldByName('包装').AsString:=FieldByName('PKTP').AsString; if FieldByName('ALKWGT').Value<>'null' then t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('ALKWGT').AsFloat; if FieldByName('ALCUBAGE').Value<>'null' then t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('ALCUBAGE').AsFloat; t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Trim(FieldByName('CTNSZ').AsString); s_ctnType:=Trim(FieldByName('CTNTP').AsString); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(s_ctnno),trim(s_ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=Trim(FieldByName('CTNNO').AsString); t_op_ctn.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; if FieldByName('PKGS').Value<>'null' then t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('PKGS').AsInteger; t_op_ctn.FieldByName('包装').AsString:=FieldByName('PKTP').AsString; if FieldByName('ALKWGT').Value<>'null' then t_op_ctn.FieldByName('重量').AsFloat:=FieldByName('ALKWGT').AsFloat; if FieldByName('ALCUBAGE').Value<>'null' then t_op_ctn.FieldByName('尺码').AsFloat:=FieldByName('ALCUBAGE').AsFloat; t_op_ctn.Post; end; Next; end; end; finally t_op_ctn.EnableControls; end; end; procedure Tfrm_op_seae_edi_data.setconcolor; begin end; procedure Tfrm_op_seae_edi_data.UpdateInfor; var aAdoQuery:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close; sql.clear; sql.add('Update t_code_vessel set 船舶呼号=:船舶呼号'); sql.add('where 英文船名=:英文船名'); Parameters.ParamByName('英文船名').Value:=t_op_seae.fieldbyname('船名').asstring; Parameters.ParamByName('船舶呼号').Value:=t_op_seae.fieldbyname('船舶IMO').asstring; ExecSQL; finally Free; end; end; function Tfrm_op_seae_edi_data.GetStrChar_1(str:String):string; var i:integer; begin result:=''; if str='' then exit; for i:=1 to length(Str) do begin if str[i] in ['0','1','2','3','4','5','6','7','8','9','.'] then else result:=result+str[i]; end; end; function Tfrm_op_seae_edi_data.GetStrChar(str:String):string; var i:integer; begin result:=''; if str='' then exit; for i:=1 to length(Str) do begin if str[i] in ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] then else result:=result+str[i]; end; end; function Tfrm_op_seae_edi_data.IsZhongwen(Str: String): Boolean; var i:Integer; begin Result:=false; if Str='' then Exit; for i:=1 to Length(Str) do begin // if Str[i]>Chr(127) then begin if bytetype(Str[i],1)<>mbsinglebyte then begin Result:=True; Exit; end; end; end; function Tfrm_op_seae_edi_data.GetCtnCode(ctnkind,ctnsize:String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; ctnsize:=StringReplace(ctnsize,'''','''''',[rfReplaceAll]); try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 海关EDI代码 EDI代码 from t_code_ctn where 箱型='''+ctnkind+''' and 尺寸='''+ctnsize+''''); Open; if not IsEmpty then Result:=Trim(FieldByName('EDI代码').asstring) else Result:=''; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_data.GetpkgsEdi(pkgs: String): String; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select Edi代码 from t_code_package where 代码='''+pkgs+''''); Open; if IsEmpty then Result:='' else Result:=FieldByName('Edi代码').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_data.isEditrue(DataSet:TDataSet): boolean; var error:String; i,c : Integer; begin result:=true; if trim(get_parameters_value(301,''))='' then begin result:=false; if trim(error)='' then error:='用户代码' else error:=error+#13#10+'用户代码'; end; if trim(get_parameters_value(302,''))='' then begin result:=false; if trim(error)='' then error:='用户代码' else error:=error+#13#10+'发送方代码'; end; if trim(get_parameters_value(303,''))='' then begin result:=false; if trim(error)='' then error:='用户代码' else error:=error+#13#10+'接受方代码'; end; c:=0; if bsSkinComboBox1.ItemIndex=3 then begin for i:=0 to cxDBCheckListBox1.Count-1 do begin if cxDBCheckListBox1.Items[i].Checked then begin c:=c+1; end; end; if c<=0 then begin if trim(error)='' then error:='修改原因' else error:=error+#13#10+'修改原因'; end else if c>4 then begin if trim(error)='' then error:='最多只能选择3个原因' else error:=error+#13#10+'最多只能选择3个原因'; result:=false; end; end; if GetStrChar(DataSet.fieldbyname('主提单号').asstring)<>'' then begin result:=false; if trim(error)='' then error:='主提单号中存在非法字符' else error:=error+#13#10+'主提单号中存在非法字符'; end; if GetStrChar_1(DataSet.fieldbyname('运输方式').asstring)<>'' then begin result:=false; if trim(error)='' then error:='HS CODE 中存在非法字符' else error:=error+#13#10+'HS CODE 中存在非法字符'; end; if DataSet.fieldbyname('船舶IMO').AsString='' then begin result:=false; if trim(error)='' then error:='船舶IMO' else error:=error+#13#10+'船舶IMO'; end; if DataSet.fieldbyname('船公司代码').AsString='' then begin result:=false; if trim(error)='' then error:='船公司海关代码' else error:=error+#13#10+'船公司海关代码'; end; if trim(DataSet.fieldbyname('主提单号').asstring)='' then begin result:=false; if trim(error)='' then error:='主提单号' else error:=error+#13#10+'主提单号'; end; if trim(DataSet.fieldbyname('发货人名称').asstring)='' then begin result:=false; if trim(error)='' then error:='发货人名称' else error:=error+#13#10+'发货人名称'; end; if trim(DataSet.fieldbyname('发货人地址1').asstring)='' then begin result:=false; if trim(error)='' then error:='发货人地址1' else error:=error+#13#10+'发货人地址1'; end; if trim(DataSet.fieldbyname('收货人名称').asstring)='' then begin result:=false; if trim(error)='' then error:='收货人名称' else error:=error+#13#10+'收货人名称'; end; if trim(DataSet.fieldbyname('收货人地址1').asstring)='' then begin result:=false; if trim(error)='' then error:='收货人地址1' else error:=error+#13#10+'收货人地址1'; end; if trim(DataSet.fieldbyname('通知人名称').asstring)='' then begin result:=false; if trim(error)='' then error:='通知人名称' else error:=error+#13#10+'通知人名称'; end; if trim(DataSet.fieldbyname('通知人地址1').asstring)='' then begin result:=false; if trim(error)='' then error:='通知人地址1' else error:=error+#13#10+'通知人地址1'; end; if trim(DataSet.fieldbyname('付费方式').asstring)='' then begin result:=false; if trim(error)='' then error:='付费方式' else error:=error+#13#10+'付费方式'; end; if pos(' ', trim(DataSet.fieldbyname('船名').asstring))>0 then begin result:=false; if trim(error)='' then error:='船名存在两个空格' else error:=error+#13#10+'船名存在两个空格'; end; if trim(DataSet.fieldbyname('船名').asstring)='' then begin result:=false; if trim(error)='' then error:='船名' else error:=error+#13#10+'船名'; end; if trim(DataSet.fieldbyname('航次').asstring)='' then begin result:=false; if trim(error)='' then error:='航次' else error:=error+#13#10+'航次'; end; if Length(trim(DataSet.fieldbyname('船舶IMO').asstring))<7 then begin result:=false; if trim(error)='' then error:='船舶呼号不能小于7位' else error:=error+#13#10+'船舶呼号不能小于7位'; end; if trim(DataSet.fieldbyname('装港代码').asstring)='' then begin result:=false; if trim(error)='' then error:='装港代码' else error:=error+#13#10+'装港代码'; end; if trim(DataSet.fieldbyname('装货港').asstring)='' then begin result:=false; if trim(error)='' then error:='装货港' else error:=error+#13#10+'装货港'; end; if trim(DataSet.fieldbyname('开船日期').asstring)='' then begin result:=false; if trim(error)='' then error:='开船日期' else error:=error+#13#10+'开船日期'; end; if trim(DataSet.fieldbyname('预抵日期').asstring)='' then begin result:=false; if trim(error)='' then error:='预抵日期' else error:=error+#13#10+'预抵日期'; end; if trim(DataSet.fieldbyname('卸货代码').asstring)='' then begin result:=false; if trim(error)='' then error:='卸货代码' else error:=error+#13#10+'卸货代码'; end; if trim(DataSet.fieldbyname('目的代码').asstring)='' then begin result:=false; if trim(error)='' then error:='目的代码' else error:=error+#13#10+'目的代码'; end; if trim(DataSet.fieldbyname('目的地').asstring)='' then begin result:=false; if trim(error)='' then error:='目的地' else error:=error+#13#10+'目的地'; end; if trim(DataSet.fieldbyname('签单地点').asstring)='' then begin result:=false; if trim(error)='' then error:='签单地点' else error:=error+#13#10+'签单地点'; end; if trim(GetpkgsEdi(DataSet.fieldbyname('包装').asstring))='' then begin result:=false; if trim(error)='' then error:='包装代码' else error:=error+#13#10+'包装代码'; end; if trim(DataSet.fieldbyname('货物描述').asstring)='' then begin result:=false; if trim(error)='' then error:='货物描述' else error:=error+#13#10+'货物描述'; end; if trim(DataSet.fieldbyname('唛头').asstring)='' then begin result:=false; if trim(error)='' then error:='唛头' else error:=error+#13#10+'唛头'; end; if DataSet.fieldbyname('件数').asinteger=0 then begin result:=false; if trim(error)='' then error:='件数' else error:=error+#13#10+'件数'; end; if DataSet.fieldbyname('重量').asFloat=0 then begin result:=false; if trim(error)='' then error:='重量' else error:=error+#13#10+'重量'; end; if DataSet.fieldbyname('尺码').asFloat=0 then begin result:=false; if trim(error)='' then error:='尺码' else error:=error+#13#10+'尺码'; end; if trim(DataSet.fieldbyname('货物标识').asstring)='' then begin result:=false; if trim(error)='' then error:='货物标识' else error:=error+#13#10+'货物标识'; end; if trim(DataSet.FieldByName('货物标识').asstring)='D' then begin if Trim(DataSet.fieldbyname('危险品分类').asstring)='' then begin result:=false; if trim(error)='' then error:='危险品分类' else error:=error+#13#10+'危险品分类'; end; if Trim(DataSet.fieldbyname('危险品编号').asstring)='' then begin result:=false; if trim(error)='' then error:='危险品编号' else error:=error+#13#10+'危险品编号'; end; if GetStrNum(Trim(DataSet.fieldbyname('危险品编号').asstring))<>4 then begin result:=false; MessageDlg('危险品编号必须是4位数字',mtWarning,[mbOk],0); if trim(error)='' then error:='危险品编号必须是4位数字' else error:=error+#13#10+'危险品编号必须是4位数字'; end; end; if trim(DataSet.FieldByName('货物标识').asstring)='R' then begin if Trim(DataSet.fieldbyname('设置温度').asstring)='' then begin result:=false; if trim(error)='' then error:='设置温度' else error:=error+#13#10+'设置温度'; end; end; t_op_ctn.close; t_op_ctn.Parameters.ParamByName('编号').Value:=DataSet.fieldbyname('编号').asstring; t_op_ctn.open; if t_op_ctn.IsEmpty then begin result:=false; MessageDlg('集装箱不能为空',mtWarning,[mbOk],0); end; t_op_ctn.First; while not t_op_ctn.Eof do begin if Trim(t_op_ctn.fieldbyname('箱号').asstring)='' then begin result:=false; if trim(error)='' then error:='箱号' else error:=error+#13#10+'箱号'; end; if Trim(t_op_ctn.fieldbyname('封号').asstring)='' then begin result:=false; if trim(error)='' then error:='封号' else error:=error+#13#10+'封号'; end; if trim(GetpkgsEdi(t_op_ctn.fieldbyname('包装').asstring))='' then begin result:=false; if trim(error)='' then error:='包装代码' else error:=error+#13#10+'包装代码'; end; if t_op_ctn.fieldbyname('件数').asinteger=0 then begin result:=false; if trim(error)='' then error:='件数' else error:=error+#13#10+'件数'; end; if t_op_ctn.fieldbyname('重量').asFloat=0 then begin result:=false; if trim(error)='' then error:='重量' else error:=error+#13#10+'重量'; end; if t_op_ctn.fieldbyname('尺码').asFloat=0 then begin result:=false; if trim(error)='' then error:='尺码' else error:=error+#13#10+'尺码'; end; t_op_ctn.Next; end; if iszhongwen(dataset.fieldbyname('唛头').AsString) then begin result:=false; MessageDlg('唛头不能有中文字符!',mtWarning,[mbOk],0); end; if iszhongwen(dataset.fieldbyname('货物描述').AsString) then begin result:=false; MessageDlg('货物描述不能有中文字符!',mtWarning,[mbOk],0); end; if trim(error)<>'' then ShowMessage(error+#13#10+'不能为空'); end; function Tfrm_op_seae_edi_data.CreateSIEdiFile_XML:TStrings; var str:Tstringlist; i,j,Count:integer; strsql,strRmain:string; rs:Tadoquery; wide_str:widestring; k:integer; inifile1:Tinifile; strType,XType,TransType:string; strDatetime,IMO:string; SenderCode,ReciverCode:string; alist:TStringList; begin if not isEditrue(frm_op_seae_edi_data.t_op_seae) then begin Exit; end; SenderCode:=trim(get_parameters_value(302,'')) ; ReciverCode:=trim(get_parameters_value(303,'')) ; if bsSkinComboBox1.ItemIndex=0 then strType:='9' else if bsSkinComboBox1.ItemIndex=1 then strType:='2' else if bsSkinComboBox1.ItemIndex=2 then strType:='3' else if bsSkinComboBox1.ItemIndex=3 then strType:='5' else if bsSkinComboBox1.ItemIndex=4 then strType:='0' else if bsSkinComboBox1.ItemIndex=5 then strType:='11' else strType:='9'; if frm_op_seae_edi_data.dxdbgrid1.SelectedCount<=1 then begin str:=Tstringlist.Create; str.Clear; str.Add(''); // str.Add(''); str.Add(''); str.Add(''); // str.Add(''+SenderCode+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring)+GetDatetime(datetimetostr(now),3)+IntToStr(GetTickCount)+''); // str.Add(''+strType+''); // str.Add('MT2101'); // str.Add(''+SenderCode+''); // str.Add(''+ReciverCode+''); // str.Add(''+GetDatetime(datetimetostr(now),4)+''); // str.Add('1.0'); str.Add(''); // str.Add(''); // str.Add(''); // str.Add(''+SenderCode+''); str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('装港代码').asstring)+''); str.Add(''); // str.Add(''); // str.Add(''+SenderCode+''); str.Add(''); // str.Add(''); // str.Add(''+frm_op_seae_edi_data.t_op_seae.fieldbyname('船公司代码').AsString+''); str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('航次').asstring)+''); // str.Add('1'); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('船舶IMO').asstring)+''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('船名').AsString)+''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货代码').asstring)+''); // str.Add(''+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,1)+'086'+''); // str.Add(''+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('预抵日期').asstring,1)+'086'+''); str.Add(''); // str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring)+''); // if bsSkinComboBox1.ItemIndex=3 then begin for i:=0 to cxDBCheckListBox1.Count-1 do begin if cxDBCheckListBox1.Items[i].Checked then begin str.Add(''+COPY(cxDBCheckListBox1.Items[i].Text,1,Pos(':',cxDBCheckListBox1.Items[i].Text)-1)+''); end; end; end; if pos('FREIGHT PREPAID',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('付费方式').asstring)) >0 then xtype := 'PP' else if pos('FREIGHT COLLECT',trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('付费方式').asstring)) >0 then xtype := 'CC' else xtype := 'PP'; if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输条款').asstring)='CY-CY' then TransType:='10' else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输条款').asstring)='DOOR-DOOR' then TransType:='27' else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输条款').asstring)='DOOR-PIER' then TransType:='28' else if uppercase(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输条款').asstring)='PIER-DOOR' then TransType:='29' else TransType:='10'; // PIER TO PIER // str.Add(''+TransType+''); // { str.Add(''); // str.Add(''); str.Add(''); } str.Add(''); // { if trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('分提单号').asstring)<>'' then begin str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('分提单号').asstring)+''); str.Add(''); end else begin end; } // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('尺码').asstring)+''); // // str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('装港代码').asstring)+''); // str.Add(''+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('开船日期').asstring,1)+'086'+''); str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('卸货代码').asstring)+''); // str.Add(''+GetDatetime(frm_op_seae_edi_data.t_op_seae.fieldbyname('预抵日期').asstring,0)+''); str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('目的代码').asstring)+''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('目的地').asstring)+''); str.Add(''); { // str.Add(''); // str.Add('); str.Add('') } // str.Add(''); // str.Add(''+xtype+''); str.Add(''); // str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('件数').asstring)+''); // str.Add(''+trim(GetpkgsEdi(frm_op_seae_edi_data.t_op_seae.fieldbyname('包装').asstring))+''); str.Add(''); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('重量').asstring)+''); { } // str.Add(''); // str.Add('10'); // str.Add(''+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人名称').AsString))+''); // str.Add('
'); // str.Add(''+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('收货人地址1').AsString))+''); { } str.Add('
'); { } str.Add('
'); // str.Add(''); // str.Add('11'); // str.Add(''+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人名称').AsString))+''); // str.Add('
'); // str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('发货人地址1').AsString)+''); { } str.Add('
'); { } str.Add('
'); // str.Add(''); // str.Add('13'); // str.Add(''+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人名称').AsString))+''); // str.Add('
'); // str.Add(''+formatAfrstr(trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('通知人地址1').AsString))+''); { } str.Add('
'); { } str.Add('
'); { } strsql:='select * from t_op_ctn_edi ' +'WHERE 编号=' +#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring+#39; try rs:=CreateAdoQuery; rs.sql.clear; rs.sql.add(strsql); rs.Open; rs.First; if not rs.IsEmpty then begin rs.First; while not rs.Eof do begin // str.Add(''); // str.Add(''); // str.Add(''+rs.fieldbyname('箱号').asstring+''); str.Add(''); // str.Add(''+GetCtnCode(rs.fieldbyname('箱型').asstring,rs.fieldbyname('尺寸').asstring)+''); // str.Add('2'); // str.Add('5'); // str.Add('M/'+trim(rs.fieldbyname('封号').asstring)+''); str.Add(''); rs.Next; end; end; rs.Close; rs.Destroy; except on e:exception do begin rs.Close; rs.Destroy; exit; end; end; k:=1; alist:=TStringList.Create; strsql:='select * from t_op_ctn_edi ' +'WHERE 编号=' +#39+frm_op_seae_edi_data.t_op_seae.fieldbyname('编号').asstring+#39; try rs:=CreateAdoQuery; rs.sql.clear; rs.sql.add(strsql); rs.Open; rs.First; if not rs.IsEmpty then begin rs.First; while not rs.Eof do begin // str.Add(''); // str.Add(''+inttostr(k)+''); // str.Add(''); // str.Add(''+trim(IntToStr(rs.fieldbyname('件数').AsInteger))+''); // str.Add(''+trim(GetpkgsEdi(rs.fieldbyname('包装').asstring)) +''); alist.text:=''; if trim(rs.fieldbyname('唛头').asstring)<>'' then alist.text:=trim(rs.fieldbyname('唛头').asstring) else alist.text:=trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('唛头').asstring); // str.Add(''+alist.text+''); str.Add(''); alist.text:=''; if trim(rs.fieldbyname('货描').asstring)<>'' then alist.text:=trim(rs.fieldbyname('货描').asstring) else alist.text:=trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('货物描述').asstring); // str.Add(''); // str.Add(''+alist.text+''); // if trim(frm_op_seae_edi_data.t_op_seae.FieldByName('货物标识').asstring)='D' then begin str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('危险品编号').asstring)+''); end; // if trim(rs.fieldbyname('HTS号').asstring)<>'' then str.Add(''+rs.fieldbyname('HTS号').asstring+'') else begin if trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输方式').asstring)<>'' then str.Add(''+trim(frm_op_seae_edi_data.t_op_seae.fieldbyname('运输方式').asstring)+''); end; str.Add(''); // { str.Add(''); // str.Add(''); str.Add(''); } // str.Add(''); // str.Add(''+trim(FloatToStr(rs.fieldbyname('重量').AsFloat))+''); str.Add(''); // str.Add(''); // str.Add(''+trim(rs.fieldbyname('箱号').asstring)+''); str.Add(''); // { str.Add(''); // str.Add(''); str.Add(''); } { // str.Add(''); // str.Add(''); str.Add(''); } // { str.Add(''); // str.Add(''); str.Add(''); } str.Add(''); k:=k+1; rs.Next; end; end; rs.Close; rs.Destroy; alist.Free; except on e:exception do begin rs.Close; rs.Destroy; exit; end; end; str.Add('
'); // { str.Add(''); // str.Add(''); str.Add(''); } str.Add('
'); str.Add('
'); frm_op_seae_edi_data.t_op_seae.Edit; frm_op_seae_edi_data.t_op_seae.FieldByName('EDI状态').AsString:='已发送'; frm_op_seae_edi_data.t_op_seae.Post; end; Result:=str; end; procedure Tfrm_op_seae_edi_data.getwebservice_ds; begin try mHttpRIO_ds:=THTTPRIO.Create(nil); mHttpRIO_ds.WSDLLocation:='http://122.4.79.84:8090/webservice/DsWebService.asmx?WSDL'; mHttpRIO_ds.URL:='http://122.4.79.84:8090/webservice/DsWebService.asmx'; mHttpRIO_ds.Port:='DsWebServiceSoap'; mHttpRIO_ds.Service:='DsWebService'; mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader:=true; mServiceSoap_Ds:=mHttpRIO_ds as DsWebServiceSoap; InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap),ioDocument );//就是这一行 { mHttpRIO_ds:=THTTPRIO.Create(nil); mHttpRIO_ds.WSDLLocation:='http://221.3.83.5:8090/webservice/DsWebService.asmx?WSDL'; mHttpRIO_ds.URL:='http://221.3.83.5:8090/webservice/DsWebService.asmx'; mHttpRIO_ds.Port:='DsWebServiceSoap'; mHttpRIO_ds.Service:='DsWebService'; mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader:=true; mServiceSoap_Ds:=mHttpRIO_ds as DsWebServiceSoap; InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap),ioDocument );//就是这一行 } except on E:Exception do begin ShowMessage(e.Message); exit; end; end; end; procedure Tfrm_op_seae_edi_data.UpdateCTN(BSNO:STRING); var aAdoQuery:TAdoQuery; p:Integer; w,c:Double; begin aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close; sql.clear; sql.add('select sum(件数) 件数, sum(重量) 重量,sum(尺码) 尺码 from t_op_ctn_edi'); sql.add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=BSNO; open;First; if not IsEmpty then begin t_op_seae.Edit; p:=FieldByName('件数').AsInteger; w:=FieldByName('重量').AsFloat; c:=FieldByName('尺码').AsFloat; t_op_seae.Post; close; sql.clear; sql.add('Update t_op_seae_edi set 件数=:件数, 重量=:重量,尺码=:尺码'); sql.add('where 编号=:编号'); Parameters.ParamByName('件数').Value:=p; Parameters.ParamByName('重量').Value:=w; Parameters.ParamByName('尺码').Value:=c; Parameters.ParamByName('编号').Value:=BSNO; ExecSQL; end; finally Free; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_edi_data.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_seae_edi_data.Hide; frm_op_seae_edi_data.ManualFloat(frm_op_seae_edi_data.BoundsRect ); frm_main.freeTabs('frm_op_seae_edi_data'); action:=cafree; frm_op_seae_edi_data:=nil; end; procedure Tfrm_op_seae_edi_data.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/15); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton11.Width:=i; bsSkinButton14.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; bsSkinButton22.Width:=i; bsSkinButton25.Width:=i; bsSkinButton27.Width:=i; end; procedure Tfrm_op_seae_edi_data.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_op_seae); end; procedure Tfrm_op_seae_edi_data.bsSkinButton6Click(Sender: TObject); begin table_next(t_op_seae); end; procedure Tfrm_op_seae_edi_data.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_seae); end; procedure Tfrm_op_seae_edi_data.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; //DBEdit3.OnChange(Sender); end else begin if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_seae.post; end; if answer=mrNo then begin t_op_seae.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton4Click(Sender: TObject); var i,j:Integer; strno:string; aQuery:TADOQuery; begin if t_op_seae.FieldByName('EDI状态').AsString='已发送' then begin showmessage('已发送不能修改,删除!'); Exit; end; j:=dxDBGrid1.SelectedCount; strno:=' where 1=2 '; for i:=0 to j-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); strno:=strno+' or 编号='''+t_op_seae.fieldbyname('编号').asstring+''''; end; if MessageDlg('确定要删除选中的'+inttostr(j)+'票业务数据吗?',mtWarning,[mbyes,mbno],0)=mryes then begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add(' delete from t_op_ctn_detail_edi where ctn_id in (select ctn_id from t_op_ctn_edi '+strno+')'); ExecSQL; Close;SQL.Clear; SQL.Add(' delete from t_op_ctn_edi '+strno); ExecSQL; Close;SQL.Clear; SQL.Add(' delete from t_op_seae_edi '+strno); ExecSQL; end; finally FreeAndNil(aQuery); end; t_op_seae.Refresh; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_op_seae); end; procedure Tfrm_op_seae_edi_data.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_op_seae.GetBookmark; t_op_seae.Refresh; t_op_seae.GotoBookmark(book1); end; procedure Tfrm_op_seae_edi_data.FormShow(Sender: TObject); var inifile1:Tinifile; s:string; begin Notebook1.PageIndex:=0; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); s:=inifile1.ReadString('database','Data Source',''); if Pos('\',s)>0 then begin dbserver:=Copy(s,1,Pos('\',s)-1); end else if Pos(';',s)>0 then begin dbserver:=Copy(s,1,Pos(';',s)-1); end else dbserver:=s; if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=28; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; //委托编号处理 t_op_seae.Close; t_op_seae.SQL.clear; t_op_seae.SQL.Add('select top 100 * from t_op_seae_edi where ' +'(录入人='+''''+employee+''''+') order by 录入日期 desc '); t_op_seae.open; t_op_ctn.Open; t_op_ctn_detail.Open; t_op_state.Open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; loadreggrid(dxdbgrid1,false,caption); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; t_code_shiper.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; t_code_consignee.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; t_code_notifyparty.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; end; procedure Tfrm_op_seae_edi_data.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_seae_edi_data.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_seae_edi_data.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,213); end; procedure Tfrm_op_seae_edi_data.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seae_edi_data.bsSkinButton8Click(Sender: TObject); VAR str:widestring; begin str:='where '+open_data('0001','录入人','no','no','no','no'); if Edit3.text<>''then str:=str+' and 主提单号 like '+''''+'%'+Edit3.text+'%'+''''; if Edit1.text<>''then str:=str+' and 分提单号 like '+''''+'%'+Edit1.text+'%'+''''; if wwDBComboBoxType.text<>''then str:=str+' and EDI类型 like '+''''+wwDBComboBoxType.text+''''; if wwDBComboBox2.text<>''then str:=str+' and EDI状态 like '+''''+wwDBComboBox2.text+''''; if wwDBDateTimePicker9.text<>''then str:=str+' and 录入日期>='+''''+wwDBDateTimePicker9.text+''''; if wwDBDateTimePicker12.text<>''then str:=str+' and 录入日期<='+''''+wwDBDateTimePicker12.text+''''; if wwDBDateTimePicker11.text<>''then str:=str+' and 开船日期>='+''''+wwDBDateTimePicker11.text+''''; if wwDBDateTimePicker13.text<>''then str:=str+' and 开船日期<='+''''+wwDBDateTimePicker13.text+''''; if wwDBComboBoxOP.text<>''then str:=str+' and 录入人='+''''+wwDBComboBoxOP.text+''''; str:=query_tiaojian(1,str,'船名','模糊',wwDBLookupCombo26.text); str:=query_tiaojian(1,str,'航次','模糊',Edit8.text); if Edit2.text<>''then str:=str+' and 编号 in ( select 编号 from t_op_ctn_edi where 箱号 like '+''''+'%'+Edit2.text+'%'+''')'; t_op_seae.close; t_op_seae.sql.clear; t_op_seae.sql.add('select * from t_op_seae_edi '+str+' order by 主提单号'); t_op_seae.open; end; procedure Tfrm_op_seae_edi_data.bsSkinButton12Click(Sender: TObject); begin Edit3.text:=''; Edit8.text:=''; Edit2.text:=''; Edit1.text:=''; wwDBDateTimePicker9.text:=''; wwDBDateTimePicker12.text:=''; wwDBDateTimePicker11.text:=''; wwDBDateTimePicker13.text:=''; wwDBComboBoxType.Text:=''; wwDBComboBox2.Text:=''; wwDBLookupCombo26.Clear; end; procedure Tfrm_op_seae_edi_data.bsSkinButton14Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton14.ClientToScreen(Point(0,bsSkinButton14.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton1Click(Sender: TObject); begin if bsSkinGroupBox5.Visible then begin bsSkinGroupBox5.Visible:=false; bsSkinGroupBox2.Visible:=true; end else begin bsSkinGroupBox5.left:=bsSkinGroupBox2.Left; bsSkinGroupBox5.Top:=bsSkinGroupBox2.Top; bsSkinGroupBox5.Height:=bsSkinGroupBox2.Height; bsSkinGroupBox5.Width:=bsSkinGroupBox2.Width; bsSkinGroupBox2.Visible:=False; bsSkinGroupBox5.Visible:=True; end; end; procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton2Click(Sender: TObject); begin if bsSkinGroupBox7.Visible then begin bsSkinGroupBox7.Visible:=false; bsSkinGroupBox3.Visible:=true; end else begin bsSkinGroupBox7.left:=bsSkinGroupBox3.Left; bsSkinGroupBox7.Top:=bsSkinGroupBox3.Top; bsSkinGroupBox7.Height:=bsSkinGroupBox3.Height; bsSkinGroupBox7.Width:=bsSkinGroupBox3.Width; bsSkinGroupBox3.Visible:=False; bsSkinGroupBox7.Visible:=True; end; end; procedure Tfrm_op_seae_edi_data.bsSkinSpeedButton3Click(Sender: TObject); begin if bsSkinGroupBox8.Visible then begin bsSkinGroupBox8.Visible:=false; bsSkinGroupBox2.Visible:=true; end else begin bsSkinGroupBox8.left:=bsSkinGroupBox2.Left; bsSkinGroupBox8.Top:=bsSkinGroupBox2.Top; bsSkinGroupBox8.Height:=bsSkinGroupBox2.Height; bsSkinGroupBox8.Width:=bsSkinGroupBox2.Width; bsSkinGroupBox2.Visible:=False; bsSkinGroupBox8.Visible:=True; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton56Click(Sender: TObject); begin t_op_ctn.insert; end; procedure Tfrm_op_seae_edi_data.bsSkinButton57Click(Sender: TObject); begin table_post(t_op_ctn); end; procedure Tfrm_op_seae_edi_data.bsSkinButton58Click(Sender: TObject); begin table_delete(t_op_ctn); end; procedure Tfrm_op_seae_edi_data.bsSkinButton59Click(Sender: TObject); begin table_cancel(t_op_ctn); end; procedure Tfrm_op_seae_edi_data.wwDBLookupComboctnChange(Sender: TObject); begin if (t_op_ctn.State=dsedit)or(t_op_ctn.State=dsinsert) then begin if frm_data_share.t_code_ctn.Locate('代码',wwDBLookupComboctn.text,[]) then begin t_op_ctn['表现形式']:=frm_data_share.t_code_ctn['表现形式']; t_op_ctn['箱型']:=frm_data_share.t_code_ctn['箱型']; t_op_ctn['尺寸']:=frm_data_share.t_code_ctn['尺寸']; end else begin t_op_ctn['表现形式']:=''; t_op_ctn['箱型']:=''; t_op_ctn['尺寸']:=''; end; end; end; procedure Tfrm_op_seae_edi_data.btnMarksClick(Sender: TObject); begin frm_main.view_momo(t_op_ctn1,'唛头'); end; procedure Tfrm_op_seae_edi_data.btnDescClick(Sender: TObject); begin frm_main.view_momo(t_op_ctn1,'货描'); end; procedure Tfrm_op_seae_edi_data.t_op_ctnAfterInsert(DataSet: TDataSet); begin t_op_ctn['编号']:=t_op_seae1.DataSet['编号']; t_op_ctn['数量']:=1; t_op_ctn['TEU']:=0; end; procedure Tfrm_op_seae_edi_data.wwDBGrid1ColEnter(Sender: TObject); begin if (wwDBGrid1.GetActiveField.FieldName='唛头') then begin // bsSkinPanel4.Visible:=true; // Label62.Visible:=True; // Label61.Visible:=false; // DBMemo5.Visible:=true; // DBMemo4.Visible:=false; end else if (wwDBGrid1.GetActiveField.FieldName='货描') then begin // bsSkinPanel4.Visible:=true; // Label62.Visible:=false; // Label61.Visible:=True; // DBMemo5.Visible:=false; // DBMemo4.Visible:=true; end else begin // bsSkinPanel4.Visible:=False; end; end; function Tfrm_op_seae_edi_data.getCtnAfr(code: string): string; var aQuery:TADOQuery; begin result:=''; aQuery:=CreateAdoQuery; try with aQuery do begin Close; SQL.Text:='select AFR代码 from t_code_ctn where 代码='''+code+''''; Open; Result:=aQuery.fieldbyname('AFR代码').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_data.getPkgAfr(code: string): string; var aQuery:TADOQuery; begin result:=''; aQuery:=CreateAdoQuery; try with aQuery do begin Close; SQL.Text:='select AFR代码 from t_code_package where 代码='''+code+''''; Open; if not IsEmpty then Result:=aQuery.fieldbyname('AFR代码').AsString; end; finally FreeAndNil(aQuery); end; end; function Tfrm_op_seae_edi_data.formatAfrstr(str: string): string; begin Result:=Trim(str); Result:=StringReplace(Result,'&','&',[rfReplaceAll]); Result:=StringReplace(Result,'<','<',[rfReplaceAll]); Result:=StringReplace(Result,'"','"',[rfReplaceAll]); Result:=StringReplace(Result,'>','>',[rfReplaceAll]); Result:=StringReplace(Result,'''',''',[rfReplaceAll]); end; procedure Tfrm_op_seae_edi_data.bsSkinButton1Click(Sender: TObject); begin t_op_ctn_detail.insert; end; procedure Tfrm_op_seae_edi_data.bsSkinButton9Click(Sender: TObject); begin table_post(t_op_ctn_detail); end; procedure Tfrm_op_seae_edi_data.bsSkinButton10Click(Sender: TObject); begin table_delete(t_op_ctn_detail); end; procedure Tfrm_op_seae_edi_data.bsSkinButton13Click(Sender: TObject); begin table_cancel(t_op_ctn_detail); end; procedure Tfrm_op_seae_edi_data.t_op_ctn_detailAfterInsert(DataSet: TDataSet); begin t_op_ctn_detail['ctn_id']:=t_op_ctn['ctn_id']; end; procedure Tfrm_op_seae_edi_data.t_op_ctn_detailBeforePost(DataSet: TDataSet); begin t_op_ctn_detail['ctn_id']:=t_op_ctn['ctn_id']; end; procedure Tfrm_op_seae_edi_data.t_op_ctn_detailBeforeInsert(DataSet: TDataSet); begin if t_op_ctn.State in [dsedit,dsinsert] then t_op_ctn.Post; end; procedure Tfrm_op_seae_edi_data.bsSkinButton17Click(Sender: TObject); begin try if IdFTP1.Connected then begin IdFTP1.Abort; IdFTP1.Quit; end; finally bsSkinGroupBox11.Visible:=false; bsSkinButton16.Enabled:=True; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton19Click(Sender: TObject); begin frm_code_edicode:=Tfrm_code_edicode.Create(self); try frm_code_edicode.t_code_edicode.Open; if not frm_code_edicode.t_code_edicode.Locate('简称',RxDBLookupCombo16.DisplayValue,[]) then begin frm_code_edicode.t_code_edicode.Insert; frm_code_edicode.t_code_edicode.FieldByName('客户简称').AsString:=t_op_seae.fieldbyname('发货人').AsString; frm_code_edicode.t_code_edicode.FieldByName('发货人').AsBoolean:=true; frm_code_edicode.t_code_edicode.FieldByName('名称').AsString:=t_op_seae.fieldbyname('发货人名称').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址1').AsString:=t_op_seae.fieldbyname('发货人地址1').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址2').AsString:=t_op_seae.fieldbyname('发货人地址2').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址3').AsString:=t_op_seae.fieldbyname('发货人地址3').AsString; frm_code_edicode.t_code_edicode.FieldByName('城市').AsString:=t_op_seae.fieldbyname('发货人城市').AsString; frm_code_edicode.t_code_edicode.FieldByName('邮编').AsString:=t_op_seae.fieldbyname('发货人邮编').AsString; frm_code_edicode.t_code_edicode.FieldByName('国家代码').AsString:=t_op_seae.fieldbyname('发货人国家代码').AsString; frm_code_edicode.t_code_edicode.FieldByName('联系人').AsString:=t_op_seae.fieldbyname('发货人联系人').AsString; frm_code_edicode.t_code_edicode.FieldByName('电话').AsString:=t_op_seae.fieldbyname('发货人电话').AsString; frm_code_edicode.t_code_edicode.FieldByName('州').AsString:=t_op_seae.fieldbyname('发货人州').AsString; end else begin frm_code_edicode.t_code_edicode.Edit; frm_code_edicode.t_code_edicode.FieldByName('名称').AsString:=t_op_seae.fieldbyname('发货人名称').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址1').AsString:=t_op_seae.fieldbyname('发货人地址1').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址2').AsString:=t_op_seae.fieldbyname('发货人地址2').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址3').AsString:=t_op_seae.fieldbyname('发货人地址3').AsString; frm_code_edicode.t_code_edicode.FieldByName('城市').AsString:=t_op_seae.fieldbyname('发货人城市').AsString; frm_code_edicode.t_code_edicode.FieldByName('邮编').AsString:=t_op_seae.fieldbyname('发货人邮编').AsString; frm_code_edicode.t_code_edicode.FieldByName('国家代码').AsString:=t_op_seae.fieldbyname('发货人国家代码').AsString; frm_code_edicode.t_code_edicode.FieldByName('联系人').AsString:=t_op_seae.fieldbyname('发货人联系人').AsString; frm_code_edicode.t_code_edicode.FieldByName('电话').AsString:=t_op_seae.fieldbyname('发货人电话').AsString; frm_code_edicode.t_code_edicode.FieldByName('州').AsString:=t_op_seae.fieldbyname('发货人州').AsString; end; frm_code_edicode.ShowModal; finally t_code_shiper.Requery(); FreeAndNil(frm_code_edicode); end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton20Click(Sender: TObject); begin frm_code_edicode:=Tfrm_code_edicode.Create(self); try frm_code_edicode.t_code_edicode.Open; if not frm_code_edicode.t_code_edicode.Locate('简称',RxDBLookupCombo1.DisplayValue,[]) then begin frm_code_edicode.t_code_edicode.Insert; frm_code_edicode.t_code_edicode.FieldByName('客户简称').AsString:=t_op_seae.fieldbyname('收货人').AsString; frm_code_edicode.t_code_edicode.FieldByName('收货人').AsBoolean:=true; frm_code_edicode.t_code_edicode.FieldByName('名称').AsString:=t_op_seae.fieldbyname('收货人名称').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址1').AsString:=t_op_seae.fieldbyname('收货人地址1').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址2').AsString:=t_op_seae.fieldbyname('收货人地址2').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址3').AsString:=t_op_seae.fieldbyname('收货人地址3').AsString; frm_code_edicode.t_code_edicode.FieldByName('城市').AsString:=t_op_seae.fieldbyname('收货人城市').AsString; frm_code_edicode.t_code_edicode.FieldByName('邮编').AsString:=t_op_seae.fieldbyname('收货人邮编').AsString; frm_code_edicode.t_code_edicode.FieldByName('国家代码').AsString:=t_op_seae.fieldbyname('收货人国家代码').AsString; frm_code_edicode.t_code_edicode.FieldByName('联系人').AsString:=t_op_seae.fieldbyname('收货人联系人').AsString; frm_code_edicode.t_code_edicode.FieldByName('电话').AsString:=t_op_seae.fieldbyname('收货人电话').AsString; frm_code_edicode.t_code_edicode.FieldByName('州').AsString:=t_op_seae.fieldbyname('收货人州').AsString; end else begin frm_code_edicode.t_code_edicode.Edit; frm_code_edicode.t_code_edicode.FieldByName('名称').AsString:=t_op_seae.fieldbyname('收货人名称').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址1').AsString:=t_op_seae.fieldbyname('收货人地址1').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址2').AsString:=t_op_seae.fieldbyname('收货人地址2').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址3').AsString:=t_op_seae.fieldbyname('收货人地址3').AsString; frm_code_edicode.t_code_edicode.FieldByName('城市').AsString:=t_op_seae.fieldbyname('收货人城市').AsString; frm_code_edicode.t_code_edicode.FieldByName('邮编').AsString:=t_op_seae.fieldbyname('收货人邮编').AsString; frm_code_edicode.t_code_edicode.FieldByName('国家代码').AsString:=t_op_seae.fieldbyname('收货人国家代码').AsString; frm_code_edicode.t_code_edicode.FieldByName('联系人').AsString:=t_op_seae.fieldbyname('收货人联系人').AsString; frm_code_edicode.t_code_edicode.FieldByName('电话').AsString:=t_op_seae.fieldbyname('收货人电话').AsString; frm_code_edicode.t_code_edicode.FieldByName('州').AsString:=t_op_seae.fieldbyname('收货人州').AsString; end; frm_code_edicode.ShowModal; finally t_code_consignee.Requery(); FreeAndNil(frm_code_edicode); end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton21Click(Sender: TObject); begin frm_code_edicode:=Tfrm_code_edicode.Create(self); try frm_code_edicode.t_code_edicode.Open; if not frm_code_edicode.t_code_edicode.Locate('简称',RxDBLookupCombo2.DisplayValue,[]) then begin frm_code_edicode.t_code_edicode.Insert; frm_code_edicode.t_code_edicode.FieldByName('客户简称').AsString:=t_op_seae.fieldbyname('通知人').AsString; frm_code_edicode.t_code_edicode.FieldByName('通知人').AsBoolean:=true; frm_code_edicode.t_code_edicode.FieldByName('名称').AsString:=t_op_seae.fieldbyname('通知人名称').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址1').AsString:=t_op_seae.fieldbyname('通知人地址1').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址2').AsString:=t_op_seae.fieldbyname('通知人地址2').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址3').AsString:=t_op_seae.fieldbyname('通知人地址3').AsString; frm_code_edicode.t_code_edicode.FieldByName('城市').AsString:=t_op_seae.fieldbyname('通知人城市').AsString; frm_code_edicode.t_code_edicode.FieldByName('邮编').AsString:=t_op_seae.fieldbyname('通知人邮编').AsString; frm_code_edicode.t_code_edicode.FieldByName('国家代码').AsString:=t_op_seae.fieldbyname('通知人国家代码').AsString; frm_code_edicode.t_code_edicode.FieldByName('联系人').AsString:=t_op_seae.fieldbyname('通知人联系人').AsString; frm_code_edicode.t_code_edicode.FieldByName('电话').AsString:=t_op_seae.fieldbyname('通知人电话').AsString; frm_code_edicode.t_code_edicode.FieldByName('州').AsString:=t_op_seae.fieldbyname('通知人州').AsString; end else begin frm_code_edicode.t_code_edicode.Edit; frm_code_edicode.t_code_edicode.FieldByName('名称').AsString:=t_op_seae.fieldbyname('通知人名称').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址1').AsString:=t_op_seae.fieldbyname('通知人地址1').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址2').AsString:=t_op_seae.fieldbyname('通知人地址2').AsString; frm_code_edicode.t_code_edicode.FieldByName('地址3').AsString:=t_op_seae.fieldbyname('通知人地址3').AsString; frm_code_edicode.t_code_edicode.FieldByName('城市').AsString:=t_op_seae.fieldbyname('通知人城市').AsString; frm_code_edicode.t_code_edicode.FieldByName('邮编').AsString:=t_op_seae.fieldbyname('通知人邮编').AsString; frm_code_edicode.t_code_edicode.FieldByName('国家代码').AsString:=t_op_seae.fieldbyname('通知人国家代码').AsString; frm_code_edicode.t_code_edicode.FieldByName('联系人').AsString:=t_op_seae.fieldbyname('通知人联系人').AsString; frm_code_edicode.t_code_edicode.FieldByName('电话').AsString:=t_op_seae.fieldbyname('通知人电话').AsString; frm_code_edicode.t_code_edicode.FieldByName('州').AsString:=t_op_seae.fieldbyname('通知人州').AsString; end; frm_code_edicode.ShowModal; finally t_code_notifyparty.Requery(); FreeAndNil(frm_code_edicode); end; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo16Enter(Sender: TObject); begin RxDBLookupCombo16.LookupDisplay:='代码;客户简称'; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo16Exit(Sender: TObject); begin RxDBLookupCombo16.LookupDisplay:='客户简称'; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo1Enter(Sender: TObject); begin RxDBLookupCombo1.LookupDisplay:='代码;客户简称'; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo1Exit(Sender: TObject); begin RxDBLookupCombo1.LookupDisplay:='客户简称'; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo2Enter(Sender: TObject); begin RxDBLookupCombo2.LookupDisplay:='代码;客户简称'; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo2Exit(Sender: TObject); begin RxDBLookupCombo2.LookupDisplay:='客户简称'; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo16Change(Sender: TObject); begin if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then begin if RxDBLookupCombo16.DisplayValue<>'' then begin t_op_seae.fieldbyname('发货人名称').AsString:=t_code_shiper.FieldByName('名称').AsString; t_op_seae.fieldbyname('发货人地址1').AsString:=t_code_shiper.FieldByName('地址1').AsString; t_op_seae.fieldbyname('发货人地址2').AsString:=t_code_shiper.FieldByName('地址2').AsString; t_op_seae.fieldbyname('发货人地址3').AsString:=t_code_shiper.FieldByName('地址3').AsString; t_op_seae.fieldbyname('发货人城市').AsString:=t_code_shiper.FieldByName('城市').AsString; t_op_seae.fieldbyname('发货人邮编').AsString:=t_code_shiper.FieldByName('邮编').AsString; t_op_seae.fieldbyname('发货人国家代码').AsString:=t_code_shiper.FieldByName('国家代码').AsString; t_op_seae.fieldbyname('发货人联系人').AsString:=t_code_shiper.FieldByName('联系人').AsString; t_op_seae.fieldbyname('发货人电话').AsString:=t_code_shiper.FieldByName('电话').AsString; t_op_seae.fieldbyname('发货人州').AsString:=t_code_shiper.FieldByName('州').AsString; end; end; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo1Change(Sender: TObject); begin if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then begin if RxDBLookupCombo1.DisplayValue<>'' then begin t_op_seae.fieldbyname('收货人名称').AsString:=t_code_consignee.FieldByName('名称').AsString; t_op_seae.fieldbyname('收货人地址1').AsString:=t_code_consignee.FieldByName('地址1').AsString; t_op_seae.fieldbyname('收货人地址2').AsString:=t_code_consignee.FieldByName('地址2').AsString; t_op_seae.fieldbyname('收货人地址3').AsString:=t_code_consignee.FieldByName('地址3').AsString; t_op_seae.fieldbyname('收货人城市').AsString:=t_code_consignee.FieldByName('城市').AsString; t_op_seae.fieldbyname('收货人邮编').AsString:=t_code_consignee.FieldByName('邮编').AsString; t_op_seae.fieldbyname('收货人国家代码').AsString:=t_code_consignee.FieldByName('国家代码').AsString; t_op_seae.fieldbyname('收货人联系人').AsString:=t_code_consignee.FieldByName('联系人').AsString; t_op_seae.fieldbyname('收货人电话').AsString:=t_code_consignee.FieldByName('电话').AsString; t_op_seae.fieldbyname('收货人州').AsString:=t_code_consignee.FieldByName('州').AsString; end; end; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo2Change(Sender: TObject); begin if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit)then begin if RxDBLookupCombo2.DisplayValue<>'' then begin t_op_seae.fieldbyname('通知人名称').AsString:=t_code_notifyparty.FieldByName('名称').AsString; t_op_seae.fieldbyname('通知人地址1').AsString:=t_code_notifyparty.FieldByName('地址1').AsString; t_op_seae.fieldbyname('通知人地址2').AsString:=t_code_notifyparty.FieldByName('地址2').AsString; t_op_seae.fieldbyname('通知人地址3').AsString:=t_code_notifyparty.FieldByName('地址3').AsString; t_op_seae.fieldbyname('通知人城市').AsString:=t_code_notifyparty.FieldByName('城市').AsString; t_op_seae.fieldbyname('通知人邮编').AsString:=t_code_notifyparty.FieldByName('邮编').AsString; t_op_seae.fieldbyname('通知人国家代码').AsString:=t_code_notifyparty.FieldByName('国家代码').AsString; t_op_seae.fieldbyname('通知人联系人').AsString:=t_code_notifyparty.FieldByName('联系人').AsString; t_op_seae.fieldbyname('通知人电话').AsString:=t_code_notifyparty.FieldByName('电话').AsString; t_op_seae.fieldbyname('通知人州').AsString:=t_code_notifyparty.FieldByName('州').AsString; end; end; end; procedure Tfrm_op_seae_edi_data.PutToDebugLog(Operation, S1: String); Var S: String; begin while Length(S1) > 0 do begin if Pos(#13, S1) > 0 then begin S := Copy(S1, 1, Pos(#13, S1) - 1); Delete(S1, 1, Pos(#13, S1)); if S1[1] = #10 then Delete(S1, 1, 1); end else S := S1; DebugListBox.ItemIndex := DebugListBox.Items.Add(Operation + S); end; end; procedure Tfrm_op_seae_edi_data.IdFTP1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); begin DebugListBox.ItemIndex := DebugListBox.Items.Add(AStatusText); end; procedure Tfrm_op_seae_edi_data.IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer); Var S: String; TotalTime: TDateTime; H, M, Sec, MS: Word; DLTime: Double; begin TotalTime := Now - STime; DecodeTime(TotalTime, H, M, Sec, MS); Sec := Sec + M * 60 + H * 3600; DLTime := Sec + MS / 1000; if DLTime > 0 then AverageSpeed := {(AverageSpeed + }(AWorkCount / 1024) / DLTime{) / 2}; if AverageSpeed > 0 then begin Sec := Trunc(((ProgressBar1.Max - AWorkCount) / 1024) / AverageSpeed); S := Format('%2d:%2d:%2d', [Sec div 3600, (Sec div 60) mod 60, Sec mod 60]); S := '剩余时间 ' + S; end else S := ''; S := FormatFloat('0.00 KB/s', AverageSpeed) + '; ' + S; case AWorkMode of wmRead: StatusBar1.Panels[1].Text := '下载速度 ' + S; wmWrite: StatusBar1.Panels[1].Text := '上传速度 ' + S; end; if AbortTransfer then IdFTP1.Abort; ProgressBar1.Position := AWorkCount; AbortTransfer := false; end; procedure Tfrm_op_seae_edi_data.IdFTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer); begin TransferrignData := true; AbortTransfer := false; STime := Now; if AWorkCountMax > 0 then ProgressBar1.Max := AWorkCountMax else ProgressBar1.Max := BytesToTransfer; AverageSpeed := 0; end; procedure Tfrm_op_seae_edi_data.IdFTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode); begin StatusBar1.Panels[1].Text := '传输完毕.'; BytesToTransfer := 0; TransferrignData := false; ProgressBar1.Position := 0; AverageSpeed := 0; end; procedure Tfrm_op_seae_edi_data.bsSkinButton22Click(Sender: TObject); var Pnt:Tpoint; begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.State=dsinsert)or(t_op_seae1.DataSet.State=dsedit) then t_op_seae1.DataSet.post; Pnt:=bsSkinButton22.ClientToScreen(Point(0,bsSkinButton22.Height)); PopupMenu4.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seae_edi_data.NZYClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_cosco) then frm_op_seae_edi_custom_cosco:=tfrm_op_seae_edi_custom_cosco.Create(application); frm_op_seae_edi_custom_cosco.ShowModal; finally frm_op_seae_edi_custom_cosco.free; frm_op_seae_edi_custom_cosco:=nil; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton23Click(Sender: TObject); begin t_op_seae.Edit; t_op_seae.fieldbyname('通知人名称').AsString:=t_op_seae.fieldbyname('收货人名称').AsString;; t_op_seae.fieldbyname('通知人地址1').AsString:=t_op_seae.fieldbyname('收货人地址1').AsString; t_op_seae.fieldbyname('通知人地址2').AsString:=t_op_seae.fieldbyname('收货人地址2').AsString; t_op_seae.fieldbyname('通知人地址3').AsString:=t_op_seae.fieldbyname('收货人地址3').AsString; t_op_seae.fieldbyname('通知人城市').AsString:=t_op_seae.fieldbyname('收货人城市').AsString; t_op_seae.fieldbyname('通知人邮编').AsString:=t_op_seae.fieldbyname('收货人邮编').AsString; t_op_seae.fieldbyname('通知人国家代码').AsString:=t_op_seae.fieldbyname('收货人国家代码').AsString; t_op_seae.fieldbyname('通知人联系人').AsString:=t_op_seae.fieldbyname('收货人联系人').AsString; t_op_seae.fieldbyname('通知人电话').AsString:=t_op_seae.fieldbyname('收货人电话').AsString; t_op_seae.fieldbyname('通知人州').AsString:=t_op_seae.fieldbyname('收货人州').AsString; t_op_seae.Post; end; procedure Tfrm_op_seae_edi_data.NZTClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_custom_edi_zt) then frm_op_seae_custom_edi_zt:=tfrm_op_seae_custom_edi_zt.Create(application); frm_op_seae_custom_edi_zt.ShowModal; finally frm_op_seae_custom_edi_zt.free; frm_op_seae_custom_edi_zt:=nil; end; end; procedure Tfrm_op_seae_edi_data.NWD2101Click(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_waidai) then frm_op_seae_edi_custom_waidai:=tfrm_op_seae_edi_custom_waidai.Create(application); frm_op_seae_edi_custom_waidai.ShowModal; finally frm_op_seae_edi_custom_waidai.free; frm_op_seae_edi_custom_waidai:=nil; end; end; procedure Tfrm_op_seae_edi_data.t_op_ctnBeforePost(DataSet: TDataSet); begin if length(t_op_ctn.FieldByName('唛头').AsString)>180 then begin MessageDlg('唛头长度不能超过180个字符',mtWarning,[mbOk],0); Abort; end; if length(t_op_ctn.FieldByName('货描').AsString)>180 then begin MessageDlg('货描长度不能超过180个字符',mtWarning,[mbOk],0); Abort; end; end; procedure Tfrm_op_seae_edi_data.NWD1101Click(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_waidai_1101) then frm_op_seae_edi_custom_waidai_1101:=tfrm_op_seae_edi_custom_waidai_1101.Create(application); frm_op_seae_edi_custom_waidai_1101.ShowModal; finally frm_op_seae_edi_custom_waidai_1101.free; frm_op_seae_edi_custom_waidai_1101:=nil; end; end; procedure Tfrm_op_seae_edi_data.NYDClick(Sender: TObject); var i:integer; str:widestring; aAdoQuery:TAdoQuery; aDataSource:TDataSource; begin if t_op_seae.IsEmpty then exit; if dxDBGrid1.SelectedCount>0 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if i=0 then str:='('+''''+t_op_seae.fieldbyname('编号').asstring+'''' else str:=str+','+''''+t_op_seae.fieldbyname('编号').asstring+''''; t_op_seae.Edit; t_op_seae.FieldByName('EDI状态').AsString:='已发送'; t_op_seae.Post; end; end else begin str:='('+''''+t_op_seae.fieldbyname('编号').asstring+''''; end; str:=str+')'; aDataSource:=TDataSource.Create(nil); aAdoQuery:=CreateAdoQuery; aDataSource.DataSet:=aAdoQuery; with aAdoQuery do try close; sql.clear; sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.编号=t_op_seae_edi.编号 ' +' where t_op_ctn_edi.编号 in '+str +' order by t_op_ctn_edi.编号'); open; sys_print('远大舱单',2,aDataSource,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); finally aDataSource.Free; Free; end; end; { if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_yd) then frm_op_seae_edi_custom_yd:=tfrm_op_seae_edi_custom_yd.Create(application); frm_op_seae_edi_custom_yd.ShowModal; finally frm_op_seae_edi_custom_yd.free; frm_op_seae_edi_custom_yd:=nil; end; } procedure Tfrm_op_seae_edi_data.NLDClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有托单信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_ld) then frm_op_seae_edi_custom_ld:=tfrm_op_seae_edi_custom_ld.Create(application); frm_op_seae_edi_custom_ld.ShowModal; finally frm_op_seae_edi_custom_ld.free; frm_op_seae_edi_custom_ld:=nil; end; end; procedure Tfrm_op_seae_edi_data.NWYClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_wy) then frm_op_seae_edi_custom_wy:=tfrm_op_seae_edi_custom_wy.Create(application); frm_op_seae_edi_custom_wy.ShowModal; finally frm_op_seae_edi_custom_wy.free; frm_op_seae_edi_custom_wy:=nil; end; end; procedure Tfrm_op_seae_edi_data.NHGClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_hg) then frm_op_seae_edi_custom_hg:=tfrm_op_seae_edi_custom_hg.Create(application); frm_op_seae_edi_custom_hg.ShowModal; finally frm_op_seae_edi_custom_hg.free; frm_op_seae_edi_custom_hg:=nil; end; end; procedure Tfrm_op_seae_edi_data.btnSealClick(Sender: TObject); begin frm_main.view_momo(t_op_ctn1,'封号'); end; procedure Tfrm_op_seae_edi_data.NHFClick(Sender: TObject); var i:integer; str:widestring; aAdoQuery:TAdoQuery; aDataSource:TDataSource; begin if t_op_seae.IsEmpty then exit; if dxDBGrid1.SelectedCount>0 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if i=0 then str:='('+''''+t_op_seae.fieldbyname('编号').asstring+'''' else str:=str+','+''''+t_op_seae.fieldbyname('编号').asstring+''''; t_op_seae.Edit; t_op_seae.FieldByName('EDI状态').AsString:='已发送'; t_op_seae.Post; end; end else begin str:='('+''''+t_op_seae.fieldbyname('编号').asstring+''''; end; str:=str+')'; aDataSource:=TDataSource.Create(nil); aAdoQuery:=CreateAdoQuery; aDataSource.DataSet:=aAdoQuery; with aAdoQuery do try close; sql.clear; sql.add('select t_op_ctn_edi.*,t_op_seae_edi.* from t_op_ctn_edi left Join t_op_seae_edi on t_op_ctn_edi.编号=t_op_seae_edi.编号 ' +' where t_op_ctn_edi.编号 in '+str +' order by t_op_ctn_edi.编号'); open; sys_print('海丰舱单',2,aDataSource,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); finally aDataSource.Free; Free; end; end; procedure Tfrm_op_seae_edi_data.wwDBComboBoxOPDropDown(Sender: TObject); var AdoQuery1:TAdoQuery; begin wwDBComboBoxOP.items.clear; AdoQuery1:=CreateAdoQuery; with AdoQuery1 do try Close;sql.Clear; SQL.Add('select * from t_sys_employee where 状态=''在职'''); SQL.Add('Order by 姓名'); Open;first; while not Eof do begin wwDBComboBoxOP.Items.Add(AdoQuery1.fieldbyname('姓名').AsString); Next; end; finally Free; end; end; procedure Tfrm_op_seae_edi_data.NZHClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_zh) then frm_op_seae_edi_custom_zh:=tfrm_op_seae_edi_custom_zh.Create(application); frm_op_seae_edi_custom_zh.ShowModal; finally frm_op_seae_edi_custom_zh.free; frm_op_seae_edi_custom_zh:=nil; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton15Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin if (t_op_ctn.State=dsinsert)or(t_op_ctn.State=dsedit) then t_op_ctn.post; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try close; sql.clear; sql.add('select sum(件数) 件数, sum(重量) 重量,sum(尺码) 尺码 from t_op_ctn_edi'); sql.add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=t_op_seae.fieldbyname('编号').asstring; open;First; if not IsEmpty then begin if t_op_seae=nil then exit; if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit) then t_op_seae.post; t_op_seae.Edit; t_op_seae.FieldByName('件数').AsInteger:=FieldByName('件数').AsInteger; t_op_seae.FieldByName('重量').AsFloat:=FieldByName('重量').AsFloat; t_op_seae.FieldByName('尺码').AsFloat:=FieldByName('尺码').AsFloat; t_op_seae.Post; end; finally Free; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton47Click(Sender: TObject); begin frm_main.view_momo(t_op_seae1,'唛头'); end; procedure Tfrm_op_seae_edi_data.bsSkinButton24Click(Sender: TObject); begin frm_main.view_momo(t_op_seae1,'货物描述'); end; procedure Tfrm_op_seae_edi_data.bsSkinButton25Click(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.State=dsinsert)or(t_op_seae1.DataSet.State=dsedit) then t_op_seae1.DataSet.post; sys_print('舱单申报',2,t_op_seae1,t_op_ctn1,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_edi_data.bsSkinButton26Click(Sender: TObject); begin frm_main.view_momo(t_op_seae1,'箱号封号'); end; procedure Tfrm_op_seae_edi_data.wwDBLookupCombo3Change(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_loaport.Locate('英文名',wwDBLookupCombo3.text,[]) then begin t_op_seae1.DataSet['装港代码']:=frm_data_share.t_code_loaport['EDI代码']; end; end; end; procedure Tfrm_op_seae_edi_data.wwDBLookupCombo3Exit(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_loaport.Locate('英文名',wwDBLookupCombo3.text,[]) then begin t_op_seae1.DataSet['装港代码']:=frm_data_share.t_code_loaport['EDI代码']; end; end; end; procedure Tfrm_op_seae_edi_data.wwDBLookupCombo52Change(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then begin t_op_seae1.DataSet['卸货代码']:=frm_data_share.t_code_disport['EDI代码']; end; end; end; procedure Tfrm_op_seae_edi_data.wwDBLookupCombo52Exit(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then begin t_op_seae1.DataSet['卸货代码']:=frm_data_share.t_code_disport['EDI代码']; end; end; end; procedure Tfrm_op_seae_edi_data.wwDBLookupCombo17Change(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo17.text,[]) then begin t_op_seae1.DataSet['目的代码']:=frm_data_share.t_code_disport['EDI代码']; end; end; end; procedure Tfrm_op_seae_edi_data.wwDBLookupCombo17Exit(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if (t_op_seae1.DataSet.state=dsedit)or(t_op_seae1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo17.text,[]) then begin t_op_seae1.DataSet['目的代码']:=frm_data_share.t_code_disport['EDI代码']; end; end; end; procedure Tfrm_op_seae_edi_data.N1Click(Sender: TObject); var Ext,adate,bsno,corp,vslvoy,mblno,id,cntNo,ctnName,s:String; ExcelTemplet:Variant; i,j,k:integer; M,D,Y:Word; imp,seae_apply_add_total:boolean; aAdoQuery,t_op_ctn_edi:TAdoQuery; alist:TStringList; 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; function getETD(VSL,VOY:string):string; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; result:=''; try aQuery.Close; aQuery.SQL.Text:='select * from v_vessel_voyage where 英文船名='''+VSL+''' and 航次='''+VOY+''''; aQuery.Open; if not aQuery.IsEmpty then result:=aQuery.fieldbyname('开船日期').AsString; finally FreeAndNil(aQuery); end; end; begin // id:=get_id; j:=1; aAdoQuery:=CreateAdoQuery; with aAdoQuery do begin close;SQL.Clear; SQL.Add('select * from t_op_seae_edi'); SQL.Add('where 主提单号=:主提单号'); Parameters.ParamByName('主提单号').Value:=''; end; alist:=TStringList.Create; t_op_ctn_edi:=CreateAdoQuery; t_op_ctn_edi.close; t_op_ctn_edi.sql.Text:='select * from t_op_ctn_edi where 编号=:编号'; if OpenDialog1.Execute then begin Ext:=lowercase(ExtractFileExt(OpenDialog1.FileName)); if Ext='.xls' then begin ExcelTemplet:= CreateOleObject('Excel.Application'); ExcelTemplet.Workbooks.Open(OpenDialog1.FileName); try frm_main.db.BeginTrans; t_op_seae.DisableControls; t_op_ctn.DisableControls; I:=2; while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,3].Value)<>'' do begin mblno:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,3].Value); aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('主提单号').Value:=mblno; aAdoQuery.Open; if aAdoQuery.IsEmpty then begin j:=j+1; id:=get_id; t_op_seae.Insert; t_op_seae['编号']:=id; t_op_seae['业务编号']:=mblno; t_op_seae['主编号']:=''; t_op_seae['EDI类型']:='CN'; t_op_seae['EDI状态']:='未发送'; t_op_seae['录入人']:=employee; t_op_seae['录入日期']:=now; t_op_seae['主提单号']:=mblno; t_op_seae['付费方式']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,5].Value); t_op_seae['签单地点']:='QINGDAO,CHINA'; t_op_seae['发货人代码']:=''; // t_op_seae['船公司']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,4].Value); t_op_seae['船公司代码']:=getcustedi(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,4].Value)); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,13].Value; s:=''; for k:=0 to alist.Count-1 do begin s:=Trim(alist[k])+s; end; t_op_seae['发货人名称']:=Trim(s); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,14].Value; s:=''; for k:=0 to alist.Count-1 do begin s:=Trim(alist[k])+s; end; t_op_seae['发货人地址1']:=Trim(s); t_op_seae['发货人地址2']:=''; t_op_seae['发货人地址3']:=''; t_op_seae['发货人']:=''; alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,15].Value; s:=''; for k:=0 to alist.Count-1 do begin s:=Trim(alist[k])+s; end; t_op_seae['收货人名称']:=Trim(s); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,16].Value; s:=''; for k:=0 to alist.Count-1 do begin s:=Trim(alist[k])+s; end; t_op_seae['收货人地址1']:=Trim(s); t_op_seae['收货人地址2']:=''; t_op_seae['收货人地址3']:=''; t_op_seae['收货人代码']:=''; alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,17].Value; s:=''; for k:=0 to alist.Count-1 do begin s:=Trim(alist[k])+s; end; t_op_seae['通知人名称']:=Trim(s); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,18].Value; s:=''; for k:=0 to alist.Count-1 do begin s:=Trim(alist[k])+s; end; t_op_seae['通知人地址1']:=Trim(s); t_op_seae['通知人地址2']:=''; t_op_seae['通知人地址3']:=''; t_op_seae['船名']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,1].Value); t_op_seae['航次']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value); t_op_seae['船舶IMO']:=GetvesselEdi(t_op_seae['船名']); if getETD(t_op_seae['船名'],t_op_seae['航次'])<>'' then t_op_seae['开船日期']:=getETD(t_op_seae['船名'],t_op_seae['航次']); t_op_seae['装货港']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,7].Value); if frm_data_share.t_code_loaport.Locate('英文名',t_op_seae['装货港'],[]) then begin t_op_seae['装港代码']:=frm_data_share.t_code_loaport['EDI代码']; end else t_op_seae['装港代码']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,8].Value); t_op_seae['卸货港']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,9].Value); if frm_data_share.t_code_disport.Locate('英文名',t_op_seae['卸货港'],[]) then begin t_op_seae['卸货代码']:=frm_data_share.t_code_disport['EDI代码']; end else t_op_seae['卸货代码']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,10].Value); t_op_seae['目的地']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,11].Value); if frm_data_share.t_code_disport.Locate('英文名',t_op_seae['卸货港'],[]) then begin t_op_seae['目的代码']:=frm_data_share.t_code_disport['EDI代码']; end else t_op_seae['目的代码']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,12].Value); t_op_seae['运输条款']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,6].Value); t_op_seae['运输方式']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,28].Value); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,27].Value; t_op_seae['唛头']:=alist.Text; alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,26].Value; t_op_seae['货物描述']:=alist.Text; t_op_seae['件数']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,23].Value); t_op_seae['包装']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,22].Value); t_op_seae['重量']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,24].Value); t_op_seae['尺码']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,25].Value); t_op_seae['危险品分类']:=''; t_op_seae['危险品编号']:=''; t_op_seae['冷藏通风量']:=''; t_op_seae['温度单位']:=''; t_op_seae['设置温度']:=''; t_op_seae['最低温度']:=''; t_op_seae['最高温度']:=''; t_op_seae['货物标识']:=''; t_op_seae['运费协议号']:=''; t_op_seae['湿度']:=''; t_op_seae['订舱号码']:=''; t_op_seae['运输方式']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,28].Value); if pos('冻',VartoStr(ExcelTemplet.ActiveSheet.Cells[I,29].Value))>0 then begin t_op_seae['货物标识']:='R'; t_op_seae['温度单位']:='C'; t_op_seae['设置温度']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,30].Value); t_op_seae['最低温度']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,30].Value); t_op_seae['最高温度']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,30].Value); end else if pos('危',VartoStr(ExcelTemplet.ActiveSheet.Cells[I,29].Value))>0 then begin t_op_seae['货物标识']:='D'; t_op_seae['危险品分类']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,31].Value); t_op_seae['危险品编号']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,32].Value); end else t_op_seae['货物标识']:='S'; t_op_seae['文件类型']:='Master'; t_op_seae.Post; t_op_ctn_edi.Close; t_op_ctn_edi.Parameters.ParamByName('编号').Value:=id; t_op_ctn_edi.Open; t_op_ctn_edi.Insert; t_op_ctn_edi['编号']:=id; cntNo:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),1,2); ctnName:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),3,2); // showmessage(mblno+' '+cntNo+'--'+ctnName); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([cntNo,ctnName]),[]) then begin t_op_ctn_edi['代码']:=frm_data_share.t_code_ctn.fieldbyname('代码').asstring; end else begin t_op_ctn_edi['代码']:='无'; end; t_op_ctn_edi['尺寸']:=cntNo; t_op_ctn_edi['箱型']:=ctnName; t_op_ctn_edi['数量']:=1; t_op_ctn_edi['表现形式']:=cntNo+''''+ctnName; t_op_ctn_edi['箱号']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,20].Value); t_op_ctn_edi['封号']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,21].Value); t_op_ctn_edi['件数']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,23].Value); t_op_ctn_edi['包装']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,22].Value); t_op_ctn_edi['重量']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,24].Value); t_op_ctn_edi['尺码']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,25].Value); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,27].Value; t_op_ctn_edi['唛头']:=alist.Text; alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,26].Value; t_op_ctn_edi['货描']:=alist.Text; 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; end else begin t_op_ctn_edi.Close; t_op_ctn_edi.Parameters.ParamByName('编号').Value:=aAdoQuery.fieldbyname('编号').asstring; t_op_ctn_edi.Open; if not t_op_ctn_edi.Locate('箱号;封号',VarArrayOf([VartoStr(ExcelTemplet.ActiveSheet.Cells[I,20].Value),VartoStr(ExcelTemplet.ActiveSheet.Cells[I,21].Value)]),[]) then begin t_op_ctn_edi.Insert; t_op_ctn_edi['编号']:=aAdoQuery.fieldbyname('编号').asstring; cntNo:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),1,2); ctnName:=Copy(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,19].Value),3,2); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([cntNo,ctnName]),[]) then begin t_op_ctn_edi['代码']:=frm_data_share.t_code_ctn.fieldbyname('代码').asstring; end else begin t_op_ctn_edi['代码']:='无'; end; t_op_ctn_edi['尺寸']:=cntNo; t_op_ctn_edi['箱型']:=ctnName; t_op_ctn_edi['数量']:=1; t_op_ctn_edi['表现形式']:=cntNo+''''+ctnName; t_op_ctn_edi['箱号']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,20].Value); t_op_ctn_edi['封号']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,21].Value); t_op_ctn_edi['件数']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,23].Value); t_op_ctn_edi['包装']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,22].Value); t_op_ctn_edi['重量']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,24].Value); t_op_ctn_edi['尺码']:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,25].Value); alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,27].Value; t_op_ctn_edi['唛头']:=alist.Text; alist.Text:=''; alist.Text:=ExcelTemplet.ActiveSheet.Cells[I,26].Value; t_op_ctn_edi['货描']:=alist.Text; 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; end; UpdateCTN(aAdoQuery.fieldbyname('编号').asstring); end; i:=i+1; end; frm_main.db.CommitTrans; finally t_op_seae.EnableControls; t_op_ctn.EnableControls; ExcelTemplet.DisplayAlerts := false;//是否提示存盘 ExcelTemplet.Quit;//如果出错则退出 MessageDlg('导入:'+IntTostr(i-2)+'行 '+'票数:'+IntTostr(j-1)+'票 ', mtConfirmation, [mbYes],0); if frm_main.db.InTransaction then begin ShowMessage('导入时出错,请刷新重试!'); frm_main.db.RollbackTrans; end; end; end; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton28Click(Sender: TObject); var i :Integer; begin with t_op_ctn do begin First; while not eof do begin Edit; FieldByName('尺码').AsFloat:=s_w(0,FieldByName('尺码').AsFloat); post; Next; end; end; end; procedure Tfrm_op_seae_edi_data.NHGYDTClick(Sender: TObject); begin if t_op_seae.isempty then begin showmessage('对不起,没有数据信息,不能生成EDI文件!'); exit; end; try if not assigned(frm_op_seae_edi_custom_hgYDT) then frm_op_seae_edi_custom_hgYDT:=tfrm_op_seae_edi_custom_hgYDT.Create(application); frm_op_seae_edi_custom_hgYDT.ShowModal; finally frm_op_seae_edi_custom_hgYDT.free; frm_op_seae_edi_custom_hgYDT:=nil; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton29Click(Sender: TObject); var xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_web: WideString; i :Integer; aAdoQuery,bAdoQuery:TAdoQuery; AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond:Word; STATUS:string; begin getwebservice_ds; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); aAdoQuery:=CreateAdoQuery; with aAdoQuery do begin Close;Sql.Clear; SQL.Add('Insert Into t_op_state (编号 ,业务状态 ,是否完成,完成时间,完成人,录入人 ,录入日期,系统加入,备注)'); SQL.Add('values (:编号,:业务状态 ,:是否完成,:完成时间,:完成人,:录入人,:录入日期,:系统加入,:备注)'); Close; end; bAdoQuery:=CreateAdoQuery; with bAdoQuery do begin Close;Sql.Clear; SQL.Add('select 业务状态,完成时间 from t_op_state'); SQL.Add('where 编号=:编号'); SQL.Add('order by 完成时间 desc'); end; try cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; xmldoc.Options:=[doNamespaceDecl]; s_web:=mServiceSoap_Ds.LoadCustomMainfastStatus(t_op_seae.FieldByName('主提单号').AsString); xmldoc.LoadFromXML(s_web); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\青岛海关\dscustom.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; if cds.RecordCount<=0 then begin ShowMessage('海关没有返回数据'); exit; end; with cds do begin First; while not Eof do begin aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('编号').Value:=t_op_seae.FieldByName('主编号').AsString; if Copy(FieldByName('STATUS').AsString,1,5)='11104' then STATUS:='舱单运输工具无预报动态' else if Copy(FieldByName('STATUS').AsString,1,5)='11124' then STATUS:='单已放行不能再拼箱' else if Copy(FieldByName('STATUS').AsString,1,5)='15302' then STATUS:='理货报告传输成功理货异常' else if Copy(FieldByName('STATUS').AsString,1,5)='21102' then STATUS:='舱单运输工具未备案' else if Copy(FieldByName('STATUS').AsString,1,5)='21106' then STATUS:='提(运)单号重复' else if Copy(FieldByName('STATUS').AsString,1,5)='21107' then STATUS:='总提(运)单未向海关传输' else if Copy(FieldByName('STATUS').AsString,1,5)='21301' then STATUS:='预配舱单主要数据传输成功' else if Copy(FieldByName('STATUS').AsString,1,5)='22103' then STATUS:=' 未找到对应提(运)单' else if Copy(FieldByName('STATUS').AsString,1,5)='22201' then STATUS:='预配舱单其他数据申报审核通过' else if Copy(FieldByName('STATUS').AsString,1,5)='23105' then STATUS:='该提(运)单已核注' else if Copy(FieldByName('STATUS').AsString,1,5)='23301' then STATUS:='预配舱单修改申请审核通过' else if Copy(FieldByName('STATUS').AsString,1,5)='24103' then STATUS:='申请删除的提(运)单不存在' else if Copy(FieldByName('STATUS').AsString,1,5)='24301' then STATUS:='预配舱单删除申请审核通过' else if Copy(FieldByName('STATUS').AsString,1,5)='25201' then STATUS:='海运运抵报告传输成功' else if Copy(FieldByName('STATUS').AsString,1,5)='99001' then STATUS:=' 报文不符合填制规范' else STATUS:=FieldByName('STATUS').AsString; aAdoQuery.Parameters.ParamByName('业务状态').Value:=STATUS; aAdoQuery.Parameters.ParamByName('是否完成').Value:=true; aAdoQuery.Parameters.ParamByName('完成人').Value:=employee; AYear:=StrToInt(Copy(FieldByName('DATESTR').AsString,1,4)); AMonth:=StrToInt(Copy(FieldByName('DATESTR').AsString,5,2)); ADay:=StrToInt(Copy(FieldByName('DATESTR').AsString,7,2)); AHour:=StrToInt(Copy(FieldByName('DATESTR').AsString,9,2)); AMinute:=StrToInt(Copy(FieldByName('DATESTR').AsString,11,2)); 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:=FieldByName('STATUS').AsString; aAdoQuery.ExecSQL; Next; end; end; finally bAdoQuery.Close; bAdoQuery.Parameters.ParamByName('编号').Value:=t_op_seae.FieldByName('主编号').AsString; bAdoQuery.Open; bAdoQuery.First; modify_all:=True; if bAdoQuery.FieldByName('业务状态').AsString<>'' then begin t_op_seae.Edit; if bAdoQuery.FieldByName('业务状态').AsString='预配舱单主要数据传输成功' then t_op_seae.FieldByName('当前状态').AsString:='主要数据传输成功' else if bAdoQuery.FieldByName('业务状态').AsString='预配舱单其他数据申报审核通过' then t_op_seae.FieldByName('当前状态').AsString:='其他数据审核通过' else if bAdoQuery.FieldByName('业务状态').AsString='运抵比对结果为:运抵正常' then t_op_seae.FieldByName('当前状态').AsString:='已运抵' else if bAdoQuery.FieldByName('业务状态').AsString='提运单放行' then t_op_seae.FieldByName('当前状态').AsString:='已放行' else if bAdoQuery.FieldByName('业务状态').AsString='预配舱单修改申请审核通过' then t_op_seae.FieldByName('当前状态').AsString:='修改通过'; t_op_seae.Post; end; modify_all:=False; aAdoQuery.Free; bAdoQuery.Free; cds.Free; t_op_state.Requery(); DBEdit3.OnChange(Sender); end; end; procedure Tfrm_op_seae_edi_data.SelectReciveData(bsno,mblno:string); var xmldoc:IXMLDocument; cds:TClientDataSet; XMLTransformProvider1:TXMLTransformProvider; s_web: WideString; i :Integer; aAdoQuery,bAdoQuery:TAdoQuery; AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond:Word; STATUS:string; begin cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); aAdoQuery:=CreateAdoQuery; with aAdoQuery do begin Close;Sql.Clear; SQL.Add('Insert Into t_op_state (编号 ,业务状态 ,是否完成,完成时间,完成人,录入人 ,录入日期,系统加入,备注)'); SQL.Add('values (:编号,:业务状态 ,:是否完成,:完成时间,:完成人,:录入人,:录入日期,:系统加入,:备注)'); Close; end; bAdoQuery:=CreateAdoQuery; with bAdoQuery do begin Close;Sql.Clear; SQL.Add('select 业务状态,完成时间 from t_op_state'); SQL.Add('where 编号=:编号'); SQL.Add('order by 完成时间 desc'); end; try cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; xmldoc.Options:=[doNamespaceDecl]; s_web:=mServiceSoap_Ds.LoadCustomMainfastStatus(mblno); xmldoc.LoadFromXML(s_web); XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\青岛海关\dscustom.xtr'; XMLTransformProvider1.TransformRead.SourceXmlDocument:=xmldoc.GetDOMDocument; cds.Data:=XMLTransformProvider1.Data; cds.Active:=true; with cds do begin First; while not Eof do begin aAdoQuery.Close; aAdoQuery.Parameters.ParamByName('编号').Value:=bsno; if Copy(FieldByName('STATUS').AsString,1,5)='11104' then STATUS:='舱单运输工具无预报动态' else if Copy(FieldByName('STATUS').AsString,1,5)='11124' then STATUS:='单已放行不能再拼箱' else if Copy(FieldByName('STATUS').AsString,1,5)='15302' then STATUS:='理货报告传输成功理货异常' else if Copy(FieldByName('STATUS').AsString,1,5)='21102' then STATUS:='舱单运输工具未备案' else if Copy(FieldByName('STATUS').AsString,1,5)='21106' then STATUS:='提(运)单号重复' else if Copy(FieldByName('STATUS').AsString,1,5)='21107' then STATUS:='总提(运)单未向海关传输' else if Copy(FieldByName('STATUS').AsString,1,5)='21301' then STATUS:='预配舱单主要数据传输成功' else if Copy(FieldByName('STATUS').AsString,1,5)='22103' then STATUS:=' 未找到对应提(运)单' else if Copy(FieldByName('STATUS').AsString,1,5)='22201' then STATUS:='预配舱单其他数据申报审核通过' else if Copy(FieldByName('STATUS').AsString,1,5)='23105' then STATUS:='该提(运)单已核注' else if Copy(FieldByName('STATUS').AsString,1,5)='23301' then STATUS:='预配舱单修改申请审核通过' else if Copy(FieldByName('STATUS').AsString,1,5)='24103' then STATUS:='申请删除的提(运)单不存在' else if Copy(FieldByName('STATUS').AsString,1,5)='24301' then STATUS:='预配舱单删除申请审核通过' else if Copy(FieldByName('STATUS').AsString,1,5)='25201' then STATUS:='海运运抵报告传输成功' else if Copy(FieldByName('STATUS').AsString,1,5)='99001' then STATUS:=' 报文不符合填制规范' else STATUS:=FieldByName('STATUS').AsString; aAdoQuery.Parameters.ParamByName('业务状态').Value:=STATUS; aAdoQuery.Parameters.ParamByName('是否完成').Value:=true; aAdoQuery.Parameters.ParamByName('完成人').Value:=employee; AYear:=StrToInt(Copy(FieldByName('DATESTR').AsString,1,4)); AMonth:=StrToInt(Copy(FieldByName('DATESTR').AsString,5,2)); ADay:=StrToInt(Copy(FieldByName('DATESTR').AsString,7,2)); AHour:=StrToInt(Copy(FieldByName('DATESTR').AsString,9,2)); AMinute:=StrToInt(Copy(FieldByName('DATESTR').AsString,11,2)); 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:=FieldByName('STATUS').AsString; aAdoQuery.ExecSQL; Next; end; end; finally bAdoQuery.Close; bAdoQuery.Parameters.ParamByName('编号').Value:=bsno; bAdoQuery.Open; bAdoQuery.First; modify_all:=True; t_op_seae.Edit; if bAdoQuery.FieldByName('业务状态').AsString<>'' then begin if bAdoQuery.FieldByName('业务状态').AsString='预配舱单主要数据传输成功' then t_op_seae.FieldByName('当前状态').AsString:='主要数据传输成功' else if bAdoQuery.FieldByName('业务状态').AsString='预配舱单其他数据申报审核通过' then t_op_seae.FieldByName('当前状态').AsString:='其他数据审核通过' else if bAdoQuery.FieldByName('业务状态').AsString='运抵比对结果为:运抵正常' then t_op_seae.FieldByName('当前状态').AsString:='已运抵' else if bAdoQuery.FieldByName('业务状态').AsString='提运单放行' then t_op_seae.FieldByName('当前状态').AsString:='已放行' else if bAdoQuery.FieldByName('业务状态').AsString='预配舱单修改申请审核通过' then t_op_seae.FieldByName('当前状态').AsString:='修改通过' end; t_op_seae.Post; aAdoQuery.Free; XMLTransformProvider1.Free; cds.Free; bAdoQuery.Free; modify_all:=False; end; end; procedure Tfrm_op_seae_edi_data.t_op_seaeBeforeEdit(DataSet: TDataSet); begin if not modify_all then begin if t_op_seae.FieldByName('EDI状态').AsString='已发送' then begin showmessage('已发送不能修改,删除!'); abort; end; end; end; procedure Tfrm_op_seae_edi_data.t_op_ctnBeforeEdit(DataSet: TDataSet); begin if not modify_all then begin if t_op_seae.FieldByName('EDI状态').AsString='已发送' then begin showmessage('已发送不能修改!'); abort; end; end; end; procedure Tfrm_op_seae_edi_data.N20Click(Sender: TObject); begin try modify_all:=true; t_op_seae.Edit; t_op_seae.FieldByName('EDI状态').AsString:='未发送'; t_op_seae.Post; finally modify_all:=false; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton30Click(Sender: TObject); var Str:TStrings; i:integer; numunzipped:integer; fileType,SenderHandphone,SenderEmail,SenderFax:string; s0,s5:string; begin if (t_op_seae1.DataSet.State=dsinsert)or(t_op_seae1.DataSet.State=dsedit) then t_op_seae1.DataSet.post; if t_op_seae.FieldByName('EDI状态').AsString='已发送' then begin showmessage('已发送不能发送,请修改为未发送!'); abort; end; if MessageDlg('确定要发送吗?',mtWarning,[mbyes,mbno],0)=mrNo then Exit; bsSkinButton28Click(Sender); bsSkinButton15Click(Sender); s0:=''; s5:=''; str:=Tstringlist.Create; try modify_all:=True; if bsSkinComboBox1.ItemIndex=0 then begin Str:=CreateSIEdiFile_xml; s0:=Str.Text; for i:=0 to Str.Count-1 do begin if IsZhongwen(Str[i]) then begin ShowMessage('此票业务可能含有中文字符或其他不规范字符'+Str[i]); exit; end; end; s5:='1'; end else begin Str:=CreateSIEdiFile_xml; s0:=Str.Text; for i:=0 to Str.Count-1 do begin if IsZhongwen(Str[i]) then begin ShowMessage('此票业务可能含有中文字符或其他不规范字符'+Str[i]); exit; end; end; end; frm_op_seae_edi_data.t_op_seae.Edit; frm_op_seae_edi_data.t_op_seae.FieldByName('发送时间').Value:=Now; frm_op_seae_edi_data.t_op_seae.FieldByName('当前状态').Value:='已发送'; frm_op_seae_edi_data.t_op_seae.Post; finally modify_all:=False; FreeAndNil(Str) end; try modify_all:=True; getwebservice_ds; if frm_data_share.t_sys_employee.locate('姓名',employee,[]) then begin SenderHandphone:=frm_data_share.t_sys_employee.fieldbyname('移动电话').asstring; SenderEmail:=frm_data_share.t_sys_employee.fieldbyname('邮箱').asstring; SenderFax:=frm_data_share.t_sys_employee.fieldbyname('传真').asstring; end; mServiceSoap_Ds.UpdateCustomMainfast(s0,s5,trim(get_parameters_value(301,'')),employee,SenderHandphone,SenderEmail,SenderFax,frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring); showmessage('发送成功!'); modify_all:=False; except showmessage('发送错误!'); end; end; procedure Tfrm_op_seae_edi_data.bsSkinComboBox1Change(Sender: TObject); begin if bsSkinComboBox1.ItemIndex=3 then begin cxDBCheckListBox1.Visible:=true; end else begin cxDBCheckListBox1.Visible:=False; end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton31Click(Sender: TObject); var Str:TStrings; i:integer; fileType:string; begin if bsSkinComboBox1.ItemIndex=0 then fileType:='-9' else if bsSkinComboBox1.ItemIndex=1 then fileType:='-2' else if bsSkinComboBox1.ItemIndex=2 then fileType:='-3' else if bsSkinComboBox1.ItemIndex=3 then fileType:='-5' else if bsSkinComboBox1.ItemIndex=4 then fileType:='-0' else if bsSkinComboBox1.ItemIndex=5 then fileType:='-11' else fileType:='-9'; { 9 主要 2 增加 3 删除 5 更新 0 次要 11 指令 } str:=Tstringlist.Create; try Str:=CreateSIEdiFile_xml; for i:=0 to Str.Count-1 do begin if IsZhongwen(Str[i]) then begin if MessageDlg('此票业务可能含有中文字符或其他不规范字符,确实要继续上传吗!',mtWarning,[mbYes,mbNo],0)=mrNo then exit; end; end; SaveDialog1.FileName:=frm_op_seae_edi_data.t_op_seae.fieldbyname('主提单号').asstring; SaveDialog1.Filter:='*.xml|*.xml'; if SaveDialog1.Execute then begin str.SaveToFile(SaveDialog1.FileName+fileType+'.xml'); showmessage('文件生成成功!'); end else begin showmessage('文件生成失败!'); exit; end; finally FreeAndNil(Str) end; end; procedure Tfrm_op_seae_edi_data.N2Click(Sender: TObject); var afield,afieldfee : variant; aOR_ID:integer; aQuery:TAdoQuery; i:integer; bsno,id:string; Boolean_Ctn:Boolean; begin if t_op_seae.IsEmpty then begin exit; MessageDlg('没有复制的信息,不能复制添加!',mtWarning,[mbok],0); end; afield := vararraycreate([0,t_op_seae.fieldcount-1],varvariant); for i := 0 to (t_op_seae.fieldcount-1) do begin afield[i] :=t_op_seae.fields[i].value ; end; bsno:=t_op_seae.fieldbyname('编号').AsString; t_op_seae.append; for i := 0 to (t_op_seae.fieldcount-1) do begin if t_op_seae.fields[i].FieldName<>'编号' then t_op_seae.fields[i].value := afield[i] ; end; id:=get_id; t_op_seae.fieldbyname('录入人').Value:=employee; t_op_seae.fieldbyname('录入日期').Value:=date; t_op_seae.fieldbyname('EDI状态').Value:='未发送'; t_op_seae.fieldbyname('当前状态').Value:='未发送'; t_op_seae.fieldbyname('编号').Value:=id; t_op_seae.fieldbyname('主编号').Value:=id; t_op_seae.fieldbyname('修改原因').Value:=''; t_op_seae.Post; aQuery:=CreateAdoQuery; try with aQuery do begin close;sql.clear; sql.Add('select * from t_op_ctn_edi where 编号=:编号'); Parameters.ParamByName('编号').Value:=bsno; open; if not t_op_ctn.active then t_op_ctn.Open; first; while not eof do begin t_op_ctn.Insert; t_op_ctn['编号']:=id; t_op_ctn['代码']:=aQuery['代码']; t_op_ctn['尺寸']:=aQuery['尺寸']; t_op_ctn['箱型']:=aQuery['箱型']; t_op_ctn['数量']:=1; t_op_ctn['表现形式']:=aQuery['表现形式']; t_op_ctn['箱号']:=aQuery['箱号']; t_op_ctn['封号']:=aQuery['封号']; t_op_ctn['件数']:=aQuery['件数']; t_op_ctn['包装']:=aQuery['包装']; t_op_ctn['重量']:=aQuery['重量']; t_op_ctn['尺码']:=aQuery['尺码']; t_op_ctn['货描']:=aQuery['货描']; t_op_ctn['唛头']:=aQuery['唛头']; if frm_data_share.t_code_ctn.Locate('代码',t_op_ctn.fieldbyname('代码').asstring,[]) then begin if frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='20'then t_op_ctn['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['TEU']:=2; end; t_op_ctn.Post; next; end; end; finally freeandnil(aQuery); showmessage('复制完成'); end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton32Click(Sender: TObject); begin UpdateInfor; end; procedure Tfrm_op_seae_edi_data.t_op_seaeBeforeDelete(DataSet: TDataSet); begin if t_op_seae.FieldByName('EDI状态').AsString='已发送' then begin showmessage('已发送不能修改,删除!'); abort; end; end; procedure Tfrm_op_seae_edi_data.DBEdit3Change(Sender: TObject); begin if t_op_seae.FieldByName('EDI状态').AsString='已发送' then begin bsSkinLabel1.DefaultFont.Color:=clGreen; end else begin bsSkinLabel1.DefaultFont.Color:=clRed; end; if not t_op_state.Active then t_op_state.OPEN; if t_op_state.Locate('业务状态','预配舱单主要数据传输成功',[]) then begin bsSkinLabel2.DefaultFont.Color:=clGreen; end else begin bsSkinLabel2.DefaultFont.Color:=clRed; end; if t_op_state.Locate('业务状态','预配舱单其他数据申报审核通过',[]) then begin bsSkinLabel3.DefaultFont.Color:=clGreen; end else begin bsSkinLabel3.DefaultFont.Color:=clRed; end; if t_op_state.Locate('业务状态','运抵比对结果为:运抵正常',[]) then begin bsSkinLabel4.DefaultFont.Color:=clGreen; end else begin bsSkinLabel4.DefaultFont.Color:=clRed; end; if t_op_state.Locate('业务状态','提运单放行',[]) then begin bsSkinLabel5.DefaultFont.Color:=clGreen; end else begin bsSkinLabel5.DefaultFont.Color:=clRed; end; if t_op_state.Locate('业务状态','预配舱单修改申请审核通过',[]) then begin bsSkinLabel6.DefaultFont.Color:=clGreen; end else begin bsSkinLabel6.DefaultFont.Color:=clRed; end; end; procedure Tfrm_op_seae_edi_data.bsSkinLabel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Pnt:Tpoint; begin Pnt:=bsSkinLabel1.ClientToScreen(Point(0,bsSkinLabel1.Height)); if not t_op_seae.FieldByName('发送时间').IsNull then begin ABC1.Caption:=t_op_seae.FieldByName('发送时间').Asstring; PopupMenu5.Popup(Pnt.x,Pnt.y); end else begin ABC1.Caption:='无'; PopupMenu5.Popup(Pnt.x,Pnt.y); end; end; procedure Tfrm_op_seae_edi_data.bsSkinLabel2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Pnt:Tpoint; begin Pnt:=bsSkinLabel2.ClientToScreen(Point(0,bsSkinLabel2.Height)); if t_op_state.Locate('业务状态','预配舱单主要数据传输成功',[]) then begin ABC1.Caption:=t_op_state.FieldByName('完成时间').Asstring; PopupMenu5.Popup(Pnt.x,Pnt.y); end else begin ABC1.Caption:='无'; PopupMenu5.Popup(Pnt.x,Pnt.y); end; end; procedure Tfrm_op_seae_edi_data.bsSkinLabel3MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Pnt:Tpoint; begin Pnt:=bsSkinLabel3.ClientToScreen(Point(0,bsSkinLabel3.Height)); if t_op_state.Locate('业务状态','预配舱单其他数据申报审核通过',[]) then begin ABC1.Caption:=t_op_state.FieldByName('完成时间').Asstring; PopupMenu5.Popup(Pnt.x,Pnt.y); end else begin ABC1.Caption:='无'; PopupMenu5.Popup(Pnt.x,Pnt.y); end; end; procedure Tfrm_op_seae_edi_data.bsSkinLabel4MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Pnt:Tpoint; begin Pnt:=bsSkinLabel4.ClientToScreen(Point(0,bsSkinLabel4.Height)); if t_op_state.Locate('业务状态','运抵比对结果为:运抵正常',[]) then begin ABC1.Caption:=t_op_state.FieldByName('完成时间').Asstring; PopupMenu5.Popup(Pnt.x,Pnt.y); end else begin ABC1.Caption:='无'; PopupMenu5.Popup(Pnt.x,Pnt.y); end; end; procedure Tfrm_op_seae_edi_data.bsSkinLabel5MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Pnt:Tpoint; begin Pnt:=bsSkinLabel5.ClientToScreen(Point(0,bsSkinLabel5.Height)); if t_op_state.Locate('业务状态','提运单放行',[]) then begin ABC1.Caption:=t_op_state.FieldByName('完成时间').Asstring; PopupMenu5.Popup(Pnt.x,Pnt.y); end else begin ABC1.Caption:='无'; PopupMenu5.Popup(Pnt.x,Pnt.y); end; end; procedure Tfrm_op_seae_edi_data.bsSkinButton27Click(Sender: TObject); var i:integer; begin if dxDBGrid1.SelectedCount>1 then begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); try frm_sys_progress.bsSkinGauge1.ProgressText:='正在生成凭证请稍后。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; getwebservice_ds; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae.GotoBookmark(Pointer(dxDBGrid1.selectedrows[I])); SelectReciveData(t_op_seae.FieldByName('主编号').AsString,t_op_seae.FieldByName('主提单号').AsString); end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; finally freeAndNil(frm_sys_progress); end; end else begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); try frm_sys_progress.bsSkinGauge1.ProgressText:='正在生成凭证请稍后。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=t_op_seae.RecordCount; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; getwebservice_ds; with t_op_seae do begin First; while not eof do begin if t_op_seae.FieldByName('当前状态').AsString<>'已放行' then SelectReciveData(t_op_seae.FieldByName('主编号').AsString,t_op_seae.FieldByName('主提单号').AsString); Next; end; end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; finally freeAndNil(frm_sys_progress); t_op_seae.First; end; end; end; { if dxDBGrid1.SelectedCount>1 then begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); try frm_sys_progress.bsSkinGauge1.ProgressText:='正在生成凭证请稍后。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=dxDBGrid1.SelectedCount; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; getwebservice_ds; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae.GotoBookmark(Pointer(dxDBGrid1.selectedrows[I])); SelectReciveData(t_op_seae.FieldByName('主编号').AsString,t_op_seae.FieldByName('主提单号').AsString); end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; finally freeAndNil(frm_sys_progress); end; end } procedure Tfrm_op_seae_edi_data.bsSkinLabel6MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var Pnt:Tpoint; begin Pnt:=bsSkinLabel6.ClientToScreen(Point(0,bsSkinLabel6.Height)); if t_op_state.Locate('业务状态','预配舱单修改申请审核通过',[]) then begin ABC1.Caption:=t_op_state.FieldByName('完成时间').Asstring; PopupMenu5.Popup(Pnt.x,Pnt.y); end else begin ABC1.Caption:='无'; PopupMenu5.Popup(Pnt.x,Pnt.y); end; end; procedure Tfrm_op_seae_edi_data.t_op_seaeAfterInsert(DataSet: TDataSet); begin t_op_seae.FieldByName('当前状态').Asstring:='未发送'; end; procedure Tfrm_op_seae_edi_data.bsSkinButton33Click(Sender: TObject); var s_czmc,s_user,s_key,s_yzh,s_yzhuser,s_yzhkey,s_lh,s_zc,s_zckey,s_sscz:string; begin try s_user:=get_parameters_value(2101,'false'); s_key:=get_parameters_value(2102,'false'); s_czmc:=get_parameters_value(2103,'false'); s_yzhuser:=get_parameters_value(2104,'false'); s_yzhkey:=get_parameters_value(2105,'false'); s_yzh:=get_parameters_value(2106,'false'); s_lh:=get_parameters_value(2109,'false'); s_zc:=get_parameters_value(2113,'false'); s_zckey:=get_parameters_value(2112,'false'); s_sscz:=get_parameters_value(2114,'false'); if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)=s_czmc then GetdyczInfo_dy(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('编号').AsString) else if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)=s_yzh then GetdyczInfo_yzh(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('编号').AsString) else if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)=s_lh then GetdyczInfo_lhcz(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('编号').AsString) else if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)=s_zc then begin GetdyczInfo_zc(s_user,s_zckey,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('编号').AsString) end else if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)=s_sscz then begin getssczinfor(Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString)) end else GetdyczInfo_jfcz('','',Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),'') finally t_op_ctn.Requery; end; end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo9Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo9); end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo9KeyPress(Sender: TObject; var Key: Char); begin RxLookupComboExit(RxDBLookupCombo9); end; procedure Tfrm_op_seae_edi_data.RxDBLookupCombo9Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo9); end; end.