From a9b3ce04ed59794b648db00bc85001a4fb96c932 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 24 十二月 2024 15:29:03 +0800
Subject: [PATCH] 分拣接口、货位分配及移库任务完成

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

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 ed090e0..7021a70 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"
@@ -87,8 +87,6 @@
 
         }
 
-
-
         /// <summary>
         /// 鎺ユ敹WMS浠诲姟淇℃伅
         /// </summary>
@@ -112,23 +110,40 @@
                     task.Creater = "WMS";
                     task.TaskState = (int)TaskStatusEnum.New;
                     task.CurrentAddress = item.SourceAddress;
-                    task.NextAddress = item.TargetAddress;
 
                     List<Dt_WarehouseDevice> wades = warehouseDevices.Where(x => x.WarehouseId == item.WarehouseId).ToList();
+
+                    Dt_Router? router = new Dt_Router();
 
                     if (string.IsNullOrEmpty(item.AGVArea))
                     {
                         Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StackerCraneCode == item.RoadWay);
-
-                        //stationManger.AGVStationCode
-                        //stationManger.StackerCraneCode
-                        //stationManger.StationDeviceCode
+                        if (stationManger == null)
+                        {
+                            return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�");
+                        }
 
                         List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (stationManger.StationDeviceCode == x.StartPosi || stationManger.StackerCraneCode == x.StartPosi));
+                        if (routers.FirstOrDefault() == null)
+                        {
+                            return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�");
+                        }
+                        router = routers.FirstOrDefault();
+                        if (routers.Count == 1)
+                        {
+                            task.NextAddress = router?.NextPosi ?? "";
+                        }
                     }
                     else
                     {
                         List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi);
+                        if (routers.FirstOrDefault() == null)
+                        {
+                            return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�");
+                        }
+                        router = routers.FirstOrDefault();
+
+                        task.NextAddress = router?.NextPosi ?? "";
                     }
 
                     tasks.Add(task);

--
Gitblit v1.9.3