自动化立体仓库 - WCS系统
#
luxiaotao1123
2020-09-12 c88db5e02d675f2a877ec484dd39ad5baab0d0b8
src/main/java/com/zy/common/service/CommonService.java
@@ -101,7 +101,7 @@
        if (Cools.isEmpty(rowLastno)) {
            throw new CoolException("数据异常,请联系管理员");
        }
        if (rowLastno.getWhsType() == 1){
        if (whsType == 1 || whsType == 2){
            int curRow = rowLastno.getCurrentRow();
            int sRow = rowLastno.getsRow();
            int eRow = rowLastno.geteRow();
@@ -113,48 +113,54 @@
            LocMast locMast = null;
            // 同一天同规格货物靠近摆法规则
            if (!Cools.isEmpty(matNos)) {
                List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
                for (String locNo : locNos) {
                    // 获取排
                    int row = Integer.parseInt(locNo.substring(0, 2));
                    // 判断是否为深库位
                    double remainder = Arith.remainder(row, rowCount / crn_qty);
                    int targetRow;
                    if (remainder == 1) {
                        // 得到当前库位的外围库位
                        targetRow =  row + 1;
                    } else if (remainder == 0) {
                        // 得到当前库位的内围库位
                        targetRow =  row - 1;
                    } else {
                        continue;
                    }
                    String targetLocNo = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2);
                    // 检测目标库位是否为空库位
                    LocMast targetLocMast = locMastService.selectById(targetLocNo);
                    if (targetLocMast != null && targetLocMast.getLocSts().equals("O")) {
                        locMast = targetLocMast;
                        crnNo = locMast.getCrnNo();
                        break;
                    }
                }
            }
//            if (!Cools.isEmpty(matNos)) {
//                List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
//                for (String locNo : locNos) {
//                    // 获取排
//                    int row = Integer.parseInt(locNo.substring(0, 2));
//                    // 判断是否为深库位
//                    double remainder = Arith.remainder(row, rowCount / crn_qty);
//                    int targetRow;
//                    if (remainder == 1) {
//                        // 得到当前库位的外围库位
//                        targetRow =  row + 1;
//                    } else if (remainder == 0) {
//                        // 得到当前库位的内围库位
//                        targetRow =  row - 1;
//                    } else {
//                        continue;
//                    }
//                    String targetLocNo = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2);
//                    // 检测目标库位是否为空库位
//                    LocMast targetLocMast = locMastService.selectById(targetLocNo);
//                    if (targetLocMast != null && targetLocMast.getLocSts().equals("O")) {
//                        locMast = targetLocMast;
//                        crnNo = locMast.getCrnNo();
//                        break;
//                    }
//                }
//            }
            // 如果没有相近物料,则按规则轮询货架
            if (null == locMast) {
                // 获取目标站所在货架排号
                Shelves shelves = new Shelves(rowCount, crn_qty);
                curRow = shelves.start(curRow);
                if (curRow < 0) {
                    throw new CoolException("检索库位失败,请联系管理员");
                // 获取目标站所在货架排号 todo:luxiaotao
                if (curRow == sRow) {
                    curRow = eRow;
                } else {
                    curRow = sRow;
                }
                for (List<Integer> node : shelves.nodes){
                    if (node.contains(curRow)) {
                        crnNo = shelves.nodes.indexOf(node) + 1;
                        break;
                    }
                }
                crnNo = whsType;
//                Shelves shelves = new Shelves(rowCount, crn_qty);
//                curRow = shelves.start(curRow);
//                if (curRow < 0) {
//                    throw new CoolException("检索库位失败,请联系管理员");
//                }
//                for (List<Integer> node : shelves.nodes){
//                    if (node.contains(curRow)) {
//                        crnNo = shelves.nodes.indexOf(node) + 1;
//                        break;
//                    }
//                }
            }
            basCrnpService.checkSiteStatus(crnNo);