| | |
| | | }); |
| | | readThread.start(); |
| | | |
| | | //设备执行 |
| | | Thread executeThread = new Thread(() -> { |
| | | while (true) { |
| | | try { |
| | | if (shuttleAction == null) { |
| | | try { |
| | | shuttleAction = SpringUtils.getBean(ShuttleAction.class); |
| | | }catch (Exception e){ |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | Object object = redisUtil.get(RedisKeyType.SHUTTLE_FLAG.key + deviceConfig.getDeviceNo()); |
| | | if (object == null) { |
| | | continue; |
| | | } |
| | | |
| | | Integer taskNo = Integer.valueOf(String.valueOf(object)); |
| | | if (taskNo != 0) { |
| | | //存在任务需要执行 |
| | | boolean result = shuttleAction.executeWork(deviceConfig.getDeviceNo(), taskNo); |
| | | } |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | executeThread.start(); |
| | | // //设备执行 |
| | | // Thread executeThread = new Thread(() -> { |
| | | // while (true) { |
| | | // try { |
| | | // if (shuttleAction == null) { |
| | | // try { |
| | | // shuttleAction = SpringUtils.getBean(ShuttleAction.class); |
| | | // }catch (Exception e){ |
| | | // } |
| | | // continue; |
| | | // } |
| | | // |
| | | // Object object = redisUtil.get(RedisKeyType.SHUTTLE_FLAG.key + deviceConfig.getDeviceNo()); |
| | | // if (object == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // Integer taskNo = Integer.valueOf(String.valueOf(object)); |
| | | // if (taskNo != 0) { |
| | | // //存在任务需要执行 |
| | | // boolean result = shuttleAction.executeWork(deviceConfig.getDeviceNo(), taskNo); |
| | | // } |
| | | // Thread.sleep(100); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }); |
| | | // executeThread.start(); |
| | | } |
| | | |
| | | private void listenMessageFromRedis() { |
| | |
| | | return false; |
| | | } |
| | | |
| | | List<NavigationMapType> restartCalcMapTypes = new ArrayList<>(mapTypes); |
| | | restartCalcMapTypes.add(NavigationMapType.SHUTTLE); |
| | | |
| | | String currentLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(currentLocNo, locNo, mapTypes, assignCommand, this); |
| | | List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(currentLocNo, locNo, restartCalcMapTypes, assignCommand, this); |
| | | if (commands == null) { |
| | | return false; |
| | | } |