From ee5046d151a858339aa137790bc830efe7f55980 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期三, 18 六月 2025 15:13:14 +0800
Subject: [PATCH] 1

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java    |   34 +++++++++-------
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvCompleteSubscriber.java |   14 +++---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvDataSubscriber.java     |   17 ++++----
 3 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvCompleteSubscriber.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvCompleteSubscriber.java
index 285faef..dd67e4e 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvCompleteSubscriber.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvCompleteSubscriber.java
@@ -31,19 +31,19 @@
 
 
     @EventListener(ApplicationReadyEvent.class)
-    private void start(){
+    private void start() {
         thread = new Thread(() -> {
             while (!Thread.currentThread().isInterrupted()) {
                 try {
                     // 闂撮殧
                     Thread.sleep(30);
 
-                    if (configService.getVal("stopDownData", Boolean.class)) { return; }
+                    if (!configService.getVal("stopDownData", Boolean.class)) {
+                        AgvProtocol protocol = redis.pop(RedisConstant.AGV_COMPLETE_FLAG);
+                        if (null != protocol) {
 
-                    AgvProtocol protocol = redis.pop(RedisConstant.AGV_COMPLETE_FLAG);
-                    if (null != protocol){
-
-                        mainService.upDataSubscribe(protocol);
+                            mainService.upDataSubscribe(protocol);
+                        }
                     }
 
                 } catch (Exception e) {
@@ -55,7 +55,7 @@
     }
 
     @PreDestroy
-    public void shutDown(){
+    public void shutDown() {
         if (thread != null) thread.interrupt();
     }
 
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvDataSubscriber.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvDataSubscriber.java
index 77a10ad..36e9c5e 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvDataSubscriber.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvDataSubscriber.java
@@ -31,7 +31,7 @@
 
 
     @EventListener(ApplicationReadyEvent.class)
-    private void start(){
+    private void start() {
 //        redis.deleteList(RedisConstant.AGV_DATA_FLAG);
         thread = new Thread(() -> {
             while (!Thread.currentThread().isInterrupted()) {
@@ -39,22 +39,23 @@
                     // 闂撮殧
                     Thread.sleep(10);
 
-                    if (configService.getVal("stopDownData", Boolean.class)) { return; }
+                    if (!configService.getVal("stopDownData", Boolean.class)) {
+                        AgvProtocol protocol = redis.pop(RedisConstant.AGV_DATA_FLAG);
+                        if (null != protocol) {
 
-                    AgvProtocol protocol = redis.pop(RedisConstant.AGV_DATA_FLAG);
-                    if (null != protocol){
-
-                        agvDataService.dataProcess(protocol);
+                            agvDataService.dataProcess(protocol);
+                        }
                     }
 
-                } catch (Exception ignore) {}
+                } catch (Exception ignore) {
+                }
             }
         });
         thread.start();
     }
 
     @PreDestroy
-    public void shutDown(){
+    public void shutDown() {
         if (thread != null) thread.interrupt();
     }
 
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 8165c21..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
@@ -73,7 +73,9 @@
     @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);
@@ -83,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<>();
@@ -106,15 +110,15 @@
 
     @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())
@@ -137,11 +141,11 @@
                 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) {
@@ -156,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;
@@ -188,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