From 8815f180964a3f51944e42631b44127250718cc5 Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期日, 06 七月 2025 13:36:07 +0800
Subject: [PATCH] 请求入库下一地址优化

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                       |   24 ++++++++++++++++++------
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                     |    9 +++++++++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs |    9 +++++++++
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
index 2f5d80f..58b7bb3 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -151,6 +151,15 @@
         /// <param name="nextAddress">涓嬩竴鍦板潃</param>
         /// <returns></returns>
         Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress, string Barcode);
+
+        /// <summary>
+        /// 鏍规嵁浠诲姟鍙枫�佹墭鐩樺彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
+        /// </summary>
+        /// <param name="taskNum">浠诲姟鍙�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <param name="Barcode">鎵樼洏鍙�</param> 
+        /// <returns></returns>
+        Dt_Task QueryExecutingCurrentConveyorLineTask(int taskNum, string currentAddress, string Barcode);
         /// <summary>
         /// 鏍规嵁鎵樼洏鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
         /// </summary>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index f7ba7c6..409077d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -94,7 +94,7 @@
                     if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
                         // 鍒ゆ柇浠诲姟鐩爣鍦板潃鍜岃矾寰勬槸鍚︽弧瓒崇壒瀹氭潯浠�
-                        if (((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ"))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
+                        if (((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) || task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
                         {
                             // 璁剧疆浠诲姟鐘舵�佷负鍑哄簱鏂板缓
                             task.TaskState = (int)TaskOutStatusEnum.OutNew;
@@ -266,7 +266,7 @@
         /// <param name="deviceNo">璁惧缂栧彿</param>
         /// <param name="currentAddress">褰撳墠鍦板潃</param>
         /// <returns></returns>
-        public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress,string Barcode)
+        public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress, string Barcode)
         {
             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 && x.PalletCode == Barcode, TaskOrderBy);
         }
@@ -308,9 +308,21 @@
         /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
         /// </summary>
         /// <param name="taskNum">浠诲姟鍙�</param>
+        /// <param name="Barcode">涓嬩竴鍦板潃</param>
+        /// <param name="currentAddress">涓嬩竴鍦板潃</param>
+        /// <returns></returns>
+        public Dt_Task QueryExecutingCurrentConveyorLineTask(int taskNum, string Barcode, string currentAddress)
+        {
+            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.PalletCode == Barcode && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
+        }
+
+        /// <summary>
+        /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
+        /// </summary>
+        /// <param name="taskNum">浠诲姟鍙�</param>
         /// <param name="nextAddress">涓嬩竴鍦板潃</param>
         /// <returns></returns>
-        public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress,string Barcode)
+        public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress, string Barcode)
         {
             return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
         }
@@ -323,7 +335,7 @@
         /// <returns></returns>
         public Dt_Task QueryExecutingConveyorLineTask(string nextAddress, string Barcode)
         {
-            return BaseDal.QueryFirst(x => (x.NextAddress == nextAddress||x.TargetAddress==nextAddress) && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
+            return BaseDal.QueryFirst(x => (x.NextAddress == nextAddress || x.TargetAddress == nextAddress) && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
         }
 
         /// <summary>
@@ -685,7 +697,7 @@
 
                 task.ModifyDate = DateTime.Now;
                 task.Modifier = "System";
-                
+
 
                 _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屾洿鏂板綋鍓嶄綅缃�恵oldCurrentPos} ----> {task.CurrentAddress}銆戝拰涓嬩竴浣嶇疆銆恵oldNextPos} ----> {task.NextAddress}銆�");
                 return task;
@@ -728,7 +740,7 @@
                 var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result;
 
                 QuartzLogger.WriteLogToFile($"Info_浠诲姟瀹屾垚", $"浠诲姟瀹屾垚,浠诲姟鍙�:銆恵taskNum}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(result)}銆憑Environment.NewLine}{Environment.NewLine}");
-                if(result != null)
+                if (result != null)
                 {
 
                     content = JsonConvert.DeserializeObject<WebResponseContent>(result);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index 8338a0c..a5db63e 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -265,6 +265,15 @@
                     }
                 }
             }
+            //else
+            //{
+            //    //褰撳墠鍦板潃璇锋眰 瀵绘壘褰撳墠鍦板潃鐨勬墭鐩樺彿 浠诲姟鍙风殑浠诲姟锛屽瀛樺湪浠诲姟鍒欓噸鏂板啀娆″啓鍏ユ柊鐩爣鍦板潃
+            //    Dt_Task currentTask = _taskService.QueryExecutingCurrentConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode, command.ConveyorLineBarcode);
+            //    if (currentTask != null)
+            //    {
+            //        conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(currentTask.TargetAddress), childDeviceCode);
+            //    }
+            //}
         }
 
         /// <summary>

--
Gitblit v1.9.3