2.1 新增或修改货物
本章节将会说明如何使用我们的 API 来新增或修改货物的范例及数据结构、
参数
寄件人信息
序号 | 参数 | 数据类型 | 长度 | 必填项 | 说明 |
---|---|---|---|---|---|
1 | ShipperName | String | 80 | 否 | 公司名字 |
2 | ContactPerson | String | 80 | 是 | 联络人 |
3 | Address1 | String | 80 | 是 | 地址1 |
4 | Address2 | String | 80 | 是 | 地址2 |
5 | Address3 | String | 80 | 否 | 地址3 |
6 | PostCode | String | 20 | 是 | 邮编 |
7 | City | String | 100 | 是 | 城市 |
8 | State | String | 100 | 是 | 州 |
9 | CountryCode | String | 3 | 是 | 国家或地区代码 例: - AU |
10 | StationCode | String | 10 | 否 | 默认为空字符串 |
11 | Phone1 | String | 30 | 是 | 电话1 |
12 | Phone2 | String | 30 | 否 | 电话2 |
13 | MobilePhone | String | 30 | 否 | 手机号 |
14 | Fax | String | 30 | 否 | 传真号 |
15 | String | 150 | 否 | 电子邮箱 | |
16 | URL | String | 256 | 否 | 网址 |
范例:
ShipperInfo _shipper = new ShipperInfo();
_shipper.ShipperName = "Unixus Solutions Sdn. Bhd.";
_shipper.ContactPerson = "IT Department";
_shipper.Address1 = "46-02 JALAN TUN ABDUL RAZAK";
_shipper.Address2 = "SUSUR 1";
_shipper.Address3 = "";
_shipper.PostCode = "80000";
_shipper.City = "JOHOR BHARU";
_shipper.State = "JOHOR";
_shipper.CountryCode = "MY";
_shipper.StationCode = "";
_shipper.Phone1 = "+60-7-2222668";
_shipper.Phone2 = "";
_shipper.MobilePhone = "";
_shipper.Fax = "";
_shipper.Email = "[email protected]";
_shipper.Url = "ezlabel.unixus.com.my";
收件人信息
序号 | 参数 | 数据类型 | 长度 | 必填项 | 说明 |
---|---|---|---|---|---|
1 | ConsigneeName | String | 80 | 否 | 公司名称 |
2 | ContactPerson | String | 80 | 是 | 联络人 |
3 | IdentityNo | String | 30 | 否 | 收件人身份证号 |
4 | Address1 | String | 80 | 是 | 地址1 |
5 | Address2 | String | 80 | 是 | 地址2 |
6 | Address3 | String | 80 | 否 | 地址3 |
7 | PostCode | String | 20 | 是 | 邮编 |
8 | City | String | 100 | 是 | 城市 |
9 | State | String | 100 | 是 | 州 |
10 | CountryCode | String | 3 | 是 | 国家或地区 例: - AU |
11 | StationCode | String | 10 | 否 | 默认为空字符串 |
12 | Phone1 | String | 30 | 是 | 电话1 |
13 | Phone2 | String | 30 | 否 | 电话2 |
14 | MobilePhone | String | 30 | 否 | 手机号 |
15 | Fax | String | 30 | 否 | 传真号 |
16 | String | 150 | 否 | 电子邮箱 | |
17 | URL | String | 256 | 否 | 网址 |
范例:
ConsigneeInfo _consignee = new ConsigneeInfo ();
_consignee.ConsigneeName = "LWE (AU) Ltd.";
_consignee.ContactPerson = "Mr. Ng";
_consignee.IdentityNo = "A123456789"
_consignee.Address1 = "Test Address 1";
_consignee.Address2 = "Test Address 2";
_consignee.Address3 = "";
_consignee.PostCode = "0845";
_consignee.City = "BATCHELOR";
_consignee.State = "NT";
_consignee.CountryCode = "AU";
_consignee.StationCode = "";
_consignee.Phone1 = "1234567890";
_consignee.Phone2 = "";
_consignee.MobilePhone = "";
_consignee.Fax = "";
_consignee.Email = "[email protected]";
_consignee.Url = "http://www.lwe.com.hk";
物品信息
使用者必须至少填一项物品信息
序号 | 参数 | 数据类型 | 长度 | 必填项 | 说明 |
---|---|---|---|---|---|
1 | ItemReference | String | 255 | 是 | 物品名称 |
2 | NoOfUnit | Integer | 是 | 数量 | |
3 | ItemValue | Numeric | 10,2 | 是 | 物品价值小计。如: 单价 $5, 3个则 $15。 ItemValue = 15 |
4 | ItemHSCode | String | 100 | 否 | 物品HS编码 |
5 | ItemSKU | String | 64 | 否 | 库存量单位 |
6 | ItemUrl | String | 1024 | 否 | 物品 Url |
范例:
shipments.ItemInfo = new ItemInfo[1];
shipments.ItemInfo[0] = new ItemInfo();
shipments.ItemInfo[0].ItemReference = "Ladies Shoes";
shipments.ItemInfo[0].NoOfUnit = 3;
shipments.ItemInfo[0].ItemValue = 15; // 物品价值小计。如: 单价 $5, 3个则 $15。 ItemValue = 15
shipments.ItemInfo[0].ItemHSCode = "15";
shipments.ItemInfo[0].ItemSKU = "15";
shipments.ItemInfo[0].ItemUrl = "http://www.abc.com";
物品重量信息
使用者必须至少填一项物品重量信息
NB: Some TOS mode, however, for example, registered post and normal mail service only allow 1 pieces of shipment per 1 HAWB NO, other TOS will allow more that 1 shipments per 1 HAWB NO.
序号 | 参数 | 资料形态 | 长度 | 必填项 | 说明 |
---|---|---|---|---|---|
1 | PackageReference | String | 255 | 是 | 包裹名称 |
2 | PackageHeight | Numeric | 7,2 | 是 | 高。两位小数点 |
3 | PackageWidth | Numeric | 7,2 | 是 | 宽。两位小数点 |
4 | PackageLength | Numeric | 7,2 | 是 | 长。两位小数点 |
5 | ActualWeight | Numeric | 7,2 | 是 | 重量。两位小数点 |
范例:
shipments.WeightInfo = new WeightInfo[shipments.NoOfPieces];
shipments.WeightInfo[0] = new WeightInfo();
shipments.WeightInfo[0].PackageReference = "PKG01";
shipments.WeightInfo[0].PackageHeight = 1.00;
shipments.WeightInfo[0].PackageWidth = 1.00;
shipments.WeightInfo[0].PackageLength = 1.00;
shipments.WeightInfo[0].ActualWeight = 5.00;
标签信息
标签信息栏位是用来储存额外的信息,不是必填项。
序号 | 参数 | 资料形态 | 长度 | 必填项 | 说明 |
---|---|---|---|---|---|
1 | TagCode | String | 50 | 是 | 标签码 值: "TAG1" "TAG2" "TAG3" |
2 | TagValue | String | 255 | 是 | 标签值 |
范例:
渠道服务
货物信息内的 TOS Mode 是根据收件人信息的国家代码来决定的。以下范例说明了如何设置 TOSMode 值。若你在使用上遇上相关问题,请洽询我们的客户支援。
范例:
if (consignee.CountryCode.Equals("MY")) {
s.TOSMode = "MY-E-EXPRESS";
}
else if (consignee.CountryCode.Equals("TH")) {
s.TOSMode = "TH-E-EXPRESS";
}
else if (consignee.CountryCode.Equals("HK")) {
s.TOSMode = "HK-E-EXPRESS";
}
else if (consignee.CountryCode.Equals("SG")) {
s.TOSMode = "SG-E-EXPRESS";
}
else if (consignee.CountryCode.Equals("ID")) {
s.TOSMode = "ID-E-EXPRESS";
}
else if (consignee.CountryCode.Equals("CN")) {
s.TOSMode = "CN-E-EXPRESS";
}
else {
// Error
}
货物信息
序号 | 参数 | 资料形态 | 长度 | 必填项 | 说明 |
---|---|---|---|---|---|
1 | ShipmentsCredentials | ShipmentsCredentials | 是 | 参考 1.2章节 | |
2 | ActionType | Enum | 是 | 参考 1.3章节 | |
3 | CustomerCode | String | 20 | 是 | 参考 1.4章节 |
4 | ProfitCentreCode | String | 20 | 否 | 参考 1.4章节 |
5 | ShipperInfo | ShipperInfo | 是 | 参考 寄件人信息 | |
6 | ConsigneeInfo | ConsigneeInfo | 是 | 参考 收件人信息 | |
7 | ItemInfo | ItemInfo[] | 是 | 参考 物品信息 | |
8 | WeightInfo | WeightInfo[] | 是 | 参考 物品重量信息 | |
9 | TagsInfo | TagsInfo[] | 否 | 参考 标签信息 | |
10 | ShipmentDate | DateTime | 是 | Unix 时间戳,13位数。例:/Date(1506330946000+0800)/ | |
11 | Submitted_Date | DateTime | 是 | Unix 时间戳,13位数。例:/Date(1506330946000+0800)/ | |
12 | HawbNo | String | 50 | 否 | 若是增加新货物信息则留空 |
13 | ReferenceNo | String | 50 | 否 | Reference 号码 |
14 | ReferenceAgent | String | 36 | 否 | 此栏位可留空 |
15 | TOSMode | String | 20 | 是 | 参考 渠道服务 |
16 | PackageType | Enum | 是 | 每个 TOS 都有不同的包裹类型,请参考下面的枚举。 | |
17 | NoOfPieces | Integer | 是 | 此字段对应物品重量信息数组大小 | |
18 | WeightType | Enum | 否 | 选择让 API 用哪种重量单位来计价 | |
19 | CurrencyCode | String | 3 | 是 | 货币代码 |
20 | NatureOfGoods | String | 255 | 是 | 货物说明 |
21 | Remarks | String | 8000 | 否 | 备注 |
22 | CODCurrency | String | 3 | 无/有 | COD价值货币。如果指定了COD值,则必须提供 |
23 | CODValue | Double | 无/有 | 如果指定了COD货币,则必须提供 | |
24 | InsuranceCurrency | String | 3 | 没有 | 保险价值货币 |
25 | InsuranceValue | Double | 没有 | 保险价值 |
// Values of PackageType
// 若你使用 SOAP,可使用枚举
// 若你使用 JSON,使用数字即可
// 若你不确定该使用什么,那就选 SPX
public enum PackageType {
DOX = 0, // Document
SPX = 1, // Parcel
SPX_L = 2, // Mail-Large
SPX_P = 3, // Mail-Package
SPX_S = 4 // Mail-Small
}
// Values of WeightType
public enum WeightType {
Kilogram = 0,
Pounds = 1
}
范例:
shipments.ShipmentDate = DateTime.Now;
shipments.HawbNo = string.Empty;
shipments.ReferenceNo = "123456";
shipments.ReferenceAgent = "";
shipments.TOSMode = "UBX-E-AU";
shipments.PackageType = PackageType.SPX;
shipments.NoOfPieces = 1;
shipments.WeightType = WeightType.Kilogram;
shipments.CurrencyCode = "AUD";
shipments.NatureOfGoods = "Shoes";
shipments.Remarks = "The shipment easy to broke, please becareful.";