From efaf0b8aeb26aca6536a4b384c912cc3cac4d070 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 15 三月 2025 16:07:45 +0800
Subject: [PATCH] 成品代码,其他仓优化,前端优化界面增加

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   40 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 4 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 11c87a9..c5ab563 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"
@@ -16,6 +16,7 @@
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
 using AutoMapper;
+using HslCommunication.Enthernet;
 using Newtonsoft.Json;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using SqlSugar;
@@ -65,6 +66,7 @@
         private Dictionary<string, OrderByType> _taskOrderBy = new()
             {
                 {nameof(Dt_Task.Grade),OrderByType.Desc },
+                {nameof(Dt_Task.TaskNum),OrderByType.Asc},
                 {nameof(Dt_Task.CreateDate),OrderByType.Asc},
             };
 
@@ -169,10 +171,18 @@
                         if (taskTypeGroup == TaskTypeGroup.InboundGroup)
                         {
                             stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress);
+                            if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt())
+                            {
+                                stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress);
+                                //杞崲鎴愬搧浠撹捣鐐圭珯鍙�
+                                item.SourceAddress = stationManger.StationCode;
+                                task.CurrentAddress = stationManger.StationCode;
+                                task.SourceAddress = stationManger.StationCode;
+                            }
                         }
                         else
                         {
-                            stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay);
+                            stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay || x.Remark==item.RoadWay);
                         }
                         if (stationManger == null)
                         {
@@ -198,18 +208,34 @@
                                 task.NextAddress = router.NextPosi;
                                 task.DeviceCode = router.ChildPosi;
                             }
-                            else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt())
+                            else if (item.TaskType == TaskTypeEnum.MesPalletReturn.ObjToInt() && router.IsEnd)
                             {
                                 task.NextAddress = router.NextPosi;
+                                task.DeviceCode = router.ChildPosi;
+                            }
+                            else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || (item.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() && item.RoadWay.Contains("BC")))
+                            {
+                                task.NextAddress = router.NextPosi;
+                                task.DeviceCode = stationManger.StackerCraneCode;
+                                task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
+                            }
+                            else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() && item.RoadWay.Contains("ZH"))
+                            {
+                                task.NextAddress = stationManger.StackerCraneStationCode;
                                 task.DeviceCode = stationManger.StackerCraneCode;
                                 task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                             }
                             else
                             {
                                 task.NextAddress = taskTypeGroup == TaskTypeGroup.InboundGroup ? task.TargetAddress : router.NextPosi;
-                                if (item.RoadWay.Contains("AGV"))
+                                if (item.RoadWay.Contains("AGV_FL")|| (item.RoadWay.Contains("AGV_CP") && taskTypeGroup == TaskTypeGroup.OutbondGroup))
                                 {
                                     task.DeviceCode = item.RoadWay;
+                                    task.AgvTaskNum = item.RoadWay + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
+                                }
+                                else if(item.RoadWay.Contains("AGV_CP") && taskTypeGroup == TaskTypeGroup.InboundGroup)
+                                {
+                                    task.DeviceCode = stationManger.StationDeviceCode;
                                     task.AgvTaskNum = task.DeviceCode + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
                                 }
                                 else
@@ -244,7 +270,6 @@
                                 return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�");
                             }
                             router = routers.FirstOrDefault();
-
                             task.NextAddress = router?.StartPosi ?? "";
                             task.DeviceCode = item.RoadWay;
                             task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
@@ -812,5 +837,12 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+        /// <summary>
+        /// //鍒ゆ柇绉诲簱璐т綅浠诲姟鏄惁宸插瓨鍦紝濡傚瓨鍦ㄥ厛鎵ц
+        /// </summary>
+        public Dt_Task QueryStackerExistTask(string PalletCode, string locationCode)
+        {
+            return BaseDal.QueryFirst(x => x.PalletCode == PalletCode && x.SourceAddress == locationCode && (x.TaskState == (int)TaskStatusEnum.SC_Execute || x.TaskState == (int)TaskStatusEnum.SC_Executing));
+        }
     }
 }

--
Gitblit v1.9.3