1
zhang
2025-06-18 ee5046d151a858339aa137790bc830efe7f55980
1
3个文件已修改
65 ■■■■ 已修改文件
zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvCompleteSubscriber.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/listen/AgvDataSubscriber.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
    }
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();
    }
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();
        }
    }