#
Junjie
2023-08-10 f886fe7c00267539242b6bdd8a465ad950fe8493
src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -298,12 +298,13 @@
            return false;
        }
        WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
        WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        if (o == null) {
            return false;
        }
        ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
        List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands();
        ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand();
@@ -363,13 +364,11 @@
            return false;
        }
        //检查路径是否可行走(检查路径锁定状态,检测路径是否有其他小车)
        //检测当前行走路径,和下一步路径
        boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(command.getNodes(), shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
        boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
        if (!checkPathIsAvailable && !checkPathIsAvailable2) {
        //检测路径是否可行走
        if (!checkPath(command.getNodes(), nextNodes)) {
            return false;
        }
        //锁定路径,锁定当前路径和下一步路径
        List<NavigateNode> nodes = command.getNodes();
        nodes.addAll(nextNodes);
@@ -442,6 +441,8 @@
            return false;
        }
        WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
        ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
        //当前步序
        int commandStep = redisCommand.getCommandStep();
@@ -482,6 +483,12 @@
        if (liftProtocol.getLev().intValue() == Utils.getLev(shuttleProtocol.getCurrentLocNo())) {
            return true;//提升机达到小车楼层,放行
        }
        //搜索是否有其他任务占用了提升机,如果占用提升机的任务和当前任务相同,则运行执行
        WrkMast wrkMast1 = wrkMastMapper.selectLiftWrkMast(liftProtocol.getLiftNo().intValue());
        if (wrkMast1 != null && wrkMast1.getWrkNo() != wrkNo.intValue()) {
            return false;
        }
        //提升机未到达小车楼层,呼叫提升机
@@ -545,4 +552,18 @@
        return false;//默认不放行
    }
    /**
     * 检测路径是否可行走
     */
    private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes) {
        //检测路径是否可行走(检查路径锁定状态,检测路径是否有其他小车)
        //检测当前行走路径,和下一步路径
        boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
        boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
        if (checkPathIsAvailable && checkPathIsAvailable2) {
            return true;//可行走
        }
        return false;//不可行走
    }
}