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主流程 
 | 
 * 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(){ 
 | 
        thread = new Thread(() -> { 
 | 
            while (!Thread.currentThread().isInterrupted()) { 
 | 
                try { 
 | 
  
 | 
                    // 间隔 
 | 
                    Thread.sleep(1000); 
 | 
  
 | 
                    // 系统运行状态判断 
 | 
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) { 
 | 
                        continue; 
 | 
                    } 
 | 
  
 | 
                    // 演示 
 | 
//                    mainService.crnDemoOfLocMove1(); 
 | 
  
 | 
                    // 入出库模式切换函数 
 | 
//                    mainService.ioConvert(); 
 | 
  
 | 
  
 | 
                  //  mainService.stnToCrnStnPick2(); 
 | 
  
 | 
                    // 入库  ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 
 | 
                    mainService.generateStoreWrkFile(1); // 组托 
 | 
//                    mainService.generateStoreWrkFile0(2); // WMS入库 
 | 
                    Thread.sleep(400); 
 | 
  
 | 
  
 | 
                    // 拣料、并板、盘点再入库 
 | 
                    mainService.stnToCrnStnPick(3); 
 | 
                    // 出库  ===>>  堆垛机出库站到出库站 
 | 
                    mainService.crnStnToOutStn(4); 
 | 
                    // 入出库  ===>>  堆垛机入出库作业下发 
 | 
                    mainService.crnIoExecute(5); 
 | 
                    // 入出库增强 ===>> 堆垛机命令下发后,异步修改工作档状态 
 | 
//                    mainService.crnIoWrkMast(); 
 | 
                    // 入库  ===>> 执行对工作档的完成操作 
 | 
                    mainService.storeFinished(6); 
 | 
                    // 堆垛机异常信息记录 
 | 
                    mainService.recCrnErr(7); 
 | 
                    // 入库  ===>> 空栈板初始化入库,叉车入库站放货 
 | 
                    mainService.storeEmptyPlt(8); 
 | 
                    // 出库  ===>> 工作档信息写入led显示器 
 | 
                    mainService.ledExecute(9); 
 | 
                    // 其他  ===>> LED显示器复位,显示默认信息 
 | 
                    mainService.ledReset(); 
 | 
  
 | 
                    mainService.outOfDevp(11); 
 | 
  
 | 
//                    if (i>10){ 
 | 
//                        //空托盘自动出库 
 | 
//                        mainService.autoEmptyOut(); 
 | 
//                        //空托盘自动入库 
 | 
//                        mainService.autoEmptyIn(); 
 | 
//                        i=0; 
 | 
//                    } 
 | 
//                    i++; 
 | 
  
 | 
  
 | 
                } catch (Exception e) { 
 | 
                    e.printStackTrace(); 
 | 
                } 
 | 
            } 
 | 
        }); 
 | 
        thread.start(); 
 | 
    } 
 | 
  
 | 
    @PreDestroy 
 | 
    public void shutDown(){ 
 | 
        if (thread != null) thread.interrupt(); 
 | 
    } 
 | 
  
 | 
} 
 |