From e19f8a13e2b35e6836ce46c17402c44327814a00 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期四, 18 十二月 2025 09:14:36 +0800
Subject: [PATCH] 产能排产漏更新

---
 WebApi/Gs.Toolbox/InterfaceUtil.cs |   70 +++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/WebApi/Gs.Toolbox/InterfaceUtil.cs b/WebApi/Gs.Toolbox/InterfaceUtil.cs
index 794a67b..1d5c889 100644
--- a/WebApi/Gs.Toolbox/InterfaceUtil.cs
+++ b/WebApi/Gs.Toolbox/InterfaceUtil.cs
@@ -18,14 +18,18 @@
     /// <param name="hNo"></param>
     /// <param name="urlType">濡傛灉涓�2锛屽垯鏄洿鏂板伐鍗曠姸鎬�</param>
     /// <returns>濡傛灉鎴愬姛杩斿洖鏃ュ織guid,鍚﹀垯杩斿洖涓�</returns>
-    public static (int, string) HttpPostErp(string param, string edtUserGuid = "", string abtGuid = "", string hNo = "", int urlType = 0)
+    public static (int, string) HttpPostErp(string param,
+        string edtUserGuid = "", string abtGuid = "", string hNo = "",
+        int urlType = 0, string keyUrl = "")
     {
-        System.Text.StringBuilder sbTm = new System.Text.StringBuilder();
-        sbTm.Append(DateTime.Now.ToString() + "寮�濮嬪彂閫�");
+        int _rtn = 0;
+        //鏃ュ織璇︾粏锛屽彂閫佺殑鏃跺�欙紝璁板綍鏃ュ織锛屽瓨鍌ㄨ繃绋嬭皟鐢ㄧ殑鏃跺�欙紝鍐嶇疮鍔犱笂mes涓氬姟鐨勬搷浣滅粨鏋�
+        System.Text.StringBuilder sbLog = new System.Text.StringBuilder();
+        sbLog.Append(DateTime.Now.ToString() + "寮�濮嬪彂閫�");
         string strLogGuid = Guid.NewGuid().ToString();
-        string url = AppSettingsHelper.getValueByKey("TestErpUrl");
+        string url = AppSettingsHelper.getValueByKey("TestErpUrl") + keyUrl;
         if (urlType == 2)
-            url = AppSettingsHelper.getValueByKey("TestErpUrl2");
+            url = AppSettingsHelper.getValueByKey("TestErpUrl2") + keyUrl;
         HttpWebRequest request = null;
         StreamWriter requestStream = null;
         WebResponse response = null;
@@ -39,7 +43,9 @@
             request.Timeout = 150000;
             request.AllowAutoRedirect = false;
             request.ServicePoint.Expect100Continue = false;
-            HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
+            HttpRequestCachePolicy noCachePolicy =
+                new HttpRequestCachePolicy(HttpRequestCacheLevel
+                    .NoCacheNoStore);
             request.CachePolicy = noCachePolicy;
             requestStream = new StreamWriter(request.GetRequestStream());
             requestStream.Write(param);
@@ -55,9 +61,10 @@
         }
         catch (Exception ex)
         {
-            LogHelper.Debug(url, "HttpPostErp param:" + param + "锛宔x:" + ex.Message);
+            LogHelper.Debug(url,
+                "HttpPostErp response:" + param + "锛宔x:" + ex.Message);
             responseStr = ex.Message;
-            // throw ex;
+            _rtn = -1;
         }
         finally
         {
@@ -65,34 +72,41 @@
             requestStream = null;
             response = null;
         }
-        Result _result = JsonConvert.DeserializeObject<Result>(responseStr);
-        int _rtn = 0;
-        if ("200".Equals(_result.state))
-            _rtn = 1;
-        sbTm.Append("," + DateTime.Now.ToString() + "缁撴潫鍙戦��");
+
+        if (_rtn != -1)
+        {
+            Result _result = JsonConvert.DeserializeObject<Result>(responseStr);
+            if ("200".Equals(_result.code))
+                _rtn = 1;
+        }
+
+        sbLog.Append("," + DateTime.Now.ToString() + "缁撴潫鍙戦��");
         if (_rtn > 0)
-            sbTm.Append(",鍙戦�佹垚鍔�");
+            sbLog.Append(",鍙戦�佹垚鍔�");
         else
-            sbTm.Append(",鍙戦�佸け璐�,mes閫�鍑烘搷浣�");
+            sbLog.Append(",鍙戦�佸け璐�,mes閫�鍑烘搷浣�");
         try
         {
             SqlParameter[] parameters =
-    {
-            new("@edtUserGuid", edtUserGuid),
-            new("@abtGuid", abtGuid),
-            new("@abtTable", ""),
-            new("@detail", sbTm.ToString()),
-            new("@hNo", hNo),
-            new("@RtnLogGuid", strLogGuid),
-            new("@SendJson", param),
-            new("@RtnJson", responseStr),
-        };
+            {
+                new("@edtUserGuid", edtUserGuid),
+                new("@abtGuid", abtGuid),
+                new("@abtTable", ""),
+                new("@detail", sbLog.ToString()),
+                new("@hNo", hNo),
+                new("@RtnLogGuid", strLogGuid),
+                new("@SendJson", param),
+                new("@RtnJson", responseStr),
+                new("@isSuccess", (_rtn > 0 ? 1 : 0)),
+                new("@isErp", 1),
+            };
             DbHelperSQL.RunProcedure("[prc_log_create]", parameters);
         }
         catch (Exception ex)
         {
             LogHelper.Debug(url, "HttpPostErp 鍐欏叆鏃ュ織琛�" + ex.Message);
         }
+
         return (_rtn, (_rtn > 0 ? strLogGuid : responseStr));
     }
 }
@@ -102,10 +116,10 @@
     /// <summary>
     /// 200鎴愬姛锛屽惁鍒欏け璐�
     /// </summary>
-    public string? state { get; set; }
+    public string? code { get; set; }
+
     public string? msg { get; set; }
 
-    public string? status { get; set; }
+    public string? count { get; set; }
 
-    public string? message { get; set; }
 }
\ No newline at end of file

--
Gitblit v1.9.3