| | |
| | | } |
| | | |
| | | // 读取正面条码 |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB103.0", (short) (5 * 40)); |
| | | if (result2.IsSuccess) { |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB103.0", (short) (5 * 40)); |
| | | if (result3.IsSuccess) { |
| | | for (int i = 0; i < 5; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 40, 40, "UTF-8"); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result3.Content, i * 40, 40, "UTF-8"); |
| | | if (!Cools.isEmpty()) { |
| | | barcode = barcode.trim(); |
| | | } |
| | | List<String> barcodeList = Arrays.stream(barcode.split(",")).collect(Collectors.toList()); |
| | | List<String> barcodeList = Arrays.stream(barcode.split(";")).collect(Collectors.toList()); |
| | | Iterator<String> iterator = barcodeList.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String next = iterator.next(); |
| | |
| | | } |
| | | } |
| | | |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | |
| | | String workNoAddress; |
| | | // 目标站地址 |
| | | String staNoAddress; |
| | | // 高度类型地址 |
| | | // 目标站地址 |
| | | String heightAddress = null; |
| | | if (index < 16) { |
| | | workNoAddress = "DB100." + index * 4; |
| | |
| | | boolean writeFlag = false; |
| | | while (writeCount < 5) { |
| | | OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo());// 目标站 |
| | | OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 目标站 |
| | | if (!Cools.isEmpty(staProtocol.getHeight()) && heightAddress != null) { |
| | | OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.valueOf(staProtocol.getHeight())); // 高度类型 |
| | | OperateResult writeResult3 = siemensS7Net.Write(heightAddress, staProtocol.getHeight()); // 目标站 |
| | | if (!writeResult3.IsSuccess) { |
| | | log.error("写入输送线命令失败,尝试重新写入,输入参数={},输出参数={}", JSON.toJSON(staProtocol), writeResult3);// 写入输送线命令失败,尝试重新写入,输入参数={},输出参数={}", JSON.toJSON(staProtocol), writeResult3); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, staProtocol.getHeight()); // 高度类型 |
| | | //fangzhi xierukushibai,jiu duoxiejici,meixunhuan |
| | | writeResult3 = siemensS7Net.Write(heightAddress, staProtocol.getHeight()); |
| | | if (!writeResult3.IsSuccess) { |
| | | writeResult3 = siemensS7Net.Write(heightAddress, staProtocol.getHeight()); // 目标站 |
| | | } |
| | | } |
| | | } |
| | | if (writeResult1.IsSuccess && writeResult2.IsSuccess) { |