فهرست منبع

苏州亚科-质检+快递:处理复打业务

dujj 2 سال پیش
والد
کامیت
ac243bf125
3فایلهای تغییر یافته به همراه66 افزوده شده و 1 حذف شده
  1. 16 0
      Demo/Demo/API.cs
  2. 45 0
      Demo/Demo/Core/CloudPrint.cs
  3. 5 1
      Demo/Demo/Program.cs

+ 16 - 0
Demo/Demo/API.cs

@@ -956,5 +956,21 @@ namespace Demo
                 param = rOP,
             });
         }
+
+        /// <summary>
+        /// 复打
+        /// </summary>
+        public static string CloudPrintOld(PrintOldParam baseParam)
+        {
+            var timestamp = DateUtils.GetTimestamp();
+            BaseReq<PrintOldParam> baseReq = new BaseReq<PrintOldParam>()
+            {
+                key = config.key,
+                t = timestamp,
+                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
+                param = baseParam
+            };
+            return CloudPrint.callPrintOld(baseReq);
+        }
     }
 }

+ 45 - 0
Demo/Demo/Core/CloudPrint.cs

@@ -2,6 +2,7 @@ using Common.Request;
 using Common.Request.cloud;
 using Utils;
 using Common;
+using Newtonsoft.Json.Linq;
 /// <summary>
 /// 订单导入
 /// </summary>
@@ -103,4 +104,48 @@ public static class CloudPrint
         var result = HttpUtils.doPostForm(ApiInfoConstant.BILL_PARCELS_URL,request);
         return result;
     }
+
+    /// <summary>
+    /// 复打
+    /// </summary>
+    /// <param name="param"></param>
+    /// <returns></returns>
+    public static string callPrintOld(BaseReq<PrintOldParam> param)
+    {
+        int code = 0;
+        string msg = "";
+        string data = "";
+        string errorStr = "";
+        try
+        {
+            param.method = ApiInfoConstant.CLOUD_PRINT_OLD_METHOD;
+            var request = ObjectToDictionaryUtils.ObjectToMap(param);
+
+            if (request == null)
+            {
+                msg = "body参数错误";
+            }
+            if (HttpUtils.doPostForm(ApiInfoConstant.ELECTRONIC_ORDER_PIC_URL, request, out data, out errorStr))
+            {
+                code = 1;
+                msg = "操作成功";
+            }
+            else
+            {
+                msg = errorStr;
+            }
+            return "";
+        }
+        catch (System.Exception ex)
+        {
+            msg = "操作失败:" + ex.ToString();
+        }
+
+        JObject result = new JObject();
+        result.Add("code", code);
+        result.Add("msg", msg);
+        result.Add("data", Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(data));
+
+        return result.ToString();
+    }
 }

+ 5 - 1
Demo/Demo/Program.cs

@@ -13,6 +13,7 @@ using System.Text;
 using System.Windows.Forms;
 using Utils;
 using static System.Net.WebRequestMethods;
+using Common.Request.cloud;
 
 namespace Demo
 {
@@ -38,7 +39,10 @@ namespace Demo
             else
             if (string.Compare(rFlag, "printOld") == 0)
             {
-
+                PrintOldParam po = new PrintOldParam();
+                po = JsonConvert.DeserializeObject<PrintOldParam>(rBody);
+                string printOld = API.CloudPrintOld(po);
+                WriteTxt(printOld, "printOld.txt");
             }
 
         }