You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2371 lines
86 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_seae_vgm_data;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, DB, ADODB, bsSkinCtrls, cxTreeView, cxControls,
cxContainer, cxCheckListBox, cxDBCheckListBox, bsSkinBoxCtrls, Grids,
Wwdbigrd, Wwdbgrid, ExtCtrls, DBCtrls, bsdbctrls, RxLookup, ComCtrls,
bsSkinTabs, StdCtrls, wwdblook, Mask, wwdbedit, Wwdotdot, Wwdbcomb,
wwdbdatetimepicker, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL,
dxCntner, dxGrClEx, dxLayout, wwcheckbox, xmldom, XMLIntf, msxmldom,
XMLDoc, dxEditor, dxExGrEd, dxExELib;
type
// head
NBEDIhead =
record
sndcom:string; // 是 发送方公司
sender:string; // 否 发送方部门
fromop:string; // 是 发送方操作员简称
fromtele:string; // 是 操作员联系电话
fromfax:string; // 否 操作员联系传真
frommail:string; // 是 操作员联系邮件地址
fromopc:string; // 否 操作员联系手机
fromope:string; // 否 操作员全称
accom:string; // 是 接收方公司
accepter:string; // 否 接收方部门
toop:string; // 否 接收方 操作员
sendtime:TDateTime; // 是 报文发送时间
editype:string; // 是 报文类型(VGM:VERMAS ; 船司订舱:IFTMBF ; 货代间订舱:SHPORD ; 船司提单:SHPMIN)
EdiID:string; // 是 报文参考号
EdiName:string; // 否 报文文件名
EdiMode:string; // 是 报文格式 := 'HYXML';
EdiReceiver:string; // 是 接收方EDI代码
EdiSender:string; // 是 接收方EDI代码
end;
//Forward
NBEDIForward =
record
EdiForwardFMT:string; // 否 EDI加工参数 显式要求的转换格式
EdiForwardType:string; // 否 EDI加工参数 转发方式
EdiForwardURL:string; // 否 EDI加工参数 转发地址
EdiForwardId:string; // 否 EDI加工参数 转发账号
EdiForwardPass:string; // 否 EDI加工参数 转发密码
EdiForwardREFE1:string; // 否 EDI加工参数 通用参数1
EdiForwardREFE2:string; // 否 EDI加工参数 通用参数2
EdiForwardREFE3:string; // 否 EDI加工参数 通用参数3 船代名称
EdiForwardREFE4:string; // 否 EDI加工参数 通用参数4 船代代码
EdiForwardREFE5:string; // 否 EDI加工参数 通用参数5 报文功能(9新增 5修改 1取消)
end;
//reference
NBEDIreference =
record
blfreight:string; // 是 报文功能(9新增 5修改 1取消)
refid:string; // 否 客户端系统托单ID
freid:string; // 否 操作系统托单ID
referenceno:string; // 否 托运编号
bookingno:string; // 是 订舱编号
workno:string; // 是 工作编号
sale:string; // 否 销售业务员
billofladingno:string; // 是 提单号
end;
//baseinfo
NBEDIbaseinfo =
record
orderman:string; // 是 订舱单位
source:string; // 否 货物来源
usdaccountshipper:string; // 否 结算货主(美圆)
customshipper:string; // 否 报关货主
rmbaccountshipper:string; // 否 结算货主(人民币)
paymenttermcode:string; // 是 付款方式代码(P/C/E) 预付到付其他?
paymentterm:string; // 是 付款方式
payableat:string; // 否 第三地付款地点
shippingitem:string; // 是 运费条款
billofladingtype:string; // 是 提单类型
shipper:string; // 是 提单货主 可99次循环 若有超过35个字符的行注意收发通每行限数35个字符超过部分请另起一行
consignee:string; // 是 收货人 可99次循环 若有超过35个字符的行注意收发通每行限数35个字符超过部分请另起一行
notifyparty:string; // 是 通知人 可99次循环 若有超过35个字符的行注意收发通每行限数35个字符超过部分请另起一行
notifyparty2:string; // 否 第二通知人 可99次循环 若有超过35个字符的行注意收发通每行限数35个字符超过部分请另起一行
ordermemo:string; // 否 订舱说明
numberoforiginals:string; // 是 提单正本数
numberofcopys:string; // 否 提单副本数
placeofissuecode:string; // 是 签单地代码
placeofissue:string; // 是 签单地
timeofissue:string; // 是 签单时间
end;
//cargo
NBEDIcargo =
record
APPLICANT:string; // 否 询价单位
BOKKINGPARTY:string; // 否 签协议的单位代码
FOBPARTY:string; // 否 国外订舱单位
SCNO:string; // 否 美线服务合同号
QUARANTINECODING:string; // 否 检疫代码
SCACCODE:string; // 否 美线服务合同号
QUOTATIONNO:string; // 否 运费协议号
CHARGETYPE:string; // 否 费率本代码
NVOCCHBLNO:string; // 否 NVOCC号
realshipper:string; // 否 真实提单货主 可99次循环
realconsignee:string; // 否 真实收货人 可99次循环
realnotifyparty:string; // 否 真实通知人 可99次循环
realnotifyparty2:string; // 否 真实第二通知人 可99次循环
end;
//booking
NBEDIbooking =
record
shipmentdate:string; // 否 装期
expirydate:string; // 否 效期
tranship:string; // 否 转船标识
batch:string; // 否 分批标识
quotationno:string; // 否 服务合同号
end;
//freight
NBEDIfreight =
record
fl:string; // 否 整箱拼箱标准(F/L)
masterlclno:string; // 否 主票提单号
requestdate:string; // 否 要求配舱日期
lastdate:string; // 否 最晚配舱日期
arrivedate:string; // 否 要求到达日期
end;
//port
ediport =
record
placeofreceipt:string; // 否 收货地点
portofloading:string; // 是 装货港
portoftranship:string; // 否 中转港
portofdischarge:string; // 是 卸货港
placeofdelivery:string; // 是 目的港
finaldestination:string; // 否 最终目的地
co_placeofreceipt:string; // 否 收货地点代码
co_portofloading:string; // 是 装货港代码
co_portoftranship:string; // 否 中转港代码
co_portofdischarge:string; // 是 卸货港代码
co_placeofdelivery:string; // 是 目的港代码
co_finaldestination:string; // 否 最终目的地代码
end;
//vessel
edivessel =
record
carrier:string; // 是 船公司
oceanvessel:string; // 是 船名
voyno:string; // 是 航次
etd:string; // 是 开航日期
deliverymode:string; // 否 运输方式
end;
//info2nd
ediinfo2nd =
record
carrier:string; // 否 二程船公司
oceanvessel:string; // 否 二程船名
voyno:string; // 否 二程航次
etd:string; // 否 二程开航日期
deliverymode:string; // 否 二程运输方式
remarks:string; // 否 二程备注 可99次循环
end;
//containers
edicontainers =
record
containertype:string; // 是 箱型
containerno:string; // 是 箱号
sealno:string; // 是 封号
containernoofpkgs:string; // 是 箱数
containergrossweight:string; // 是 毛重
containercbm:string; // 是 体积
containerpackagingcode:string; // 是 箱货物包装类型代码
containerpackaging:string; // 是 箱货物包装类型
containerdescription:string; // 否 箱货物描述
containermarksandnumbers:string; // 否 箱麦头
vgmgrossmassweight:string; // 是 VGM总重量
vgmweighingmethod:string; // 是 VGM称重方式
vgmweighingtime:string; // 是 VGM称重时间
vgmresponsibleparty:string; // 是 VGM联系单位
vgmauthorizedperson:string; // 是 VGM授权联系人
vgmauthorizedpersontele:string; // 是 VGM授权联系人电话
vgmauthorizedpersonmail:string; // 否 VGM授权联系人邮件
vgmremark:string; // 否 VGM其他备注内容
end;
//goods
NBEDIgoods =
record
marksandnumbers:string; // 是 麦头 可99次循环
noofpkgs:string; // 是 包装件数
packagingcode:string; // 是 包装类型代码
packaging:string; // 是 包装类型
cargoid:string; // 是 货物类型(GC/RF/DR)
hscode:string; // 否 海关编码
description:string; // 是 货物描述(英文货名) 可99次循环
cdescription:string; // 否 货物描述(中文货名) 可99次循环
grossweight:string; // 是 毛重
cbm:string; // 是 体积
specialgoods:string; // 否 特殊货物说明 可99次循环
end;
//dr
NBEDIdr =
record
ediCLASS:string; // 否 CLASS 危险品分类
PAGE:string; // 否 危险品页号
UNDGNO:string; // 否 联合国危险品编号
TECNAME:string; // 否 技术名称
PACKGROUP:string; // 否 包装组别
ediLABEL:string; // 否 LABEL 危险品标签 可99次循环
FLASHPOINT:string; // 否 危险货物闪点
FLASHUNIT:string; // 否 闪点温度计量单位 C=摄氏 F=华氏
EMSNO:string; // 否 应急措施号
MFAGNO:string; // 否 医疗急救措施指南号
MPT:string; // 否 海运污染 Y/N
Elinkman:string; // 否 紧急联系人 EMS CONTACT应急联系
DANGEROUS:string; // 否 危险品信息
TEMPERATURE:string; // 否 冷藏品温度要求
TEMPERATUREUNIT:string; // 否 冷藏温度计量单位 C=摄氏 F=华氏
MINTEMPERATURE:string; // 否 冷藏最低温度
MAXTEMPERATURE:string; // 否 冷藏最高温度
ALLCOLDTORAGE:string; // 否 全程冷藏 Y/N
VENTI:string; // 否 通风量
REEFER:string; // 否 冷藏信息 可99次循环
end;
//loadplan
NBEDIloadplan =
record
entryno:string; // 否 进仓编号
warehouse:string; // 否 仓库
landcarrier:string; // 否 车队
stuffdate:TDateTime; // 否 装箱时间
stuffmode:string; // 否 装箱方式
stuffaddress:string; // 否 装箱地点
stuffmemo:string; // 否 装箱备注
end;
//goodsdetail VGM没有 船司订舱、货代间订舱、船司提单有
NBEDIgoodsdetail =
record
cargosequenceno:string; // 是 分货物序号
marksandnumbers:string; // 是 麦头 可99次循环
noofpkgs:string; // 是 包装件数
packagingcode:string; // 是 包装类型代码
packaging:string; // 是 包装类型
cargoid:string; // 是 货物类型(GC/RF/DR)
hscode:string; // 否 海关编码
description:string; // 是 货物描述(英文货名) 可99次循环
cdescription:string; // 否 货物描述(中文货名) 可99次循环
grossweight:string; // 是 毛重
cbm:string; // 是 体积
specialgoods:string; // 否 特殊货物说明 可99次循环
end;
//goodsdetail_dr VGM没有 船司订舱、货代间订舱、船司提单有
NBEDIgoodsdetail_dr =
record
ediCLASS:string; // 否 CLASS 危险品分类
PAGE:string; // 否 危险品页号
UNDGNO:string; // 否 联合国危险品编号
TECNAME:string; // 否 技术名称
PACKGROU:string; // 否 包装组别
ediLABEL:string; // 否 LABEL 危险品标签 可99次循环
FLASHPOINT:string; // 否 危险货物闪点
FLASHUNIT:string; // 否 闪点温度计量单位 C=摄氏 F=华氏
EMSNO:string; // 否 应急措施号
MFAGNO:string; // 否 医疗急救措施指南号
MPT:string; // 否 海运污染 Y/N
Elinkman:string; // 否 紧急联系人 EMS CONTACT应急联系
DANGEROUS:string; // 否 危险品信息
TEMPERATURE:string; // 否 冷藏品温度要求
TEMPERATUREUNIT:string; // 否 冷藏温度计量单位 C=摄氏 F=华氏
MINTEMPERATURE:string; // 否 冷藏最低温度
MAXTEMPERATURE:string; // 否 冷藏最高温度
ALLCOLDTORAGE:string; // 否 全程冷藏 Y/N
VENTI:string; // 否 通风量
REEFER:string; // 否 冷藏信息 可99次循环
end;
//goodsdetail_containers 只有船司提单有
NBEDIgoodsdetail_containers =
record
containertype:string; // 是 箱型
containerno:string; // 是
sealno:string; // 是
containernoofpkgs:string; // 是
containergrossweight:string; // 是
containercbm:string; // 是
end;
var
MyContainers : array [0..99] of edicontainers;
MyNBEDIgoodsdetail : array [0..99] of NBEDIgoodsdetail;
MyNBEDIgoodsdetail_containers : array [0..99] of array [0..99] of NBEDIgoodsdetail_containers;
goods_ctn_count: array [0..99] of integer;
type
Tfrm_op_seae_vgm_data = class(TForm)
Notebook1: TNotebook;
t_op_ctn_vgm: TADOQuery;
Panel2: TPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinPanel1: TbsSkinPanel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
DBEdit11: TDBEdit;
wwDBDateTimePicker1: TwwDBDateTimePicker;
bsSkinLabel1: TbsSkinLabel;
bsSkinLabel2: TbsSkinLabel;
bsSkinLabel3: TbsSkinLabel;
bsSkinLabel4: TbsSkinLabel;
bsSkinLabel5: TbsSkinLabel;
bsSkinLabel6: TbsSkinLabel;
bsSkinLabel7: TbsSkinLabel;
bsSkinLabel8: TbsSkinLabel;
bsSkinLabel9: TbsSkinLabel;
bsSkinLabel10: TbsSkinLabel;
bsSkinLabel11: TbsSkinLabel;
bsSkinLabel12: TbsSkinLabel;
bsSkinPanel2: TbsSkinPanel;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinGroupBox2: TbsSkinGroupBox;
bsSkinGroupBox3: TbsSkinGroupBox;
bsSkinPanel3: TbsSkinPanel;
bsSkinLabel19: TbsSkinLabel;
DBMemo1: TDBMemo;
bsSkinPanel4: TbsSkinPanel;
bsSkinLabel20: TbsSkinLabel;
bsSkinLabel21: TbsSkinLabel;
DBEdit18: TDBEdit;
DBEdit19: TDBEdit;
bsSkinLabel22: TbsSkinLabel;
DBEdit20: TDBEdit;
DBEdit21: TDBEdit;
bsSkinLabel23: TbsSkinLabel;
DBEdit22: TDBEdit;
wwDBDateTimePicker2: TwwDBDateTimePicker;
bsSkinLabel24: TbsSkinLabel;
DBEdit23: TDBEdit;
DBEdit24: TDBEdit;
DBEdit25: TDBEdit;
bsSkinLabel25: TbsSkinLabel;
DBEdit26: TDBEdit;
DBEdit27: TDBEdit;
bsSkinLabel26: TbsSkinLabel;
DBEdit28: TDBEdit;
DBEdit29: TDBEdit;
bsSkinLabel27: TbsSkinLabel;
DBEdit30: TDBEdit;
bsSkinPanel5: TbsSkinPanel;
bsSkinGroupBox4: TbsSkinGroupBox;
DBMemo2: TDBMemo;
bsSkinGroupBox5: TbsSkinGroupBox;
DBMemo3: TDBMemo;
bsSkinPanel6: TbsSkinPanel;
bsSkinLabel28: TbsSkinLabel;
bsSkinLabel29: TbsSkinLabel;
bsSkinLabel30: TbsSkinLabel;
DBEdit31: TDBEdit;
DBEdit32: TDBEdit;
wwDBDateTimePicker3: TwwDBDateTimePicker;
bsSkinLabel31: TbsSkinLabel;
bsSkinLabel32: TbsSkinLabel;
DBEdit33: TDBEdit;
DBEdit34: TDBEdit;
bsSkinLabel33: TbsSkinLabel;
DBEdit35: TDBEdit;
bsSkinLabel34: TbsSkinLabel;
bsSkinPanel7: TbsSkinPanel;
bsSkinButton12: TbsSkinButton;
bsSkinButton13: TbsSkinButton;
bsSkinButton14: TbsSkinButton;
bsSkinButton15: TbsSkinButton;
bsSkinPanel8: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
ds_op_ctn_vgm: TDataSource;
dxDBGrid1ctn_id: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column5: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1TEU: TdxDBGridMaskColumn;
dxDBGrid1Column8: TdxDBGridMaskColumn;
dxDBGrid1Column9: TdxDBGridMaskColumn;
dxDBGrid1Column10: TdxDBGridMaskColumn;
dxDBGrid1Column11: TdxDBGridMaskColumn;
dxDBGrid1Column13: TdxDBGridCurrencyColumn;
dxDBGrid1Column14: TdxDBGridCurrencyColumn;
dxDBGrid1Column15: TdxDBGridMaskColumn;
dxDBGrid1Column16: TdxDBGridMaskColumn;
dxDBGrid1PO: TdxDBGridMaskColumn;
dxDBGrid1SKU: TdxDBGridMaskColumn;
dxDBGrid1Column19: TdxDBGridMaskColumn;
dxDBGrid1UN: TdxDBGridMaskColumn;
dxDBGrid1HTS: TdxDBGridMaskColumn;
dxDBGrid1Column22: TdxDBGridMaskColumn;
dxDBGrid1Column23: TdxDBGridCurrencyColumn;
dxDBGrid1Column24: TdxDBGridMaskColumn;
dxDBGrid1Column25: TdxDBGridMaskColumn;
dxDBGrid1Column26: TdxDBGridMaskColumn;
dxDBGrid1Column27: TdxDBGridCurrencyColumn;
dxDBGrid1VGM: TdxDBGridCurrencyColumn;
dxDBGrid1Column29: TdxDBGridMaskColumn;
dxDBGrid1Column30: TdxDBGridDateColumn;
dxDBGrid1Column31: TdxDBGridMaskColumn;
dxDBGrid1Column32: TdxDBGridMaskColumn;
dxDBGrid1Column33: TdxDBGridMaskColumn;
ds_code_ctn: TDataSource;
t_code_ctn: TADOQuery;
dxDBGridLayoutList1: TdxDBGridLayoutList;
dxDBGridLayoutList1Item1: TdxDBGridLayout;
dxDBGrid1Column3: TdxDBGridExtLookupColumn;
bsSkinPanel9: TbsSkinPanel;
bsSkinButton16: TbsSkinButton;
bsSkinButton17: TbsSkinButton;
bsSkinButton18: TbsSkinButton;
bsSkinButton19: TbsSkinButton;
bsSkinButton20: TbsSkinButton;
bsSkinPanel10: TbsSkinPanel;
bsSkinLabel35: TbsSkinLabel;
bsSkinLabel36: TbsSkinLabel;
bsSkinLabel37: TbsSkinLabel;
wwDBDateTimePicker4: TwwDBDateTimePicker;
bsSkinLabel38: TbsSkinLabel;
bsSkinLabel39: TbsSkinLabel;
bsSkinLabel40: TbsSkinLabel;
bsSkinLabel42: TbsSkinLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
bsSkinLabel43: TbsSkinLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
bsSkinLabel44: TbsSkinLabel;
wwDBDateTimePicker7: TwwDBDateTimePicker;
bsSkinLabel45: TbsSkinLabel;
bsSkinLabel46: TbsSkinLabel;
wwDBComboBox3: TwwDBComboBox;
bsSkinPanel11: TbsSkinPanel;
dxDBGrid2: TdxDBGrid;
bsSkinButton21: TbsSkinButton;
bsSkinButton22: TbsSkinButton;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
t_op_seae_vgm: TADOQuery;
ds_op_seae_vgm: TDataSource;
dxDBGrid2Column1: TdxDBGridMaskColumn;
dxDBGrid2Column2: TdxDBGridMaskColumn;
dxDBGrid2Column3: TdxDBGridMaskColumn;
dxDBGrid2Column4: TdxDBGridMaskColumn;
dxDBGrid2Column5: TdxDBGridMaskColumn;
dxDBGrid2Column6: TdxDBGridMaskColumn;
dxDBGrid2Column7: TdxDBGridMaskColumn;
dxDBGrid2Column8: TdxDBGridMaskColumn;
dxDBGrid2Column9: TdxDBGridMaskColumn;
dxDBGrid2Column10: TdxDBGridMaskColumn;
dxDBGrid2Column11: TdxDBGridMaskColumn;
dxDBGrid2Column12: TdxDBGridMaskColumn;
dxDBGrid2Column13: TdxDBGridDateColumn;
dxDBGrid2Column14: TdxDBGridMaskColumn;
dxDBGrid2Column15: TdxDBGridMaskColumn;
dxDBGrid2Column16: TdxDBGridMaskColumn;
dxDBGrid2Column17: TdxDBGridMaskColumn;
dxDBGrid2Column18: TdxDBGridMaskColumn;
dxDBGrid2Column19: TdxDBGridMaskColumn;
dxDBGrid2Column20: TdxDBGridMaskColumn;
dxDBGrid2Column21: TdxDBGridMaskColumn;
dxDBGrid2Column22: TdxDBGridMaskColumn;
dxDBGrid2Column23: TdxDBGridMaskColumn;
dxDBGrid2Column24: TdxDBGridMaskColumn;
dxDBGrid2Column25: TdxDBGridMaskColumn;
dxDBGrid2Column26: TdxDBGridMaskColumn;
dxDBGrid2Column27: TdxDBGridMaskColumn;
dxDBGrid2Column28: TdxDBGridMaskColumn;
dxDBGrid2Column29: TdxDBGridMaskColumn;
dxDBGrid2Column30: TdxDBGridMaskColumn;
dxDBGrid2Column31: TdxDBGridMaskColumn;
dxDBGrid2Column32: TdxDBGridDateColumn;
dxDBGrid2Column33: TdxDBGridMaskColumn;
dxDBGrid2Column34: TdxDBGridMaskColumn;
dxDBGrid2Column35: TdxDBGridMaskColumn;
dxDBGrid2Column36: TdxDBGridMaskColumn;
dxDBGrid2Column37: TdxDBGridMaskColumn;
dxDBGrid2Column38: TdxDBGridMaskColumn;
dxDBGrid2Column39: TdxDBGridMaskColumn;
dxDBGrid2Column40: TdxDBGridMaskColumn;
dxDBGrid2Column41: TdxDBGridDateColumn;
dxDBGrid2Column42: TdxDBGridMaskColumn;
dxDBGrid2Column43: TdxDBGridCurrencyColumn;
dxDBGrid2Column44: TdxDBGridColumn;
t_code_package: TADOQuery;
ds_code_package: TDataSource;
dxDBGridLayoutList1Item2: TdxDBGridLayout;
dxDBGrid1Column12: TdxDBGridExtLookupColumn;
XMLDocument1: TXMLDocument;
SaveDialog1: TSaveDialog;
DBMemo4: TDBMemo;
DBMemo5: TDBMemo;
DBMemo6: TDBMemo;
bsSkinLabel14: TbsSkinLabel;
bsSkinLabel15: TbsSkinLabel;
DBEdit13: TDBEdit;
DBEdit14: TDBEdit;
bsSkinLabel16: TbsSkinLabel;
bsSkinLabel17: TbsSkinLabel;
bsSkinLabel18: TbsSkinLabel;
DBEdit15: TDBEdit;
DBEdit16: TDBEdit;
DBEdit17: TDBEdit;
DBComboBox3: TDBComboBox;
OpenDialog1: TOpenDialog;
DBComboBox4: TDBComboBox;
DBEdit5: TDBEdit;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
wwDBComboBox1: TwwDBComboBox;
Edit5: TEdit;
dxDBGrid2Column45: TdxDBGridColumn;
bsSkinLabel13: TbsSkinLabel;
DBEdit6: TDBEdit;
bsSkinLabel41: TbsSkinLabel;
dxDBGrid2Column46: TdxDBGridColumn;
dxDBGrid2Column47: TdxDBGridColumn;
DBEdit12: TDBEdit;
bsSkinLabel47: TbsSkinLabel;
DBEdit36: TDBEdit;
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure dxDBGrid2DblClick(Sender: TObject);
procedure bsSkinButton16Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure dxDBGrid1Column3Change(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton17Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure t_op_seae_vgmAfterScroll(DataSet: TDataSet);
procedure bsSkinButton21Click(Sender: TObject);
procedure bsSkinButton22Click(Sender: TObject);
procedure bsSkinButton19Click(Sender: TObject);
procedure t_op_seae_vgmBeforePost(DataSet: TDataSet);
private
{ Private declarations }
function IsZhongwen(Str: String): Boolean;
function CheckParaNotExist(para:string):Boolean;
function GetCntrVGM(cntrsize: String):String;
function GetCntr(vgmsize: String;var cc:string;var xc:string;var bxxs:string):String;
function GetPackVGM(cntrsize: String):String;
function SeparateEC(Str: String): string;
function GetNBEDIhead(OPType:Boolean;var MyNBEDIhead : NBEDIhead):Boolean;
function GetNBEDIForward(OPType:Boolean;var MyNBEDIForward : NBEDIForward):Boolean;
function GetNBEDIreference(OPType:Boolean;var MyNBEDIreference : NBEDIreference):Boolean;
function GetNBEDIbaseinfo(OPType:Boolean;var MyNBEDIbaseinfo : NBEDIbaseinfo):Boolean;
function GetNBEDIcargo(OPType:Boolean;var MyNBEDIcargo : NBEDIcargo):Boolean;
function GetNBEDIbooking(OPType:Boolean;var MyNBEDIbooking : NBEDIbooking):Boolean;
function GetNBEDIfreight(OPType:Boolean;var MyNBEDIfreight : NBEDIfreight):Boolean;
function Getediport(OPType:Boolean;var MyPort : ediport):Boolean;
function Getedivessel(OPType:Boolean;var MyVessel : edivessel):Boolean;
function Getediinfo2nd(OPType:Boolean;var Myinfo2nd : ediinfo2nd):Boolean;
function Getedicontainers(OPType:Boolean;var ContainerCount:Integer):Boolean;
function GetNBEDIgoods(OPType:Boolean;var MyNBEDIgoods : NBEDIgoods):Boolean;
function GetNBEDIdr(OPType:Boolean;var MyNBEDIdr : NBEDIdr):Boolean;
function GetNBEDIloadplan(OPType:Boolean;var MyNBEDIloadplan : NBEDIloadplan):Boolean;
function GetNBEDIgoodsdetail(OPType:Boolean;var goodscount : Integer):Boolean;
procedure MakeVGM(editype:string);
public
{ Public declarations }
end;
var
frm_op_seae_vgm_data: Tfrm_op_seae_vgm_data;
HasM:Boolean; //是否有错
const
xmltype:array [0..3] of string=('SHPMBF','SHPORD','VERMAS','SHPMIN');
implementation
uses u_data_share, my_sys_function, u_main, u_sys_progress,u_edi_vgm_weihu;
{$R *.dfm}
//读取XML文件节点信息 不加任何回车换行
function ReadXml(node: IXMLNode): string;
var
nodeList,attrList: IXMLNodeList;
str,strName,strValue: string;
i: Integer;
begin
Result := '';
if not node.HasChildNodes then Exit;
attrList := node.AttributeNodes; {根节点的属性列表}
nodeList := node.ChildNodes; {根节点下的子节点列表}
str := '<' + node.NodeName;
{先读取属性}
for i := 0 to attrList.Count - 1 do
begin
strName := attrList[i].NodeName;
strValue := attrList[i].NodeValue;
str := str + ' ' + strName + '=' + AnsiQuotedStr(strValue, '"');
end;
str := str + '>' + sLineBreak; {sLineBreak 是常量, 相当于 #13#10}
{读取子节点}
for i := 0 to nodeList.Count - 1 do
begin
strName := nodeList[i].NodeName;
if nodeList[i].IsTextElement then
begin
strValue := nodeList[i].NodeValue;
str := str + '<' + strName + '>' + strValue + '</' + strName + '>' + sLineBreak;
end else if nodeList[i].HasChildNodes then
begin
str := str + ReadXml(nodeList[i]); {这是最关键的递归调用}
str := str + '</' + strName + '>' + sLineBreak; {封口}
end;
end;
str := str + '</' + node.NodeName + '>'; {封口}
Result := str;
end;
function Tfrm_op_seae_vgm_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)) or (Str[i]=Chr(9)) then begin
Result:=True;
Exit;
end;
end;
end;
function Tfrm_op_seae_vgm_data.CheckParaNotExist(para:string):Boolean;
begin
Result:=False;
if Trim(para)='' then Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetCntrVGM(cntrsize: String):String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select VGM代码 from t_code_ctn where 代码='''+cntrsize+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('VGM代码').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_vgm_data.GetCntr(vgmsize: String;var cc:string;var xc:string;var bxxs:string):String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select * from t_code_ctn where VGM代码='''+vgmsize+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('代码').AsString;
cc:=FieldByName('尺寸').AsString;
xc:=FieldByName('箱型').AsString;
bxxs:=FieldByName('表现形式').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_vgm_data.GetPackVGM(cntrsize: 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 代码='''+cntrsize+'''');
Open;
if IsEmpty then
Result:=''
else
Result:=FieldByName('EDI代码').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_op_seae_vgm_data.SeparateEC(Str: String): string;
var
i:Integer;
begin
if Str='' then Exit;
for i:=1 to Length(Str) do
begin
if (Str[i]<=Chr(127)) then Result:=Result+Str[i] else Break;
end;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton11Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton12Click(Sender: TObject);
begin
t_op_ctn_vgm.Append;
end;
procedure Tfrm_op_seae_vgm_data.FormShow(Sender: TObject);
var
strstart,strend:string;
begin
loadreggrid(dxdbgrid2, true, caption);
loadreggrid(dxdbgrid1, true, caption+'1');
strstart:= formatdatetime('yyyy-mm-dd hh:mm:ss',date);
strend:= formatdatetime('yyyy-mm-dd hh:mm:ss',Now);
with t_code_ctn do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_code_ctn');
Open;
end;
with t_code_package do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_code_package');
Open;
end;
with t_op_seae_vgm do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_op_seae_vgm where 发送日期 between '+quotedstr(strstart)+' and '+quotedstr(strend)+' order by 发送日期 desc');
Open;
end;
Notebook1.PageIndex:=1;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton10Click(Sender: TObject);
begin
Notebook1.PageIndex:=1;
end;
procedure Tfrm_op_seae_vgm_data.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid2,caption);
savereggrid(dxdbgrid1,caption+'1');
frm_op_seae_vgm_data.Hide;
frm_op_seae_vgm_data.ManualFloat(frm_op_seae_vgm_data.BoundsRect );
frm_main.freeTabs('frm_op_seae_vgm_data');
action:=cafree;
frm_op_seae_vgm_data:=nil;
end;
procedure Tfrm_op_seae_vgm_data.dxDBGrid2DblClick(Sender: TObject);
begin
if t_op_seae_vgm.IsEmpty then
begin
ShowMessage('没有数据!不能进入明细!请点击新增业务按钮');
Exit;
end;
with t_op_ctn_vgm do
begin
close;
SQL.Clear;
SQL.Add('select * from t_op_ctn_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString) );
Open;
end;
Notebook1.PageIndex:=0;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton16Click(Sender: TObject);
begin
t_op_seae_vgm.Append;
Notebook1.PageIndex:=0;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton3Click(Sender: TObject);
begin
t_op_seae_vgm.Append;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton8Click(Sender: TObject);
begin
table_post(t_op_seae_vgm);
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton15Click(Sender: TObject);
begin
t_op_ctn_vgm.fieldbyname('编号').AsString:=t_op_seae_vgm.fieldbyname('编号').AsString;
t_op_ctn_vgm.fieldbyname('箱数').AsString:='1';
table_post(t_op_ctn_vgm);
end;
procedure Tfrm_op_seae_vgm_data.dxDBGrid1Column3Change(Sender: TObject);
begin
t_op_ctn_vgm.fieldbyname('表现形式').AsString:=t_code_ctn.fieldbyname('表现形式').AsString;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_op_seae_vgm);
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton9Click(Sender: TObject);
var
mybookmark:TBookmark;
begin
mybookmark:= t_op_seae_vgm.GetBookmark;
t_op_seae_vgm.Requery();
t_op_seae_vgm.GotoBookmark(mybookmark);
end;
//OPType:True解析 False生成
function Tfrm_op_seae_vgm_data.GetNBEDIhead(OPType:Boolean;var MyNBEDIhead : NBEDIhead):Boolean;
var
i:Integer;
pnode,anode: IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='head' then
begin
MyNBEDIhead.sndcom:=VarToStr(anode.ChildNodes[0].NodeValue);
MyNBEDIhead.sender:=VarToStr(anode.ChildNodes[1].NodeValue);
MyNBEDIhead.fromop:=VarToStr(anode.ChildNodes[2].NodeValue);
MyNBEDIhead.fromtele:=VarToStr(anode.ChildNodes[3].NodeValue);
MyNBEDIhead.fromfax:=VarToStr(anode.ChildNodes[4].NodeValue);
MyNBEDIhead.frommail:=VarToStr(anode.ChildNodes[5].NodeValue);
MyNBEDIhead.fromopc:=VarToStr(anode.ChildNodes[6].NodeValue);
MyNBEDIhead.fromope:=VarToStr(anode.ChildNodes[7].NodeValue);
MyNBEDIhead.accom:=VarToStr(anode.ChildNodes[8].NodeValue);
MyNBEDIhead.accepter:=VarToStr(anode.ChildNodes[9].NodeValue);
MyNBEDIhead.toop:=VarToStr(anode.ChildNodes[10].NodeValue);
MyNBEDIhead.sendtime:=StrToDateTime(VarToStr(anode.ChildNodes[11].NodeValue));
MyNBEDIhead.editype:=VarToStr(anode.ChildNodes[12].NodeValue);
MyNBEDIhead.EdiID:=VarToStr(anode.ChildNodes[13].NodeValue);
MyNBEDIhead.EdiName:=VarToStr(anode.ChildNodes[14].NodeValue);
MyNBEDIhead.EdiMode:=VarToStr(anode.ChildNodes[15].NodeValue);
MyNBEDIhead.EdiReceiver:=VarToStr(anode.ChildNodes[16].NodeValue);
MyNBEDIhead.EdiSender:=VarToStr(anode.ChildNodes[17].NodeValue);
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
MyNBEDIhead.sndcom := aQuery.fieldbyname('发送方代码').AsString;
if (IsZhongwen(MyNBEDIhead.sndcom)) or (CheckParaNotExist(MyNBEDIhead.sndcom)) then
begin
HasM:=True;
ShowMessage('发送方代码未配置或不能包含中文!请检查!');
Exit;
end;
MyNBEDIhead.fromop := aQuery.fieldbyname('发送人').AsString;
if (IsZhongwen(MyNBEDIhead.fromop)) or (CheckParaNotExist(MyNBEDIhead.fromop)) then
begin
HasM:=True;
ShowMessage('发送人未配置或不能包含中文!请检查!');
Exit;
end;
MyNBEDIhead.fromtele := aQuery.fieldbyname('电话').AsString;
if (IsZhongwen(MyNBEDIhead.fromtele)) or (CheckParaNotExist(MyNBEDIhead.fromtele)) then
begin
HasM:=True;
ShowMessage('发送人电话未配置或不能包含中文!请检查!');
Exit;
end;
MyNBEDIhead.frommail := aQuery.fieldbyname('邮箱').AsString;
if (IsZhongwen(MyNBEDIhead.frommail)) or (CheckParaNotExist(MyNBEDIhead.frommail)) then
begin
HasM:=True;
ShowMessage('发送人邮箱未配置或不能包含中文!请检查!');
Exit;
end;
MyNBEDIhead.accom := aQuery.fieldbyname('接收方代码').AsString;
if (IsZhongwen(MyNBEDIhead.accom)) or (CheckParaNotExist(MyNBEDIhead.accom)) then
begin
HasM:=True;
ShowMessage('接收方代码未配置或不能包含中文!请检查!');
Exit;
end;
MyNBEDIhead.sendtime := aQuery.fieldbyname('发送日期').AsDateTime;
MyNBEDIhead.editype := aQuery.fieldbyname('报文类型').AsString;
MyNBEDIhead.EdiID := aQuery.fieldbyname('文件名').AsString;
MyNBEDIhead.EdiName:= aQuery.fieldbyname('文件名').AsString;
MyNBEDIhead.EdiMode :='HYXML';
MyNBEDIhead.EdiReceiver := aQuery.fieldbyname('接收方代码').AsString;
MyNBEDIhead.EdiSender := aQuery.fieldbyname('发送方代码').AsString;
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIForward(OPType:Boolean;var MyNBEDIForward : NBEDIForward):Boolean;
var
str:string;
i:Integer;
pnode,anode: IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='Forward' then
begin
if VarToStr(anode.ChildNodes[9].NodeValue)='9' then str:='新增';
if VarToStr(anode.ChildNodes[9].NodeValue)='5' then str:='修改';
if VarToStr(anode.ChildNodes[9].NodeValue)='1' then str:='取消';
MyNBEDIForward.EdiForwardREFE5:=str;
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
if aQuery.fieldbyname('报文功能').AsString='新增' then MyNBEDIForward.EdiForwardREFE5:= '9';
if aQuery.fieldbyname('报文功能').AsString='修改' then MyNBEDIForward.EdiForwardREFE5:= '5';
if aQuery.fieldbyname('报文功能').AsString='取消' then MyNBEDIForward.EdiForwardREFE5:= '1';
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIreference(OPType:Boolean;var MyNBEDIreference : NBEDIreference):Boolean;
var
i:Integer;
str:string;
pnode,anode,bnode,node: IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='reference' then
begin
if VarToStr(anode.ChildNodes[0].NodeValue)='9' then str:='新增';
if VarToStr(anode.ChildNodes[0].NodeValue)='5' then str:='修改';
if VarToStr(anode.ChildNodes[0].NodeValue)='1' then str:='取消';
MyNBEDIreference.blfreight:=str;
MyNBEDIreference.refid:=VarToStr(anode.ChildNodes[1].NodeValue);
MyNBEDIreference.freid:=VarToStr(anode.ChildNodes[2].NodeValue);
MyNBEDIreference.referenceno:=VarToStr(anode.ChildNodes[3].NodeValue);
MyNBEDIreference.bookingno:=VarToStr(anode.ChildNodes[4].NodeValue);
MyNBEDIreference.workno:=VarToStr(anode.ChildNodes[5].NodeValue);
MyNBEDIreference.sale:=VarToStr(anode.ChildNodes[6].NodeValue);
MyNBEDIreference.billofladingno:=VarToStr(anode.ChildNodes[7].NodeValue);
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
if aQuery.fieldbyname('报文功能').AsString='新增' then MyNBEDIreference.blfreight:= '9';
if aQuery.fieldbyname('报文功能').AsString='修改' then MyNBEDIreference.blfreight:= '5';
if aQuery.fieldbyname('报文功能').AsString='取消' then MyNBEDIreference.blfreight:= '1';
MyNBEDIreference.referenceno:=aQuery.fieldbyname('业务编号').AsString;
MyNBEDIreference.bookingno:=aQuery.fieldbyname('订舱单号').AsString;
MyNBEDIreference.workno:=aQuery.fieldbyname('业务编号').AsString;
MyNBEDIreference.sale:='gu';
MyNBEDIreference.billofladingno:=aQuery.fieldbyname('提单号').AsString;
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIbaseinfo(OPType:Boolean;var MyNBEDIbaseinfo : NBEDIbaseinfo):Boolean;
var
i,k,j:Integer;
str:string;
pnode,anode,bnode : IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='detail' then
begin
for k:=0 to anode.ChildNodes.Count-1 do
begin
bnode := anode.ChildNodes[k];
if bnode.NodeName='baseinfo' then
begin
MyNBEDIbaseinfo.orderman:= VarToStr(bnode.ChildNodes[0].NodeValue);
MyNBEDIbaseinfo.source:= VarToStr(bnode.ChildNodes[1].NodeValue);
MyNBEDIbaseinfo.usdaccountshipper:= VarToStr(bnode.ChildNodes[2].NodeValue);
MyNBEDIbaseinfo.customshipper:= VarToStr(bnode.ChildNodes[3].NodeValue);
MyNBEDIbaseinfo.rmbaccountshipper:= VarToStr(bnode.ChildNodes[4].NodeValue);
MyNBEDIbaseinfo.paymenttermcode:= VarToStr(bnode.ChildNodes[5].NodeValue);
MyNBEDIbaseinfo.paymentterm:= VarToStr(bnode.ChildNodes[6].NodeValue);
MyNBEDIbaseinfo.payableat:= VarToStr(bnode.ChildNodes[7].NodeValue);
MyNBEDIbaseinfo.shippingitem:= VarToStr(bnode.ChildNodes[8].NodeValue);
MyNBEDIbaseinfo.billofladingtype:= VarToStr(bnode.ChildNodes[9].NodeValue);
str:='';
for j:=0 to bnode.ChildNodes[10].ChildNodes.count-1 do
str:=str+VarToStr(bnode.ChildNodes[10].ChildNodes[j].NodeValue)+#13#10;
MyNBEDIbaseinfo.shipper:= str;
str:='';
for j:=0 to bnode.ChildNodes[11].ChildNodes.count-1 do
str:=str+VarToStr(bnode.ChildNodes[11].ChildNodes[j].NodeValue)+#13#10;
MyNBEDIbaseinfo.consignee:= str;
str:='';
for j:=0 to bnode.ChildNodes[12].ChildNodes.count-1 do
str:=str+VarToStr(bnode.ChildNodes[12].ChildNodes[j].NodeValue)+#13#10;
MyNBEDIbaseinfo.notifyparty:= str;
str:='';
for j:=0 to bnode.ChildNodes[13].ChildNodes.count-1 do
str:=str+VarToStr(bnode.ChildNodes[13].ChildNodes[j].NodeValue)+#13#10;
MyNBEDIbaseinfo.notifyparty2:= str;
MyNBEDIbaseinfo.ordermemo:= VarToStr(bnode.ChildNodes[14].NodeValue);
MyNBEDIbaseinfo.numberoforiginals:= VarToStr(bnode.ChildNodes[15].NodeValue);
MyNBEDIbaseinfo.numberofcopys:= VarToStr(bnode.ChildNodes[16].NodeValue);
MyNBEDIbaseinfo.placeofissuecode:= VarToStr(bnode.ChildNodes[17].NodeValue);
MyNBEDIbaseinfo.placeofissue:= VarToStr(bnode.ChildNodes[18].NodeValue);
MyNBEDIbaseinfo.timeofissue:= VarToStr(bnode.ChildNodes[19].NodeValue);
end;
end;
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
MyNBEDIbaseinfo.orderman:=aQuery.fieldbyname('接收方代码').AsString;
MyNBEDIbaseinfo.paymenttermcode:= aQuery.fieldbyname('付费方式代码').AsString;
MyNBEDIbaseinfo.paymentterm:=aQuery.fieldbyname('付费方式').AsString;
//运费条款暂时不用
MyNBEDIbaseinfo.shippingitem:=aQuery.fieldbyname('运输条款').AsString;
MyNBEDIbaseinfo.shipper := aQuery.fieldbyname('发货人名称').AsString;
MyNBEDIbaseinfo.consignee:=aQuery.fieldbyname('收货人名称').AsString;
MyNBEDIbaseinfo.notifyparty:=aQuery.fieldbyname('通知人名称').AsString;
MyNBEDIbaseinfo.numberoforiginals:=aQuery.fieldbyname('提单份数').AsString;
MyNBEDIbaseinfo.placeofissuecode:='NBPORTEDI';
MyNBEDIbaseinfo.placeofissue:=aQuery.fieldbyname('签单地点').AsString;
if FormatDateTime('yyyy-mm-dd',aQuery.fieldbyname('签单日期').AsDateTime)='1900-01-01' then
MyNBEDIbaseinfo.timeofissue:='' else MyNBEDIbaseinfo.timeofissue:=aQuery.fieldbyname('签单日期').AsString;
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIcargo(OPType:Boolean;var MyNBEDIcargo : NBEDIcargo):Boolean;
begin
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIbooking(OPType:Boolean;var MyNBEDIbooking : NBEDIbooking):Boolean;
begin
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIfreight(OPType:Boolean;var MyNBEDIfreight : NBEDIfreight):Boolean;
begin
Result:=True;
end;
function Tfrm_op_seae_vgm_data.Getediport(OPType:Boolean;var MyPort : ediport):Boolean;
var
i,k,j:Integer;
pnode,anode,bnode,cnode: IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='detail' then
begin
for k:=0 to anode.ChildNodes.Count-1 do
begin
bnode := anode.ChildNodes[k];
if bnode.NodeName='freight' then
begin
for j:=0 to bnode.ChildNodes.Count-1 do
begin
cnode := bnode.ChildNodes[j];
if cnode.NodeName='port' then
begin
MyPort.placeofreceipt:=VarToStr(cnode.ChildNodes[0].NodeValue);
MyPort.portofloading:=VarToStr(cnode.ChildNodes[1].NodeValue);
MyPort.portoftranship:=VarToStr(cnode.ChildNodes[2].NodeValue);
MyPort.portofdischarge:=VarToStr(cnode.ChildNodes[3].NodeValue);
MyPort.placeofdelivery:=VarToStr(cnode.ChildNodes[4].NodeValue);
MyPort.finaldestination:=VarToStr(cnode.ChildNodes[5].NodeValue);
MyPort.co_placeofreceipt:=VarToStr(cnode.ChildNodes[6].NodeValue);
MyPort.co_portofloading:=VarToStr(cnode.ChildNodes[7].NodeValue);
MyPort.co_portoftranship:=VarToStr(cnode.ChildNodes[8].NodeValue);
MyPort.co_portofdischarge:=VarToStr(cnode.ChildNodes[9].NodeValue);
MyPort.co_placeofdelivery:=VarToStr(cnode.ChildNodes[10].NodeValue);
MyPort.co_finaldestination:=VarToStr(cnode.ChildNodes[11].NodeValue);
end;
end;
end;
end;
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
MyPort.portofloading:=aQuery.fieldbyname('起运港名称').AsString;
MyPort.portofdischarge:=aQuery.fieldbyname('卸货港名称').AsString;
MyPort.placeofdelivery:=aQuery.fieldbyname('目的地名称').AsString;
MyPort.co_portofloading:=aQuery.fieldbyname('起运港代码').AsString;
MyPort.co_portofdischarge:=aQuery.fieldbyname('卸货港代码').AsString;
MyPort.co_placeofdelivery:=aQuery.fieldbyname('目的地代码').AsString;
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.Getedivessel(OPType:Boolean;var MyVessel : edivessel):Boolean;
var
i,k,j:Integer;
pnode,anode,bnode,cnode: IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='detail' then
begin
for k:=0 to anode.ChildNodes.Count-1 do
begin
bnode := anode.ChildNodes[k];
if bnode.NodeName='freight' then
begin
for j:=0 to bnode.ChildNodes.Count-1 do
begin
cnode := bnode.ChildNodes[j];
if cnode.NodeName='vessel' then
begin
MyVessel.carrier:=VarToStr(cnode.ChildNodes[0].NodeValue);
MyVessel.oceanvessel:=VarToStr(cnode.ChildNodes[1].NodeValue);
MyVessel.voyno:=VarToStr(cnode.ChildNodes[2].NodeValue);
MyVessel.etd:=VarToStr(cnode.ChildNodes[3].NodeValue);
MyVessel.deliverymode:=VarToStr(cnode.ChildNodes[4].NodeValue);
end;
end;
end;
end;
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
MyVessel.carrier:=aQuery.fieldbyname('船公司').AsString;
MyVessel.oceanvessel:=aQuery.fieldbyname('船名').AsString;
MyVessel.voyno:=aQuery.fieldbyname('航次').AsString;
MyVessel.etd:= aQuery.fieldbyname('开船日期').AsString;
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.Getediinfo2nd(OPType:Boolean;var Myinfo2nd : ediinfo2nd):Boolean;
begin
Result:=True;
end;
function Tfrm_op_seae_vgm_data.Getedicontainers(OPType:Boolean;var ContainerCount:Integer):Boolean;
var
i,k,j,m,n:Integer;
str:string;
pnode,anode,bnode,cnode,dnode: IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='detail' then
begin
for k:=0 to anode.ChildNodes.Count-1 do
begin
bnode := anode.ChildNodes[k];
if bnode.NodeName='freight' then
begin
for j:=0 to bnode.ChildNodes.Count-1 do
begin
cnode := bnode.ChildNodes[j];
if cnode.NodeName='container' then
begin
ContainerCount:=cnode.ChildNodes.Count;
for m:=0 to cnode.ChildNodes.Count -1 do
begin
dnode := cnode.ChildNodes[m];
MyContainers[m].containertype:=VarToStr(dnode.ChildNodes[0].NodeValue);
MyContainers[m].containerno:=VarToStr(dnode.ChildNodes[1].NodeValue);
MyContainers[m].sealno:=VarToStr(dnode.ChildNodes[2].NodeValue);
MyContainers[m].containernoofpkgs:=VarToStr(dnode.ChildNodes[3].NodeValue);
if Trim(MyContainers[m].containernoofpkgs)='' then MyContainers[m].containernoofpkgs:='1';
MyContainers[m].containergrossweight:=VarToStr(dnode.ChildNodes[4].NodeValue);
if Trim(MyContainers[m].containergrossweight)='' then MyContainers[m].containergrossweight:='0';
MyContainers[m].containercbm:=VarToStr(dnode.ChildNodes[5].NodeValue);
if Trim(MyContainers[m].containercbm)='' then MyContainers[m].containercbm:='0';
MyContainers[m].containerpackagingcode:=VarToStr(dnode.ChildNodes[6].NodeValue);
MyContainers[m].containerpackaging:=VarToStr(dnode.ChildNodes[7].NodeValue);
str:='';
for n:=0 to dnode.ChildNodes[8].ChildNodes.Count-1 do
str:=str+VarToStr(dnode.ChildNodes[8].ChildNodes[n].NodeValue)+#13#10;
MyContainers[m].containerdescription:=str;
MyContainers[m].containermarksandnumbers:=VarToStr(dnode.ChildNodes[9].NodeValue);
MyContainers[m].vgmgrossmassweight:=VarToStr(dnode.ChildNodes[10].NodeValue);
if Trim(MyContainers[m].vgmgrossmassweight)='' then MyContainers[m].vgmgrossmassweight:='0';
MyContainers[m].vgmweighingmethod:=VarToStr(dnode.ChildNodes[11].NodeValue);
MyContainers[m].vgmweighingtime:=VarToStr(dnode.ChildNodes[12].NodeValue);
MyContainers[m].vgmresponsibleparty:=VarToStr(dnode.ChildNodes[13].NodeValue);
MyContainers[m].vgmauthorizedperson:=VarToStr(dnode.ChildNodes[14].NodeValue);
MyContainers[m].vgmauthorizedpersontele:=VarToStr(dnode.ChildNodes[15].NodeValue);
MyContainers[m].vgmauthorizedpersonmail:=VarToStr(dnode.ChildNodes[16].NodeValue);
MyContainers[m].vgmremark:=VarToStr(dnode.ChildNodes[17].NodeValue);
end;
end;
end;
end;
end;
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_ctn_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
ContainerCount:=aQuery.RecordCount;
aQuery.First;
for i:=0 to ContainerCount-1 do
begin
MyContainers[i].containertype:=GetCntrVGM(aQuery.fieldbyname('代码').AsString);
MyContainers[i].containerno:=aQuery.fieldbyname('箱号').AsString;
MyContainers[i].sealno:=aQuery.fieldbyname('封号').AsString;
MyContainers[i].containernoofpkgs:=aQuery.fieldbyname('箱数').AsString;
MyContainers[i].containergrossweight:=aQuery.fieldbyname('重量').AsString;
MyContainers[i].containercbm:=aQuery.fieldbyname('尺码').AsString;
MyContainers[i].containerpackagingcode:=aQuery.fieldbyname('包装代码').AsString;
MyContainers[i].containerpackaging:=aQuery.fieldbyname('包装').AsString;
MyContainers[i].vgmgrossmassweight:=aQuery.fieldbyname('VGM总重量').AsString;
MyContainers[i].vgmweighingmethod:= aQuery.fieldbyname('VGM称重方式').AsString ;
MyContainers[i].vgmweighingtime:=aQuery.fieldbyname('VGM称重时间').AsString;
MyContainers[i].vgmresponsibleparty :=aQuery.fieldbyname('VGM联系单位').AsString;
MyContainers[i].vgmauthorizedperson:=aQuery.fieldbyname('VGM联系人').AsString;
MyContainers[i].vgmauthorizedpersontele:=aQuery.fieldbyname('VGM联系电话').AsString;
aQuery.Next;
end;
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIgoods(OPType:Boolean;var MyNBEDIgoods : NBEDIgoods):Boolean;
var
i,k,m:Integer;
str:string;
pnode,anode,bnode : IXMLNode;
aQuery:TADOQuery;
SQLStr:string;
begin
Result:=False;
if OPType then
begin
pnode := XMLDocument1.DocumentElement;
try
for i:=0 to pnode.ChildNodes.Count-1 do
begin
anode := pnode.ChildNodes[i];
if anode.NodeName='detail' then
begin
for k:=0 to anode.ChildNodes.Count-1 do
begin
bnode := anode.ChildNodes[k];
if bnode.NodeName='goods' then
begin
str:='';
for m:=0 to bnode.ChildNodes[0].ChildNodes.Count-1 do
str:=str+VarToStr(bnode.ChildNodes[0].ChildNodes[m].NodeValue)+#13#10;
MyNBEDIgoods.marksandnumbers:=str;
MyNBEDIgoods.noofpkgs:=VarToStr(bnode.ChildNodes[1].NodeValue);
if Trim(MyNBEDIgoods.noofpkgs)='' then MyNBEDIgoods.noofpkgs:='0';
MyNBEDIgoods.packagingcode:=VarToStr(bnode.ChildNodes[2].NodeValue);
MyNBEDIgoods.packaging:=VarToStr(bnode.ChildNodes[3].NodeValue);
MyNBEDIgoods.cargoid:=VarToStr(bnode.ChildNodes[4].NodeValue);
MyNBEDIgoods.hscode:=VarToStr(bnode.ChildNodes[5].NodeValue);
str:='';
for m:=0 to bnode.ChildNodes[6].ChildNodes.Count-1 do
str:=str+VarToStr(bnode.ChildNodes[6].ChildNodes[m].NodeValue)+#13#10;
MyNBEDIgoods.description:=str;
str:='';
for m:=0 to bnode.ChildNodes[7].ChildNodes.Count-1 do
str:=str+VarToStr(bnode.ChildNodes[7].ChildNodes[m].NodeValue)+#13#10;
MyNBEDIgoods.cdescription:=str;
MyNBEDIgoods.grossweight:=VarToStr(bnode.ChildNodes[8].NodeValue);
if Trim(MyNBEDIgoods.grossweight)='' then MyNBEDIgoods.grossweight:='0';
MyNBEDIgoods.cbm:=VarToStr(bnode.ChildNodes[9].NodeValue);
if Trim(MyNBEDIgoods.cbm)='' then MyNBEDIgoods.cbm:='0';
str:='';
for m:=0 to bnode.ChildNodes[10].ChildNodes.Count-1 do
str:=str+VarToStr(bnode.ChildNodes[10].ChildNodes[m].NodeValue)+#13#10;
MyNBEDIgoods.specialgoods:=str;
end;
end;
end;
end;
except
on e:Exception do ShowMessage('解析XML错误');
end;
end;
if not OPType then
begin
aQuery:=CreateAdoQuery;
SQLStr:='select * from t_op_seae_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString);
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end;
MyNBEDIgoods.marksandnumbers:=aQuery.fieldbyname('唛头').AsString;
MyNBEDIgoods.noofpkgs:=aQuery.fieldbyname('件数').AsString;
MyNBEDIgoods.packagingcode:=aQuery.fieldbyname('包装代码').AsString;
MyNBEDIgoods.packaging:=aQuery.fieldbyname('包装').AsString;
MyNBEDIgoods.description:=aQuery.fieldbyname('货描').AsString;
MyNBEDIgoods.grossweight:=aQuery.fieldbyname('重量').AsString;
MyNBEDIgoods.cbm:=aQuery.fieldbyname('尺码').AsString;
MyNBEDIgoods.cargoid:='GC';
FreeAndNil(aQuery);
end;
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIdr(OPType:Boolean;var MyNBEDIdr : NBEDIdr):Boolean;
begin
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIloadplan(OPType:Boolean;var MyNBEDIloadplan : NBEDIloadplan):Boolean;
begin
Result:=True;
end;
function Tfrm_op_seae_vgm_data.GetNBEDIgoodsdetail(OPType:Boolean;var goodscount : Integer):Boolean;
begin
Result:=True;
end;
procedure Tfrm_op_seae_vgm_data.MakeVGM(editype:string);
var
fNode,pNode,mNode,cNode,dNode,eNode,gNode: IXMLNode; {定义7层节点}
sl:TStringList;
i,k,Elength,Wlength,Clength:Integer;
myhead:NBEDIhead;
myForward:NBEDIForward;
myreference:NBEDIreference;
mybaseinfo:NBEDIbaseinfo;
mycargo:NBEDIcargo;
mybooking:NBEDIbooking;
myfreight:NBEDIfreight;
myport:ediport;
myvessel:edivessel;
myinfo:ediinfo2nd;
ContainerCount,goodscount:Integer;
mygoods:NBEDIgoods;
mydr:NBEDIdr;
myloadolan:NBEDIloadplan;
begin
XMLDocument1.XML.Clear;
XMLDocument1.Active := True;
XMLDocument1.Version := '1.0';
XMLDocument1.Encoding := 'GB2312';
//添加根节点 edi
fNode := XMLDocument1.AddChild('edi');
// 为根节点添加子节点:HEAD
pNode := fNode.AddChild('head');
GetNBEDIhead(False,myhead);
cNode := pNode.AddChild('sndcom'); //*
cNode.Text := myhead.sndcom;
cNode := pNode.AddChild('sender');
cNode.Text :=myhead.sender;
cNode := pNode.AddChild('fromop'); //*
cNode.Text := myhead.fromop;
cNode := pNode.AddChild('fromtele'); //*
cNode.Text := myhead.fromtele;
cNode := pNode.AddChild('fromfax');
cNode.Text := myhead.fromfax;
cNode := pNode.AddChild('frommail'); //*
cNode.Text := myhead.frommail;
cNode := pNode.AddChild('fromopc');
cNode.Text := myhead.fromopc;
cNode := pNode.AddChild('fromope');
cNode.Text := myhead.fromope;
cNode := pNode.AddChild('accom'); //*
cNode.Text :=myhead.accom;
cNode := pNode.AddChild('accepter');
cNode.Text :=myhead.accepter;
cNode := pNode.AddChild('toop');
cNode.Text :=myhead.toop;
cNode := pNode.AddChild('sendtime'); //*
cNode.Text:=FormatDateTime('yyyy-mm-dd hh:mm:ss',myhead.sendtime);
cNode := pNode.AddChild('editype'); //*
cNode.Text:=myhead.editype;
cNode := pNode.AddChild('EdiID'); //*
cNode.Text:=myhead.EdiID;
cNode := pNode.AddChild('EdiName');
cNode.Text:=myhead.EdiName;
cNode := pNode.AddChild('EdiMode'); //*
cNode.Text:=myhead.EdiMode;
cNode := pNode.AddChild('EdiReceiver'); //*
cNode.Text := myhead.EdiReceiver;
cNode := pNode.AddChild('EdiSender'); //*
cNode.Text := myhead.EdiSender;
// 为根节点添加子节点:Forward
pNode := fNode.AddChild('Forward');
GetNBEDIForward(False,myForward);
cNode := pNode.AddChild('EdiForwardFMT');
cNode.Text := myForward.EdiForwardFMT;
cNode := pNode.AddChild('EdiForwardType');
cNode.Text := myForward.EdiForwardType;
cNode := pNode.AddChild('EdiForwardURL');
cNode.Text := myForward.EdiForwardURL;
cNode := pNode.AddChild('EdiForwardId');
cNode.Text := myForward.EdiForwardId;
cNode := pNode.AddChild('EdiForwardPass');
cNode.Text := myForward.EdiForwardPass;
cNode := pNode.AddChild('EdiForwardREFE1');
cNode.Text := myForward.EdiForwardREFE1;
cNode := pNode.AddChild('EdiForwardREFE2');
cNode.Text := myForward.EdiForwardREFE2;
cNode := pNode.AddChild('EdiForwardREFE3');
cNode.Text := myForward.EdiForwardREFE3;
cNode := pNode.AddChild('EdiForwardREFE4');
cNode.Text := myForward.EdiForwardREFE4;
cNode := pNode.AddChild('EdiForwardREFE5');
cNode.Text := myForward.EdiForwardREFE5;
// 为根节点添加子节点:reference
pNode := fNode.AddChild('reference');
GetNBEDIreference(False,myreference);
cNode := pNode.AddChild('blfreight'); //*
cNode.Text := myreference.blfreight;
cNode := pNode.AddChild('refid');
cNode.Text := myreference.refid;
cNode := pNode.AddChild('freid');
cNode.Text := myreference.freid;
cNode := pNode.AddChild('referenceno');
cNode.Text := myreference.referenceno;
cNode := pNode.AddChild('bookingno'); //*
cNode.Text := myreference.bookingno;
cNode := pNode.AddChild('workno'); //*
cNode.Text := myreference.workno;
cNode := pNode.AddChild('sale');
cNode.Text := myreference.sale;
cNode := pNode.AddChild('billofladingno'); //*
cNode.Text := myreference.billofladingno;
// 为根节点添加子节点:detail
pNode := fNode.AddChild('detail');
//增加二级子节点 baseinfo
mNode:= pNode.AddChild('baseinfo');
GetNBEDIbaseinfo(False,mybaseinfo);
cNode := mNode.AddChild('orderman'); //* 订舱单位 如果录了就取订舱代理如果没录就取company里的shortname
cNode.Text := mybaseinfo.orderman;
cNode := mNode.AddChild('source');
cNode := mNode.AddChild('usdaccountshipper');
cNode.Text := mybaseinfo.usdaccountshipper;
cNode := mNode.AddChild('customshipper');
cNode.Text := mybaseinfo.customshipper;
cNode := mNode.AddChild('rmbaccountshipper');
cNode.Text := mybaseinfo.rmbaccountshipper;
cNode := mNode.AddChild('paymenttermcode'); //* 付款方式代码(P/C/E)
cNode.Text := mybaseinfo.paymenttermcode;
cNode := mNode.AddChild('paymentterm'); //*
cNode.Text := mybaseinfo.paymentterm;
cNode := mNode.AddChild('payableat');
cNode.Text := mybaseinfo.payableat;
cNode := mNode.AddChild('shippingitem'); //*
cNode.Text := mybaseinfo.shippingitem;
cNode := mNode.AddChild('billofladingtype'); //*
cNode.Text := mybaseinfo.billofladingtype;
cNode := mNode.AddChild('shipper'); //*
sl:=TStringList.Create;
sl.Text:=mybaseinfo.shipper;
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
cNode := mNode.AddChild('consignee'); //*
sl:=TStringList.Create;
sl.Text:=mybaseinfo.consignee;
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
cNode := mNode.AddChild('notifyparty'); //*
sl:=TStringList.Create;
sl.Text:=mybaseinfo.notifyparty;
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
cNode := mNode.AddChild('notifyparty2');
if Trim(mybaseinfo.notifyparty2)<>'' then
begin
sl:=TStringList.Create;
sl.Text:=mybaseinfo.notifyparty2;
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
end
else
begin
dNode := cNode.AddChild('text');
end;
cNode := mNode.AddChild('ordermemo');
cNode.Text := mybaseinfo.ordermemo;
cNode := mNode.AddChild('numberoforiginals'); //*
cNode.Text := mybaseinfo.numberoforiginals;
cNode := mNode.AddChild('numberofcopys');
cNode.Text := mybaseinfo.numberofcopys;
cNode := mNode.AddChild('placeofissuecode'); //*
cNode.Text := mybaseinfo.placeofissuecode;
cNode := mNode.AddChild('placeofissue'); //*
cNode.Text := mybaseinfo.placeofissue;
cNode := mNode.AddChild('timeofissue'); //*
cNode.Text := mybaseinfo.timeofissue;
//增加二级子节点 cargo
mNode:= pNode.AddChild('cargo');
GetNBEDIcargo(False,mycargo);
cNode := mNode.AddChild('APPLICANT');
cNode.Text := mycargo.APPLICANT;
cNode := mNode.AddChild('BOKKINGPARTY');
cNode.Text := mycargo.BOKKINGPARTY;
cNode := mNode.AddChild('FOBPARTY');
cNode.Text := mycargo.FOBPARTY;
cNode := mNode.AddChild('SCNO');
cNode.Text := mycargo.SCNO;
cNode := mNode.AddChild('QUARANTINECODING');
cNode.Text := mycargo.QUARANTINECODING;
cNode := mNode.AddChild('SCACCODE');
cNode.Text := mycargo.SCACCODE;
cNode := mNode.AddChild('QUOTATIONNO');
cNode.Text := mycargo.QUOTATIONNO;
cNode := mNode.AddChild('CHARGETYPE');
cNode.Text := mycargo.CHARGETYPE;
cNode := mNode.AddChild('NVOCCHBLNO');
cNode.Text := mycargo.NVOCCHBLNO;
cNode := mNode.AddChild('realshipper');
dNode := cNode.AddChild('text');
dNode.Text := mycargo.realshipper;
cNode := mNode.AddChild('realconsignee');
dNode := cNode.AddChild('text');
dNode.Text := mycargo.realconsignee;
cNode := mNode.AddChild('realnotifyparty');
dNode := cNode.AddChild('text');
dNode.Text := mycargo.realnotifyparty;
cNode := mNode.AddChild('realnotifyparty2');
dNode := cNode.AddChild('text');
dNode.Text := mycargo.realnotifyparty2;
//增加二级子节点 booking
mNode:= pNode.AddChild('booking');
GetNBEDIbooking(False,mybooking);
cNode := mNode.AddChild('shipmentdate');
cNode.Text := mybooking.shipmentdate;
cNode := mNode.AddChild('expirydate');
cNode.Text := mybooking.expirydate;
cNode := mNode.AddChild('tranship');
cNode.Text := mybooking.tranship;
cNode := mNode.AddChild('batch');
cNode.Text := mybooking.batch;
cNode := mNode.AddChild('quotationno');
cNode.Text := mybooking.quotationno;
//增加二级子节点 freight
mNode:= pNode.AddChild('freight');
GetNBEDIfreight(False,myfreight);
cNode := mNode.AddChild('fl');
cNode.Text := myfreight.fl;
cNode := mNode.AddChild('masterlclno');
cNode.Text := myfreight.masterlclno;
cNode := mNode.AddChild('requestdate');
cNode.Text := myfreight.requestdate;
cNode := mNode.AddChild('lastdate');
cNode.Text := myfreight.lastdate;
cNode := mNode.AddChild('arrivedate');
cNode.Text := myfreight.arrivedate;
//增加三级子节点 port
cNode := mNode.AddChild('port');
Getediport(False,myport);
dNode := cNode.AddChild('placeofreceipt');
dNode.Text := myport.placeofreceipt;
dNode := cNode.AddChild('portofloading'); //* 装货港
dNode.Text := myport.portofloading;
dNode := cNode.AddChild('portoftranship');
dNode.Text := myport.portoftranship;
dNode := cNode.AddChild('portofdischarge'); //* 卸货港
dNode.Text := myport.portofdischarge;
dNode := cNode.AddChild('placeofdelivery'); //* 目的港
dNode.Text:=myport.placeofdelivery;
dNode := cNode.AddChild('finaldestination');
dNode.Text:=myport.finaldestination;
dNode := cNode.AddChild('co_placeofreceipt');
dNode.Text:=myport.co_placeofreceipt;
dNode := cNode.AddChild('co_portofloading'); //* 装货港代码
dNode.Text:=myport.co_portofloading;
dNode := cNode.AddChild('co_portoftranship');
dNode.Text:=myport.co_portoftranship;
dNode := cNode.AddChild('co_portofdischarge'); //* 卸货港代码
dNode.Text:=myport.co_portofdischarge;
dNode := cNode.AddChild('co_placeofdelivery'); //* 目的港代码
dNode.Text:=myport.co_placeofdelivery;
dNode := cNode.AddChild('co_finaldestination');
dNode.Text:=myport.co_finaldestination;
//增加三级子节点vessel
cNode := mNode.AddChild('vessel');
Getedivessel(False,myvessel);
dNode := cNode.AddChild('carrier'); //* 船公司
dNode.Text:=myvessel.carrier;
dNode := cNode.AddChild('oceanvessel'); //* 船名
dNode.Text:=myvessel.oceanvessel;
dNode := cNode.AddChild('voyno'); //* 航次
dNode.Text:=myvessel.voyno;
dNode := cNode.AddChild('etd'); //* 开航日期
dNode.Text:= myvessel.etd;
dNode := cNode.AddChild('deliverymode');
dNode.Text := myvessel.deliverymode;
//增加三级子节点info2nd
cNode := mNode.AddChild('info2nd');
Getediinfo2nd(false,myinfo);
dNode := cNode.AddChild('carrier');
dNode.Text := myinfo.carrier;
dNode := cNode.AddChild('oceanvessel');
dNode.Text := myinfo.oceanvessel;
dNode := cNode.AddChild('voyno');
dNode.Text := myinfo.voyno;
dNode := cNode.AddChild('etd');
dNode.Text := myinfo.etd;
dNode := cNode.AddChild('deliverymode');
dNode.Text := myinfo.deliverymode;
dNode := cNode.AddChild('remarks');
eNode := dNode.AddChild('text');
eNode.Text := myinfo.remarks;
//增加三级子节点container
cNode := mNode.AddChild('container'); //若集装箱没录,提示:集装箱信息不能为空
Getedicontainers(False,ContainerCount);
if ContainerCount =0 then
begin
HasM:=True;
ShowMessage('集装箱信息不存在不能生成EDI文件请检查');
Exit;
end;
for i:=0 to ContainerCount-1 do
begin
dNode := cNode.AddChild('containers'); //可无限循环
eNode := dNode.AddChild('containertype'); //* 箱型 箱型不能为空
eNode.Text:=mycontainers[i].containertype;
eNode := dNode.AddChild('containerno'); //* 箱号 箱型不能为空
eNode.Text:=mycontainers[i].containerno;
eNode := dNode.AddChild('sealno'); //* 封号 不能为空
eNode.Text:=mycontainers[i].sealno;
eNode := dNode.AddChild('containernoofpkgs'); //* 件数 不能为空
eNode.Text:=mycontainers[i].containernoofpkgs;
eNode := dNode.AddChild('containergrossweight'); //* 毛重 不能为空
eNode.Text:=mycontainers[i].containergrossweight;
eNode := dNode.AddChild('containercbm'); //* 体积 不能为空
eNode.Text:=mycontainers[i].containercbm;
eNode := dNode.AddChild('containerpackagingcode'); //* 箱货物包装类型代码 包装类型代码未配置
eNode.Text:=mycontainers[i].containerpackagingcode;
eNode := dNode.AddChild('containerpackaging'); //* 箱货物包装类型 包装不能为空
eNode.Text:=mycontainers[i].containerpackaging;
eNode := dNode.AddChild('containerdescription');
gNode := eNode.AddChild('text');
gNode.Text := mycontainers[i].containerdescription;
eNode := dNode.AddChild('containermarksandnumbers');
eNode.Text := mycontainers[i].containermarksandnumbers;
eNode := dNode.AddChild('vgmgrossmassweight'); //VGM总重量 不能为空
eNode.Text:=mycontainers[i].vgmgrossmassweight;
eNode := dNode.AddChild('vgmweighingmethod'); //VGM称重方式 不能为空
eNode.Text:=mycontainers[i].vgmweighingmethod;
eNode := dNode.AddChild('vgmweighingtime'); //VGM称重时间 不能为空 空则取开船前三天
eNode.Text:=mycontainers[i].vgmweighingtime;
eNode := dNode.AddChild('vgmresponsibleparty'); //VGM联系单位
eNode.Text:=mycontainers[i].vgmresponsibleparty;
eNode := dNode.AddChild('vgmauthorizedperson'); //VGM授权联系人
eNode.Text:=mycontainers[i].vgmauthorizedperson;
eNode := dNode.AddChild('vgmauthorizedpersontele'); //VGM授权联系人电话
eNode.Text:=mycontainers[i].vgmauthorizedpersontele;
eNode := dNode.AddChild('vgmauthorizedpersonmail'); //VGM授权联系人邮件
eNode.Text := mycontainers[i].vgmauthorizedpersonmail;
eNode := dNode.AddChild('vgmremark'); //VGM其他备注内容
eNode.Text := mycontainers[i].vgmremark;
end;
//增加二级子节点 goods
mNode:= pNode.AddChild('goods');
GetNBEDIgoods(False,mygoods);
cNode := mNode.AddChild('marksandnumbers'); //* 唛头
if Trim(mygoods.marksandnumbers)='' then
begin
dNode := cNode.AddChild('text');
end
else
begin
sl:=TStringList.Create;
sl.Text:=mygoods.marksandnumbers;
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
end;
cNode := mNode.AddChild('noofpkgs'); //* 包装件数
cNode.Text:=mygoods.noofpkgs;
cNode := mNode.AddChild('packagingcode'); //* 包装类型代码
cNode.Text:=mygoods.packagingcode;
cNode := mNode.AddChild('packaging'); //* 包装类型
cNode.Text:=mygoods.packaging;
cNode := mNode.AddChild('cargoid'); //* 货物类型(GC/RF/DR)
cNode.Text:=mygoods.cargoid;
cNode := mNode.AddChild('hscode'); //海关编码
cNode.Text:=mygoods.hscode;
cNode := mNode.AddChild('description'); //货物描述(英文货名)
if Trim(mygoods.description)='' then
begin
dNode := cNode.AddChild('text');
end
else
begin
sl:=TStringList.Create;
sl.Text:=SeparateEC(mygoods.description);
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
end;
cNode := mNode.AddChild('cdescription'); //货物描述(中文货名)
Wlength:= Length(mygoods.description);
Elength:= Length(SeparateEC(mygoods.description));
if Trim(Copy(mygoods.description,Elength,WLength-Elength-1) )=''
then
begin
dNode := cNode.AddChild('text');
end
else
begin
sl:=TStringList.Create;
sl.Text:=Copy(mygoods.description,Elength,WLength-Elength-1);
for i:=0 to sl.Count-1 do
begin
dNode := cNode.AddChild('text');
dNode.Text:=sl[i];
end;
sl.Free;
end;
cNode := mNode.AddChild('grossweight'); //* 毛重
cNode.Text:= mygoods.grossweight;
cNode := mNode.AddChild('cbm'); //* 体积
cNode.Text:= mygoods.cbm;
cNode := mNode.AddChild('specialgoods'); //特殊货物说明
dNode := cNode.AddChild('text');
dNode.Text := mygoods.specialgoods;
//增加二级子节点 dr
mNode := pNode.AddChild('dr');
GetNBEDIdr(False,mydr);
cNode := mNode.AddChild('CLASS');
cNode.Text := mydr.ediCLASS;
cNode := mNode.AddChild('PAGE');
cNode.Text := mydr.PAGE;
cNode := mNode.AddChild('UNDGNO');
cNode.Text := mydr.UNDGNO;
cNode := mNode.AddChild('TECNAME');
cNode.Text := mydr.TECNAME;
cNode := mNode.AddChild('PACKGROUP');
cNode.Text := mydr.PACKGROUP ;
cNode := mNode.AddChild('LABEL');
dNode := cNode.AddChild('text');
dNode.Text := mydr.ediLABEL;
cNode := mNode.AddChild('FLASHPOINT');
cNode.Text := mydr.FLASHPOINT;
cNode := mNode.AddChild('FLASHUNIT');
cNode.Text := mydr.FLASHUNIT;
cNode := mNode.AddChild('EMSNO');
cNode.Text := mydr.EMSNO;
cNode := mNode.AddChild('MFAGNO');
cNode.Text := mydr.MFAGNO;
cNode := mNode.AddChild('MPT');
cNode.Text := mydr.MPT;
cNode := mNode.AddChild('Elinkman');
cNode.Text := mydr.Elinkman;
cNode := mNode.AddChild('DANGEROUS');
dNode := cNode.AddChild('text');
dNode.Text := mydr.DANGEROUS;
cNode := mNode.AddChild('TEMPERATURE');
cNode.Text := mydr.TEMPERATURE;
cNode := mNode.AddChild('TEMPERATUREUNIT');
cNode.Text := mydr.TEMPERATUREUNIT;
cNode := mNode.AddChild('MINTEMPERATURE');
cNode.Text := mydr.MINTEMPERATURE;
cNode := mNode.AddChild('MAXTEMPERATURE');
cNode.Text := mydr.MAXTEMPERATURE;
cNode := mNode.AddChild('ALLCOLDTORAGE');
cNode.Text := mydr.ALLCOLDTORAGE;
cNode := mNode.AddChild('VENTI');
cNode.Text := mydr.VENTI;
cNode := mNode.AddChild('REEFER');
dNode := cNode.AddChild('text');
dNode.Text := mydr.REEFER;
//增加二级子节点 loadplan
mNode := pNode.AddChild('loadplan');
GetNBEDIloadplan(false,myloadolan);
cNode := mNode.AddChild('entryno');
cNode.Text := myloadolan.entryno;
cNode := mNode.AddChild('warehouse');
cNode.Text := myloadolan.warehouse;
cNode := mNode.AddChild('landcarrier');
cNode.Text := myloadolan.landcarrier;
cNode := mNode.AddChild('stuffdate');
// cNode.Text := myloadolan.stf
cNode := mNode.AddChild('stuffmode');
cNode.Text := myloadolan.stuffmode;
cNode := mNode.AddChild('stuffaddress');
cNode.Text := myloadolan.stuffaddress;
cNode := mNode.AddChild('stuffmemo');
cNode.Text := myloadolan.stuffmemo;
//增加二级子节点 announce
mNode := pNode.AddChild('announce');
cNode := mNode.AddChild('text');
//增加二级子节点 remarks
mNode := pNode.AddChild('remarks');
//分品名 只要不是VGM都有 可无限循环
if editype <>'VERMAS' then
begin
GetNBEDIgoodsdetail(False,goodscount);
for i:=0 to goodscount-1 do
begin
mNode := pNode.AddChild('goodsdetail');
cNode := mNode.AddChild('cargosequenceno');
cNode.Text:=MyNBEDIgoodsdetail[i].cargosequenceno;
cNode := mNode.AddChild('marksandnumbers');
dNode := cNode.AddChild('text');
dNode.Text:=MyNBEDIgoodsdetail[i].marksandnumbers;
cNode := mNode.AddChild('noofpkgs');
cNode.Text:=MyNBEDIgoodsdetail[i].noofpkgs;
cNode := mNode.AddChild('packagingcode');
cNode.Text:=MyNBEDIgoodsdetail[i].packagingcode;
cNode := mNode.AddChild('packaging');
cNode.Text:=MyNBEDIgoodsdetail[i].packaging;
cNode := mNode.AddChild('cargoid');
cNode.Text:=MyNBEDIgoodsdetail[i].cargoid;
cNode := mNode.AddChild('hscode');
cNode.Text:=MyNBEDIgoodsdetail[i].hscode;
cNode := mNode.AddChild('description');
dNode := cNode.AddChild('text');
dNode.Text:=MyNBEDIgoodsdetail[i].description;
cNode := mNode.AddChild('cdescription');
dNode := cNode.AddChild('text');
dNode.Text:=MyNBEDIgoodsdetail[i].cdescription;
cNode := mNode.AddChild('grossweight');
cNode.Text:=MyNBEDIgoodsdetail[i].grossweight;
cNode := mNode.AddChild('cbm');
cNode.Text:=MyNBEDIgoodsdetail[i].cbm;
cNode := mNode.AddChild('specialgoods');
dNode := cNode.AddChild('text');
dNode.Text:=MyNBEDIgoodsdetail[i].specialgoods;
// 东胜七没有加dr。这里也不加了
//dNode := cNode.AddChild('dr');
//eNode := dNode.AddChild('CLASS') ;
//只有船司提单有
if editype='SHPMIN' then
begin
cNode := mNode.AddChild('container');
for k:=0 to goods_ctn_count[i]-1 do
begin
dNode := cNode.AddChild('containers') ;
eNode := dNode.AddChild('containertype');
eNode.Text := MyNBEDIgoodsdetail_containers[i,k].containertype;
eNode := dNode.AddChild('containerno');
eNode.Text := MyNBEDIgoodsdetail_containers[i,k].containerno;
eNode := dNode.AddChild('sealno');
eNode.Text := MyNBEDIgoodsdetail_containers[i,k].sealno;
eNode := dNode.AddChild('containernoofpkgs');
eNode.Text := MyNBEDIgoodsdetail_containers[i,k].containernoofpkgs;
eNode := dNode.AddChild('containergrossweight');
eNode.Text := MyNBEDIgoodsdetail_containers[i,k].containergrossweight;
eNode := dNode.AddChild('containercbm');
eNode.Text := MyNBEDIgoodsdetail_containers[i,k].containercbm;
end;
end;
end;
end;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton5Click(Sender: TObject);
var
myhead:NBEDIhead;
myForward:NBEDIForward;
myreference:NBEDIreference;
mybaseinfo:NBEDIbaseinfo;
mycargo:NBEDIcargo;
mybooking:NBEDIbooking;
myfreight:NBEDIfreight;
myport:ediport;
myvessel:edivessel;
myinfo:ediinfo2nd;
ContainerCount,goodscount:Integer;
mygoods:NBEDIgoods;
mydr:NBEDIdr;
myloadolan:NBEDIloadplan;
i:Integer;
aQuery:TADOQuery;
SQLStr,CTNSQLStr,newno,ztdh:string;
mydm,mycc,myxx,mybxxs:string;
FileNames: string;
mybookmark:TBookmark;
begin
OpenDialog1.Filter:='xml文件(*.xml)|*.xml|全部文件(*.*)|*.*';
OpenDialog1.DefaultExt := '*.xml';
OpenDialog1.Execute;
FileNames := OpenDialog1.FileName;
if FileNames = '' then
begin
ShowMessage('文件名不能为空');
Exit;
end;
XMLDocument1.LoadFromFile(FileNames);
GetNBEDIhead(True,myhead);
GetNBEDIForward(True,myForward);
GetNBEDIreference(True,myreference);
GetNBEDIbaseinfo(True,mybaseinfo);
GetNBEDIcargo(True,mycargo);
GetNBEDIbooking(True,mybooking);
GetNBEDIfreight(True,myfreight);
Getediport(True,myport);
Getedivessel(True,myvessel);
Getediinfo2nd(True,myinfo);
Getedicontainers(True,ContainerCount);
GetNBEDIgoods(True,mygoods);
GetNBEDIdr(True,mydr);
GetNBEDIloadplan(True,myloadolan);
GetNBEDIgoodsdetail(True,goodscount);
aQuery:=CreateAdoQuery ;
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add('SELECT newid() AS 最新');
open;
newno:=fieldbyname('最新').AsString;
SQLStr:='insert into t_op_seae_vgm (编号,提单号,客户名称,船公司,开船日期,报文类型,报文功能,文件名,业务编号,'
+'订舱单号,提单份数,发送人,电话,邮箱,发送日期,船名,航次,发送账号,发送方代码,接收方代码,订舱代理,发货人名称,'
+'收货人名称,通知人名称,货描,起运港名称,起运港代码,收货地名称,收货地代码,卸货港名称,卸货港代码,目的地名称,目的地代码,'
+'签单地点,签单日期,付费方式,付费方式代码,运输条款,唛头,重量,尺码,件数,包装,包装代码,中转港名称,中转港代码) values ('
+QuotedStr(newno)+','
+QuotedStr(myreference.billofladingno)+','+QuotedStr(myhead.sndcom)+','+QuotedStr(myvessel.carrier)+','
+QuotedStr(myvessel.etd)+','+QuotedStr(myhead.editype)+','
+QuotedStr(myreference.blfreight)+','+QuotedStr(myhead.EdiName)+','+QuotedStr(myreference.workno)+','
+QuotedStr(myreference.bookingno)+','+QuotedStr(mybaseinfo.numberoforiginals)+','+QuotedStr(myhead.fromop)+','
+QuotedStr(myhead.fromtele)+','+QuotedStr(myhead.frommail)+','+QuotedStr(FormatDateTime('yyyy-mm-dd hh:mm:ss',myhead.sendtime))+','
+QuotedStr(myvessel.oceanvessel)+','+QuotedStr(myvessel.voyno)+','+QuotedStr(myhead.sndcom)+','
+QuotedStr(myhead.sndcom)+','+QuotedStr(myhead.EdiReceiver)+','+QuotedStr(mybaseinfo.orderman)+','
+QuotedStr(mybaseinfo.shipper)+','+QuotedStr(mybaseinfo.consignee)+','+QuotedStr(mybaseinfo.notifyparty)+','
+QuotedStr(mygoods.description)+','+QuotedStr(myport.portofloading)+','+QuotedStr(myport.co_portofloading)+','
+QuotedStr(myport.placeofreceipt)+','+QuotedStr(myport.co_placeofreceipt)+','
+QuotedStr(myport.portofdischarge)+','+QuotedStr(myport.co_portofdischarge)+','
+QuotedStr(myport.placeofdelivery)+','+QuotedStr(myport.co_placeofdelivery)+','
+QuotedStr(mybaseinfo.placeofissue)+','+QuotedStr(mybaseinfo.timeofissue)+','
+QuotedStr(mybaseinfo.paymentterm)+','+QuotedStr(mybaseinfo.paymenttermcode)+','
+QuotedStr(mybaseinfo.shippingitem)+','+QuotedStr(mygoods.marksandnumbers)+','
+QuotedStr(mygoods.grossweight)+','+QuotedStr(mygoods.cbm)+','+QuotedStr(mygoods.noofpkgs)+','+QuotedStr(mygoods.packaging)+','
+QuotedStr(mygoods.packagingcode)+','+QuotedStr(myport.portoftranship)+','+QuotedStr(myport.co_portoftranship)+')';
Close;
SQL.Clear;
SQL.Add(SQLStr);
ExecSQL;
for i:=0 to ContainerCount-1 do
begin
mydm:= GetCntr(MyContainers[i].containertype,mycc,myxx,mybxxs);
CTNSQLStr:='insert into t_op_ctn_vgm (编号,代码,尺寸,箱型,表现形式,箱数,箱号,封号,包装,包装代码,重量,尺码,货描,唛头,VGM总重量,'
+'VGM称重方式,VGM称重时间,VGM联系单位,VGM联系人,VGM联系电话,主提单号) values ('+QuotedStr(newno)+','
+QuotedStr(mydm)+','+QuotedStr(mycc)+','+QuotedStr(myxx)+','+QuotedStr(mybxxs)+','+MyContainers[i].containernoofpkgs+','
+QuotedStr(MyContainers[i].containerno)+','+QuotedStr(MyContainers[i].sealno)+','+QuotedStr(MyContainers[i].containerpackaging)+','
+QuotedStr(MyContainers[i].containerpackagingcode)+','+MyContainers[i].containergrossweight+','+MyContainers[i].containercbm+','
+QuotedStr(MyContainers[i].containerdescription)+','+QuotedStr(MyContainers[i].containermarksandnumbers)+','
+MyContainers[i].vgmgrossmassweight+','+QuotedStr(MyContainers[i].vgmweighingmethod)+','+QuotedStr(MyContainers[i].vgmweighingtime)+','
+QuotedStr(MyContainers[i].vgmresponsibleparty)+','+QuotedStr(MyContainers[i].vgmauthorizedperson)+','
+QuotedStr(MyContainers[i].vgmauthorizedpersontele)+','+QuotedStr(myreference.billofladingno)+')';
Close;
SQL.Clear;
SQL.Add(CTNSQLStr);
ExecSQL;
end;
end;
FreeAndNil(aQuery);
mybookmark:= t_op_seae_vgm.GetBookmark;
t_op_seae_vgm.Requery();
t_op_seae_vgm.GotoBookmark(mybookmark);
with t_op_ctn_vgm do
begin
close;
SQL.Clear;
SQL.Add('select * from t_op_ctn_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString) );
Open;
end;
ShowMessage('导入成功');
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton6Click(Sender: TObject);
begin
HasM:=False;
MakeVGM(t_op_seae_vgm.fieldbyname('报文类型').AsString);
if HasM then Exit;
if SaveDialog1.Execute then
begin
XMLDocument1.SaveToFile(SaveDialog1.FileName+'.XML');
XMLDocument1.Active:=False;
showmessage('文件生成成功!');
end
else
begin
showmessage('文件生成失败!');
exit;
end;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton1Click(Sender: TObject);
begin
t_op_seae_vgm.Prior;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton2Click(Sender: TObject);
begin
t_op_seae_vgm.Next;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton17Click(Sender: TObject);
begin
table_delete(t_op_seae_vgm);
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton14Click(Sender: TObject);
begin
table_delete(t_op_ctn_vgm);
end;
procedure Tfrm_op_seae_vgm_data.t_op_seae_vgmAfterScroll(
DataSet: TDataSet);
begin
with t_op_ctn_vgm do
begin
close;
SQL.Clear;
SQL.Add('select * from t_op_ctn_vgm where 编号='+QuotedStr(t_op_seae_vgm.fieldbyname('编号').AsString) );
Open;
end;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton21Click(Sender: TObject);
var
SQLStr,WhereStr:string;
begin
SQLStr:='select * from t_op_seae_vgm ';
WhereStr:=' where 1=1 ';
if Trim(Edit1.Text) <>'' then WhereStr:=WhereStr+' and 客户名称='+QuotedStr(Edit1.Text);
if Trim(Edit2.Text) <>'' then WhereStr:=WhereStr+' and 提单号='+QuotedStr(Edit2.Text);
if Trim(Edit3.Text) <>'' then WhereStr:=WhereStr+' and 邮件发送人='+QuotedStr(Edit3.Text);
if Trim(Edit4.Text) <>'' then WhereStr:=WhereStr+' and 船公司='+QuotedStr(Edit4.Text);
if Trim(Edit5.Text) <>'' then WhereStr:=WhereStr+' and 揽货人='+QuotedStr(Edit5.Text);
if Trim(wwDBComboBox1.Text) <>'' then WhereStr:=WhereStr+' and 报文类型='+QuotedStr(wwDBComboBox1.Text);
if Trim(wwDBComboBox3.Text) <>'' then WhereStr:=WhereStr+' and 回执状态='+QuotedStr(wwDBComboBox3.Text);
if Trim(wwDBDateTimePicker4.Text)<>'' then WhereStr:=WhereStr+' and 发送日期>='+QuotedStr(wwDBDateTimePicker4.Text);
if Trim(wwDBDateTimePicker5.Text)<>'' then WhereStr:=WhereStr+' and 发送日期<='+QuotedStr(wwDBDateTimePicker5.Text);
if Trim(wwDBDateTimePicker6.Text)<>'' then WhereStr:=WhereStr+' and 开船日期>='+QuotedStr(wwDBDateTimePicker6.Text);
if Trim(wwDBDateTimePicker7.Text)<>'' then WhereStr:=WhereStr+' and 开船日期<='+QuotedStr(wwDBDateTimePicker7.Text);
with t_op_seae_vgm do
begin
Close;
SQL.Clear;
SQL.Add(SQLStr+WhereStr);
Open;
end;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton22Click(Sender: TObject);
begin
if not assigned(frm_edi_vgm_weihu) then frm_edi_vgm_weihu:=Tfrm_edi_vgm_weihu.Create(self);
frm_edi_vgm_weihu.ShowModal;
end;
procedure Tfrm_op_seae_vgm_data.bsSkinButton19Click(Sender: TObject);
begin
if t_op_seae_vgm.IsEmpty then Exit;
if (t_op_seae_vgm.State = dsinsert) or (t_op_seae_vgm.State = dsedit) then t_op_seae_vgm.Post;
sys_print('海运出口单证', 2, ds_op_seae_vgm, nil, nil, nil, ds_op_ctn_vgm, nil, nil, nil, nil, nil, nil);
end;
procedure Tfrm_op_seae_vgm_data.t_op_seae_vgmBeforePost(DataSet: TDataSet);
function getnewid():string;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
With aQuery do begin
Close;SQL.Clear;
SQL.Text:='select NEWID() NEWID ';
Open;
Result:=Fieldbyname('NEWID').AsString;
end;
finally
FreeAndNil(aQuery);
end;
end;
begin
if (t_op_seae_vgm.FieldByName(编号).AsString='') then begin
t_op_seae_vgm.FieldByName(编号).AsString:=getnewid;
end;
end;
end.