自动化立体仓库 - WMS系统
zwl
8 天以前 7294ef58d1a343bdc765773ba69928820ce0d20f
src/main/java/com/zy/common/service/CommonService.java
@@ -2012,6 +2012,89 @@
    }
    /**
     * 双伸堆垛机同货优先:
     * 先找深库位中 standby1 相同且状态为 F 的货位,再检查其对应浅库位是否为空。
     */
    private LocMast findDoubleExtensionSameGoodsPreferredLoc(RowLastno rowLastno, RowLastnoType rowLastnoType,
                                                             Integer crnNo, CrnDepthRuleProfile profile,
                                                             LocTypeDto locTypeDto, FindLocNoAttributeVo findLocNoAttributeVo) {
        if (profile == null || !profile.isDoubleExtension() || findLocNoAttributeVo == null
                || Cools.isEmpty(findLocNoAttributeVo.getStandby1())) {
            return null;
        }
        String standby1 = findLocNoAttributeVo.getStandby1();
        LinkedHashSet<Integer> processedDeepRows = new LinkedHashSet<Integer>();
        for (Integer searchRow : profile.getSearchRows()) {
            if (searchRow == null || !profile.isDeepRow(searchRow) || !processedDeepRows.add(searchRow)) {
                continue;
            }
            Integer shallowRow = profile.getPairedShallowRow(searchRow);
            if (shallowRow == null) {
                continue;
            }
            List<LocMast> deepLocs = findOccupiedLocsByRow(searchRow, crnNo, findLocNoAttributeVo);
            if (Cools.isEmpty(deepLocs)) {
                continue;
            }
            List<String> deepLocNos = new ArrayList<String>();
            for (LocMast deepLoc : deepLocs) {
                if (deepLoc == null || Cools.isEmpty(deepLoc.getLocNo())) {
                    continue;
                }
                deepLocNos.add(deepLoc.getLocNo());
            }
            if (Cools.isEmpty(deepLocNos)) {
                continue;
            }
            List<LocDetl> sameGoodsLocDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("standby1", standby1)
                    .in("loc_no", deepLocNos));
            if (Cools.isEmpty(sameGoodsLocDetls)) {
                continue;
            }
            LinkedHashSet<String> sameGoodsLocNos = new LinkedHashSet<String>();
            for (LocDetl locDetl : sameGoodsLocDetls) {
                if (locDetl == null || Cools.isEmpty(locDetl.getLocNo())) {
                    continue;
                }
                sameGoodsLocNos.add(locDetl.getLocNo());
            }
            if (Cools.isEmpty(sameGoodsLocNos)) {
                continue;
            }
            for (LocMast deepLoc : deepLocs) {
                if (deepLoc == null || !sameGoodsLocNos.contains(deepLoc.getLocNo())) {
                    continue;
                }
                LocMast shallowLoc = findLocByPosition(rowLastno, rowLastnoType, crnNo, shallowRow,
                        deepLoc.getBay1(), deepLoc.getLev1(), "O");
                if (!Cools.isEmpty(shallowLoc) && matchesLocType(shallowLoc, locTypeDto)) {
                    return shallowLoc;
                }
            }
        }
        return null;
    }
    /**
     * 查询某一排上状态为 F 的库位,并按当前频次/前几列策略排序。
     */
    private List<LocMast> findOccupiedLocsByRow(Integer row, Integer crnNo, FindLocNoAttributeVo findLocNoAttributeVo) {
        List<LocMast> result = new ArrayList<LocMast>();
        if (row == null) {
            return result;
        }
        Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>()
                .eq("row1", row)
                .eq("loc_sts", "F");
        if (crnNo != null) {
            wrapper.eq("crn_no", crnNo);
        }
        List<LocMast> locMasts = locMastService.selectList(wrapper);
        return sortLocCandidates(locMasts, findLocNoAttributeVo, false);
    }
    /**
     * 在一对浅排/深排之间选择真正可投放的目标库位。
     */
    private LocMast findPairAssignableLoc(RowLastno rowLastno, RowLastnoType rowLastnoType, Integer crnNo,
@@ -2036,11 +2119,8 @@
            }
        }
        for (LocMast shallowLoc : shallowOpenLocs) {
            LocMast deepBlockingLoc = findLocByPosition(rowLastno, rowLastnoType, crnNo, deepRow, shallowLoc.getBay1(), shallowLoc.getLev1(), "F", "D");
            if (!Cools.isEmpty(deepBlockingLoc)) {
                return shallowLoc;
            }
            if (findLocByPosition(rowLastno, rowLastnoType, crnNo, deepRow, shallowLoc.getBay1(), shallowLoc.getLev1()) == null) {
            LocMast deepInStockLoc = findLocByPosition(rowLastno, rowLastnoType, crnNo, deepRow, shallowLoc.getBay1(), shallowLoc.getLev1(), "F");
            if (!Cools.isEmpty(deepInStockLoc)) {
                return shallowLoc;
            }
        }
@@ -2069,6 +2149,11 @@
        CrnDepthRuleProfile profile = basCrnDepthRuleService.resolveProfile(rowLastno, crnNo, preferredNearRow);
        if (profile == null || Cools.isEmpty(profile.getSearchRows())) {
            return null;
        }
        LocMast sameGoodsPreferredLoc = findDoubleExtensionSameGoodsPreferredLoc(rowLastno, rowLastnoType, crnNo,
                profile, locTypeDto, findLocNoAttributeVo);
        if (!Cools.isEmpty(sameGoodsPreferredLoc)) {
            return sameGoodsPreferredLoc;
        }
        LinkedHashSet<Integer> processedShallowRows = new LinkedHashSet<Integer>();
        boolean singleExtension = profile.isSingleExtension();
@@ -2170,9 +2255,8 @@
                count++;
                continue;
            }
            LocMast deepBlockingLoc = findLocByPosition(rowLastno, rowLastnoType, crnNo, deepRow, shallowLoc.getBay1(), shallowLoc.getLev1(), "F", "D");
            if (!Cools.isEmpty(deepBlockingLoc) ||
                    findLocByPosition(rowLastno, rowLastnoType, crnNo, deepRow, shallowLoc.getBay1(), shallowLoc.getLev1()) == null) {
            LocMast deepInStockLoc = findLocByPosition(rowLastno, rowLastnoType, crnNo, deepRow, shallowLoc.getBay1(), shallowLoc.getLev1(), "F");
            if (!Cools.isEmpty(deepInStockLoc)) {
                count++;
            }
        }