From 45c56eb2641ac2e69c4d1fc37d31e3179edbae67 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 三月 2026 09:30:00 +0800
Subject: [PATCH] config: 更新 TargetAddresses 为数组格式

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 7ae869a..4ebcb83 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -103,13 +103,13 @@
                     }
                     else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                     {
-                        List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+                        Dt_Router routers = _routerService.QueryNextRoute(item.SourceAddress);
                         //鏆備笉鑰冭檻澶氳矾寰�
-                        if (routers.Count > 0)
+                        if (!routers.IsNullOrEmpty())
                         {
                             task.TaskState = (int)TaskInStatusEnum.InNew;
                             task.CurrentAddress = item.SourceAddress;
-                            task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                            task.NextAddress = routers.ChildPosi;
                         }
                     }
                     tasks.Add(task);
@@ -118,7 +118,7 @@
 
                 _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "鎺ユ敹WMS浠诲姟");
 
-                content = WebResponseContent.Instance.OK("鎴愬姛");
+                content = WebResponseContent.Instance.OK("鎴愬姛", tasks);
             }
             catch (Exception ex)
             {
@@ -179,6 +179,9 @@
         /// <returns></returns>
         public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress)
         {
+            if (string.IsNullOrEmpty(nextAddress))
+                throw new ArgumentNullException(nameof(nextAddress), "涓嬩竴鍦板潃涓嶈兘涓虹┖");
+
             return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
         }
 
@@ -190,6 +193,9 @@
         /// <returns></returns>
         public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress)
         {
+            if (string.IsNullOrEmpty(currentAddress))
+                throw new ArgumentNullException(nameof(currentAddress), "褰撳墠鍦板潃涓嶈兘涓虹┖");
+
             return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
         }
 
@@ -273,6 +279,9 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
+                if (string.IsNullOrEmpty(message))
+                    throw new ArgumentNullException(nameof(message), "寮傚父淇℃伅涓嶈兘涓虹┖");
+
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
@@ -371,7 +380,8 @@
                         {
                             PalletCode = task.PalletCode,
                         };
-                        var result = _httpClientHelper.Post<WebResponseContent>("WMS", taskDto.ToJson(), nameof(ConfigKey.GetTasksLocation));
+
+                        var result = _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.GetTasksLocation), taskDto.ToJson(), nameof(ConfigKey.GetTasksLocation));
                         if (!result.IsSuccess && !result.Data.Status)
                         {
                             return WebResponseContent.Instance.Error($"璋冪敤WMS鎺ュ彛鑾峰彇浠诲姟鐩爣鍦板潃澶辫触,浠诲姟鍙�:銆恵task.TaskNum}銆�,閿欒淇℃伅:銆恵content.Message}銆�");
@@ -386,6 +396,14 @@
                         task.NextAddress = wmsTargetAddress;
                         task.TargetAddress = wmsTargetAddress;
                         task.CurrentAddress = task.NextAddress;
+                    }
+                    else
+                    {
+                        //_httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.GetTasksLocation), taskDto.ToJson(), nameof(ConfigKey.GetTasksLocation));
+                        //if (!result.IsSuccess && !result.Data.Status)
+                        //{
+                        //    return WebResponseContent.Instance.Error($"璋冪敤WMS鎺ュ彛鑾峰彇浠诲姟鐩爣鍦板潃澶辫触,浠诲姟鍙�:銆恵task.TaskNum}銆�,閿欒淇℃伅:銆恵content.Message}銆�");
+                        //}
                     }
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup)
@@ -434,6 +452,9 @@
         {
             try
             {
+                if (string.IsNullOrEmpty(currentAddress))
+                    throw new ArgumentNullException(nameof(currentAddress), "褰撳墠鍦板潃涓嶈兘涓虹┖");
+
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress);
                 if (task == null) throw new Exception($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
 
@@ -455,6 +476,7 @@
             }
             catch (Exception ex)
             {
+                Console.WriteLine($"UpdatePosition 鏇存柊浠诲姟浣嶇疆澶辫触,浠诲姟鍙�:銆恵taskNum}銆�,閿欒淇℃伅:銆恵ex.Message}銆�");
             }
             return null;
         }
@@ -487,7 +509,7 @@
 
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
 
-                    var result = _httpClientHelper.Post<WebResponseContent>("WMS", (new StockInfoDTO() { PalletCode = task.PalletCode, TaskNum = task.TaskNum }).ToJson());
+                    var result = _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.OutboundFinishTaskAsync), (new StockInfoDTO() { PalletCode = task.PalletCode, TaskNum = task.TaskNum }).ToJson());
                     if (result.IsSuccess && result.Data.Status)
                     {
                         return content.Error($"閫氱煡WMS绯荤粺鍫嗗灈鏈哄嚭搴撳畬鎴愭垚鍔�,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙�:銆恵task.PalletCode}銆�");
@@ -508,7 +530,7 @@
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
 
 
-                    var result = _httpClientHelper.Post<WebResponseContent>("WMS", (new CreateTaskDto()
+                    var result = _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.InboundFinishTaskAsync), (new CreateTaskDto()
                     {
                         PalletCode = task.PalletCode,
                     }).ToJson());

--
Gitblit v1.9.3