| | |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.CrnThread; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.PreDestroy; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private MainProcess mainProcess; |
| | | |
| | | |
| | | @PostConstruct |
| | | // @PostConstruct |
| | | public void init(){ |
| | | // 初始化消息队列 |
| | | initMq(); |
| | | // 初始化下位机线程 |
| | | initThread(); |
| | | // 开始主流程进程 |
| | | mainProcess.start(); |
| | | } |
| | | |
| | | private void initMq(){ |
| | |
| | | |
| | | private void initThread(){ |
| | | // 初始化堆垛机线程 |
| | | for (Slave crn : slaveProperties.getCrn()) { |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | CrnThread crnThread = new CrnThread(crn); |
| | | new Thread(crnThread).start(); |
| | | SlaveConnection.put(SlaveType.Crn, crn.getId(), crnThread); |