| | |
| | | List<TrafficControlDataModel> allTrafficControl = getAllTrafficControl(); |
| | | //更新交管信息 |
| | | redisUtil.set(RedisKeyType.TRAFFIC_CONTROL_MAP.key, allTrafficControl); |
| | | |
| | | for (TrafficControlDataModel dataModel : allTrafficControl) { |
| | | Integer shuttleNo = dataModel.getShuttleNo(); |
| | | Integer taskNo = dataModel.getTaskNo(); |
| | | |
| | | Object object1 = redisUtil.get(RedisKeyType.TRAFFIC_CONTROL_SUCCESS_APPLY.key + shuttleNo + "_" + taskNo); |
| | | if(object1 == null) { |
| | | redisUtil.set(RedisKeyType.TRAFFIC_CONTROL_SUCCESS_APPLY.key + shuttleNo + "_" + taskNo, 1, 60 * 60); |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(200); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | Long idleTime = pathIdleShuttleMap.get(shuttleProtocol.getShuttleNo()); |
| | | if((System.currentTimeMillis() - idleTime) > 1000 * 10) { |
| | | //检测障碍物车 |
| | | boolean checkObstacle = shuttleOperaUtils.checkObstacle(shuttleProtocol.getCurrentLocNo(), new ArrayList<Integer>() {{ |
| | | int checkObstacle = shuttleOperaUtils.checkObstacle(shuttleProtocol.getCurrentLocNo(), new ArrayList<Integer>() {{ |
| | | add(shuttleNo); |
| | | }}); |
| | | }}, totalNodeList); |
| | | pathIdleShuttleMap.remove(shuttleProtocol.getShuttleNo()); |
| | | |
| | | if (checkObstacle == 2) { |
| | | pathShuttleThread.restartCalcPath(); |
| | | } |
| | | } |
| | | }else { |
| | | pathIdleShuttleMap.put(shuttleProtocol.getShuttleNo(), System.currentTimeMillis()); |
| | |
| | | } |
| | | |
| | | if(totalLocList.contains(locNo)) { |
| | | String first = totalLocList.get(0); |
| | | if(first.equals(locNo)) {//filter first node |
| | | continue; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | operateTrafficControl(param); |
| | | |
| | | applyRecordsMap.remove(shuttleNo); |
| | | News.info("receipt traffic {},{}", shuttleNo, taskNo); |
| | | redisUtil.set(RedisKeyType.TRAFFIC_CONTROL_SUCCESS_APPLY.key + shuttleNo + "_" + taskNo, 1, 60 * 60); |
| | | News.info("[RCS Debug] receipt traffic {},{}", shuttleNo, taskNo); |
| | | return true; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public synchronized boolean cancelTrafficControl(Integer shuttleNo, Integer taskNo) { |
| | | public boolean cancelTrafficControl(Integer shuttleNo, Integer taskNo) { |
| | | TrafficControlDataModel dataModel = queryTrafficControl(shuttleNo, taskNo); |
| | | if (dataModel == null) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public synchronized boolean forceCancelTrafficControl(Integer shuttleNo) { |
| | | public boolean forceCancelTrafficControl(Integer shuttleNo) { |
| | | TrafficControlDataModel dataModel = queryTrafficControl(shuttleNo); |
| | | if (dataModel == null) { |
| | | return false; |
| | |
| | | public synchronized boolean operateTrafficControl(OperateTrafficControlParam param) { |
| | | long startTime = System.currentTimeMillis(); |
| | | String operaType = param.getOperaType(); |
| | | News.info("Operate Traffic Control is Start " + operaType); |
| | | News.info("[RCS Debug] Operate Traffic Control is Start " + operaType); |
| | | |
| | | boolean result = false; |
| | | if (operaType.equals("add")) { |
| | |
| | | new ArrayList<>(model.getTotalNodeList()) |
| | | )) |
| | | .collect(Collectors.toList()); |
| | | News.info("Operate Traffic Control is end " + (System.currentTimeMillis() - startTime) + "ms"); |
| | | News.info("[RCS Debug] Operate Traffic Control is end " + (System.currentTimeMillis() - startTime) + "ms"); |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | trafficControlDataList.remove(idx);//取消管制 |
| | | redisUtil.del(RedisKeyType.TRAFFIC_CONTROL_SUCCESS_APPLY.key + shuttleNo + "_" + taskNo); |
| | | return true; |
| | | } |
| | | |