#
Junjie
9 天以前 728ad81fa10d2879654c5f9ae4314db94eafb865
src/main/java/com/zy/core/action/ShuttleAction.java
@@ -22,6 +22,7 @@
import com.zy.core.dispatcher.ShuttleDispatchUtils;
import com.zy.core.enums.*;
import com.zy.core.model.CommandResponse;
import com.zy.core.model.TrafficControlDataModel;
import com.zy.core.model.command.ShuttleAssignCommand;
import com.zy.core.model.command.ShuttleCommand;
import com.zy.core.model.command.ShuttleRedisCommand;
@@ -86,7 +87,7 @@
        return false;
    }
    public synchronized boolean executeWork(Integer shuttleNo, Integer taskNo) {
    public boolean executeWork(Integer shuttleNo, Integer taskNo) {
        Object obj = redisUtil.get(RedisKeyType.SHUTTLE_WORK_FLAG.key + taskNo);
        if (obj == null) {
            return false;
@@ -165,7 +166,9 @@
            List<NavigateNode> nodes = JSON.parseArray(JSON.toJSONString(command.getNodes()), NavigateNode.class);
            //申请管制
            boolean apply = applyTrafficControl(commands, nodes, shuttleNo, taskNo);
            applyTrafficControl(commands, nodes, shuttleNo, taskNo);
            //查询管制
            boolean apply = queryTrafficControl(shuttleNo, taskNo);
            if(!apply){
                return false;//申请失败
            }
@@ -294,6 +297,7 @@
                    //直线段数据标识
                    Long linePartFlag = startNode.getLinePartFlag();
                    if(commandStep < commands.size()){
                    //取指令
                    ShuttleCommand currentCommand = commands.get(commandStep);
                    if(currentCommand.getMode() != ShuttleCommandModeType.MOVE.id) {
@@ -309,6 +313,7 @@
                    if(currentStartNode.getLinePartFlag().equals(linePartFlag)) {
                        //数据标识一致
                        return 2;//允许小车移动连续下发指令
                        }
                    }
                }
@@ -490,6 +495,21 @@
        return trafficControlThread.applyTrafficControl(totalNodeList, nodeList, shuttleNo, taskNo);
    }
    //查询是否申请管制成功
    public boolean queryTrafficControl(Integer shuttleNo, Integer taskNo) {
        TrafficControlThread trafficControlThread = (TrafficControlThread) SlaveConnection.get(SlaveType.TrafficControl, 1);
        if (trafficControlThread == null) {
            return false;
        }
        TrafficControlDataModel trafficControlDataModel = trafficControlThread.queryTrafficControl(shuttleNo, taskNo);
        if (trafficControlDataModel == null) {
            return false;
        }
        return true;
    }
//    /**
//     * 搜索小车路径是否存在冲突
//     * 0:未检测 1:检测无冲突 2:检测有冲突