From d698df84e62ff9a4267e2d9bb86a09da5043e0b3 Mon Sep 17 00:00:00 2001 From: tzsk <Administrator@qq.com> Date: 星期三, 20 三月 2024 11:20:52 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/BarcodeThread.java | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zy/core/thread/BarcodeThread.java b/src/main/java/com/zy/core/thread/BarcodeThread.java index 3a81562..2a8a648 100644 --- a/src/main/java/com/zy/core/thread/BarcodeThread.java +++ b/src/main/java/com/zy/core/thread/BarcodeThread.java @@ -50,6 +50,7 @@ JSONObject jsonObject = new JSONObject(); jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F)); jsonObject.put("barcode", barcode); + jsonObject.put("id", slave.getId()); if (OutputQueue.BARCODE.size() >= 32) { OutputQueue.BARCODE.poll(); } @@ -99,22 +100,21 @@ connect(); while (true) { try { - byte[] read = read(14, 5000); + byte[] read = read(14, 15000); if (null != read) { String s = new String(read); if (!Cools.isEmpty(s)) { setBarcode(new String(read)); } - }else{ - setBarcode(""); } Thread.sleep(50); - } catch (SocketTimeoutException ignore) { - connCount++; - } catch (Exception e) { + }catch (Exception e) { setBarcode(""); - e.printStackTrace(); + log.error("run" + e); +// e.printStackTrace(); + connect(); } + } } -- Gitblit v1.9.1