自动化立体仓库 - WMS系统
src/main/java/com/zy/common/service/CommonService.java
@@ -186,35 +186,35 @@
            }
        }
        // 如果没有相近物料,则按规则轮询货架
        if (null == locMast) {
            if(crnNo>1) {
                curRow = curRow -2;
            }
            Shelves shelves = new Shelves(rowCount, crn_qty);
            int divides = (int) Arith.divides(1, curRow - 1, 4);
            curRow = (int) Arith.remainder(curRow, 4);
            if (curRow == 0) {
                curRow = 4;
            }
            for (int i = 0; i < shelves.group; i ++) {
                curRow = shelves.start(curRow);
                if (curRow < 0) {
                    throw new CoolException("检索库位失败,请联系管理员");
                }
                if (basCrnpService.checkSiteError(crnNo, true)) {
                    curRow = curRow + divides*4;
                    break;
                }
            }
            if(crnNo>1) {
                curRow = curRow +2;
            }
        }
        if (crnNo == 0) {
            throw new CoolException("没有可用的堆垛机");
        }
//        // 如果没有相近物料,则按规则轮询货架
//        if (null == locMast) {
//            if(crnNo>1) {
//                curRow = curRow -2;
//            }
//            Shelves shelves = new Shelves(rowCount, crn_qty);
//            int divides = (int) Arith.divides(1, curRow - 1, 4);
//            curRow = (int) Arith.remainder(curRow, 4);
//            if (curRow == 0) {
//                curRow = 4;
//            }
//            for (int i = 0; i < shelves.group; i ++) {
//                curRow = shelves.start(curRow);
//                if (curRow < 0) {
//                    throw new CoolException("检索库位失败,请联系管理员");
//                }
//                if (basCrnpService.checkSiteError(crnNo, true)) {
//                    curRow = curRow + divides*4;
//                    break;
//                }
//            }
//            if(crnNo>1) {
//                curRow = curRow +2;
//            }
//        }
//
//        if (crnNo == 0) {
//            throw new CoolException("没有可用的堆垛机");
//        }
        // 获取目标站
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                .eq("type_no", staDescId)
@@ -229,7 +229,27 @@
        if (!staNo.getAutoing().equals("Y")) {
            throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用");
        }
        if(curRow==1){
            curRow=2;
        }else if(curRow==2){
            curRow=1;
        }else if(curRow==3){
            curRow=6;
        }else if(curRow==6){
            curRow=3;
        }else if(curRow==7){
            curRow=10;
        }else if(curRow==10){
            curRow=7;
        }else if(curRow==4){
            curRow=5;
        }else if(curRow==5){
            curRow=4;
        }else if(curRow==8){
            curRow=9;
        }else if(curRow==9){
            curRow=8;
        }
        // 更新库位排号
        rowLastno.setCurrentRow(curRow);
        rowLastnoService.updateById(rowLastno);
@@ -278,6 +298,18 @@
            if (times < rowCount) {
                times = times + 1;
                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
            }else if (times == rowCount) {
                LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>()
                        .eq("crn_no", crnNo)
                        .eq("loc_sts", "O")
                        .orderBy("lev1"));
                if(Cools.isEmpty(locMast1)){
                    throw new CoolException("堆垛机="+crnNo+"没有空库位");
                }
                if(!locMastService.checkEmptyCount(locMast1)){
                    throw new CoolException("堆垛机="+crnNo+"没有空库位");
                }
            }
            // 轻货物找轻库位为空时,可以去找重库位仓