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 備註
22 CODCurrency String 3 無/有 COD價值貨幣。如果指定了COD值,則必須提供
23 CODValue Double 無/有 如果指定了COD貨幣,則必須提供
24 InsuranceCurrency String 3 沒有 保險價值貨幣
25 InsuranceValue Double 沒有 保險價值
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.