|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.asrs.service.AgvBasDevpService; | 
|---|
|  |  |  | import com.zy.asrs.service.BasDevpService; | 
|---|
|  |  |  | import com.zy.core.News; | 
|---|
|  |  |  | import com.zy.core.Slave; | 
|---|
|  |  |  | import com.zy.core.ThreadHandler; | 
|---|
|  |  |  | 
|---|
|  |  |  | private DataInputStream dataInputStream; | 
|---|
|  |  |  | public Integer connCount = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AgvBasDevpService agvBasDevpService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public BarcodeThread(Slave slave) { | 
|---|
|  |  |  | this.slave = slave; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | this.barcode.delete(0, this.barcode.length()); | 
|---|
|  |  |  | this.barcode.append(barcode); | 
|---|
|  |  |  | if(!Cools.isEmpty(barcode)) { | 
|---|
|  |  |  | AgvBasDevpService agvBasDevpService = SpringUtils.getBean(AgvBasDevpService.class); | 
|---|
|  |  |  | News.info("{}号条码器,检索数据:{}", slave.getId(), this.barcode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String devNo = slave.getId() == 13 ? "310-1" : slave.getId() == 15 ? "312-2" : slave.getId() == 17 ? "314-1" : slave.getId() == 19 ? "316-1" : null; | 
|---|
|  |  |  | if(!Cools.isEmpty(devNo)){ | 
|---|
|  |  |  | barcode = barcode.substring(3,barcode.length()); | 
|---|
|  |  |  | agvBasDevpService.updateBarcode(devNo,barcode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | News.info("{}号条码器,更新成功", slave.getId()); | 
|---|
|  |  |  | JSONObject jsonObject = new JSONObject(); | 
|---|
|  |  |  | jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F)); | 
|---|
|  |  |  | jsonObject.put("barcode", barcode); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | OutputQueue.BARCODE.offer(jsonObject); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String devNo = slave.getId() == 13 ? "310-1" : slave.getId() == 15 ? "312-2" : slave.getId() == 17 ? "314-1" : slave.getId() == 19 ? "316-1" : null; | 
|---|
|  |  |  | if(!Cools.isEmpty(devNo)){ | 
|---|
|  |  |  | agvBasDevpService.updateBarcode(devNo,barcode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|