src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/core/thread/BarcodeThread.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -107,6 +107,9 @@ // 获取条码扫描仪信息 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); String barcode = barcodeThread.getBarcode(); if(!Cools.isEmpty(barcode)) { System.err.println(barcode); } // 获取入库站信息 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()).clone(); @@ -178,6 +181,7 @@ // 命令下发区 -------------------------------------------------------------------------- // 更新站点信息 且 下发plc命令 barcodeThread.setBarcode(""); staProtocol.setWorkNo((short) workNo); @@ -188,6 +192,8 @@ throw new CoolException("更新plc站点信息失败"); } } catch (Exception e) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } src/main/java/com/zy/core/thread/BarcodeThread.java
@@ -1,5 +1,6 @@ package com.zy.core.thread; import com.core.common.Cools; import com.zy.core.Slave; import com.zy.core.ThreadHandler; import lombok.Data; @@ -41,7 +42,7 @@ if (null != read) { barcode = new String(read); } Thread.sleep(1000); Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); } @@ -124,6 +125,16 @@ return true; } public String getBarcode() { if (Cools.isEmpty(barcode)) { return null; } else if("NG".endsWith(barcode)) { return null; } else { return barcode.trim(); } } public static void main(String[] args) throws Exception { BarcodeThread barcodeThread = new BarcodeThread(new Slave()); barcodeThread.getSlave().setIp("192.168.2.150"); src/main/resources/application.yml
@@ -85,7 +85,7 @@ # 条码扫描仪 barcode[0]: id: 1 ip: 192.168.10.150 ip: 192.168.6.150 port: 51236 # 台车 car[0]: