From c5736834f88a5fd43abadaec50dd2b1e6dceb4ba Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 15 九月 2022 10:36:52 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/BarcodeThread.java |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/BarcodeThread.java b/src/main/java/com/zy/core/thread/BarcodeThread.java
index 6623a1a..571c438 100644
--- a/src/main/java/com/zy/core/thread/BarcodeThread.java
+++ b/src/main/java/com/zy/core/thread/BarcodeThread.java
@@ -1,5 +1,6 @@
 package com.zy.core.thread;
 
+import com.alibaba.fastjson.JSONObject;
 import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.zy.core.Slave;
@@ -15,7 +16,6 @@
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.SocketTimeoutException;
-import java.text.MessageFormat;
 import java.util.Date;
 
 /**
@@ -48,7 +48,10 @@
                     if (!Cools.isEmpty(s)) {
                         barcode = new String(read);
                         log.info("{}鍙锋潯鐮佸櫒锛屾绱㈡暟鎹細{}", slave.getId(), this.barcode);
-                        OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝爢鍨涙満plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+                        JSONObject jsonObject = new JSONObject();
+                        jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F));
+                        jsonObject.put("barcode", barcode);
+                        OutputQueue.BARCODE.offer(jsonObject);
                     }
                 }
                 Thread.sleep(100);
@@ -72,7 +75,7 @@
 //            log.info("鏉$爜鎵弿浠繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         } catch (Exception e) {
             socket = null;
-            log.error("鏉$爜鎵弿浠繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+//            log.error("鏉$爜鎵弿浠繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             return false;
         }
         return true;

--
Gitblit v1.9.1