From 734f49c3f74e4a46cfb5892ce60dbf1bb86e74ab Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 22 七月 2025 19:14:39 +0800
Subject: [PATCH] 出入库流程

---
 WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs
index adbae83..275eeae 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs
@@ -78,19 +78,26 @@
             return null;
         }
 
-        public static string Post(string serviceAddress, string requestJson = null, string contentType = "application/json", Dictionary<string, string>? headers = null)
+        public static string Post(string serviceAddress, string requestJson = "", string contentType = "application/json", Dictionary<string, string>? headers = null)
         {
+            string result = string.Empty;
+            DateTime beginDate = DateTime.Now;
             try
             {
-                string result = string.Empty;
                 using (HttpContent httpContent = new StringContent(requestJson))
                 {
                     httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                     using HttpClient httpClient = new HttpClient();
                     httpClient.Timeout = new TimeSpan(0, 0, 60);
-
-                    foreach (var header in headers)
-                        httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                    if (serviceAddress.Contains("cimforce/AtomJsonService"))
+                    {
+                        httpClient.Timeout = new TimeSpan(0, 0, 30);
+                    }
+                    if (headers != null)
+                    {
+                        foreach (var header in headers)
+                            httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                    }
 
                     result = httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync().Result;
                 }
@@ -98,9 +105,12 @@
             }
             catch (Exception e)
             {
-                Console.WriteLine(e.Message);
+                throw new Exception(e.Message);
             }
-            return null;
+            finally
+            {
+                //Logger.Add(serviceAddress, requestJson, result, beginDate);
+            }
         }
         /// <summary>
         /// post璇锋眰

--
Gitblit v1.9.3