| | |
| | | import com.zy.core.model.*; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.*; |
| | | import com.zy.core.thread.impl.NyShuttleThread; |
| | | import com.zy.core.thread.impl.ZyForkLiftThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | for (Slave devp : slaveProperties.getDevp()) { |
| | | MessageQueue.init(SlaveType.Devp, devp); |
| | | } |
| | | for (Slave devp2 : slaveProperties.getDevp2()) { |
| | | MessageQueue.init(SlaveType.Devp2, devp2); |
| | | } |
| | | // 初始化条码扫描仪mq |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | MessageQueue.init(SlaveType.Barcode, barcode); |
| | |
| | | for (Slave car : slaveProperties.getCar()) { |
| | | MessageQueue.init(SlaveType.Car, car); |
| | | } |
| | | // 初始化提升机mq |
| | | for (Slave lift : slaveProperties.getLift()) { |
| | | MessageQueue.init(SlaveType.Lift, lift); |
| | | // 初始化货叉提升机mq |
| | | for (Slave forkLift : slaveProperties.getForkLift()) { |
| | | MessageQueue.init(SlaveType.ForkLift, forkLift); |
| | | } |
| | | // 初始化四向穿梭车mq |
| | | for (Slave shuttle : slaveProperties.getShuttle()) { |
| | |
| | | new Thread((Runnable) devpThread).start(); |
| | | SlaveConnection.put(SlaveType.Devp, devp.getId(), devpThread); |
| | | } |
| | | for (Devp2Slave devp2 : slaveProperties.getDevp2()) { |
| | | SiemensDevpThread2 siemensDevpThread2 = new SiemensDevpThread2(devp2); |
| | | new Thread(siemensDevpThread2).start(); |
| | | SlaveConnection.put(SlaveType.Devp2, devp2.getId(), siemensDevpThread2); |
| | | } |
| | | // 初始化提升机 |
| | | News.info("初始化提升机........................................................"); |
| | | for (LiftSlave liftSlave : slaveProperties.getLift()) { |
| | | LiftThread liftThread = new LiftThread(liftSlave, redisUtil); |
| | | new Thread(liftThread).start(); |
| | | SlaveConnection.put(SlaveType.Lift, liftSlave.getId(), liftThread); |
| | | // 初始化货叉提升机 |
| | | News.info("初始化货叉提升机........................................................"); |
| | | for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) { |
| | | ZyForkLiftThread forkLiftThread = new ZyForkLiftThread(forkLiftSlave, redisUtil); |
| | | new Thread(forkLiftThread).start(); |
| | | SlaveConnection.put(SlaveType.ForkLift, forkLiftSlave.getId(), forkLiftThread); |
| | | } |
| | | // 初始化四向穿梭车 |
| | | News.info("初始化四向穿梭车......................................................"); |
| | |
| | | News.info("初始化条码扫描仪线程..................................................."); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = new BarcodeThread(barcode); |
| | | new Thread(barcodeThread).start(); |
| | | if (barcode.getId() >= 11) { |
| | | new Thread(barcodeThread).start(); |
| | | } |
| | | SlaveConnection.put(SlaveType.Barcode, barcode.getId(), barcodeThread); |
| | | } |
| | | // 初始化LED线程 |