| | |
| | | } |
| | | |
| | | /** |
| | | * 普通 run2 的推荐排优先阶段。 |
| | | * |
| | | * 推荐排只对普通物料生效,空托盘已经切换成“按库区轮询堆垛机”的规则, |
| | | * 因此这里会直接跳过空托盘请求,避免 row 参数把空托盘重新带回旧逻辑。 |
| | | * |
| | | * 另外,单排推荐不再作为“强绑定单台堆垛机”处理。 |
| | | * 现场上游经常只传一个推荐排,例如 row=[1],如果这里直接短路命中, |
| | | * 满板任务就会长期压在同一台堆垛机上。现在只有当推荐排能覆盖多台堆垛机时, |
| | | * 才把它当作真正的优先候选集合。 |
| | | */ |
| | | private LocMast findRun2RecommendLoc(RowLastno rowLastno, RowLastnoType rowLastnoType, boolean emptyPalletRequest, |
| | | List<Integer> recommendRows, LocTypeDto locTypeDto, Integer staDescId, |
| | | Integer sourceStaNo, StartupDto startupDto, Integer preferredArea, |
| | | List<Integer> triedCrnNos) { |
| | | if (emptyPalletRequest) { |
| | | return null; |
| | | } |
| | | List<Integer> recommendCrnNos = mapRowsToCrnNos(rowLastno, recommendRows); |
| | | if (Cools.isEmpty(recommendCrnNos) || recommendCrnNos.size() <= 1) { |
| | | return null; |
| | | } |
| | | LocMast locMast = findRun2EmptyLocByCrnNos(rowLastno, rowLastnoType, recommendCrnNos, locTypeDto, |
| | | staDescId, sourceStaNo, startupDto, preferredArea, "recommend"); |
| | | triedCrnNos.addAll(recommendCrnNos); |
| | | return locMast; |
| | | } |
| | | |
| | | /** |
| | | * 普通物料 run2 找位主流程。 |
| | | * |
| | | * 执行顺序: |
| | |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private List<Integer> mapRowsToCrnNos(RowLastno rowLastno, List<Integer> rows) { |
| | | List<Integer> result = new ArrayList<>(); |
| | | if (rowLastno == null || Cools.isEmpty(rows)) { |
| | | return result; |
| | | } |
| | | LinkedHashSet<Integer> orderedCrnNos = new LinkedHashSet<>(); |
| | | Integer rowSpan = getCrnRowSpan(rowLastno.getTypeId()); |
| | | if (rowSpan == null || rowSpan <= 0) { |
| | | rowSpan = 2; |
| | | } |
| | | int startCrnNo = rowLastno.getsCrnNo() == null ? 1 : rowLastno.getsCrnNo(); |
| | | int endCrnNo = rowLastno.geteCrnNo() == null ? startCrnNo + rowLastno.getCrnQty() - 1 : rowLastno.geteCrnNo(); |
| | | int startRow = rowLastno.getsRow() == null ? 1 : rowLastno.getsRow(); |
| | | int endRow = rowLastno.geteRow() == null ? Integer.MAX_VALUE : rowLastno.geteRow(); |
| | | for (Integer row : rows) { |
| | | if (row == null || row < startRow || row > endRow) { |
| | | continue; |
| | | } |
| | | int crnNo = startCrnNo + (row - startRow) / rowSpan; |
| | | if (crnNo >= startCrnNo && crnNo <= endCrnNo) { |
| | | orderedCrnNos.add(crnNo); |
| | | } |
| | | } |
| | | result.addAll(orderedCrnNos); |
| | | return result; |
| | | } |
| | | |
| | |
| | | * run2 入库找位主流程。 |
| | | * |
| | | * 当前方法只保留“组织流程”和“统一收口”的职责,具体策略拆成独立方法: |
| | | * 1. 普通物料:推荐排优先 -> 站点优先库区/堆垛机 -> 其它库区。 |
| | | * 1. 普通物料:按 row_lastno 自身轮询顺序 -> 站点优先库区/堆垛机 -> 其它库区。 |
| | | * 2. 空托盘:优先库区 loc_type2=1 -> 其它库区 loc_type2=1 -> loc_type1=2 兼容。 |
| | | * 3. 命中库位后分别回写普通物料游标或空托盘库区游标。 |
| | | * |
| | | * WCS 传入的推荐排不再参与 run2 选位,避免上游 row 参数把任务重新绑回固定堆垛机。 |
| | | */ |
| | | public StartupDto getLocNoRun2(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, List<Integer> recommendRows, int times) { |
| | | |
| | |
| | | List<Integer> orderedCrnNos = getOrderedCrnNos(rowLastno, crnNo); |
| | | List<Integer> orderedRunnableCrnNos = getOrderedRunnableRun2CrnNos(rowLastno, staDescId, sourceStaNo, orderedCrnNos); |
| | | List<Integer> triedCrnNos = new ArrayList<>(); |
| | | locMast = findRun2RecommendLoc(rowLastno, rowLastnoType, emptyPalletRequest, recommendRows, locTypeDto, |
| | | staDescId, sourceStaNo, startupDto, preferredArea, triedCrnNos); |
| | | if (Cools.isEmpty(locMast)) { |
| | | if (emptyPalletRequest) { |
| | | // 空托盘单独按库区轮询: |
| | | // 1. 当前库区先找 loc_type2=1 |
| | | // 2. 当前库区没有,再找其他库区 loc_type2=1 |
| | | // 3. 全部 narrow 都没有时,再退到 loc_type1=2 |
| | | emptyPalletAreaSearchResult = findEmptyPalletRun2AreaLoc(rowLastno, staDescId, sourceStaNo, startupDto, preferredArea, locTypeDto); |
| | | if (!Cools.isEmpty(emptyPalletAreaSearchResult)) { |
| | | locMast = emptyPalletAreaSearchResult.locMast; |
| | | } |
| | | } else { |
| | | locMast = findNormalRun2Loc(rowLastno, rowLastnoType, sourceStaNo, staDescId, findLocNoAttributeVo, |
| | | locTypeDto, startupDto, preferredArea, orderedCrnNos, triedCrnNos); |
| | | if (emptyPalletRequest) { |
| | | // 空托盘单独按库区轮询: |
| | | // 1. 当前库区先找 loc_type2=1 |
| | | // 2. 当前库区没有,再找其他库区 loc_type2=1 |
| | | // 3. 全部 narrow 都没有时,再退到 loc_type1=2 |
| | | emptyPalletAreaSearchResult = findEmptyPalletRun2AreaLoc(rowLastno, staDescId, sourceStaNo, startupDto, preferredArea, locTypeDto); |
| | | if (!Cools.isEmpty(emptyPalletAreaSearchResult)) { |
| | | locMast = emptyPalletAreaSearchResult.locMast; |
| | | } |
| | | } else { |
| | | locMast = findNormalRun2Loc(rowLastno, rowLastnoType, sourceStaNo, staDescId, findLocNoAttributeVo, |
| | | locTypeDto, startupDto, preferredArea, orderedCrnNos, triedCrnNos); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(locMast)) { |
| | |
| | | } |
| | | |
| | | public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, List<Integer> recommendRows, int times) { |
| | | // WCS 传入的推荐排不再参与 AGV/平库选位,统一按库位排号自身轮询逻辑找位。 |
| | | |
| | | // 初始化参数 |
| | | int crnNo = 0; //堆垛机号 |
| | |
| | | } |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | if (Cools.isEmpty(locMast) && !Cools.isEmpty(recommendRows)) { |
| | | for (Integer recommendRow : recommendRows) { |
| | | if (Cools.isEmpty(recommendRow)) { |
| | | continue; |
| | | } |
| | | LocMast recommendLoc = locMastService.queryFreeLocMast(recommendRow, locTypeDto.getLocType1(), rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(recommendLoc) && VersionUtils.locMoveCheckLocTypeComplete(recommendLoc, locTypeDto)) { |
| | | locMast = recommendLoc; |
| | | crnNo = recommendLoc.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Integer preferredArea = findLocNoAttributeVo.getOutArea(); |
| | | |