zhang
2026-01-05 1809dba25f489ea01c07a9ecc977d9f408545310
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();
        // 最多 ? 组bus运行
        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();
        // 最多 ? 组bus运行
        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; }