From 9f793f3f8b36a05840de9e593c5d6d8fa69ec606 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 10 一月 2025 17:46:51 +0800
Subject: [PATCH] 系统调用IP地址修改至配置文件

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs |    2 +-
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json               |    1 +
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs           |   14 ++++++++++++--
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json               |    2 +-
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs        |   10 ++++++----
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json"
index 3e0e1e8..e04bb50 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json"
@@ -23,7 +23,7 @@
     // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
     "IPs": "http://127.0.0.1:8080,http://localhost:8080"
   },
-  "WMSApiAddress": "http://127.0.0.1:9293",
+  "WMSApiAddress": "http://127.0.0.1:9293", //"http://127.0.0.1:9283",姝e紡鐜鍦板潃
   "ApiName": "WIDESEA",
   "ExpMinutes": 120,
   "QuartzJobAutoStart": true
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index d23cf79..50fb3c7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -195,7 +195,7 @@
                                 task.NextAddress = router.NextPosi;
                                 task.DeviceCode = stationManger.StationDeviceCode;
                             }
-                            else if(item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
+                            else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
                             {
                                 task.NextAddress = router.NextPosi;
                                 task.DeviceCode = stationManger.StackerCraneCode;
@@ -290,7 +290,7 @@
                     return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙颁俊鎭�");
                 }
                 string address = AppSettings.Get("WMSApiAddress");
-                if(string.IsNullOrEmpty(address))
+                if (string.IsNullOrEmpty(address))
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
                 }
@@ -323,7 +323,7 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
                 }
-                string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}",roadwayNos.Serialize());
+                string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}", roadwayNos.Serialize());
                 WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                 if (responseContent != null && responseContent.Status && responseContent.Data != null)
                 {
@@ -346,7 +346,9 @@
         /// <returns></returns>
         public string? RequestAssignLocation(int taskNum, string roadwayNo)
         {
-            string responseStr = HttpHelper.Get($"http://127.0.0.1:9283/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}");
+            string address = AppSettings.Get("WMSApiAddress");
+            if (string.IsNullOrEmpty(address)) throw new Exception("鏈壘鍒癢MSApi鍦板潃");
+            string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}");
 
             WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
             if (responseContent != null && responseContent.Status && responseContent.Data != null)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs"
index 2178c1e..4c27ad7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs"
@@ -165,7 +165,7 @@
                         }
                         stockInfos.Add(stockInfo);
                     }
-                    var LocationCodes = stockInfos/*.Where(x => x.LocationCode != "骞冲簱浣�")*/.Select(stockInfo => stockInfo.LocationCode).ToList();
+                    var LocationCodes = stockInfos.Where(x => x.LocationCode != "骞冲簱浣�").Select(stockInfo => stockInfo.LocationCode).ToList();
                     List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => LocationCodes.Contains(x.LocationCode));
                     locationInfos.ForEach(x =>
                     {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 150a167..0146be8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -112,7 +112,12 @@
                 {
                     x.AGVArea = agvDescription;
                 });
-                string response = HttpHelper.Post("http://127.0.0.1:9281/api/Task/ReceiveTask", taskDTOs.Serialize());
+                string address = AppSettings.Get("WCSApiAddress");
+                if (string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢CSApi鍦板潃");
+                }
+                string response = HttpHelper.Post($"{address}/api/Task/ReceiveTask", taskDTOs.Serialize());
 
                 return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
             }
@@ -130,7 +135,12 @@
         {
             try
             {
-                string response = HttpHelper.Post("http://127.0.0.1:9281/api/CTU_AGV/PutFinish", code);
+                string address = AppSettings.Get("WCSApiAddress");
+                if (string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢CSApi鍦板潃");
+                }
+                string response = HttpHelper.Post($"{address}/api/CTU_AGV/PutFinish", code);
 
                 return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
             }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json"
index 4dc0d11..7b50cb5 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json"
@@ -26,6 +26,7 @@
   },
 
   "WCS": "http://localhost:9291/api/Task/",
+  "WCSApiAddress": "http://127.0.0.1:9291",//"http://127.0.0.1:9281",姝e紡鐜鍦板潃
   "LogAopEnable": false,
   "PrintSql": true, //鎵撳嵃SQL璇彞
   "ApiName": "WIDESEA",

--
Gitblit v1.9.3