zhangchao
2024-09-04 17e41c4b535eb30a4768c7d17b8707bad74bbb22
移库逻辑调整
5个文件已修改
96 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/mapper/LocMastMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/LocMastService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocMastMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -20,7 +20,7 @@
        "when 11 then 0 when 12 then 1 when 13 then 1 when 14 then 0 when 15 then 0 when 16 then 1 end desc,newid()")
    List<Integer> queryDistinctRow(@Param("crnNo")Integer crnNo);
    LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1, @Param("locType2") Short locType2);
    LocMast queryFreeLocMast(@Param("row") Integer row,@Param("bay") Integer bay, @Param("locType1") Short locType1, @Param("locType2") Short locType2);
    @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}")
    List<String> queryGroupEmptyStock(Integer crnNo);
src/main/java/com/zy/asrs/service/LocMastService.java
@@ -16,6 +16,10 @@
     * 检索可用库位
     */
    LocMast queryFreeLocMast(Integer row, Short locType1,Short locType2);
    /**
     * 检索可用库位
     */
    LocMast queryFreeLocMast(Integer row,Integer bay, Short locType1,Short locType2);
    /**
     * 获取同组货架的空库位
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -19,10 +19,16 @@
    @Override
    public LocMast queryFreeLocMast(Integer row, Short locType1, Short locType2) {
        return this.baseMapper.queryFreeLocMast(row, locType1, locType2);
        return this.baseMapper.queryFreeLocMast(row, null, locType1, locType2);
    }
    @Override
    public LocMast queryFreeLocMast(Integer row, Integer bay, Short locType1, Short locType2) {
        return this.baseMapper.queryFreeLocMast(row, bay, locType1, locType2);
    }
    @Override
    public List<String> queryGroupEmptyStock(String sourceLocNo) {
        if (Cools.isEmpty(sourceLocNo)) {
            return null;
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -91,17 +91,17 @@
    @Value("${wms.url}")
    private String wmsUrl;
    private Short getWorkMode(Integer bay) {
        if (bay == 2 || bay == 7) {
    private Short getWorkMode(Short locType1, Integer bay) {
        if (locType1 == 2) {
            return (short) 3;
        } else if (bay == 3) {
            return (short) 2;
        } else if (bay == 4) {
            return (short) 2;
        } else if (bay == 5) {
        } else if (locType1 == 5) {
            return (short) 3;
        } else {
            if (bay == 5) {
            return (short) 1;
        } else {
            return (short) 0;
                return (short) 2;
            }
        }
    }
@@ -883,7 +883,7 @@
            CrnCommand crnCommand = new CrnCommand();
            crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
            crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号
            Short workMode = getWorkMode(locMast.getBay1());
            Short workMode = getWorkMode(locMast.getLocType1(), locMast.getBay1());
            if (workMode == 2) {
                //CrnTaskModeType该枚举类无效,只有1代表工位,2代表工位2,3双工位
                crnCommand.setTaskMode(CrnTaskModeType.PAKOUT);
@@ -1055,12 +1055,13 @@
                    News.warnNoLog("" + mark + " - 2" + " - 12" + " - 命令下发 : 工作号={},源排={},源列={},源层={},目标排={},目标列={},目标层={}", wrkMast.getWrkNo().shortValue(), sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue(), crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue());
                    String locNo = sourceSta.getLocNo();
                    // 获取目标库位信息
                    LocMast sta = locMastService.getById(sourceSta.getLocNo());
                    // 1.堆垛机开始移动
                    CrnCommand crnCommand = new CrnCommand();
                    crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
                    crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号
                    Short workMode = getWorkMode(sourceSta.getBay1());
                    Short workMode = getWorkMode(sta.getLocType1(), sourceSta.getBay1());
                    if (workMode == 2) {
                        //CrnTaskModeType该枚举类无效,只有1代表工位,2代表工位2,3双工位
                        crnCommand.setTaskMode(CrnTaskModeType.PAKOUT);
@@ -1268,7 +1269,7 @@
        CrnCommand crnCommand = new CrnCommand();
        crnCommand.setCrnNo(slave.getId()); // 堆垛机编号
        crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号
        Short workMode = getWorkMode(sourceSta.getBay1());
        Short workMode = getWorkMode(sta.getLocType1(), sourceSta.getBay1());
        crnCommand.setAckFinish((short) 0);  // 任务完成确认位
        if (workMode == 2) {
            //CrnTaskModeType该枚举类无效,只有1代表工位,2代表工位2,3双工位
@@ -1918,7 +1919,7 @@
            LocMast loc = null;
            for (Integer row : rows) {
                if (Utils.isDeepLoc(slaveProperties, row)) {
                    loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1(), shallowLoc.getLocType2());
                    loc = locMastService.queryFreeLocMast(row, shallowLoc.getBay1(), shallowLoc.getLocType1(), shallowLoc.getLocType2());
                    if (loc != null) {
                        if (Utils.isDeepLoc(slaveProperties, loc.getLocNo())) {
                            String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
@@ -1930,25 +1931,25 @@
                    }
                    if (null != loc) {
                        //调整的原因:双工位的情况,5列,只能2号工位取放,34列,只能工位1取放
                        if (shallowLoc.getLocType1() == 1) {
                            if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
//                        if (shallowLoc.getLocType1() == 1) {
//                            if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
//                                break;
//                            } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
//                                if (loc.getBay1() == 3 || loc.getBay1() == 4) {
//                                    break;
//                                }
//                            }
//                            loc = null;
//                        } else {
                                break;
                            } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
                                if (loc.getBay1() == 3 || loc.getBay1() == 4) {
                                    break;
                                }
                            }
                            loc = null;
                        } else {
                            break;
                        }
                        // }
                    }
                }
            }
            if (null == loc) {
                for (Integer row : rows) {
                    if (Utils.isShallowLoc(slaveProperties, row)) {
                        loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1(), shallowLoc.getLocType2());
                        loc = locMastService.queryFreeLocMast(row, shallowLoc.getBay1(), shallowLoc.getLocType1(), shallowLoc.getLocType2());
                        if (null != loc) {//对应深库位非在库状态,不能移库
                            String deepLoc = Utils.getDeepLoc(slaveProperties, loc.getLocNo());
@@ -1959,19 +1960,19 @@
                        }
                        if (null != loc) {
                            //调整的原因:双工位的情况,5列,只能2号工位取放,34列,只能工位1取放
                            if (shallowLoc.getLocType1() == 1) {
                                if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
//                            //调整的原因:双工位的情况,5列,只能2号工位取放,34列,只能工位1取放
//                            if (shallowLoc.getLocType1() == 1) {
//                                if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
//                                    break;
//                                } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
//                                    if (loc.getBay1() == 3 || loc.getBay1() == 4) {
//                                        break;
//                                    }
//                                }
//                                loc = null;
//                            } else {
                                    break;
                                } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
                                    if (loc.getBay1() == 3 || loc.getBay1() == 4) {
                                        break;
                                    }
                                }
                                loc = null;
                            } else {
                                break;
                            }
                            // }
                        }
                    }
                }
src/main/resources/mapper/LocMastMapper.xml
@@ -42,6 +42,9 @@
        from asr_loc_mast
        where row1=#{row}
        and loc_sts='O'
        <if test="bay != null and bay == 5">
            and bay1 = #{bay}
        </if>
        <if test="locType1 != null">
            and loc_type1 = #{locType1}
        </if>
@@ -51,6 +54,10 @@
        order by NEWID(),lev1 asc,bay1 asc
    </select>
    <select id="queryDemoSourceLoc" resultMap="BaseResultMap">
        select top 1 * from asr_loc_mast where crn_no = #{crnNo}
        and loc_sts='D'