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 Email String 150 电子邮箱
16 URL String 256 网址

范例:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
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 Email String 150 电子邮箱
17 URL String 256 网址

范例:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
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

范例:

1 2 3 4 5 6 7 8
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 重量。两位小数点

范例:

1 2 3 4 5 6 7
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 标签值

范例:

1 2 3 4
shipments.TagsInfo = new TagsInfo[1];
shipments.TagsInfo[0] = new TagsInfo();
shipments.TagsInfo[0].TagCode = "TAG1";
shipments.TagsInfo[0].TagValue = "Any extra information";

渠道服务

货物信息内的 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 备注
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// 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
}

范例:

1 2 3 4 5 6 7 8 9 10 11
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.";
Copyright © 2018 Unixus Solutions Sdn. Bhd. All rights reserved.