#
18516761980
2021-11-05 acdc4b3427cbd2a6dc811aed202fbd3e9c309d69
src/main/java/com/zy/common/service/CommonService.java
@@ -89,6 +89,11 @@
        return workNo;
    }
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, int times) {
        LocTypeDto oldLocType = locTypeDto.clone();
        return getLocNo(whsType, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
    }
    /**
     * 检索库位号
     * @param whsType 类型 1:双深式货架
@@ -97,7 +102,7 @@
     * @param matNos 物料号集合
     * @return locNo 检索到的库位号
     */
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, int times) {
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
        StartupDto startupDto = new StartupDto();
        // 生成工作号
        int workNo = getWorkNo(0);
@@ -249,6 +254,20 @@
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
                // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X
                if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
                    LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo()));
                    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
                        locMast = null;
                    }
                }
                // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O
                if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
                    LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
                    if (!shallowLoc.getLocSts().equals("O")) {
                        locMast = null;
                    }
                }
            }
        }
@@ -257,24 +276,33 @@
            // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归
            if (times < rowCount) {
                times = times + 1;
                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
            } else {
                times = 0;
            }
            // 货物检索低库位仓失败,兼容高库位仓后继续执行
            if (locTypeDto.getLocType1() == 1) {
                locTypeDto.setLocType1((short) 2);
                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
            }
            // 货物检索窄库位仓失败,兼容宽库位仓后继续执行
            if (locTypeDto.getLocType2() == 1) {
                locTypeDto.setLocType2((short) 2);
                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
                if (oldLocType.getLocType1() == 1) {
                    locTypeDto.setLocType1((short) 1);
                }
                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
            }
            // 货物检索轻库位仓失败,兼容重库位仓后继续执行
            if (locTypeDto.getLocType3() == 1) {
                locTypeDto.setLocType3((short) 2);
                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
                if (oldLocType.getLocType1() == 1) {
                    locTypeDto.setLocType1((short) 1);
                }
                if (oldLocType.getLocType2() == 1) {
                    locTypeDto.setLocType2((short) 1);
                }
                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
            }
            log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times);
            throw new CoolException("没有空库位");