1
zhang
2026-04-17 9869f39cc82ae584ef4d783bb13316ccd24d26dd
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/operation/ConveyorBackgroundService.java
@@ -31,7 +31,6 @@
    private ScheduledExecutorService executorService;
    private final AtomicBoolean running = new AtomicBoolean(false);
    private long lastDbUpdateTime = 0;
@@ -44,7 +43,7 @@
        executorService = Executors.newSingleThreadScheduledExecutor(r -> {
            Thread thread = new Thread(r);
            thread.setName("cv-background-thread");
            thread.setDaemon(true);
            //thread.setDaemon(true);
            return thread;
        });
@@ -53,13 +52,12 @@
                properties.getInitialDelay(),
                properties.getInterval(),
                TimeUnit.MILLISECONDS);
        running.set(true);
        News.info("输送线后台服务线程初始化完成");
    }
    private void processConveyorTasks() {
        // 系统运行状态判断
        if (!SystemProperties.WCS_RUNNING_STATUS.get() || !running.get()) {
        if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
            News.info("系统未运行或服务已停止,跳过输送线任务处理");
            return;
        }
@@ -68,19 +66,21 @@
            News.info("执行输送线操作");
            lastDbUpdateTime = currentTime;
        }
        try {
            // 执行配置的操作序列
            for (CtuOperationConfig config : properties.getOperations()) {
        // 执行配置的操作序列
        for (CtuOperationConfig config : properties.getOperations()) {
            try {
                operationExecutor.execute(config);
            } catch (Exception e) {
                News.error("输送线操作执行最终失败, type={}, error={}", config.getType(), e.getMessage());
                // 可选:发送告警、暂停调度等
            }
        } catch (Exception e) {
            News.error("输送线任务处理异常,{}", e.getMessage());
        }
    }
    @PreDestroy
    public void shutDown() {
        running.set(false);
        if (executorService != null && !executorService.isShutdown()) {
            News.info("正在关闭输送线后台服务线程...");
            executorService.shutdown();