| | |
| | | byte[] content = result.Content; |
| | | for (int i = 0; i < DeviceField.BARCODE.getArrLength(); i++) { |
| | | int[] seg = DeviceField.BARCODE.getSeg(); |
| | | Short staNo = siemensS7Net.getByteTransform().TransInt16( |
| | | int staNo = siemensS7Net.getByteTransform().TransInt16( |
| | | content, seg[0] + i * DeviceField.BARCODE.getByteLength()); |
| | | String barcode = siemensS7Net.getByteTransform().TransString( |
| | | content, seg[1] + i * DeviceField.BARCODE.getByteLength(), |
| | | DeviceField.BARCODE.getByteLength() - seg[1], "UTF-8"); |
| | | |
| | | if (!Cools.isEmpty(barcode) && staNo != null) { |
| | | if (!Cools.isEmpty(barcode) && staNo != 0) { |
| | | StaProtocol staProtocol = station.get(staNo); |
| | | if (staProtocol == null) { |
| | | log.warn("扫码站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNo); |
| | |
| | | byte[] content = result.Content; |
| | | for (int i = 0; i < DeviceField.WEIGHT.getArrLength(); i++) { |
| | | int[] seg = DeviceField.WEIGHT.getSeg(); |
| | | Short staNo = siemensS7Net.getByteTransform().TransInt16( |
| | | int staNo = siemensS7Net.getByteTransform().TransInt16( |
| | | content, seg[0] + i * DeviceField.WEIGHT.getByteLength()); |
| | | Double weight = (double) siemensS7Net.getByteTransform().TransSingle( |
| | | content, seg[1] + i * DeviceField.WEIGHT.getByteLength()); |
| | | if (!Cools.isEmpty(weight) && staNo != null) { |
| | | if (!Cools.isEmpty(weight) && staNo != 0) { |
| | | StaProtocol staProtocol = station.get(staNo); |
| | | if (staProtocol == null) { |
| | | log.warn("称重站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNo); |
| | |
| | | byte[] content = result.Content; |
| | | for (int i = 0; i < DeviceField.DIMENSION_WORD.getArrLength(); i++) { |
| | | int[] seg = DeviceField.DIMENSION_WORD.getSeg(); |
| | | Short staNo = siemensS7Net.getByteTransform().TransInt16( |
| | | int staNo = siemensS7Net.getByteTransform().TransInt16( |
| | | content, seg[0]); |
| | | if (staNo != null) { |
| | | if (staNo != 0) { |
| | | StaProtocol staProtocol = station.get(staNo); |
| | | if (staProtocol == null) { |
| | | log.warn("异常站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNo); |