From 61d02c1796f3bedc6650e29cc33d9ee85e3a78fb Mon Sep 17 00:00:00 2001 From: LSH Date: 星期一, 19 六月 2023 08:07:17 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/ServerBootstrap.java | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java index 9e5e95d..dfca756 100644 --- a/src/main/java/com/zy/core/ServerBootstrap.java +++ b/src/main/java/com/zy/core/ServerBootstrap.java @@ -6,6 +6,7 @@ import com.zy.core.model.CrnSlave; import com.zy.core.model.DevpSlave; import com.zy.core.model.LedSlave; +import com.zy.core.model.RgvSlave; import com.zy.core.properties.SlaveProperties; import com.zy.core.thread.*; import lombok.extern.slf4j.Slf4j; @@ -28,7 +29,10 @@ @Autowired private MainProcess mainProcess; - + /** + * PostConstruct浼氬湪鍔犺浇servlet鐨勬椂鍊欒繍琛屼竴娆� + * @throws InterruptedException + */ @PostConstruct @Async public void init() throws InterruptedException { @@ -48,6 +52,10 @@ for (Slave crn : slaveProperties.getCrn()) { MessageQueue.init(SlaveType.Crn, crn); } + // 鍒濆鍖栧爢鍨涙満mq + for (Slave rgv : slaveProperties.getRgv()) { + MessageQueue.init(SlaveType.Rgv, rgv); + } // 鍒濆鍖栬緭閫佺嚎mq for (Slave devp : slaveProperties.getDevp()) { MessageQueue.init(SlaveType.Devp, devp); @@ -64,10 +72,10 @@ for (Slave scale : slaveProperties.getScale()) { MessageQueue.init(SlaveType.Scale, scale); } - // 鍒濆鍖栧彴杞q - for (Slave car : slaveProperties.getCar()) { - MessageQueue.init(SlaveType.Car, car); - } +// // 鍒濆鍖栧彴杞q +// for (Slave car : slaveProperties.getCar()) { +// MessageQueue.init(SlaveType.Car, car); +// } } private void initThread(){ @@ -78,7 +86,13 @@ new Thread((Runnable) crnThread).start(); SlaveConnection.put(SlaveType.Crn, crn.getId(), crnThread); } - + // 鍒濆鍖栫┛姊溅绾跨▼ + log.info("鍒濆鍖朢GV绾跨▼..................................................."); + for (RgvSlave rgv : slaveProperties.getRgv()) { + RgvThread rgvThread = new RgvThread(rgv); + new Thread((Runnable) rgvThread).start(); + SlaveConnection.put(SlaveType.Rgv, rgv.getId(), rgvThread); + } // 鍒濆鍖栬緭閫佺嚎绾跨▼ log.info("鍒濆鍖栬緭閫佺嚎绾跨▼..................................................."); for (DevpSlave devp : slaveProperties.getDevp()) { @@ -91,7 +105,7 @@ log.info("鍒濆鍖栨潯鐮佹壂鎻忎华绾跨▼..................................................."); for (Slave barcode : slaveProperties.getBarcode()) { BarcodeThread barcodeThread = new BarcodeThread(barcode); - new Thread(barcodeThread).start(); +// new Thread(barcodeThread).start(); SlaveConnection.put(SlaveType.Barcode, barcode.getId(), barcodeThread); } // 鍒濆鍖朙ED绾跨▼ @@ -101,6 +115,13 @@ new Thread(ledThread).start(); SlaveConnection.put(SlaveType.Led, led.getId(), ledThread); } + // 鍒濆鍖栫绉ょ嚎绋� +// log.info("鍒濆鍖栫绉ょ嚎绋�..................................................."); +// for (Slave scale : slaveProperties.getScale()) { +// ScaleThread barcodeThread = new ScaleThread(scale); +// new Thread(barcodeThread).start(); +// SlaveConnection.put(SlaveType.Scale, scale.getId(), barcodeThread); +// } } -- Gitblit v1.9.1