From 2cc4dfef234b47bef364edf798b5051a25f33217 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期五, 30 八月 2024 10:58:56 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   62 ++++++++++++++++++++++++++++--
 1 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index a479655..5a0ccf0 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -30,11 +30,11 @@
 using WIDESEAWCS_Core.BaseServices;
 using WIDESEAWCS_Core.Enums;
 using WIDESEAWCS_DTO.TaskInfo;
-using WIDESEAWCS_IBasicInfoRepository;
-using WIDESEAWCS_IBasicInfoService;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob.Models;
+using WIDESEAWCS_QuartzJob.Service;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -121,7 +121,13 @@
             return content;
         }
 
-        public WebResponseContent RequestWMsTask(string palletCode, string sourceAddress)
+        /// <summary>
+        /// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟
+        /// </summary>
+        /// <param name="palletCode">鎵樼洏鍙�</param>
+        /// <param name="sourceAddress">璧峰鍦板潃</param>
+        /// <returns></returns>
+        public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -148,19 +154,54 @@
             return content;
         }
 
+        /// <summary>
+        /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
+        /// </summary>
+        /// <param name="deviceNo">璁惧缂栧彿</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
         public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress)
         {
             return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) && x.CurrentAddress == currentAddress, TaskOrderBy);
         }
 
+        /// <summary>
+        /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
+        /// </summary>
+        /// <param name="taskNum">浠诲姟鍙�</param>
+        /// <param name="nextAddress">涓嬩竴鍦板潃</param>
+        /// <returns></returns>
         public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress)
         {
-            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress, TaskOrderBy);
+            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
         }
 
+        /// <summary>
+        /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎瀹屾垚鐨勪换鍔�
+        /// </summary>
+        /// <param name="taskNum">浠诲姟鍙�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
         public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress)
         {
-            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress, TaskOrderBy);
+            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
+        }
+
+        /// <summary>
+        /// 鏍规嵁璁惧缂栧彿銆佷换鍔$被鍨嬪垎缁�(鍙��)鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鏂板鐨勪换鍔�
+        /// </summary>
+        /// <param name="deviceNo">璁惧缂栧彿</param>
+        /// <param name="taskTypeGroup">浠诲姟绫诲瀷鍒嗙粍(鍙��)</param>
+        /// <returns></returns>
+        public Dt_Task? QuertStackerCraneTask(string deviceNo, TaskTypeGroup? taskTypeGroup = null)
+        {
+            if(taskTypeGroup == null)
+                return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy);
+            if(taskTypeGroup.Value == TaskTypeGroup.InboundGroup)
+                return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish, TaskOrderBy);
+            if(taskTypeGroup.Value == TaskTypeGroup.OutbondGroup)
+                return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy);
+            return null;
         }
 
         /// <summary>
@@ -285,6 +326,11 @@
             return content;
         }
 
+        /// <summary>
+        /// 灏嗕换鍔$姸鎬佷慨鏀逛负涓嬩竴涓姸鎬�
+        /// </summary>
+        /// <param name="task">浠诲姟瀹炰綋瀵硅薄</param>
+        /// <returns></returns>
         public WebResponseContent UpdateTaskStatusToNext([NotNull] Dt_Task task)
         {
             WebResponseContent content = new WebResponseContent();
@@ -345,6 +391,12 @@
             return content;
         }
 
+        /// <summary>
+        /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏇存柊浠诲姟浣嶇疆淇℃伅
+        /// </summary>
+        /// <param name="taskNum">浠诲姟鍙�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
         public Dt_Task? UpdatePosition(int taskNum, string currentAddress)
         {
             try

--
Gitblit v1.9.3