pengmn
2025-05-30 cd40ada4efe0d0a4036714cf597ce170b8cf5a54
HH.WCS.Mobox3.HangYang/wms/WMSHelper.cs
@@ -1064,16 +1064,17 @@
                // 阶段1: 标记未来需要保留的货位
                MarkReservedLocations(outbound);
                var tasks = new List<WCSTask>();
                var outboundLocCodes = outbound.Select(o => o.locCode).ToHashSet();
                foreach (var outboundItem in outbound)
                {
                    // 1. 查找目标货位
                    var targetLoc = FindTargetLocation(outboundItem.locCode);
                    if (targetLoc == null) continue;
                    var wmsTask = WMSHelper.GetWmsTaskList("执行", outboundItem.trayCode);
                    if (wmsTask == null)
                    if (wmsTask != null)
                    {
                        //LogHelper.Info($"未查询到在执行中的作业:{outboundItem.trayCode}!", "杭氧");
                        outboundItem.opCode = "";
                        outboundItem.opCode = wmsTask.S_CODE;
                    }
                    // 2. 处理双深位逻辑(第1排或第4排)
@@ -1086,6 +1087,14 @@
                        {
                            //如果货位已满,则生成移库任务
                            if (outerLoc.N_CURRENT_NUM == outerLoc.N_CAPACITY)
                            {
                                if (outboundLocCodes.Contains(outerLoc.S_CODE))
                                {
                                    // 方案1:合并任务(直接出库外侧货位)
                                    tasks.Add(CreateOutboundTask(outerLoc,
                                        outbound.First(o => o.locCode == outerLoc.S_CODE),"1"));
                                }
                                else
                            {
                                // 优先移到深位,其次外侧
                                var bestTarget = FindBestRelocationTarget(outerLoc);
@@ -1105,7 +1114,7 @@
                                        S_START_LOC = outerLoc.S_CODE,
                                        S_END_LOC = bestTarget.S_CODE,
                                        S_TYPE = "深位移库",
                                        S_OP_CODE = wmsTask.S_CODE,
                                            S_OP_CODE = outboundItem.opCode,
                                        N_PRIORITY = 1,
                                        N_SCHEDULE_TYPE = 1,
                                        N_B_STATE = 0,
@@ -1117,6 +1126,8 @@
                                    });
                                }
                                else continue;
                                }
                            }
                        }
                        else
@@ -1168,7 +1179,7 @@
                      .FirstOrDefault();
            }
            private WCSTask CreateOutboundTask(Location loc, Outbound outbound) =>
            private WCSTask CreateOutboundTask(Location loc, Outbound outbound,string priority = "") =>
                new WCSTask
                {
                    S_CODE = GenerateTaskNo(),
@@ -1178,7 +1189,7 @@
                    S_END_LOC = outbound.endBit,
                    S_TYPE = outbound.taskType,
                    S_OP_CODE = outbound.opCode,
                    N_PRIORITY = 0,
                    N_PRIORITY = string.IsNullOrEmpty(priority) ? 0 : int.Parse(priority),
                    N_SCHEDULE_TYPE = 1,
                    N_B_STATE = 0,
                    S_B_STATE = WCSTask.GetStateStr(0),
@@ -1228,6 +1239,9 @@
            }
        }
        /// <summary>
        /// 空托出库封装算法
        /// </summary>
        public class EmptyPalletOutboundScheduler
        {
            private readonly List<Location> _allLocations;