| | |
| | | import com.zy.common.utils.NavigatePositionConvert; |
| | | import com.zy.common.utils.NavigateUtils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.common.utils.ShuttleOperaUtils; |
| | | import com.zy.core.News; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.RedisKeyType; |
| | |
| | | private HashMap<Integer, HashMap<String, List<Integer>>> levNodesMap = null; |
| | | |
| | | |
| | | private HashMap<Integer,Long> pathIdleShuttleMap = new HashMap<>(); |
| | | private HashMap<Integer,Long> applyRecordsMap = new HashMap<>(); |
| | | private HashMap<String, List<NavigateNode>> taskNodesMap = new HashMap<>(); |
| | | private List<TrafficControlDataModel> trafficControlDataList = new ArrayList<>(); |
| | |
| | | |
| | | @Override |
| | | public synchronized boolean applyTrafficControl(List<NavigateNode> totalNodeList, List<NavigateNode> nodeList, Integer shuttleNo, Integer taskNo) { |
| | | ShuttleOperaUtils shuttleOperaUtils = SpringUtils.getBean(ShuttleOperaUtils.class); |
| | | if (shuttleOperaUtils == null) { |
| | | return false; |
| | | } |
| | | |
| | | //更新交管信息 |
| | | redisUtil.set(RedisKeyType.TRAFFIC_CONTROL_MAP.key, trafficControlDataList); |
| | | |
| | |
| | | //检测路径是否有小车 |
| | | for (String loc : totalLocList) { |
| | | if(shuttleLocList.contains(loc)) { |
| | | ShuttleThread pathShuttleThread = Utils.searchShuttle(loc); |
| | | if (pathShuttleThread == null) { |
| | | return false; |
| | | } |
| | | |
| | | ShuttleProtocol shuttleProtocol = pathShuttleThread.getStatus(); |
| | | if(shuttleProtocol == null) { |
| | | return false; |
| | | } |
| | | |
| | | if (pathShuttleThread.isIdle()) { |
| | | if(pathIdleShuttleMap.containsKey(shuttleProtocol.getShuttleNo())) { |
| | | Long idleTime = pathIdleShuttleMap.get(shuttleProtocol.getShuttleNo()); |
| | | if((System.currentTimeMillis() - idleTime) > 1000 * 10) { |
| | | //检测障碍物车 |
| | | boolean checkObstacle = shuttleOperaUtils.checkObstacle(shuttleProtocol.getCurrentLocNo(), new ArrayList<Integer>() {{ |
| | | add(shuttleNo); |
| | | }}); |
| | | pathIdleShuttleMap.remove(shuttleProtocol.getShuttleNo()); |
| | | } |
| | | }else { |
| | | pathIdleShuttleMap.put(shuttleProtocol.getShuttleNo(), System.currentTimeMillis()); |
| | | } |
| | | } |
| | | return false;//node has shuttle |
| | | } |
| | | } |