自动化立体仓库 - WMS系统
#
Junjie
2023-11-07 dc07f8dfebabfc695bfe5fc4d65083eb2a23d728
src/main/java/com/zy/common/service/CommonService.java
@@ -144,6 +144,13 @@
            return getLocNoStep6(staDescId, sourceStaNo, locMast);//返回dto
        }
        //存货分类编码规则
        locMast = getLocNoCodeStepRule(matNos, locTypeDto);
        if (locMast != null) {
            //找到库位,返回dto
            return getLocNoStep6(staDescId, sourceStaNo, locMast);//返回dto
        }
        // 靠近摆放规则 --- 相同订单号, 同天同规格物料
        locMast = getLocNoStep3(staDescId, matNos, locTypeDto);
        if (locMast != null) {
@@ -196,9 +203,12 @@
                List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
                for (LocMast locMast0 : locMasts) {
                    //预留空库位
                    if (locMastService.checkEmptyCount(locMast0, 10)) {
                        return locMast0;
                    LocMast locMast1 = locMastService.findInnerLoc(locMast0.getLocNo());//检测同库位组深库位是否有空闲库位
                    if (locMast1 != null) {
                        //预留空库位
                        if (locMastService.checkEmptyCount(locMast1, 10)) {
                            return locMast1;
                        }
                    }
                }
            }
@@ -209,6 +219,55 @@
                throw new CoolException("规则区域没有空库位");
            }
        }
        return locMast;
    }
    /**
     * 库位编码规则
     */
    private LocMast getLocNoCodeStepRule(List<String> matNos, LocTypeDto locTypeDto) {
        LocMast locMast = null;
        //库位编码规则只能在相同编码货物中生效
        String matnr = "";
        for(String matNo : matNos){
            if("".equals(matnr)){
                matnr = matNo.substring(0, 4);
            }
            if(!matnr.equals(matNo.substring(0, 4))){
                return null;
            }
        }
        // 库区锁定
        List<LocRule> locRules = locRuleService.findCode(Cools.isEmpty(matNos) ? null : matNos.get(0),null);
        if (locRules == null || locRules.isEmpty()) {
            return null;//没有库位规则,跳出当前任务
        }
        for (LocRule locRule : locRules) {
            if (locRule == null) {
                continue;
            }
            List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
            for (LocMast locMast0 : locMasts) {
                LocMast locMast1 = locMastService.findInnerLoc(locMast0.getLocNo());//检测同库位组深库位是否有空闲库位
                if (locMast1 != null) {
                    //预留空库位
                    if (locMastService.checkEmptyCount(locMast1, 10)) {
                        return locMast1;
                    }
                }
            }
        }
//            if (locRules.get(0).getKeepGo() == 0) {
//                //找不到空库位,且禁止继续寻找其他非混载区域库位
//                //找不到库位,抛出异常
//                throw new CoolException("规则区域没有空库位");
//            }
        return locMast;
    }
@@ -232,7 +291,7 @@
                //再判断库存明细档,料号相同的明细库位
                List<String> locNos = locDetlService.getSameDetl(matNos.get(0));
                for (String locNo : locNos) {
                    LocMast locMast0 = locMastService.findNearloc(locNo);
                    LocMast locMast0 = locMastService.findInnerLoc(locNo);
                    if (null != locMast0) {
                        // 浅库位符合尺寸检测
                        if (VersionUtils.checkLocType(locMast0, locTypeDto)) {