Ver código fonte

bug修复,注释掉docker打包

hecheng 3 anos atrás
pai
commit
e4be02a25a

+ 10 - 4
zd-modules/zd-netty/src/main/java/com/zd/netty/sdk/DeJuRFIDService.java

@@ -30,15 +30,22 @@ public class DeJuRFIDService implements IService {
 
 
     @Override
     @Override
     public void start(RemoteLabHardware hardware) {
     public void start(RemoteLabHardware hardware) {
-        GClient client = new GClient();
+        GClient client;
         String ipAddress = hardware.getIpAddress();
         String ipAddress = hardware.getIpAddress();
+        if (clientMap.containsKey(ipAddress)){
+            client=clientMap.get(ipAddress);
+        }else {
+            client = new GClient();
+            clientMap.put(ipAddress,client);
+        }
         Integer port = hardware.getPort();
         Integer port = hardware.getPort();
-        if (client.openTcp(ipAddress+":"+port, 2000)) {
+        if (client.openTcp(ipAddress+":8160", 2000)) {
             // 订阅标签上报事件
             // 订阅标签上报事件
             client.onTagEpcLog = (readName, logBaseEpcInfo) -> {
             client.onTagEpcLog = (readName, logBaseEpcInfo) -> {
                 // 回调内部如有阻塞,会影响API正常使用
                 // 回调内部如有阻塞,会影响API正常使用
                 // 标签回调数量较多,请将标签数据先缓存起来再作业务处理
                 // 标签回调数量较多,请将标签数据先缓存起来再作业务处理
-                if (null != logBaseEpcInfo && 0 == logBaseEpcInfo.getResult()) {
+                log.error("=======================>"+logBaseEpcInfo.getEpc());
+                if (0 == logBaseEpcInfo.getResult()) {
                     InventoryTag tag=new InventoryTag();
                     InventoryTag tag=new InventoryTag();
                     BeanUtils.copyProperties(logBaseEpcInfo,tag);
                     BeanUtils.copyProperties(logBaseEpcInfo,tag);
                     sendService.send(tag);
                     sendService.send(tag);
@@ -92,7 +99,6 @@ public class DeJuRFIDService implements IService {
             } else {
             } else {
                 log.info("Inventory epc error.");
                 log.info("Inventory epc error.");
             }
             }
-            clientMap.put(ipAddress,client);
         } else {
         } else {
             throw new ServiceException("Connect failure.");
             throw new ServiceException("Connect failure.");
         }
         }