package com.zy.core; import com.zy.asrs.service.CtuMainService; 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 CtuMainService ctuMainService; // 所属线程 private Thread thread; // 频率 private int i = 0; /** * =====>> 开始工作 */ public void start() { thread = new Thread(() -> { while (!Thread.currentThread().isInterrupted()) { try { // 间隔 Thread.sleep(1000); // 系统运行状态判断 if (!SystemProperties.WCS_RUNNING_STATUS.get()) { continue; } //出库流程:ctu放货站到出库站(拣料站) ctuMainService.out(10); // 模拟入库流程:组托或拣料完成,用户按下入库按钮;实际业务场下,是用户操作按下按钮 ctuMainService.fake(20); // 清除ctu取货站的信号 ctuMainService.clear(30); // 入库流程:去ctu取货等待站 ctuMainService.waitTake(40); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } @PreDestroy public void shutDown() { if (thread != null) thread.interrupt(); } }