using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Script.Serialization; namespace NetLibrary.Express { public class MiaoXinApi { public string url { get; set; } /// /// 授权码 /// public string authenticate { get; set; } JavaScriptSerializer JsonConvert = null; public MiaoXinApi() { JsonConvert = new JavaScriptSerializer(); } #region 发货 public string SendGoods(MiaoXin_Order model, out string ErrorMessage) { string postmessage = JsonConvert.Serialize(model); //UTF8Encoding encoding = new UTF8Encoding(); string XmlContent = CustomIO.HttpRequest("http://222.73.27.186:8082/createOrderApi.htm?param=" + postmessage, "POST", out ErrorMessage); if (string.IsNullOrEmpty(ErrorMessage) == false) return ""; MiaoXin_Result model2 = JsonConvert.Deserialize(XmlContent); if (model2.ack.ToLower() == "true") return model2.tracking_number; else { ErrorMessage = model2.message; return ""; } } #endregion } #region 订单 public class MiaoXin_Order { public string buyerid { get; set; } /// /// 收件地址街道,必填 /// public string consignee_address { get; set; } /// /// 城市 /// public string consignee_city { get; set; } /// /// 接收人手机 /// public string consignee_mobile { get; set; } /// /// 收件人,必填 /// public string consignee_name { get; set; } /// /// 接前找淼信索取该代码,淼信用于判断数据来源Trade_type可选值,请对号入座 //SUMAI 速脉ERP //QQZS 全球助手 //WDJL 网店精灵 //IEBAY365 IEBAY365 //ZYXT 客户自用系统/其他不在列表中的均使用该代码 //STOMS 赛兔OMS //TTERP 通途ERP //MGDZ 芒果店长 //LRERP 懒人erp /// public string trade_type { get; set; } /// /// 邮编,有邮编的国家必填 /// public string consignee_postcode { get; set; } /// /// 州/省 /// public string consignee_state { get; set; } /// /// 收件电话,必填 /// public string consignee_telephone { get; set; } /// /// 收件国家二字代码,必填 /// public string country { get; set; } /// /// 客户ID,必填 {'customer_id':'16201','customer_userid':'15361','ack':'true'} /// public string customer_id { get; set; } /// /// 登录人ID,必填 /// public string customer_userid { get; set; } /// /// 原单号,必填 /// public string order_customerinvoicecode { get; set; } /// /// 运输方式ID,必填 3861 /// public string product_id { get; set; } public string weight { get; set; } public List orderInvoiceParam { get; set; } } #endregion #region 物品信息 public class MiaoXin_Goods { /// /// 申报价值,必填 /// public string invoice_amount { get; set; } /// ///件数,必填 /// public string invoice_pcs { get; set; } /// /// 品名,必填 /// public string invoice_title { get; set; } /// /// 单件重 /// public string invoice_weight { get; set; } /// /// /// public string item_id { get; set; } /// /// /// public string item_transactionid { get; set; } /// /// sku,如果是e邮宝,e特快,e包裹则传中文品名 /// public string sku { get; set; } } #endregion #region 返回信息 public class MiaoXin_Result { public string ack { get; set; } public string message { get; set; } public string reference_number { get; set; } public string tracking_number { get; set; } /// /// /// public string order_id { get; set; } } #endregion }