| | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | private void startupBus() throws InterruptedException { |
| | | // if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; } |
| | | if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { return; } |
| | | if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { |
| | | return; |
| | | } |
| | | List<Bus> busList = busService.selectBySts(BusStsType.RECEIVE); |
| | | for (Bus bus : busList) { |
| | | mainService.allocateTask(bus); |
| | |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | private void calculateSeg() throws InterruptedException { |
| | | if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { return; } |
| | | if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { |
| | | return; |
| | | } |
| | | List<Task> taskList = taskService.selectBySts(TaskStsType.WAITING); |
| | | |
| | | List<AgvTaskDto> taskDtoList = new ArrayList<>(); |
| | |
| | | |
| | | @EventListener(ApplicationReadyEvent.class) |
| | | public void init() { |
| | | try { Thread.sleep(1200); } catch (InterruptedException ignore) {} |
| | | try { |
| | | Thread.sleep(1200); |
| | | } catch (InterruptedException ignore) { |
| | | } |
| | | // traffic calculate |
| | | this.trafficCalcThread = new Thread(() -> { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | Thread.sleep(CORE_SCAN_FREQUENCY_MILLISECOND); |
| | | |
| | | if (configService.getVal("stopDownData", Boolean.class)) { return; } |
| | | |
| | | |
| | | List<Segment> segments = segmentService.list(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getState, SegmentStateType.WAITING.toString()) |
| | |
| | | try { |
| | | Thread.sleep(CORE_SCAN_FREQUENCY_MILLISECOND); |
| | | |
| | | if (configService.getVal("stopDownData", Boolean.class)) { return; } |
| | | |
| | | List<String> actionGroupIds = actionService.selectGroupNo(ActionStsType.PREPARE); |
| | | for (String actionGroupId : actionGroupIds) { |
| | | mainService.publishAction(actionGroupId); |
| | | if (!configService.getVal("stopDownData", Boolean.class)) { |
| | | List<String> actionGroupIds = actionService.selectGroupNo(ActionStsType.PREPARE); |
| | | for (String actionGroupId : actionGroupIds) { |
| | | mainService.publishAction(actionGroupId); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | // patch ---------------------------------------------------------------------------------------------- |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void busFinishPatch(){ |
| | | private void busFinishPatch() { |
| | | List<Bus> busList = busService.selectBySts(BusStsType.PROGRESS); |
| | | for (Bus bus : busList) { |
| | | boolean finish = true; |
| | |
| | | |
| | | |
| | | @PreDestroy |
| | | public void shutDown(){ |
| | | public void shutDown() { |
| | | if (this.trafficCalcThread != null) { |
| | | this.trafficCalcThread .interrupt(); |
| | | this.trafficCalcThread.interrupt(); |
| | | } |
| | | if (this.actionPublicThread != null) { |
| | | this.actionPublicThread .interrupt(); |
| | | this.actionPublicThread.interrupt(); |
| | | } |
| | | } |
| | | |