From 259509a4598f0516f583a4529e87c521d6f99450 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期一, 23 六月 2025 09:39:42 +0800 Subject: [PATCH] 1 --- zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-) diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java index 43d4ac0..686c696 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java @@ -69,10 +69,13 @@ @Autowired private AgvModelService agvModelService; + @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); @@ -82,7 +85,9 @@ @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<>(); @@ -105,7 +110,10 @@ @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()) { @@ -133,9 +141,11 @@ try { Thread.sleep(CORE_SCAN_FREQUENCY_MILLISECOND); - 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) { @@ -150,7 +160,7 @@ // 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; @@ -182,12 +192,12 @@ @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(); } } -- Gitblit v1.9.1