自动化立体仓库 - WCS系统
*
lsh
2024-10-17 13610d4b55fb5d2871a4f12e3e8df4ab86bf33f7
src/main/java/com/zy/core/MainProcess.java
@@ -1,11 +1,15 @@
package com.zy.core;
import com.zy.asrs.service.impl.MainServiceImpl;
import com.zy.core.properties.SystemProperties;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
/**
 * WCS主流程
@@ -16,8 +20,15 @@
@Component
public class MainProcess {
    @Autowired
    private MainServiceImpl mainService;
    // 所属线程
    private Thread thread;
    // 频率
    private int i = 0;
    private int j = 0;
    private int k = 0;
    private int l = 0;
    /**
     * =====>>  开始工作
@@ -26,25 +37,30 @@
        thread = new Thread(() -> {
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    // 系统运行状态判断
                    if (SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    i++; if (i>5) i=0;
                    j++; if (j>5) j=0;
                    k++;
                    if (k>13) {
                        k=0;
                        l++;
                        if (l>3) l=0;
                    }
                    // 间隔
                    Thread.sleep(1500);
                    log.info("WCS 工作中 .....................");
                    Thread.sleep(1000);
                    // 系统运行状态判断
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    }
                    //更新位置信息
                    mainService.updateStePosition();
                    // 任务下发
                    mainService.loopSteCharge();
                } catch (Exception e) {
                    e.printStackTrace();
                }