package com.zy.core; import com.zy.asrs.service.impl.CtuMainServiceImpl; import com.zy.core.properties.SystemProperties; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PreDestroy; /** * WCS主流程 * Created by vincent on 2020/8/6 */ @Data @Slf4j @Component public class CtuMainProcess { @Autowired private CtuMainServiceImpl ctuMainService; // 所属线程 private Thread thread; // 频率 private int i = 0; private boolean rgcWrk = true; /** * =====>> 开始工作 */ public void start() { thread = new Thread(() -> { while (!Thread.currentThread().isInterrupted()) { try { // 间隔 Thread.sleep(1000); // 系统运行状态判断 if (!SystemProperties.WCS_RUNNING_STATUS.get()) { continue; } // 自动入库 ctuMainService.generateStoreWrkFile(1); // 出库 ctuMainService.out(2); // 小车取完货,通知plc ctuMainService.outToPlc(6); // 101-108按钮入库 ctuMainService.in(3); //1001自动出 //ctuMainService.autoOut(4); //1007自动入 //ctuMainService.autoIn(5); //ctuMainService.updateSta(6); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } @PreDestroy public void shutDown() { if (thread != null) thread.interrupt(); } }