#
Junjie
2023-10-22 bceb4ec708bb800f43d7827c99dade24a550666a
src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
@@ -137,7 +137,8 @@
            WrkMast wrkMast1 = wrkMastMapper.selectByWorkNo(wrkNo);
            if (wrkMast1 != null) {
                int lev = Utils.getLev(wrkMast1.getLocNo());//目标楼层
                String locNO=wrkMast1.getIoType()<100?wrkMast1.getLocNo():wrkMast1.getSourceLocNo();
                int lev = Utils.getLev(locNO);//目标楼层
                //检测目标楼层车数量是否小于允许的最大数量
                boolean checkDispatchMaxNum = checkDispatchMaxNum(lev);
@@ -235,7 +236,7 @@
        if (Utils.getLev(locNo) != shuttleProtocol.getPoint().getZ()) {
            //目标库位和小车库位处于不同一楼层,需要通过提升机调度
            //获取穿梭车最近且空闲的提升机输送站点
            LiftStaProtocol liftSta = this.getRecentLiftSta(shuttleNo);
            LiftStaProtocol liftSta = this.getRecentLiftSta(shuttleNo, Utils.getLev(locNo));
            if (liftSta == null) {
                return false;//没有可用且空闲的输送站点
            }
@@ -318,13 +319,32 @@
            }
        }
        //搜索是否存在前往目标楼层的小车移动工作档
        for (WrkMast wrkMast : wrkMastMapper.selectShuttleMoveWrk()) {
            if (wrkMast.getSourceLocNo() == null || wrkMast.getLocNo() == null) {
                continue;
            }
            int sourceLev = Utils.getLev(wrkMast.getSourceLocNo());//工作档源楼层
            int targetLev = Utils.getLev(wrkMast.getLocNo());//工作档目标楼层
            if (sourceLev == lev) {
                continue;//工作档楼层和目标楼层相同,跳过
            }
            if (targetLev == lev) {
                levCount++;//工作档目标楼层和实际楼层相同,数量增加
                continue;
            }
        }
        return levCount < Integer.parseInt(config.getValue());
    }
    /**
     * 获取穿梭车最近且空闲的提升机输送站点
     */
    public LiftStaProtocol getRecentLiftSta(Integer shuttleNo) {
    public LiftStaProtocol getRecentLiftSta(Integer shuttleNo, Integer targetLev) {
        //获取四向穿梭车线程
        NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
        if (shuttleThread == null) {
@@ -356,6 +376,16 @@
                continue;
            }
            //判断目标楼层站点是否无托盘
            LiftStaProtocol targetLiftStaProtocol = NyLiftUtils.getLiftStaByLev(slave.getId(), targetLev);
            if (targetLiftStaProtocol == null) {
                continue;
            }
            if (targetLiftStaProtocol.getHasTray()) {
                continue;//有托盘跳过
            }
            list.add(liftStaProtocol);
        }