快递---快递鸟的电子面单取消操作-----------

近期在对接快递接口,公司使用了第三方快递接口获取快递数据,这边由于业务需求,有可能会对已取号的快递电子面单做出处理

为此自己东拉西扯总算完善了接口

当然 详细的明细还得各位有使用的朋友,自己去查看所提供的api

----------------------------------------------------------仅限数据未发货的快递电子面单

话不多直接上代码------------当然所能取消的快递的电子面单  是有限制的

 1 /// <summary>
 2     /// 取消已取号未拣货的运单
 3     /// </summary>
 4     public class ExpressOrderCancel
 5     {
 6         /// <summary>
 7         /// 快递公司编码
 8         /// </summary>
 9         public string ShipperCode { get; set; }
10         /// <summary>
11         /// 订单编号
12         /// </summary>
13         public string OrderCode { get; set; }
14         /// <summary>
15         /// 快递单号
16         /// </summary>
17         public string ExpNo { get; set; }
18 
19         /// <summary>
20         /// 电子面单客户号
21         /// </summary>
22         public string CustomerName { get; set; }
23         /// <summary>
24         /// 电子面单密码
25         /// </summary>
26         public string CustomerPwd { get; set; }
27     }
28 
29      /// <summary>
30         /// 取消电子面单---------------------------
31         /// </summary>
32         /// <param name="orderData"></param>
33         /// <returns></returns>
34         public ReturnOrderCancel orderCancelByJson(ExpressOrderCancel orderData)
35         {
36             orderData.CustomerName = CustomerName;//快递公司的账户ID
37             orderData.CustomerPwd = CustomerPwd;//快递公司的账户密码
38             orderData.ShipperCode = ExpressCode;//快递公司编码
39             string requestData = JsonConvert.SerializeObject(orderData);
40             Dictionary<string, string> param = new Dictionary<string, string>();
41             param.Add("RequestData", HttpUtility.UrlEncode(requestData, Encoding.UTF8));
42             param.Add("EBusinessID", EBusinessID);//快递鸟商户ID
43             param.Add("RequestType", "1147");
44             string dataSign = encrypt(requestData, AppKey, "UTF-8");
45             param.Add("DataSign", HttpUtility.UrlEncode(dataSign, Encoding.UTF8));
46             param.Add("DataType", "2");
47             string CelURL = "http://testapi.kdniao.cc:8081/Ebusiness/EbusinessOrderhandle.aspx";
48             string result = sendPost(CelURL, param);
49             try
50             {
51                 ReturnOrderCancel eorder = JsonConvert.DeserializeObject<ReturnOrderCancel>(result);
52                 return eorder;
53             }
54             catch (Exception)
55             {
56                 ReturnOrderCancel ere = JsonConvert.DeserializeObject<ReturnOrderCancel>(result);
57 
58                 return ere;
59             }
60         }

 

posted on 2017-12-06 17:36  快舔包我很肥  阅读(909)  评论(0编辑  收藏  举报

导航