| | |
| | | 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(); |
| | | } |
| | |
| | | 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)) { |
| | |
| | | } |
| | | } |
| | | Thread.sleep(50); |
| | | } catch (SocketTimeoutException ignore) { |
| | | connCount++; |
| | | } catch (Exception e) { |
| | | }catch (Exception e) { |
| | | setBarcode(""); |
| | | e.printStackTrace(); |
| | | log.error("run" + e); |
| | | // e.printStackTrace(); |
| | | connect(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |