#
luxiaotao1123
2021-09-01 778cddbbea621916f984b943b963edfc9cdc4853
src/main/java/com/zy/common/service/CommonService.java
@@ -98,20 +98,7 @@
        StartupDto startupDto = new StartupDto();
        // 生成工作号
        int workNo = getWorkNo(0);
        switch (sourceStaNo) {
            case 202:
                whsType = 2;
                break;
            case 205:
                whsType = 1;
                break;
            case 126:
                whsType = 3;
                break;
            default:
                throw new CoolException("库位排号分配错误, 源站号:" + sourceStaNo);
        }
        whsType = 1;
        RowLastno rowLastno = rowLastnoService.selectById(whsType);
        if (Cools.isEmpty(rowLastno)) {
            throw new CoolException("数据异常,请联系管理员");
@@ -172,47 +159,18 @@
            }
        }
        // todo
        // 如果没有相近物料,则按规则轮询货架
        if (null == locMast) {
            Shelves shelves = new Shelves(rowCount, crn_qty);
            // 1-4排
            // 1-6排
            if (whsType == 1) {
                for (int i = 0; i < shelves.group; i ++) {
                    curRow = shelves.start(curRow);
                for (int i = 0; i < 6; i++) {
                    curRow = shelves.start0(curRow);
                    if (curRow < 0) {
                        throw new CoolException("检索库位失败,请联系管理员");
                    }
                    Integer crnNo1 = shelves.get(curRow);
                    if (basCrnpService.checkSiteError(crnNo1, true)) {
                        crnNo = crnNo1;
                        break;
                    }
                }
            // 5-8排
            } else if (whsType == 2) {
                curRow = curRow - 4;
                for (int i = 0; i < shelves.group; i ++) {
                    curRow = shelves.start(curRow);
                    if (curRow < 0) {
                        throw new CoolException("检索库位失败,请联系管理员");
                    }
                    Integer crnNo1 = shelves.get(curRow);
                    if (basCrnpService.checkSiteError(crnNo1 + 1, true)) {
                        // 偏移量补偿
                        curRow = curRow + 4;
                        crnNo = crnNo1 + 1;
                        break;
                    }
                }
            // 126空板入 1-8排
            } else {
                for (int i = 0; i < shelves.group; i ++) {
                    curRow = shelves.start(curRow);
                    if (curRow < 0) {
                        throw new CoolException("检索库位失败,请联系管理员");
                    }
                    Integer crnNo1 = shelves.get(curRow);
                    Integer crnNo1 = shelves.get0(curRow);
                    if (basCrnpService.checkSiteError(crnNo1, true)) {
                        crnNo = crnNo1;
                        break;
@@ -246,15 +204,28 @@
            if (Utils.isShallowLoc(slaveProperties, curRow)) {
                Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
                locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1());
                // 因库位移转、需预留空库位
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
            }
            if (Cools.isEmpty(locMast)) {
                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
                // 因库位移转、需预留空库位
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
            }
        }
        if (Cools.isEmpty(locMast)) {
            // 轻货物找轻库位为空时,可以去找重库位仓
            // 轻货物找低库位为空时,可以去找中库位仓
            if (locTypeDto.getLocType1() == 1) {
                locTypeDto.setLocType1((short) 2);
                return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto, times);
            }
            // 轻货物找中库位为空时,可以去找高库位仓
            if (locTypeDto.getLocType1() == 2) {
                locTypeDto.setLocType1((short) 3);
                return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto, times);
            }
            if (times >= rowCount) {
@@ -290,4 +261,4 @@
        }
    }
}
}