自动化立体仓库 - WMS系统
#
野心家
2023-06-08 5a0592f51e21bebc2155fb94e5058deb0604299c
src/main/java/com/zy/common/service/CommonService.java
@@ -118,57 +118,57 @@
        // 目标库位
        LocMast locMast = null;
        // 靠近摆放规则 --- 同天同规格物料
        if (!Cools.isEmpty(matNos)) {
            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow);
            for (String locNo : locNos) {
                if (Utils.isShallowLoc(slaveProperties, locNo)) {
                    continue;
                }
                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
                // 检测目标库位是否为空库位
                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                    if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) {
                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                            locMast = shallowLoc;
                            crnNo = locMast.getCrnNo();
                            break;
                        }
                    }
                }
            }
        }
        // 靠近摆放规则 --- 空托
        if (staDescId == 10) {
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
            if (locMasts.size() > 0) {
                for (LocMast loc : locMasts) {
                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
                        continue;
                    }
                    String shallowLocNo = Utils.getShallowLoc(slaveProperties,  loc.getLocNo());
                    // 检测目标库位是否为空库位
                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                            locMast = shallowLoc;
                            crnNo = locMast.getCrnNo();
                            break;
                        }
                    }
                }
            }
        }
//        // 靠近摆放规则 --- 同天同规格物料
//        if (!Cools.isEmpty(matNos)) {
//            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow);
//            for (String locNo : locNos) {
//                if (Utils.isShallowLoc(slaveProperties, locNo)) {
//                    continue;
//                }
//                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
//                // 检测目标库位是否为空库位
//                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
//                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
//                    if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) {
//                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
//                            locMast = shallowLoc;
//                            crnNo = locMast.getCrnNo();
//                            break;
//                        }
//                    }
//                }
//            }
//        }
//
//        // 靠近摆放规则 --- 空托
//        if (staDescId == 10) {
//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
//            if (locMasts.size() > 0) {
//                for (LocMast loc : locMasts) {
//                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
//                        continue;
//                    }
//                    String shallowLocNo = Utils.getShallowLoc(slaveProperties,  loc.getLocNo());
//                    // 检测目标库位是否为空库位
//                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
//                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
//                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
//                            locMast = shallowLoc;
//                            crnNo = locMast.getCrnNo();
//                            break;
//                        }
//                    }
//                }
//            }
//        }
        // 如果没有相近物料,则按规则轮询货架
        if (null == locMast) {
            Shelves shelves = new Shelves(rowCount, crn_qty);
            int divides = (int) Arith.divides(1, curRow - 1, 4);
            curRow = (int) Arith.remainder(curRow, 4);
            int divides = (int) Arith.divides(1, curRow - 1, 2);
            curRow = (int) Arith.remainder(curRow, 2);
            if (curRow == 0) {
                curRow = 4;
                curRow = 2;
            }
            for (int i = 0; i < shelves.group; i ++) {
                curRow = shelves.start(curRow);
@@ -179,7 +179,7 @@
                crnNo1 = crnNo1 + divides*1;
                if (basCrnpService.checkSiteError(crnNo1, true)) {
                    crnNo = crnNo1;
                    curRow = curRow + divides*4;
                    curRow = curRow + divides*2;
                    break;
                }
            }