| | |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | } else if (slave.getId() == 3) { |
| | | |
| | | //条码 |
| | | //Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.18",(short)10); |
| | | if (result2.IsSuccess) { |
| | | |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,0,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 7); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | OperateResultExOne<byte[]> result10 = siemensS7Net.Read("DB101.26", (short)1); |
| | | if (result10.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result10.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(301); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | } else if (slave.getId() == 4) { |
| | | //条码 |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.18",(short)10); |
| | | if (result2.IsSuccess) { |
| | | |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,0,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 8); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | // 外形检测 - 111 |
| | | //Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result10 = siemensS7Net.Read("DB101.26", (short)1); |
| | | if (result10.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result10.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(301); |
| | | StaProtocol staProtocol = station.get(401); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | |
| | | return; |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | //log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | |
| | | Integer siteId = staProtocol.getSiteId(); |
| | | staProtocol = station.get(siteId); |
| | |
| | | return; |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | //log.info("输送线命令下发 [id:{}] >>>>> 命令下发成功: {}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | |
| | | Integer siteId = staProtocol.getSiteId(); |
| | | staProtocol = station.get(siteId); |