From 9086b238cd9fbb9fbeae7cab11d59576cd9d2853 Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期一, 24 十一月 2025 10:27:01 +0800
Subject: [PATCH] 合并

---
 项目代码/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs |   51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 11 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 078ae8d..820e628 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -18,7 +18,6 @@
 using Newtonsoft.Json;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
-using System.Threading.Tasks;
 using WIDESEA_DTO.Agv;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.APIEnum;
@@ -524,24 +523,54 @@
             }
             return content;
         }
-        public WebResponseContent MESAvgArriveNotice(RequestAGVArriveDTO requestAGVArriveDTO)
+        /// <summary>
+        /// 鍒ゆ柇鍏佽鏀捐揣
+        /// </summary>
+        /// <returns></returns>
+        public string MESAvgArriveNotice(RequestAGVArriveDTO requestAGVArriveDTO)
         {
-            WebResponseContent content = new WebResponseContent();
+            Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.MESAvgArriveNotice.ToString());
+
+            string response = Post(apiInfo.ApiAddress, JsonConvert.SerializeObject(requestAGVArriveDTO));
+
+            return response;
+        }
+        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 address = AppSettings.Get("WMSApiAddress");
-                if (string.IsNullOrEmpty(address))
+                using (HttpContent httpContent = new StringContent(requestJson))
                 {
-                    return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+                    httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+
+                    using HttpClient httpClient = new HttpClient();
+                    httpClient.Timeout = new TimeSpan(0, 0, 30);
+                    string LoginToken = AppSettings.Get("MESLoginToken");
+                    headers = new Dictionary<string, string>
+                    {
+                        //姝e紡
+                        { "LoginToken", LoginToken }
+                    };
+                    if (headers != null)
+                    {
+                        foreach (var header in headers)
+                            httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                    }
+                    HttpResponseMessage responseMessage = httpClient.PostAsync(serviceAddress, httpContent).Result;
+                    result = responseMessage.Content.ReadAsStringAsync().Result;
                 }
-                string responseStr = HttpHelper.Post($"{address}/api/Mes/MESAvgArriveNotice", requestAGVArriveDTO.Serialize());
-                return content.OK(responseStr);
+                return result;
             }
-            catch (Exception ex)
+            catch (Exception e)
             {
-                content = WebResponseContent.Instance.Error(ex.Message);
+                throw new Exception(e.Message);
             }
-            return content;
+            finally
+            {
+                Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate);
+            }
         }
         public WebResponseContent CPEmptyInbound(string palletCode,string SourceAddress)
         {

--
Gitblit v1.9.3