| | |
| | | // 阶段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排) |
| | |
| | | { |
| | | //如果货位已满,则生成移库任务 |
| | | 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); |
| | |
| | | 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, |
| | |
| | | }); |
| | | } |
| | | else continue; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | |
| | | .FirstOrDefault(); |
| | | } |
| | | |
| | | private WCSTask CreateOutboundTask(Location loc, Outbound outbound) => |
| | | private WCSTask CreateOutboundTask(Location loc, Outbound outbound,string priority = "") => |
| | | new WCSTask |
| | | { |
| | | S_CODE = GenerateTaskNo(), |
| | |
| | | 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), |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空托出库封装算法 |
| | | /// </summary> |
| | | public class EmptyPalletOutboundScheduler |
| | | { |
| | | private readonly List<Location> _allLocations; |