From 63dcb7fc55d32960f643f4040900ce9a0e33536d Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 20 十月 2025 17:25:56 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |  244 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 179 insertions(+), 65 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index f2f9f1a..5a22c8f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -44,19 +44,32 @@
 
         private Dictionary<string, OrderByType> _taskOrderBy = new()
         {
-            {nameof(Dt_Task.Grade), OrderByType.Desc },
+            {nameof(Dt_Task.Grade), OrderByType.Asc },
             {nameof(Dt_Task.CreateDate), OrderByType.Asc},
         };
+
 
         public Dictionary<string, OrderByType> TaskOrderBy
         { get { return _taskOrderBy; } set { _taskOrderBy = value; } }
 
+
+        #region 鑾峰彇鎵�鏈変换鍔$被鍨嬨�佺姸鎬�
         public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList();
 
         public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList();
-        public List<int> TaskRelocationboundTypes => typeof(TaskRelocationStatusEnum).GetEnumIndexList();
-        public List<int> TaskAGVCarryboundTypes => typeof(TaskAGVCarryStatusEnum).GetEnumIndexList();
-        public List<int> TaskAcrossFloorboundTypes => typeof(TaskAcrossFloorStatusEnum).GetEnumIndexList();
+        public List<int> TaskRelocationboundTypes => typeof(TaskRelocationTypeEnum).GetEnumIndexList();
+        public List<int> TaskAGVCarryboundTypes => typeof(TaskAGVCarryTypeEnum).GetEnumIndexList();
+        public List<int> TaskAcrossFloorboundTypes => typeof(TaskAcrossFloorTypeEnum).GetEnumIndexList();
+
+        public List<int> TaskInboundStates => typeof(TaskInStatusEnum).GetEnumIndexList();
+
+        public List<int> TaskOutboundStates => typeof(TaskOutStatusEnum).GetEnumIndexList();
+        public List<int> TaskRelocationboundStates => typeof(TaskRelocationStatusEnum).GetEnumIndexList();
+        public List<int> TaskAGVCarryboundStates => typeof(TaskAGVCarryStatusEnum).GetEnumIndexList();
+        public List<int> TaskAcrossFloorboundStates => typeof(TaskAcrossFloorStatusEnum).GetEnumIndexList();
+
+        #endregion 鑾峰彇鎵�鏈変换鍔$被鍨嬨�佺姸鎬�
+
 
         public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository) : base(BaseDal)
         {
@@ -100,78 +113,179 @@
                     // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄嚭搴撲换鍔�
                     if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
-                        var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
-
-                        task.TaskState = (int)TaskOutStatusEnum.OutNew;
-
-                        task.CurrentAddress = item.SourceAddress;
-
-                        task.NextAddress = station.stationChildCode;
-
-                        task.Floor = "1F";
-
-                        task.AGVSign = "";
-                    }
-                    // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄叆搴撲换鍔�
-                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
-                    {
-                        var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
-
-                        task.TaskState = (int)TaskInStatusEnum.InNew;
-
-                        task.CurrentAddress = item.SourceAddress;
-
-                        task.NextAddress = station.stationChildCode;
-
-                        task.Floor = "1F";
-
-                        task.AGVSign= "";
-                    }
-                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
-                    {
-                        task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew;
-
-                        task.CurrentAddress = item.SourceAddress;
-
-                        task.NextAddress = task.TargetAddress;
-
-                        task.Floor = "1F";
-
-                        task.AGVSign = "";
-                    }
-                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup)
-                    {
-                        var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
-
-                        task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
-
-                        task.CurrentAddress = item.SourceAddress;
-
-                        task.NextAddress = task.TargetAddress;
-
-                        task.Floor = station.stationFloor;
-
-                        task.AGVSign = "";
-                    }
-                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup)
-                    {
-                        var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
-
-                        if (station != null)
+                        if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.OutbondGroup)
                         {
-                            var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
 
-                            task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+                            task.TaskState = (int)TaskOutStatusEnum.OutNew;
 
                             task.CurrentAddress = item.SourceAddress;
 
-                            task.NextAddress = next.stationChildCode;
+                            task.NextAddress = station.stationChildCode;
+
+                            task.Floor = "1F";
+
+                            task.AGVSign = "";
+                        }
+                        else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+                            if (station != null)
+                            {
+                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+
+                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+                                task.CurrentAddress = item.SourceAddress;
+
+                                task.NextAddress = next.stationChildCode;
+
+                                task.Floor = station.stationFloor;
+
+                                task.AGVSign = "";
+                            }
+                        }
+                        else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.TargetAddress);
+
+                            task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
+
+                            task.CurrentAddress = item.SourceAddress;
+
+                            task.NextAddress = task.TargetAddress;
 
                             task.Floor = station.stationFloor;
 
                             task.AGVSign = "";
                         }
                     }
+                    // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓哄叆搴撲换鍔�
+                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+                    {
+                        if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.InboundGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.Roadway == "SC1");
+
+                            task.TaskState = (int)TaskInStatusEnum.InNew;
+
+                            task.CurrentAddress = item.SourceAddress;
+
+                            task.NextAddress = station.stationChildCode;
+
+                            task.Floor = "1F";
+
+                            task.AGVSign = "";
+                        }
+                        else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+                            if (station != null)
+                            {
+                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+
+                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+                                task.CurrentAddress = item.SourceAddress;
+
+                                task.NextAddress = next.stationChildCode;
+
+                                task.Floor = station.stationFloor;
+
+                                task.AGVSign = "";
+                            }
+                        }
+                        else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+                            task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
+
+                            task.CurrentAddress = item.SourceAddress;
+
+                            task.NextAddress = task.TargetAddress;
+
+                            task.Floor = station.stationFloor;
+
+                            task.AGVSign = "";
+                        }
+
+                    }
+                    // 鍒ゆ柇浠诲姟绫诲瀷鏄惁涓虹Щ搴撲换鍔�
+                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
+                    {
+                        if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.RelocationGroup)
+                        {
+                            task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew;
+
+                            task.CurrentAddress = item.SourceAddress;
+
+                            task.NextAddress = task.TargetAddress;
+
+                            task.Floor = "1F";
+
+                            task.AGVSign = "";
+                        }
+                        else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+                            if (station != null)
+                            {
+                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+
+                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+                                task.CurrentAddress = item.SourceAddress;
+
+                                task.NextAddress = next.stationChildCode;
+
+                                task.Floor = station.stationFloor;
+
+                                task.AGVSign = "";
+                            }
+                        }
+                        else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+                            task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
+
+                            task.CurrentAddress = item.SourceAddress;
+
+                            task.NextAddress = task.TargetAddress;
+
+                            task.Floor = station.stationFloor;
+
+                            task.AGVSign = "";
+                        }
+                    }
+                    //鍒ゆ柇浠诲姟绫诲瀷鏄惁涓鸿法妤煎眰鎼繍浠诲姟
+                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.AcrossFloorGroup)
+                    {
+                        if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
+                        {
+                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+
+                            if (station != null)
+                            {
+                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+
+                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+
+                                task.CurrentAddress = item.SourceAddress;
+
+                                task.NextAddress = next.stationChildCode;
+
+                                task.Floor = station.stationFloor;
+
+                                task.AGVSign = "";
+                            }
+                        }
+                    }
+
                     // 灏嗚浆鎹㈠悗鐨勪换鍔℃坊鍔犲埌浠诲姟鍒楄〃涓�
                     tasks.Add(task);
                 }

--
Gitblit v1.9.3