From 75dcfe564467731b993519eb59ce330703ed1d5b Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期六, 25 四月 2026 16:26:04 +0800
Subject: [PATCH] Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
index 1e5c562..abe9f65 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
@@ -1,6 +1,7 @@
 using Newtonsoft.Json;
 using Serilog;
 using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
 using WIDESEA_Core;
 using WIDESEAWCS_Common.Constants;
 using WIDESEAWCS_Common.HttpEnum;
@@ -150,10 +151,10 @@
                 return selectedTask;
             }
 
-            // ===== TargetAddress 涓嶅彲鐢ㄦ椂锛屽厛灏濊瘯鍚� NextAddress 鐨勫叾浠栦换鍔� =====
+            // ===== TargetAddress 涓嶅彲鐢ㄦ椂锛屽厛灏濊瘯鍚� NextAddress涓嶅悓TargetAddress 鐨勫叾浠栦换鍔� =====
             var sameStationTasks = _taskService
                 .QueryStackerCraneOutTasks(deviceCode, new List<string> { candidateTask.NextAddress })
-                .Where(x => x.TaskId != candidateTask.TaskId)
+                .Where(x => x.TaskId != candidateTask.TaskId && x.TargetAddress != candidateTask.TargetAddress)
                 .ToList();
 
             foreach (var sameStationTask in sameStationTasks)
@@ -168,13 +169,8 @@
 
             // ===== 鍚� NextAddress 鏃犲彲鐢ㄤ换鍔★紝灏濊瘯涓嶅悓 NextAddress 鐨勪换鍔� =====
             // 鏌ユ壘鍏朵粬鍙敤鐨勫嚭搴撶珯鍙�
-            var otherOutStationCodes = _routerService
-                .QueryNextRoutes(deviceCode, candidateTask.NextAddress, candidateTask.TaskType)
-                .Select(x => x.ChildPosi)
-                .ToList();
-
             // 鏌ヨ鍏朵粬绔欏彴鐨勫嚭搴撲换鍔�
-            var tasks = _taskService.QueryStackerCraneOutTasks(deviceCode, otherOutStationCodes);
+            var tasks = _taskService.QueryStackerCraneOutTasks(deviceCode, new List<string> { candidateTask.NextAddress }, false);
             foreach (var alternativeTask in tasks)
             {
                 selectedTask = TrySelectOutboundTask(alternativeTask);

--
Gitblit v1.9.3