| | |
| | | |
| | | //条码 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.840.0",(short) (barcodeSize*8)); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB400.100.0",(short) (barcodeSize*8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,6, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | |
| | | } |
| | | } |
| | | |
| | | //条码 |
| | | Thread.sleep(200); |
| | | int[] staW = new int[]{1004,1014,1020}; |
| | | |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB400.148.0",(short) (staW.length*4)); |
| | | if (result3.IsSuccess) { |
| | | for (int i = 0; i < staW.length; i++) { |
| | | Integer siteId = staW[i]; // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setSiteId(siteId); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result3.Content, i*4 + 2, 2); |
| | | staProtocol.setFrontErr(status[0]); // 前超限 |
| | | staProtocol.setBackErr(status[1]); // 后超限 |
| | | staProtocol.setHighErr(status[2]); // 高超限 |
| | | staProtocol.setLeftErr(status[3]); // 左超限 |
| | | staProtocol.setRightErr(status[4]); // 右超限 |
| | | } |
| | | } |
| | | |
| | | if (result.IsSuccess) { |
| | | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |