From 1809dba25f489ea01c07a9ecc977d9f408545310 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 05 一月 2026 09:41:49 +0800
Subject: [PATCH] 电压改电量

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/AutoRunScheduler.java |   71 ++++++++++++++++++++++++++++-------
 1 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/AutoRunScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/AutoRunScheduler.java
index 0076b5f..e496015 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/AutoRunScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/AutoRunScheduler.java
@@ -63,8 +63,18 @@
     @Scheduled(fixedDelay = 1000) // 鍥哄畾棰戠巼鎵ц锛屽悓姝�
 //    @Scheduled(cron = "0/1 * * * * ? ")
     private void execute() {
-        if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; }
-        this.autoRun();
+        if (configService.getVal("TaskAssignMode", Boolean.class)) {
+            this.autoRun();
+        }
+        if (configService.getVal("TaskAssignMode1", Boolean.class,false)) {
+            this.autoRun0(1);
+        }
+        if (configService.getVal("TaskAssignMode2", Boolean.class,false)) {
+            this.autoRun0(2);
+        }
+        if (configService.getVal("TaskAssignMode3", Boolean.class,false)) {
+            this.autoRun0(3);
+        }
     }
 
     private void autoRun() {
@@ -83,6 +93,26 @@
         // 绉诲簱
         this.runLocToLoc(memo);
     }
+
+    private void autoRun0(Integer i) {
+        int availableAgvCount = this.getAvailableAgvCount();
+        if (0 == availableAgvCount) { return; }
+
+//        List<String> staPreNos = getStaPrefixes(staGroupList);
+        List<String> staPreNos = new ArrayList<>();
+        String memo = "DEMO_STA_" + String.join("-", staPreNos);
+        if(i ==1){
+            // 鍏ュ簱
+            this.runStaToLoc0(memo);
+        }else if (i == 2){
+            // 鍑哄簱
+            this.runLocToSta0(memo);
+        }else if (i == 3){
+            // 绉诲簱
+            this.runLocToLoc(memo);
+        }
+    }
+
 
     // 鍏ュ簱
     private void runStaToLoc(String memo) {
@@ -133,6 +163,14 @@
     }
 
     private void runStaToLoc0(String memo) {
+        int availableAgvCount = this.getAvailableAgvCount();
+
+        // 鏈�澶� ? 缁刡us杩愯
+        if (availableAgvCount <= busService.count(new LambdaQueryWrapper<Bus>()
+                .in(Bus::getBusSts, BusStsType.RECEIVE.val(), BusStsType.PROGRESS.val())
+                .in(Bus::getMemo, memo, memo)
+        )) { return; }
+
         AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, AgvModelType.CTU_BOX_TRANSPORT_AGV.toString()));
         if (null == agvModel) { return; }
 
@@ -245,6 +283,14 @@
     }
 
     private void runLocToSta0(String memo) {
+        int availableAgvCount = this.getAvailableAgvCount();
+
+        // 鏈�澶� ? 缁刡us杩愯
+        if (availableAgvCount <= busService.count(new LambdaQueryWrapper<Bus>()
+                .in(Bus::getBusSts, BusStsType.RECEIVE.val(), BusStsType.PROGRESS.val())
+                .in(Bus::getMemo, memo, memo)
+        )) { return; }
+
         AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, AgvModelType.CTU_BOX_TRANSPORT_AGV.toString()));
         if (null == agvModel) { return; }
 
@@ -322,21 +368,17 @@
 
         // STOCK
         List<Loc> stockLocList = locService.selectRandByLocSts(LocStsType.STOCK.val(), maxCapacity);
-//        LambdaQueryWrapper<Loc> stockWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getLocSts, LocStsType.STOCK.val());
-//        List<Loc> stockList = locService.list(stockWrapper);
-//        if (Cools.isEmpty(stockList) || stockList.size() < agvModel.getBackpack()) {
-//            return;
-//        }
-//        Collections.shuffle(stockList);
+        if (Cools.isEmpty(stockLocList)) {
+            return;
+        }
+        Collections.shuffle(stockLocList);
 
         // IDLE
         List<Loc> idleLocList = locService.selectRandByLocSts(LocStsType.IDLE.val(), maxCapacity);
-//        LambdaQueryWrapper<Loc> idleWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getLocSts, LocStsType.IDLE.val());
-//        List<Loc> idleList = locService.list(idleWrapper);
-//        if (Cools.isEmpty(idleList)) {
-//            return;
-//        }
-//        Collections.shuffle(idleList);
+        if (Cools.isEmpty(idleLocList)) {
+            return;
+        }
+        Collections.shuffle(idleLocList);
 
         OpenBusSubmitParam param = new OpenBusSubmitParam();
         param.setBatch(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19));
@@ -351,6 +393,7 @@
 
             param.getTaskList().add(taskDto);
         }
+        if (Cools.isEmpty(param.getTaskList())) { return; }
 
         mainService.generateBusAndTask(param, memo);
     }

--
Gitblit v1.9.1