自动化立体仓库 - WMS系统
Junjie
2023-06-03 ef811df34e156ea6d253fbfa12c76b4c0a593840
src/main/java/com/zy/common/service/CommonService.java
@@ -161,8 +161,6 @@
     * 混载找库位
     */
    private LocMast getLocNoStep1(List<String> matNos, LocTypeDto locTypeDto) {
        LocMast locMast = null;
        //判断当前货物是否为混载货物
        String firstMatNos = matNos.get(0);
        boolean mixed = false;//默认不是混载货物
@@ -174,41 +172,44 @@
        }
        if (!mixed) {
            return locMast;//不是混载货物,直接跳出当前任务
            return null;//不是混载货物,直接跳出当前任务
        }
        // 找混载库位规则
        LocRule locRule = locRuleService.findMixed();
        if (locRule == null) {
            return locMast;//没有混载规则,跳出当前任务
        List<LocRule> locRules = locRuleService.findMixed();
        if (locRules == null || locRules.size() == 0) {
            return null;//没有混载规则,跳出当前任务
        }
        //将库位规则组转换为库位组
        List<LocMast> locMasts = locRuleService.locRuleToLocNos(locRule);
        if (locMasts == null || locMasts.size() == 0) {
            if (locRule.getKeepGo() == 0) {
                //找不到空库位,且禁止继续寻找其他非混载区域库位
                //找不到库位,抛出异常
                throw new CoolException("混载区域没有空库位");
        for (LocRule locRule : locRules) {
            if (locRule == null) {
                continue;
            }
            return locMast;//没有混载规则,跳出当前任务
        }
        for (LocMast one : locMasts) {
            LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
            if (null != locMast0) {
                // 浅库位符合尺寸检测
                if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
                    // 因库位移转、需预留空库位
                    if (locMastService.checkEmptyCount(locMast0, 10)) {
                        locMast = locMast0;
                        break;
            List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
            for (LocMast one : locMasts) {
                LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
                if (null != locMast0) {
                    // 浅库位符合尺寸检测
                    if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
                        // 因库位移转、需预留空库位
                        if (locMastService.checkEmptyCount(locMast0, 10)) {
                            return locMast0;//找到空余的混载库位
                        }
                    }
                }
            }
        }
        return locMast;
        if (locRules.get(0).getKeepGo() == 0) {
            //找不到空库位,且禁止继续寻找其他非混载区域库位
            //找不到库位,抛出异常
            throw new CoolException("混载区域没有空库位");
        }
        return null;
    }
    /**
@@ -217,8 +218,16 @@
    private LocMast getLocNoStep2(List<String> matNos, LocTypeDto locTypeDto) {
        LocMast locMast = null;
        // 库区锁定
        LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0));
        if (!Cools.isEmpty(locRule)) {
        List<LocRule> locRules = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0));
        if (locRules == null || locRules.size() == 0) {
            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 one : locMasts) {
                LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
@@ -227,13 +236,19 @@
                    if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
                        // 因库位移转、需预留空库位
                        if (locMastService.checkEmptyCount(locMast0, 10)) {
                            locMast = locMast0;
                            break;
                            return locMast0;
                        }
                    }
                }
            }
        }
        if (locRules.get(0).getKeepGo() == 0) {
            //找不到空库位,且禁止继续寻找其他非混载区域库位
            //找不到库位,抛出异常
            throw new CoolException("规则区域没有空库位");
        }
        return locMast;
    }