package com.zy.core; import com.zy.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.stereotype.Component; import javax.annotation.PreDestroy; /** * WCS主流程 * Created by vincent on 2020/8/6 */ @Data @Slf4j @Component public class MainProcess { @Autowired private MainServiceImpl mainService; // 所属线程 private Thread thread; // 频率 private int i = 0; private boolean rgcWrk = true; /** * =====>> 开始工作 */ public void start() throws InterruptedException { thread = new Thread(() -> { // 初始化罐装线出库口是否可出 while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(1000); // 系统运行状态判断 if (!SystemProperties.WCS_RUNNING_STATUS.get()) { continue; } if(rgcWrk) { Thread.sleep(3000); mainService.intiGzxkc(); rgcWrk = false; } // 托盘到达rgv接驳站点,更改工作档状态为9.呼叫RGV,环穿程序调度rgv mainService.callRgv(); // rgv放货完成,给输送线下发任务 mainService.rgvToDev(); // 1090异常口重新入库分配库位 mainService.abnormalMouthWarehousing(); // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 mainService.generateStoreWrkFile(1); // 组托 // 生成 空子/母托盘出库任务 mainService.generateEmptyPalletStoreWrk(); // 入库 ===>> 母托盘叠满入库 mainService.autoEmptyIn(); // 子托盘底下母托盘回叠盘机 mainService.motherTrayReflow(); // 出库 ===>> 堆垛机出库站到出库站 mainService.crnStnToOutStn(4); // 入出库 ===>> 堆垛机入出库作业下发 mainService.crnIoExecute(5); // 入库 ===>> 执行对工作档的完成操作 mainService.storeFinished(6); // 空桶到达罐装线入口 告诉罐装线入库桶信息 mainService.inGzxBefore(); // 空桶罐装完成到达罐装线出口 完成直供罐装线任务和空桶出库任务,创建成品桶入库任务 mainService.canningLineTaskFinish(); // 读要桶信号,自动出空桶 mainService.autoOutEmptyBucket(); // 堆垛机异常信息记录 mainService.recCrnErr(7); // 输送线异常信息记录 mainService.recDevpErr(); // 出库 ===>> 工作档信息写入led显示器 mainService.ledExecute(9); // 其他 ===>> LED显示器复位,显示默认信息 mainService.ledReset(); mainService.outOfDevp(11); // 堆垛机回原点 mainService.originGo(); //手动站位转移 mainService.manualStationTransfer(); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } @PreDestroy public void shutDown(){ if (thread != null) thread.interrupt(); } }