From 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 09 七月 2025 22:55:27 +0800
Subject: [PATCH] 增加质检出入库逻辑

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   44 +++++++++++++++++++++++++++++---------------
 1 files changed, 29 insertions(+), 15 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 1ab6133..740ecd1 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"
@@ -119,6 +119,10 @@
                             task.NextAddress = routers.FirstOrDefault().ChildPosi;
                         }
                     }
+                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
+                    {
+                        task.TaskState = item.SourceIsPickPlace ? TaskRelocationStatusEnum.CarSource_Finish.ObjToInt() : TaskRelocationStatusEnum.RelocationNew.ObjToInt();
+                    }
                     tasks.Add(task);
                 }
                 BaseDal.AddData(tasks);
@@ -273,6 +277,11 @@
                 return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && !string.IsNullOrEmpty(x.NextAddress) && x.CurrentAddress == currentAddress, TaskOrderBy);
         }
 
+        public Dt_Task QueryCarOutFinish()
+        {
+            Dt_Task? _Task = BaseDal.QueryFirst(x => TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.Car_OutFinish, TaskOrderBy);
+            return _Task;
+        }
         /// <summary>
         /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鍑哄簱绫诲瀷鐨勬柊澧炵殑浠诲姟
         /// </summary>
@@ -313,14 +322,14 @@
             {
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
-                if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
-                {
-                    task.TaskState = (int)TaskOutStatusEnum.OutPending;
-                }
-                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
-                {
-                    task.TaskState = (int)TaskInStatusEnum.InPending;
-                }
+                //if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+                //{
+                //    task.TaskState = (int)TaskOutStatusEnum.OutPending;
+                //}
+                //else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+                //{
+                //    task.TaskState = (int)TaskInStatusEnum.InPending;
+                //}
                 task.ExceptionMessage = message;
                 task.ModifyDate = DateTime.Now;
                 BaseDal.UpdateData(task);
@@ -436,7 +445,7 @@
                     }
                     else if (task.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt())
                     {
-                        if (task.TaskState >= (int)CarChargingTaskEnum.RelocationCarFinish)
+                        if (task.TaskState >= (int)CarChargingTaskEnum.CarChargingFinish)
                         {
                             return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                         }
@@ -614,9 +623,9 @@
         /// <param name="TaskState"></param>
         /// <param name="TaskType"></param>
         /// <returns></returns>
-        public Dt_Task GetTaskState(int TaskState, int TaskType)
+        public Dt_Task? GetTaskState(int TaskState, int TaskType)
         {
-            Dt_Task task = null;
+            Dt_Task? task = null;
             if (TaskState > 0 && TaskType > 0)
                 task = BaseDal.QueryFirst(x => x.TaskState == TaskState && x.TaskType == TaskType);
             else if (TaskState > 0)
@@ -641,12 +650,17 @@
             {
                 if (!string.IsNullOrEmpty(SourceAddress) && SourceAddress != "")
                 {
-                    Dt_Task? task = BaseDal.QueryFirst(x => x.SourceAddress == SourceAddress && x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt());
+                    Dt_Task? task = BaseDal.QueryFirst(x => x.SourceAddress == SourceAddress &&
+                    x.ShuttleCarCode == ShuttleCarCode &&
+                    (x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt() ||
+                    x.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt()));
                     if (task != null) return;
                 }
                 if (!string.IsNullOrEmpty(TargetAddress) && TargetAddress != "")
                 {
-                    Dt_Task? task = BaseDal.QueryFirst(x => x.TargetAddress == TargetAddress && x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt());
+                    Dt_Task? task = BaseDal.QueryFirst(x => x.TargetAddress == TargetAddress &&
+                    (x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt() ||
+                    x.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt()));
                     if (task != null) return;
                 }
                 #region 鍒涘缓鍫嗗灈鏈虹Щ杞︿换鍔�
@@ -662,12 +676,12 @@
                     NextAddress = TargetAddress,
                     CreateDate = DateTime.Now,
                     Creater = "WCS",
-                    TaskState = string.IsNullOrEmpty(remark) ? (int)TaskCarStatusEnum.CarNew : (int)CarChargingTaskEnum.CarNew,
+                    TaskState = string.IsNullOrEmpty(remark) ? (int)TaskCarStatusEnum.CarNew : (int)CarChargingTaskEnum.CarChargingNew,
                     ShuttleCarCode = ShuttleCarCode,
                     WMSId = 0,
                     Remark = remark
                 };
-                if (SourceAddress == TargetAddress) dt_Task.TaskState = (int)CarChargingTaskEnum.SC_CarFinish;
+                if (SourceAddress == TargetAddress) dt_Task.TaskState = (int)CarChargingTaskEnum.CarChargingSC_CarFinish;
                 AddData(dt_Task);
                 #endregion
             }

--
Gitblit v1.9.3