自动化立体仓库 - WMS系统
#
18516761980
2022-08-17 9a265d9ba9fab36a46d57add862096fa86ca37da
#
5个文件已修改
213 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/WcsController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocMastMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -590,12 +590,14 @@
        java.sql.Date requestTime = new java.sql.Date(date1.getTime());
        // 生成入库通知档
        Mat mat = matService.selectByMatnr(param.getPackName());
        if (Cools.isEmpty(mat)) {
            throw new CoolException(param.getPackName() + "商品档案不存在");
        }
//        Mat mat = matService.selectByMatnr(param.getPackName());
//        if (Cools.isEmpty(mat)) {
//            throw new CoolException(param.getPackName() + "商品档案不存在");
//        }
        WaitPakin waitPakin = new WaitPakin();
        waitPakin.sync(mat);
//        waitPakin.sync(mat);
        waitPakin.setMatnr(param.getPackName());
        waitPakin.setMaktx(param.getPackName());
        waitPakin.setZpallet(param.getPackNo());   // Pack码
        waitPakin.setIoStatus("N");     // 入出状态
        waitPakin.setAnfme(1.0);  // 数量
src/main/java/com/zy/common/service/CommonService.java
@@ -100,16 +100,6 @@
//        whsType = getWhsType(sourceStaNo, times);
        StartupDto startupDto = new StartupDto();
        if (sourceStaNo < 200){
            whsType = 1;
        } else if (sourceStaNo > 199 && sourceStaNo < 300){
            whsType = 2;
        } else if (sourceStaNo > 299 && sourceStaNo < 400){
            whsType = 3;
        } else if (sourceStaNo > 399){
            whsType = 4;
        }
        RowLastno rowLastno = rowLastnoService.selectById(whsType);
        if (Cools.isEmpty(rowLastno)) {
            throw new CoolException("数据异常,请联系管理员");
@@ -126,49 +116,49 @@
        // 目标库位
        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 (!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 (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) {
@@ -218,38 +208,38 @@
        // 开始查找库位 ==============================>>
        // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排
        if (locMast == null) {
            if (Utils.isShallowLoc(slaveProperties, curRow)) {
                Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
                locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1());
                // todo:luxiaotao 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D)
                // 因库位移转、需预留空库位
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
            }
//        if (locMast == null) {
//            if (Utils.isShallowLoc(slaveProperties, curRow)) {
//                Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
//                locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1());
//                // todo:luxiaotao 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D)
//                // 因库位移转、需预留空库位
//                if (!locMastService.checkEmptyCount(locMast)) {
//                    locMast = null;
//                }
//            }
            if (Cools.isEmpty(locMast)) {
                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
                // 因库位移转、需预留空库位
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
                // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X
                if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
                    LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo()));
                    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
                        locMast = null;
                    }
                }
                // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O
                if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
                    LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
                    if (!shallowLoc.getLocSts().equals("O")) {
                        locMast = null;
                    }
                }
//                if (!locMastService.checkEmptyCount(locMast)) {
//                    locMast = null;
//                }
//                // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X
//                if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
//                    LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo()));
//                    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
//                        locMast = null;
//                    }
//                }
//                // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O
//                if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
//                    LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
//                    if (!shallowLoc.getLocSts().equals("O")) {
//                        locMast = null;
//                    }
//                }
            }
        }
//        }
        // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位
        if (Cools.isEmpty(locMast)) {
@@ -259,11 +249,11 @@
                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
            }
            // 轻货物找轻库位为空时,可以去找重库位仓
            if (locTypeDto.getLocType1() == 1) {
                locTypeDto.setLocType1((short) 2);
                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
            }
//            // 轻货物找轻库位为空时,可以去找重库位仓
//            if (locTypeDto.getLocType1() == 1) {
//                locTypeDto.setLocType1((short) 2);
//                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
//            }
            log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times);
            throw new CoolException("没有空库位");
        }
@@ -292,40 +282,6 @@
                msgBuilder.insert(0, "0");
            }
            return msgBuilder.toString();
        }
    }
    /**
     * 根据入库站获取库位排号分配
     */
    private Integer getWhsType(Integer sourceStaNo, int times) {
        if (times >= 16) {
            return 4;
        }
        switch (sourceStaNo) {
            case 173:
            case 176:
            case 180:
            case 185:
                return 1;
            case 189:
            case 194:
            case 198:
            case 202:
                return 2;
            case 206:
//            case 211:
//            case 215:
//            case 219:
//            case 223:
            case 227:
                return 3;
            case 305:
            case 303:
            case 301:
                return 4;
            default:
                throw new CoolException("根据入库站获取库位排号分配失败,入库站:" + sourceStaNo);
        }
    }
src/main/java/com/zy/common/web/WcsController.java
@@ -81,7 +81,8 @@
        // 源站点状态检测
        BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true);
        sourceStaNo.setLocType1(param.getLocType1());
//        sourceStaNo.setLocType1(param.getLocType1());
        sourceStaNo.setLocType1((short)1);
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        StartupDto dto = null;
src/main/resources/application.yml
@@ -1,5 +1,5 @@
server:
  port: 8080
  port: 8081
  servlet:
    context-path: /@pom.build.finalName@
#  tomcat:
src/main/resources/mapper/LocMastMapper.xml
@@ -48,7 +48,7 @@
        <if test="locType1 != null">
            and loc_type1 = #{locType1}
        </if>
        order by loc_sts desc ,lev1 asc,bay1 asc
        order by lev1 asc,bay1 asc
    </select>
    <select id="queryShallowLocFMast" resultMap="BaseResultMap">