wanshenmean
12 小时以前 c9a1df9c19a64844d05d120ff171f523d77e7823
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);
@@ -207,10 +203,13 @@
        {
            // 先进行本地站台检查(PLC 读取,快速),避免不必要的 WMS HTTP 调用
            // 判断 TargetAddress 输送线站台是否空闲
            if (!IsTargetAddressConveyorStationAvailable(outboundTask))
            if (outboundTask.TaskType != (int)TaskOutboundTypeEnum.OutEmpty)
            {
                return null;
                // 判断 TargetAddress 输送线站台是否空闲
                if (!IsTargetAddressConveyorStationAvailable(outboundTask))
                {
                    return null;
                }
            }
            // 判断 NextAddress 出库站台是否可用