| | |
| | | if (statusEntity == null) { |
| | | continue; |
| | | } |
| | | String barcode = siemensNet.getByteTransform().TransString(result2.Content, i * 16, 4, "UTF-8"); |
| | | String barcode = siemensNet.getByteTransform().TransString(result2.Content, i * 16, 8, "UTF-8"); |
| | | barcode = barcode.trim(); |
| | | barcodeEntity.setBarcode(barcode); |
| | | statusEntity.setBarcode(barcode); |
| | | } |
| | | } |
| | | |
| | |
| | | return commandResponse; |
| | | } |
| | | |
| | | OperateResult write = null; |
| | | OperateResult writeTaskNo = null; |
| | | OperateResult writeTargetStaNo = null; |
| | | // 任务下发次数 |
| | | int writeCount = 0; |
| | | do { |
| | | short[] data = new short[2]; |
| | | data[0] = command.getTaskNo().shortValue(); |
| | | data[1] = command.getTargetStaNo().shortValue(); |
| | | |
| | | write = siemensNet.Write("DB100." + index * 4, data); |
| | | if (write.IsSuccess) { |
| | | writeTaskNo = siemensNet.Write("DB100." + index * 4, command.getTaskNo()); |
| | | writeTargetStaNo = siemensNet.Write("DB100." + index * 4 + 4, command.getTargetStaNo().shortValue()); |
| | | if (writeTaskNo.IsSuccess && writeTargetStaNo.IsSuccess) { |
| | | log.error("写入输送线命令成功。站点编号={},站点数据={},写入次数={}", command.getStationId(), JSON.toJSON(command), |
| | | writeCount); |
| | | commandResponse.setResult(true); |
| | |
| | | } |
| | | } while (writeCount < 5); |
| | | |
| | | if (write == null) { |
| | | commandResponse.setMessage("写入命令失败"); |
| | | return commandResponse; |
| | | } |
| | | |
| | | if (!write.IsSuccess) { |
| | | if (!writeTaskNo.IsSuccess || !writeTargetStaNo.IsSuccess) { |
| | | ZyStationStatusEntity staProtocol = findStatusEntity(command.getStationId()); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("写入输送线站点数据失败。站点编号={1},站点数据={2}", command.getStationId(), |
| | | JSON.toJSON(staProtocol))); |