| | |
| | | private RedisUtil redisUtil; |
| | | private SiemensS7Net siemensS7Net; |
| | | private StringBuffer barcode = new StringBuffer(); |
| | | private String lastBarcode; |
| | | private String lastBarcode = ""; |
| | | |
| | | public SiemensBarcodeThread(Device device, RedisUtil redisUtil) { |
| | | this.device = device; |
| | |
| | | |
| | | @Override |
| | | public boolean setBarcode(String barcode) { |
| | | this.lastBarcode = String.valueOf(this.barcode); |
| | | this.barcode.delete(0, this.barcode.length()); |
| | | this.barcode.append(barcode); |
| | | if(!Cools.isEmpty(barcode) && !this.lastBarcode.equals(barcode)) { |
| | | this.lastBarcode = String.valueOf(this.barcode); |
| | | News.info("{}号条码器,检索数据:{}", device.getId(), this.barcode); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F)); |