unit u_op_ctn; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, BusinessSkinForm, Grids, Wwdbigrd, Wwdbgrid, StdCtrls, wwdblook, DB, ADODB, Mask, wwdbedit, Wwdotdot, Wwdbcomb, DBGridEh, ExtCtrls, DBCtrls, Menus,ComObj, inifiles, Rio, SOAPHTTPClient,InvokeRegistry,DyxtService,Service,jfczService,BLService,myService, DBClient,XMLIntf,XMLDoc, xmldom, Xmlxform, kbmMemTable,superobject, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP ; type Tfrm_op_ctn = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; wwDBGrid1: TwwDBGrid; wwDBLookupCombo1: TwwDBLookupCombo; wwDBLookupCombo2: TwwDBLookupCombo; t_op_ctn: TADOQuery; t_op_ctn1: TDataSource; Memo1: TMemo; Memo2: TMemo; Memo3: TMemo; Memo4: TMemo; bsSkinPanel1: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton5: TbsSkinButton; wwDBLookupCombo4: TwwDBLookupCombo; bsSkinPanel2: TbsSkinPanel; Splitter1: TSplitter; t_op_ctndetail1: TDataSource; wwDBLookupCombo5: TwwDBLookupCombo; wwDBLookupCombo3: TwwDBLookupCombo; t_op_ctndetail: TADOQuery; DBGridEh1: TDBGridEh; bsSkinButton9: TbsSkinButton; t_ch_client: TADOQuery; t_ch_client1: TDataSource; t_op_ctnsum1: TDataSource; t_op_ctnsum: TADOQuery; bsSkinPanel3: TbsSkinPanel; Label1: TLabel; DBText1: TDBText; Label2: TLabel; DBText2: TDBText; DBText3: TDBText; Label3: TLabel; DBText4: TDBText; Label4: TLabel; Label5: TLabel; DBText5: TDBText; PopupMenu1: TPopupMenu; N2: TMenuItem; N3: TMenuItem; N7: TMenuItem; bsSkinButton7: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton10: TbsSkinButton; Panel1: TPanel; DBNavigator1: TDBNavigator; bsSkinButton11: TbsSkinButton; Button1: TButton; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; OpenDialog1: TOpenDialog; Button2: TButton; wwDBLookupCombo61: TwwDBLookupCombo; kbmMemTable1: TkbmMemTable; kbmMemTable1StringField: TStringField; kbmMemTable1StringField2: TStringField; kbmMemTable1IntegerField: TIntegerField; kbmMemTable1StringField3: TStringField; kbmMemTable1FloatField: TFloatField; kbmMemTable1FloatField2: TFloatField; kbmMemTable1StringField4: TStringField; kbmMemTable1StringField5: TStringField; kbmMemTable1StringField6: TStringField; wwDBComboBox1: TwwDBComboBox; wwDBComboBox2: TwwDBComboBox; btn1: TButton; txt1: TStaticText; bsSkinButton15: TbsSkinButton; kbmMemTable1Field: TFloatField; procedure t_op_ctnAfterInsert(DataSet: TDataSet); procedure t_op_ctnBeforePost(DataSet: TDataSet); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure wwDBLookupCombo1Change(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton6Click(Sender: TObject); procedure t_op_ctnBeforeDelete(DataSet: TDataSet); procedure t_op_ctnBeforeEdit(DataSet: TDataSet); procedure t_op_ctnAfterPost(DataSet: TDataSet); procedure t_op_ctndetailBeforeInsert(DataSet: TDataSet); procedure t_op_ctndetailNewRecord(DataSet: TDataSet); procedure bsSkinButton9Click(Sender: TObject); procedure t_op_ctnAfterOpen(DataSet: TDataSet); procedure N2Click(Sender: TObject); procedure N7Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure btn1Click(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); private { Private declarations } mServiceSoap_dy:DyxtServiceSoap; mServiceSoap_yzh:ServiceSoap; mHttpRIO_dy,mHttpRIO_yzh:THTTPRIO; procedure Updatebs; public { Public declarations } dbserver:string; procedure getwebservice_dy; procedure getwebservice_yzh; 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); function getYardCode(yard:string):string; end; var frm_op_ctn: Tfrm_op_ctn; frm_op_ctn_type:boolean; op_ctn_limited:string; implementation uses u_data_share, my_sys_function, u_op_seae, u_op_seai, u_main, u_op_seae_ctn; {$R *.dfm} procedure Tfrm_op_ctn.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_ctn.getwebservice_yzh; begin try mHttpRIO_yzh:=THTTPRIO.Create(nil); //170改成186 mHttpRIO_yzh.WSDLLocation:='http://222.173.95.186:78/selectservice/Service.asmx?WSDL'; mHttpRIO_yzh.URL:='http://222.173.95.186:78/selectservice/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_ctn.dewebservice; begin mHttpRIO_dy.Free; end; procedure Tfrm_op_ctn.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:BLServiceSoap; sltcnt:GetLTCntrInfoResult; begin try t_op_ctn.DisableControls; cds:=TClientDataSet.Create(nil); XMLTransformProvider1:=TXMLTransformProvider.Create(NIL); sltcnt:=GetLTCntrInfoResult.Create; cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; smartWS:=GetBLServiceSoap(False,''); s_web:=smartWS.GetBLNoInfo(s_billno,'18315FA0-8E5A-4935-8369-91BE89BC6B6A'); //ShowMessage(s_web); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\JFCZ.xml'); if FileExists(ExtractFilePath(Application.ExeName)+'jfcz\jfcz.xtr') then begin XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'jfcz\jfcz.xtr'; end else begin CreateDirectory(pChar(ExtractFilePath(Application.ExeName)+'jfcz'),nil); CopyFile(pChar('\\'+dbserver+'\jfcz\jfcz.xtr'),pChar(ExtractFilePath(Application.ExeName)+'jfcz\jfcz.xtr'),True); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'jfcz\jfcz.xtr'; end; // 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; if (cds.FindField('BOXWEIGHT')<>nil) then begin kbmMemTable1.FieldByName('称重重量').AsFloat:=kbmMemTable1.FieldByName('重量').AsFloat-FieldByNAME('BOXWEIGHT').AsFloat; end; 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; if (cds.FindField('BOXWEIGHT')<>nil) then begin kbmMemTable1.FieldByName('称重重量').AsFloat:=kbmMemTable1.FieldByName('重量').AsFloat-FieldByNAME('BOXWEIGHT').AsFloat; end; 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.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.FieldByName('称重重量').AsFloat:=FieldByName('称重重量').AsFloat; t_op_ctn.Post; end; Next; end; end; finally t_op_ctn.EnableControls; cds.Free; end; end; procedure Tfrm_op_ctn.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'); if FileExists(ExtractFilePath(Application.ExeName)+'大亚场站\提箱.xtr') then begin XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'大亚场站\提箱.xtr'; end else begin CreateDirectory(pChar(ExtractFilePath(Application.ExeName)+'大亚场站'),nil); CopyFile(pChar('\\'+dbserver+'\大亚场站\提箱.xtr'),pChar(ExtractFilePath(Application.ExeName)+'大亚场站\提箱.xtr'),True); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'大亚场站\提箱.xtr'; //XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\大亚场站\提箱.xtr'; //XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\大亚场站\提箱.xtr'; end; 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'); if FileExists(ExtractFilePath(Application.ExeName)+'大亚场站\重箱返场.xtr') then begin XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\重箱返场.xtr'; end else begin CreateDirectory(pChar(ExtractFilePath(Application.ExeName)+'大亚场站'),nil); CopyFile(pChar('\\'+dbserver+'\大亚场站\提箱.xtr'),pChar(ExtractFilePath(Application.ExeName)+'大亚场站\重箱返场.xtr'),True); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'大亚场站\重箱返场.xtr'; end; // 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('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'); if FileExists(ExtractFilePath(Application.ExeName)+'大亚场站\包装.xtr') then begin XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'\大亚场站\包装.xtr'; end else begin CreateDirectory(pChar(ExtractFilePath(Application.ExeName)+'大亚场站'),nil); CopyFile(pChar('\\'+dbserver+'\大亚场站\提箱.xtr'),pChar(ExtractFilePath(Application.ExeName)+'大亚场站\包装.xtr'),True); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'大亚场站\包装.xtr'; end; // XMLTransformProvider1.TransformRead.TransformationFile:='\\'+dbserver+'\大亚场站\包装.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_ctn.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:='HLCUTA1180315678'; //QDJY000476 cds.Active:=false; xmldoc:=NewXMLDocument; xmldoc.Encoding:='UTF-8'; s_web:=mServiceSoap_yzh.P_GETDATA(s_billno,'YT'); xmldoc.LoadFromXML(s_web); xmldoc.SaveToFile('c:\集装箱信息.xml'); if FileExists(ExtractFilePath(Application.ExeName)+'怡之航场站\集装箱信息.xtr') then begin XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'怡之航场站\集装箱信息.xtr'; end else begin CreateDirectory(pChar(ExtractFilePath(Application.ExeName)+'怡之航场站'),nil); CopyFile(pChar('\\'+dbserver+'\怡之航场站\集装箱信息.xtr'),pChar(ExtractFilePath(Application.ExeName)+'怡之航场站\集装箱信息.xtr'),True); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'怡之航场站\集装箱信息.xtr'; end; // 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.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_ctn.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'); if FileExists(ExtractFilePath(Application.ExeName)+'陆海场站\集装箱信息.xtr') then begin XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'陆海场站\集装箱信息.xtr'; end else begin CreateDirectory(pChar(ExtractFilePath(Application.ExeName)+'陆海场站'),nil); CopyFile(pChar('\\'+dbserver+'\陆海场站\集装箱信息.xtr'),pChar(ExtractFilePath(Application.ExeName)+'陆海场站\集装箱信息.xtr'),True); XMLTransformProvider1.TransformRead.TransformationFile:=ExtractFilePath(Application.ExeName)+'陆海场站\集装箱信息.xtr'; end; // XMLTransformProvider1.TransformRead.TransformationFile:='\\'+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; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('PKGS').AsInteger; t_op_ctn.FieldByName('包装').AsString:=FieldByName('PKTP').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:=Trim(FieldByName('CTNNO').AsString); t_op_ctn.FieldByName('封号').AsString:=FieldByName('SEALNO').AsString; t_op_ctn.FieldByName('件数').AsInteger:=FieldByName('PKGS').AsInteger; t_op_ctn.FieldByName('包装').AsString:=FieldByName('PKTP').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; finally t_op_ctn.EnableControls; end; end; procedure Tfrm_op_ctn.t_op_ctnAfterInsert(DataSet: TDataSet); begin t_op_ctn['编号']:=t_op_ctn.DataSource.DataSet['编号']; t_op_ctn['数量']:=1; t_op_ctn['代码']:='01'; t_op_ctn['称重方式']:='累加'; end; procedure Tfrm_op_ctn.t_op_ctnBeforePost(DataSet: TDataSet); var cntrs:string; begin if frm_data_share.t_code_ctn.Locate('代码',t_op_ctn.fieldbyname('代码').asstring,[]) 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['尺寸']; if frm_data_share.t_code_ctn.FieldByName('尺寸').asstring='20'then t_op_ctn['TEU']:=1*t_op_ctn.FieldByName('数量').asinteger; 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*t_op_ctn.FieldByName('数量').asinteger; end else begin t_op_ctn['代码']:=''; t_op_ctn['表现形式']:=''; t_op_ctn['箱型']:=''; t_op_ctn['尺寸']:=''; end; cntrs:=t_op_ctn.fieldbyname('箱号').asstring; if cntrs<>'' then if ((GetStrNum(cntrs))<>7) or ((GetcharNum(cntrs))<>4) then begin MessageDlg('集装箱箱号不正确!:格式为:ABCU1234567',mtWarning,[mbOk],0); abort; end; table_before_post(t_op_ctn,'代码'); table_before_post(t_op_ctn,'数量'); end; procedure Tfrm_op_ctn.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_ctn); table_post(t_op_ctndetail); end; procedure Tfrm_op_ctn.bsSkinButton4Click(Sender: TObject); var i:integer; str_list:Tstringlist; begin if t_op_ctn.isempty then exit; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; if wwDBGrid1.SelectedList.Count>=1 then begin try t_op_ctn.DisableControls; str_list:=Tstringlist.create; for i:=0 to wwDBGrid1.SelectedList.Count-1 do begin t_op_ctn.GotoBookmark(pointer(wwDBGrid1.SelectedList[i])); str_list.Add(t_op_ctn.fieldbyname('ctn_ID').asstring); end; for i:=0 to str_list.Count-1 do begin if t_op_ctn.locate('ctn_ID',str_list[i],[]) then t_op_ctn.Delete; end; finally str_list.free; t_op_ctn.EnableControls; end; end else begin t_op_ctn.delete; end; t_op_ctn.Refresh; end; procedure Tfrm_op_ctn.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_op_ctn); end; procedure Tfrm_op_ctn.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_ctn.FormShow(Sender: TObject); var inifile1:Tinifile; FromFileName,ToFileName:string; begin t_op_ctn.open; t_op_ctndetail.Open; frm_data_share.t_code_tradetype.requery; frm_data_share.t_code_ctn.requery; frm_data_share.t_code_package.requery; frm_data_share.t_crm_client_truck.requery; frm_data_share.t_crm_client_changzhan.requery; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); dbserver:=inifile1.ReadString('database','Data Source',''); if pos(';',dbserver)>0 then begin dbserver:=Copy(dbserver,1,Length(dbserver)-1); if pos('\',dbserver)>0 then begin dbserver:=Copy(dbserver,1,pos('\',dbserver)-1); end; end else begin if pos('\',dbserver)>0 then begin dbserver:=Copy(dbserver,1,pos('\',dbserver)-1); end; end; FromFileName:='\\'+dbserver+'\jfcz\midas.dll'; ToFileName:=ExtractFilePath(application.ExeName)+'midas.dll'; if not FileExists(ExtractFilePath(application.ExeName)+'midas.dll') then CopyFile(pChar(FromFileName),pChar(ToFileName),False); inifile1.free; end; procedure Tfrm_op_ctn.wwDBLookupCombo1Change(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('代码',wwDBLookupCombo1.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_ctn.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_op_ctn); CanClose:=frm_close_query(t_op_ctndetail); end; procedure Tfrm_op_ctn.Updatebs; var bok:Tbookmark; if_first:boolean; pkgs:integer; kgs,cbm:double; s:string; begin if t_op_ctn.IsEmpty then exit; if op_ctn_limited='0001'then begin op_befor_post(frm_op_seae.t_op_seae,op_ctn_limited); end else begin op_befor_post(frm_op_seai.t_op_seai,op_ctn_limited); end; if_first:=true; pkgs:=0; kgs:=0.00; cbm:=0.00; bok:=t_op_ctn.GetBookmark; try t_op_ctn.DisableControls; t_op_ctn.DataSource.DataSet.DisableControls; t_op_ctn.First; while not t_op_ctn.Eof do begin if strtobool(get_parameters_value(139,'true')) then begin if if_first then begin if (Trim(t_op_ctn.fieldbyname('箱号').asstring)<>'') and (Trim(t_op_ctn.fieldbyname('封号').asstring)<>'') then memo1.Lines.Text:=t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring; memo2.Lines.Text:=t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring; memo3.Lines.Text:=t_op_ctn.fieldbyname('重量').asstring+'KGS'; memo4.Lines.Text:=t_op_ctn.fieldbyname('尺码').asstring+'CBM'; pkgs:=t_op_ctn.fieldbyname('件数').asinteger; kgs:=t_op_ctn.fieldbyname('重量').asfloat; cbm:=t_op_ctn.fieldbyname('尺码').asfloat; if_first:=false; end else begin if (Trim(t_op_ctn.fieldbyname('箱号').asstring)<>'') and (Trim(t_op_ctn.fieldbyname('封号').asstring)<>'') then memo1.Lines.Add(t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring); memo2.Lines.Add(t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring); memo3.Lines.Add(t_op_ctn.fieldbyname('重量').asstring+'KGS'); memo4.Lines.Add(t_op_ctn.fieldbyname('尺码').asstring+'CBM'); pkgs:=pkgs+t_op_ctn.fieldbyname('件数').asinteger; kgs:=kgs+t_op_ctn.fieldbyname('重量').asfloat; cbm:=cbm+t_op_ctn.fieldbyname('尺码').asfloat; end; end else begin if if_first then begin memo1.Lines.Text:=t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring+'/'+t_op_ctn.fieldbyname('表现形式').asstring+'/' +t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring+'/'+t_op_ctn.fieldbyname('重量').asstring+'KGS'+'/'+t_op_ctn.fieldbyname('尺码').asstring+'CBM'; memo2.Lines.Text:=t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring; memo3.Lines.Text:=t_op_ctn.fieldbyname('重量').asstring+'KGS'; memo4.Lines.Text:=t_op_ctn.fieldbyname('尺码').asstring+'CBM'; pkgs:=t_op_ctn.fieldbyname('件数').asinteger; kgs:=t_op_ctn.fieldbyname('重量').asfloat; cbm:=t_op_ctn.fieldbyname('尺码').asfloat; if_first:=false; end else begin memo1.Lines.Add(t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring+'/'+t_op_ctn.fieldbyname('表现形式').asstring+'/' +t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring+'/'+t_op_ctn.fieldbyname('重量').asstring+'KGS'+'/'+t_op_ctn.fieldbyname('尺码').asstring+'CBM' ); memo2.Lines.Add(t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring); memo3.Lines.Add(t_op_ctn.fieldbyname('重量').asstring+'KGS'); memo4.Lines.Add(t_op_ctn.fieldbyname('尺码').asstring+'CBM'); pkgs:=pkgs+t_op_ctn.fieldbyname('件数').asinteger; kgs:=kgs+t_op_ctn.fieldbyname('重量').asfloat; cbm:=cbm+t_op_ctn.fieldbyname('尺码').asfloat; end; end; t_op_ctn.next; end; if ((pkgs<>0) and (FormatFloat('0.0000;-0.0000;0',pkgs)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('件数').AsInteger))) or ((kgs<>0) and (FormatFloat('0.0000;-0.0000;0',kgs)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('重量').AsFloat))) or ((cbm<>0) and (FormatFloat('0.0000;-0.0000;0',cbm)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('尺码').AsFloat))) then begin if MessageDlg('基本信息的件重尺和集装箱信息的件重尺不同,是否更新',mtWarning,[mbyes,mbno],0)=mrYes then begin if op_ctn_limited='0001'then begin t_op_ctn.DataSource.DataSet.edit; { t_op_ctn.DataSource.DataSet['件数']:=pkgs; t_op_ctn.DataSource.DataSet['重量']:=kgs; t_op_ctn.DataSource.DataSet['尺码']:=cbm; } t_op_ctn.DataSource.DataSet['箱号封号']:=memo1.Lines.Text; if pkgs<>0 then t_op_ctn.DataSource.DataSet['件数包装']:=memo2.Lines.Text; if kgs<>0 then t_op_ctn.DataSource.DataSet['货物重量']:=memo3.Lines.Text; if cbm<>0 then t_op_ctn.DataSource.DataSet['货物尺码']:=memo4.Lines.Text; t_op_ctn.DataSource.DataSet['件数']:=pkgs; t_op_ctn.DataSource.DataSet['重量']:=kgs; t_op_ctn.DataSource.DataSet['尺码']:=cbm; t_op_ctn.DataSource.DataSet.post; end; if op_ctn_limited='0002'then begin t_op_ctn.DataSource.DataSet.edit; t_op_ctn.DataSource.DataSet['箱号封号']:=memo1.Lines.Text; t_op_ctn.DataSource.DataSet['件数']:=pkgs; t_op_ctn.DataSource.DataSet['重量']:=kgs; t_op_ctn.DataSource.DataSet['尺码']:=cbm; t_op_ctn.DataSource.DataSet.post; end; end; end; finally t_op_ctn.EnableControls; t_op_ctn.DataSource.DataSet.EnableControls; t_op_ctn.GotoBookmark(bok); end; end; procedure Tfrm_op_ctn.bsSkinButton6Click(Sender: TObject); var bok:Tbookmark; if_first:boolean; pkgs:integer; kgs,cbm:double; s,package:string; begin if t_op_ctn.IsEmpty then exit; { if op_ctn_limited='0001'then begin if assigned(frm_op_seae) then op_befor_post(frm_op_seae.t_op_seae,op_ctn_limited); end else if op_ctn_limited='0002'then begin if assigned(frm_op_seae) then op_befor_post(frm_op_seae.t_op_seae,op_ctn_limited); end else begin end; } t_op_ctn.First; if_first:=true; pkgs:=0; kgs:=0.00; cbm:=0.00; bok:=t_op_ctn.GetBookmark; try t_op_ctn.DisableControls; while not t_op_ctn.Eof do begin if strtobool(get_parameters_value(139,'true')) then begin if if_first then begin if (Trim(t_op_ctn.fieldbyname('箱号').asstring)<>'') and (Trim(t_op_ctn.fieldbyname('封号').asstring)<>'') then memo1.Lines.Text:=t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring; memo2.Lines.Text:=t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring; memo3.Lines.Text:=t_op_ctn.fieldbyname('重量').asstring+'KGS'; memo4.Lines.Text:=t_op_ctn.fieldbyname('尺码').asstring+'CBM'; pkgs:=t_op_ctn.fieldbyname('件数').asinteger; kgs:=t_op_ctn.fieldbyname('重量').asfloat; cbm:=t_op_ctn.fieldbyname('尺码').asfloat; package:=t_op_ctn.fieldbyname('包装').asstring; if_first:=false; end else begin if (Trim(t_op_ctn.fieldbyname('箱号').asstring)<>'') and (Trim(t_op_ctn.fieldbyname('封号').asstring)<>'') then memo1.Lines.Add(t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring); memo2.Lines.Add(t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring); memo3.Lines.Add(t_op_ctn.fieldbyname('重量').asstring+'KGS'); memo4.Lines.Add(t_op_ctn.fieldbyname('尺码').asstring+'CBM'); pkgs:=pkgs+t_op_ctn.fieldbyname('件数').asinteger; kgs:=kgs+t_op_ctn.fieldbyname('重量').asfloat; cbm:=cbm+t_op_ctn.fieldbyname('尺码').asfloat; package:=t_op_ctn.fieldbyname('包装').asstring; end; end else begin if if_first then begin memo1.Lines.Text:=t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring+'/'+t_op_ctn.fieldbyname('表现形式').asstring+'/' +t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring+'/'+t_op_ctn.fieldbyname('重量').asstring+'KGS'+'/'+t_op_ctn.fieldbyname('尺码').asstring+'CBM'; memo2.Lines.Text:=t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring; memo3.Lines.Text:=t_op_ctn.fieldbyname('重量').asstring+'KGS'; memo4.Lines.Text:=t_op_ctn.fieldbyname('尺码').asstring+'CBM'; pkgs:=t_op_ctn.fieldbyname('件数').asinteger; kgs:=t_op_ctn.fieldbyname('重量').asfloat; cbm:=t_op_ctn.fieldbyname('尺码').asfloat; package:=t_op_ctn.fieldbyname('包装').asstring; if_first:=false; end else begin memo1.Lines.Add(t_op_ctn.fieldbyname('箱号').asstring+'/'+t_op_ctn.fieldbyname('封号').asstring+'/'+t_op_ctn.fieldbyname('表现形式').asstring+'/' +t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring+'/'+t_op_ctn.fieldbyname('重量').asstring+'KGS'+'/'+t_op_ctn.fieldbyname('尺码').asstring+'CBM' ); memo2.Lines.Add(t_op_ctn.fieldbyname('件数').asstring+t_op_ctn.fieldbyname('包装').asstring); memo3.Lines.Add(t_op_ctn.fieldbyname('重量').asstring+'KGS'); memo4.Lines.Add(t_op_ctn.fieldbyname('尺码').asstring+'CBM'); pkgs:=pkgs+t_op_ctn.fieldbyname('件数').asinteger; kgs:=kgs+t_op_ctn.fieldbyname('重量').asfloat; cbm:=cbm+t_op_ctn.fieldbyname('尺码').asfloat; package:=t_op_ctn.fieldbyname('包装').asstring; end; end; t_op_ctn.next; end; if ((pkgs<>0) and (FormatFloat('0.0000;-0.0000;0',pkgs)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('件数').AsInteger))) or ((kgs<>0) and (FormatFloat('0.0000;-0.0000;0',kgs)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('重量').AsFloat))) or ((cbm<>0) and (FormatFloat('0.0000;-0.0000;0',cbm)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('尺码').AsFloat))) or ((memo1.Lines.Text<>'') and (memo1.Lines.Text<>t_op_ctn.DataSource.DataSet.FieldByName('箱号封号').AsString)) or ((Trim(package)<>'') and (Trim(package)<>Trim(t_op_ctn.DataSource.DataSet.fieldbyname('包装').asstring))) then begin if MessageDlg('基本信息的件,重,尺,包装和集装箱信息的件,重,尺,包装不同,是否更新',mtWarning,[mbyes,mbno],0)=mrYes then begin if op_ctn_limited='0001'then begin t_op_ctn.DataSource.DataSet.edit; t_op_ctn.DataSource.DataSet['箱号封号']:=memo1.Lines.Text; t_op_ctn.DataSource.DataSet['件数包装']:=memo2.Lines.Text; t_op_ctn.DataSource.DataSet['货物重量']:=memo3.Lines.Text; t_op_ctn.DataSource.DataSet['货物尺码']:=memo4.Lines.Text; t_op_ctn.DataSource.DataSet['包装']:=package; t_op_ctn.DataSource.DataSet.post; end; if op_ctn_limited='0002'then begin t_op_ctn.DataSource.DataSet.edit; t_op_ctn.DataSource.DataSet['箱号封号']:=memo1.Lines.Text; t_op_ctn.DataSource.DataSet['件数']:=pkgs; t_op_ctn.DataSource.DataSet['重量']:=kgs; t_op_ctn.DataSource.DataSet['尺码']:=cbm; t_op_ctn.DataSource.DataSet.post; end; end; end; finally t_op_ctn.EnableControls; t_op_ctn.GotoBookmark(bok); end; end; procedure Tfrm_op_ctn.t_op_ctnBeforeDelete(DataSet: TDataSet); begin if t_op_ctn.RecordCount=1 then begin if t_op_ctn.DataSource.DataSet.FieldByName('装运方式').asstring='整箱' then begin showmessage('业务集装箱不能为空,不能删除!!'); abort; end; end; if t_op_ctndetail.RecordCount>=1 then begin showmessage('集装箱存在装箱货物明细,不能删除,请先删除该集装箱下的货物明细'); abort; end; if op_ctn_limited='0001'then begin op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited); end else begin op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited); end; end; procedure Tfrm_op_ctn.t_op_ctnBeforeEdit(DataSet: TDataSet); begin if op_ctn_limited='0001'then begin op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited); end else begin op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited); end; end; procedure Tfrm_op_ctn.t_op_ctnAfterPost(DataSet: TDataSet); begin { update_ctn(t_op_ctn); if t_op_ctnsum.Active then t_op_ctnsum.Requery; t_op_ctn.Refresh; } if ((Pos('RF',t_op_ctn.fieldbyname('表现形式').AsString)>0) OR (Pos('RH',t_op_ctn.fieldbyname('表现形式').AsString)>0)) then begin if op_ctn_limited='0001'then begin t_op_ctn.DataSource.DataSet.edit; t_op_ctn.DataSource.DataSet['货物标识']:='R'; t_op_ctn.DataSource.DataSet.post; END; end; end; procedure Tfrm_op_ctn.t_op_ctndetailBeforeInsert(DataSet: TDataSet); begin if t_op_ctn.IsEmpty then begin ShowMessage('集装箱信息为空不能增加集装箱明细'); Abort; end; if t_op_ctn.State in [dsedit,dsinsert] then t_op_ctn.Post; t_op_ctn.Refresh; end; procedure Tfrm_op_ctn.t_op_ctndetailNewRecord(DataSet: TDataSet); begin t_op_ctndetail['ctn_id']:=t_op_ctn.FieldByName('ctn_id').AsInteger; t_op_ctndetail['件数']:=t_op_ctn.FieldByName('件数').AsInteger; t_op_ctndetail['包装']:=t_op_ctn.FieldByName('包装').AsString; t_op_ctndetail['重量']:=t_op_ctn.FieldByName('重量').AsFloat; t_op_ctndetail['尺码']:=t_op_ctn.FieldByName('尺码').AsFloat; t_op_ctndetail['货物描述']:=t_op_ctn.FieldByName('品名').AsString; end; procedure Tfrm_op_ctn.bsSkinButton9Click(Sender: TObject); var i :integer; str:string; begin if t_op_ctn.IsEmpty then exit; if wwDBGrid1.SelectedList.Count>=1 then begin for i:=0 to wwDBGrid1.SelectedList.Count-1 do begin t_op_ctn.GotoBookmark(pointer(wwDBGrid1.SelectedList[i])); if i=0 then str:='('+t_op_ctn.fieldbyname('ctn_id').asstring else str:=str+','+t_op_ctn.fieldbyname('ctn_id').asstring; end; end else begin str:='('+t_op_ctn.fieldbyname('ctn_id').asstring; end; str:=str+')'; t_ch_client.close; t_ch_client.sql.clear; t_ch_client.sql.add('select * from t_op_ctn ' +'where ctn_id in '+str +' order by ctn_id'); t_ch_client.open; try sys_print('海运出口装箱单',2,t_op_ctn.DataSource,nil,nil,nil,nil,t_ch_client1,t_op_ctn1,nil,nil,nil,nil); except end; end; procedure Tfrm_op_ctn.t_op_ctnAfterOpen(DataSet: TDataSet); begin if not t_op_ctnsum.Active then t_op_ctnsum.open; end; procedure Tfrm_op_ctn.N2Click(Sender: TObject); begin t_op_ctn.Append; end; procedure Tfrm_op_ctn.N7Click(Sender: TObject); var afield : variant; i: Integer; begin if t_op_ctn.IsEmpty then exit; afield := vararraycreate([0,t_op_ctn.fieldcount-1],varvariant); for i := 0 to (t_op_ctn.fieldcount-1) do begin afield[i] :=t_op_ctn.fields[i].value ; end; t_op_ctn.append; for i := 0 to (t_op_ctn.fieldcount-1) do begin if t_op_ctn.fields[i].FieldName<>'ctn_id' then t_op_ctn.fields[i].value := afield[i] ; end; end; procedure Tfrm_op_ctn.bsSkinButton1Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_ctn.bsSkinButton7Click(Sender: TObject); var afield : variant; i,j,m: Integer; book1:TBookmark; begin if t_op_ctn.IsEmpty then exit; try t_op_ctn.DisableControls; book1:=t_op_ctn.GetBookmark; m:=t_op_ctn.fieldByName('数量').AsInteger; for j:=0 to m-2 do begin afield := vararraycreate([0,t_op_ctn.fieldcount-1],varvariant); for i := 0 to (t_op_ctn.fieldcount-1) do begin afield[i] :=t_op_ctn.fields[i].value ; end; t_op_ctn.append; for i := 0 to (t_op_ctn.fieldcount-1) do begin if (t_op_ctn.fields[i].FieldName<>'ctn_id') and (t_op_ctn.fields[i].FieldName<>'数量') then t_op_ctn.fields[i].value := afield[i] ; end; end; finally t_op_ctn.GotoBookmark(book1); t_op_ctn.EnableControls; t_op_ctn.Edit; t_op_ctn.fieldByName('数量').AsInteger:=1; t_op_ctn.Post; end; end; procedure Tfrm_op_ctn.FormClose(Sender: TObject; var Action: TCloseAction); begin if not do_data(op_ctn_limited,t_op_ctn.DataSource.DataSet.FieldByName('录入人').asstring ,t_op_ctn.DataSource.DataSet.FieldByName('操作员').asstring ,t_op_ctn.DataSource.DataSet.FieldByName('揽货人').asstring ,t_op_ctn.DataSource.DataSet.FieldByName('客服员').asstring ,t_op_ctn.DataSource.DataSet.FieldByName('报关操作').asstring ,t_op_ctn.DataSource.DataSet.FieldByName('报检操作').asstring) then begin Exit; end; if t_op_ctn.DataSource.DataSet.FieldByName('业务状态').AsString<>'业务封帐' then begin if not t_op_ctn.IsEmpty then begin try t_op_ctndetail.Close; t_op_ctndetail.DataSource:=nil; update_ctn(t_op_ctn); bsSkinButton6Click(bsSkinButton6); finally t_op_ctndetail.DataSource:=t_op_ctn1; end; end; end; end; procedure Tfrm_op_ctn.bsSkinButton8Click(Sender: TObject); begin frm_main.view_momo(t_op_ctn1,'品名'); end; procedure Tfrm_op_ctn.bsSkinButton10Click(Sender: TObject); var s_czmc,s_user,s_key,s_yzh,s_yzhuser,s_yzhkey,s_lh: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'); // GetdyczInfo_yzh(s_user,s_key,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('编号').AsString); 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 GetdyczInfo_jfcz('','',Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),''); finally t_op_ctn.Requery; end; end; // bsSkinButton6.onClick(bsSkinButton6); // getczwebmsg(t_op_ctn.DataSource.DataSet.fieldbyname('编号').AsString,Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString),t_op_ctn.DataSource.DataSet.fieldbyname('分提单号').AsString); procedure Tfrm_op_ctn.bsSkinButton11Click(Sender: TObject); begin frm_main.view_momo(t_op_ctndetail1,'货物描述'); end; procedure Tfrm_op_ctn.Button1Click(Sender: TObject); var qty:integer; pkg,cbm:Double; begin qty:=0; pkg:=0; cbm:=0; if t_op_ctndetail.IsEmpty then Exit; with t_op_ctndetail do try DisableControls; First; while not eof do begin qty:=qty+FieldByName('件数').AsInteger; pkg:=pkg+FieldByName('重量').AsFloat; cbm:=cbm+FieldByName('尺码').AsFloat; next; end; showmessage('分箱合计 件数:'+IntToStr(qty)+' 重量:'+FormatFloat('0.0000;0.0000;0',pkg)+' 尺码:'+FormatFloat('0.0000;0.0000;0',cbm)); finally EnableControls; end; end; procedure Tfrm_op_ctn.bsSkinButton12Click(Sender: TObject); begin try if not ASSIGNED(frm_op_seae_ctn) then frm_op_seae_ctn:=Tfrm_op_seae_ctn.Create(application); frm_op_seae_ctn.t_op_ctn1:=t_op_ctn1; frm_op_seae_ctn.bsNo:=t_op_ctn.DataSource.DataSet.FieldByName('编号').asstring; frm_op_seae_ctn.CorpName:=t_op_ctn.DataSource.DataSet.FieldByName('委托单位').asstring; frm_op_seae_ctn.Vsl:=t_op_ctn.DataSource.DataSet.FieldByName('船名').asstring; frm_op_seae_ctn.Voy:=t_op_ctn.DataSource.DataSet.FieldByName('航次').asstring; frm_op_seae_ctn.ShowModal; finally frm_op_seae_ctn.Free; frm_op_seae_ctn:=nil; end; end; procedure Tfrm_op_ctn.bsSkinButton13Click(Sender: TObject); var Ext,ctnno,ctnType:String; ExcelTemplet:Variant; i:integer; begin if OpenDialog1.Execute then begin Ext:=lowercase(ExtractFileExt(OpenDialog1.FileName)); // ShowMessage(ctnno+' '+ctnType+' '+Ext); if Ext='.xls' then begin ExcelTemplet:= CreateOleObject('Excel.Application'); try ExcelTemplet.Workbooks.Open(OpenDialog1.FileName); I:=2; t_op_ctn.First; // ShowMessage(trim(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,1].Value))); if t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString=trim(VartoStr(ExcelTemplet.ActiveSheet.Cells[I,1].Value)) then while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value)<>'' do begin begin t_op_ctn.append; ctnno:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,4].Value); ctnType:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,5].Value); if frm_data_share.t_code_ctn.Locate('尺寸;箱型',VarArrayOf([trim(ctnno),trim(ctnType)]), []) then begin t_op_ctn.FieldByName('代码').AsString:=frm_data_share.t_code_ctn.FieldByName('代码').AsString; end; t_op_ctn.FieldByName('箱号').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value); 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.FieldByName('称重方式').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,10].Value); t_op_ctn.FieldByName('称重重量').AsString:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,11].Value); i:=i+1; end; end; finally ExcelTemplet.DisplayAlerts := false;//是否提示存盘 ExcelTemplet.Quit;//如果出错则退出 end; end; end; end; procedure Tfrm_op_ctn.Button2Click(Sender: TObject); begin with t_op_ctn do try DisableControls; First; while not Eof do begin if wwDBLookupCombo61.Value<>'' then begin Edit; FieldByName('包装').AsString:=wwDBLookupCombo61.Value; Post; end; Next; end; finally t_op_ctn.EnableControls; end; end; procedure Tfrm_op_ctn.btn1Click(Sender: TObject); begin with t_op_ctn do try DisableControls; First; while not Eof do begin if wwDBComboBox2.Value<>'' then begin Edit; FieldByName('称重方式').AsString:=wwDBComboBox2.Value; Post; end; Next; end; finally t_op_ctn.EnableControls; end; end; procedure Tfrm_op_ctn.bsSkinButton15Click(Sender: TObject); var yardcode:string; IdHTTP1:TIdHTTP; strmsg,company:string; Url : string;//请求地址 ResponseStream : TStringStream; //返回信息 ResponseStr: string; RequestStr : string; //请求信息 RequestStream : TStringStream; jo:ISuperobject; tt:TSuperArray; i:Integer; CTNALL,s_ctnno,s_ctnType,pkgs,kgs,cbm:string; begin if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)='' then begin ShowMessage('场站不能为空!'); exit; end; if Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString)='' then begin ShowMessage('主提单号不能为空!'); exit; end; yardcode:=getYardCode(Trim(t_op_ctn.DataSource.DataSet.fieldbyname('场站').AsString)); if (yardcode='') then begin ShowMessage('场站东胜代码不能为空!'); exit; end; company:=frm_data_share.t_sys_company.fieldbyname('简称').AsString; ResponseStream := TStringStream.Create(''); RequestStream := TStringStream.Create(''); IdHTTP1:=TIdHTTP.Create(Application); try IdHttp1.Request.Accept := '*/*'; IdHttp1.Request.AcceptLanguage:='zh-CN'; IdHttp1.Request.UserAgent:='Mozilla/3.0 (compatible; Indy Library)'; IdHttp1.Request.ContentType:='application/x-www-form-urlencoded'; Url:='http://47.104.90.170:5000/query'; try RequestStr:='webusername=&webuserpass=&mblno='+Trim(t_op_ctn.DataSource.DataSet.fieldbyname('主提单号').AsString)+'&yardid='+yardcode+'&isweb=0&custname='+company+'&psw='; //孙小华 RequestStream.WriteString(RequestStr); IdHttp1.post(Url,RequestStream,ResponseStream); except on e : Exception do begin end; end; ResponseStr := ResponseStream.DataString; //获取网页返回的信息 ResponseStr := UTF8Decode(ResponseStr); //网页中的存在中文时,需要进行UTF8解码 jo:=so(ResponseStr); if (jo.O['status'].AsString='0') then begin showmessage('无法提取,'+jo.O['message'].AsString); end else begin tt:=jo.O['message'].AsArray; for i:=0 to tt.Length-1 do begin CTNALL:=tt.O[i].S['CTNALL']; if t_op_ctn.Locate('箱号',Trim(tt.O[i].S['CNTRNO']),[]) then begin t_op_ctn.Edit; s_ctnno:=Copy(CTNALL,1,2); s_ctnType:=Copy(CTNALL,3,2); 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; pkgs:=tt.O[i].S['PKGS']; kgs:=tt.O[i].S['KGS']; cbm:=tt.O[i].S['CBM']; if pkgs='' then pkgs:='0'; if kgs='' then kgs:='0'; if cbm='' then cbm:='0'; t_op_ctn.FieldByName('封号').AsString:=tt.O[i].S['SEALNO']; t_op_ctn.FieldByName('件数').AsInteger:=StrToInt(pkgs); t_op_ctn.FieldByName('包装').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('包装').AsString; t_op_ctn.FieldByName('重量').AsFloat:=StrToFloatDef(kgs,0); t_op_ctn.FieldByName('尺码').AsFloat:=StrToFloatDef(cbm,0); t_op_ctn.Post; end else begin t_op_ctn.append; s_ctnno:=Copy(CTNALL,1,2); s_ctnType:=Copy(CTNALL,3,2); pkgs:=tt.O[i].S['PKGS']; kgs:=tt.O[i].S['KGS']; cbm:=tt.O[i].S['CBM']; if pkgs='' then pkgs:='0'; if kgs='' then kgs:='0'; if cbm='' then cbm:='0'; 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:=tt.O[i].S['CNTRNO']; t_op_ctn.FieldByName('封号').AsString:=tt.O[i].S['SEALNO']; t_op_ctn.FieldByName('件数').AsInteger:=StrToInt(pkgs); t_op_ctn.FieldByName('包装').AsString:=t_op_ctn.DataSource.DataSet.fieldbyname('包装').AsString; t_op_ctn.FieldByName('重量').AsFloat:=StrToFloatDef(kgs,0); t_op_ctn.FieldByName('尺码').AsFloat:=StrToFloatDef(cbm,0); t_op_ctn.Post; end; end; end; finally FreeAndNil(IdHTTP1); end; end; function Tfrm_op_ctn.getYardCode(yard: string): string; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('Select 东胜代码 from t_crm_client where 客户简称='''+yard+''''); Open; if not IsEmpty then Result:=Trim(FieldByName('东胜代码').asstring) else Result:=''; end; finally FreeAndNil(aQuery); end; end; end.