From e9b4a4107bdd7a7c737192827d4ee17e23c362f6 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 21 三月 2025 14:23:15 +0800
Subject: [PATCH] 1

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs |   54 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
index 4638dac..0352558 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -9,6 +9,7 @@
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob.Models;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -222,11 +223,11 @@
                     return content.Error("褰撳墠鎵樼洏瀛樺湪浠诲姟");
                 }
 
-                // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩存帴鍑哄簱浠诲姟
-                if (await HasDirectOutboundTask(stationManager))
-                {
-                    return content.Error($"銆恵stationManager.stationChildCode}銆戝凡瀛樺湪鐩存帴鍑哄簱浠诲姟浠诲姟");
-                }
+                //// 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩存帴鍑哄簱浠诲姟
+                //if (await HasDirectOutboundTask(stationManager))
+                //{
+                //    return content.Error($"銆恵stationManager.stationChildCode}銆戝凡瀛樺湪鐩存帴鍑哄簱浠诲姟浠诲姟");
+                //}
 
                 //if (stationManager.stationType == 7)
                 //{
@@ -400,12 +401,43 @@
 
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                 {
-                    var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay);
-                    task.TaskState = (int)TaskOutStatusEnum.OutNew;
-                    task.CurrentAddress = taskDTO.RoadWay;
-                    task.NextAddress = stationinfo.stationChildCode;
-                    task.SourceAddress = taskDTO.SourceAddress;
-                    task.TargetAddress = taskDTO.TargetAddress;
+                    if (task.TaskType == (int)TaskOutboundTypeEnum.OutTray)
+                    {
+                        // 鏌ヨ涓嬩竴涓矾鐢�
+                        List<Dt_Router> routers = _routerService.QueryNextRoutes(taskDTO.RoadWay, taskDTO.TargetAddress);
+                        if (routers.Count > 0)
+                        {
+                            // 璁剧疆浠诲姟鐘舵�佷负鍑哄簱鏂板缓
+                            task.TaskState = (int)TaskOutStatusEnum.OutNew;
+                            // 璁剧疆褰撳墠鍦板潃涓烘簮鍦板潃
+                            task.CurrentAddress = taskDTO.SourceAddress;
+                            // 璁剧疆涓嬩竴涓湴鍧�涓虹涓�涓瓙浣嶇疆
+                            task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                        }
+                        else
+                        {
+                            // 鏌ヨ浠庢簮鍦板潃鍒扮洰鏍囧湴鍧�鐨勮矾鐢�
+                            routers = _routerService.QueryNextRoutes(taskDTO.SourceAddress, taskDTO.TargetAddress);
+                            if (routers.Count > 0)
+                            {
+                                // 璁剧疆浠诲姟鐘舵�佷负鍑哄簱瀹屾垚
+                                task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish;
+                                // 璁剧疆褰撳墠鍦板潃涓烘簮鍦板潃
+                                task.CurrentAddress = taskDTO.SourceAddress;
+                                // 璁剧疆涓嬩竴涓湴鍧�涓虹涓�涓瓙浣嶇疆
+                                task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay);
+                        task.TaskState = (int)TaskOutStatusEnum.OutNew;
+                        task.CurrentAddress = taskDTO.RoadWay;
+                        task.NextAddress = stationinfo.stationChildCode;
+                        task.SourceAddress = taskDTO.SourceAddress;
+                        task.TargetAddress = taskDTO.TargetAddress;
+                    }
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                 {

--
Gitblit v1.9.3