| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.utils.News; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | private Slave slave; |
| | | private StringBuffer barcode = new StringBuffer(); |
| | | |
| | | private String lastBarcode = ""; |
| | | |
| | | public BarcodeThread(Slave slave) { |
| | | this.slave = slave; |
| | | } |
| | |
| | | public void setBarcode(String barcode) { |
| | | this.barcode.delete(0, this.barcode.length()); |
| | | this.barcode.append(barcode); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码器,检索数据:{}", slave.getId(), this.barcode); |
| | | if(!Cools.isEmpty(barcode) && !lastBarcode.equals(barcode)) { |
| | | News.info("Barcode"+" - 1"+" - {}号条码器,检索数据:{}", slave.getId(), this.barcode); |
| | | lastBarcode = barcode; |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F)); |
| | | jsonObject.put("barcode", barcode); |