#ZH
野心家
2025-05-26 c9b270dae703ee077a4e41013d7662c5e61afd29
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,35 +20,54 @@
@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;
    private int[] autoZ = new int[]{0,0,0,0,0,0,0};
    /**
     * =====>>  开始工作
     */
    public void start(){
        thread = new Thread(() -> {
            try{
                Thread.sleep(200);
                log.info("++++++++ 开始验证许可证 ++++++++");
                if (!mainService.licenseVerify()){
                    SystemProperties.WCS_RUNNING_STATUS.set(Boolean.FALSE);
                    log.info("++++++++ 验证许可证失败 ++++++++");
                } else {
                    SystemProperties.WCS_RUNNING_STATUS.set(Boolean.TRUE);
                    log.info("++++++++ 验证许可证成功 ++++++++");
                }
            } catch (Exception e) {}
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    // 间隔
                    Thread.sleep(200);
                    // 系统运行状态判断
                    if (SystemProperties.WCS_RUNNING_STATUS.get()) {
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    }
                    //更新位置信息
                    mainService.updateStePositionNearby();
                    //更新位置信息
                    mainService.updateStePosition();
                    // 任务下发
                    mainService.DevpTaskNoRun();
                    // 任务完成
                    mainService.rgvCompleteWrkMastSta(autoZ);
                    //更新位置信息
                    mainService.updateStePosition();
                    // 间隔
                    Thread.sleep(1500);
                    log.info("WCS 工作中 .....................");
                } catch (Exception e) {
                    e.printStackTrace();
                }