From 733e63cb362f17aea4a1020654fa348a0d0c1f06 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 24 二月 2025 00:08:59 +0800
Subject: [PATCH] 优化入库逻辑,优化直接出库逻辑,优化移库任务逻辑

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 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 e1dca94..d3bc955 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"
@@ -61,6 +61,8 @@
 
         public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList();
 
+        public List<int> TaskRelocationTypes => typeof(TaskRelocationTypeEnum).GetEnumIndexList();
+
         public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, ITaskHtyService taskHtyService, IMapper mapper) : base(BaseDal)
         {
             _routerService = routerService;
@@ -174,9 +176,9 @@
         /// <param name="taskNum">浠诲姟鍙�</param>
         /// <param name="currentAddress">褰撳墠鍦板潃</param>
         /// <returns></returns>
-        public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress)
+        public Dt_Task QueryCompletedConveyorLineTask(string Barcode, string currentAddress)
         {
-            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
+            return BaseDal.QueryFirst(x => x.PalletCode == Barcode && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
         }
 
         public Dt_Task QuertOutProductionLineTask(bool NextAddIsNull)
@@ -202,7 +204,28 @@
                 return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy);
             return null;
         }
-
+        /// <summary>
+        /// 鏌ヨ搴撳唴绉诲簱浠诲姟
+        /// </summary>
+        /// <param name="deviceNo"></param>
+        /// <param name="currentAddress"></param>
+        /// <returns></returns>
+        public Dt_Task QueryStackerCraneRelocationTask(string deviceNo, string currentAddress = "")
+        {
+            Dt_Task task = null;
+            if (string.IsNullOrEmpty(currentAddress))
+                task = BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskRelocationTypes.Contains(x.TaskType), TaskOrderBy);
+            else
+                task = BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && TaskRelocationTypes.Contains(x.TaskType), TaskOrderBy);
+            if (task != null)
+            {
+                if (task.SourceIsPickPlace && task.TaskState == (int)TaskRelocationStatusEnum.RelocationNew || !task.SourceIsPickPlace && task.TaskState == (int)TaskRelocationStatusEnum.CarSource_Finish)
+                    return task;
+                else
+                    return null;
+            }
+            return task;
+        }
         /// <summary>
         /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鏂板鐨勪换鍔�
         /// </summary>
@@ -581,7 +604,7 @@
                 TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
                 Grade = 2,
                 Roadway = "SC01",
-                TaskType = (int)TaskOtherTypeEnum.RelocationCar,
+                TaskType = string.IsNullOrEmpty(remark) ? (int)TaskOtherTypeEnum.RelocationCar : (int)TaskOtherTypeEnum.RelocationCarCharging,
                 SourceAddress = SourceAddress,
                 TargetAddress = TargetAddress,
                 CurrentAddress = SourceAddress,

--
Gitblit v1.9.3