| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | |
| | | } |
| | | StaProtocol staProtocol = station.get(barcodeSite2.get(i)); |
| | | if (staProtocol != null) { |
| | | while (iterator.hasNext()) { |
| | | String next = iterator.next(); |
| | | if (next.length() < 7 || next.length() > 10 || !next.matches("[0-9]*")) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | staProtocol.setMatIdList(barcodeList); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // 读正面故障反馈 |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0", (short) (16 * 4)); |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.2340.0", (short) (16 * 2)); |
| | | if (resultErr.IsSuccess) { |
| | | for (int i = 0; i < 16; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 4, 1); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 2, 2); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | staProtocol.setBreakerErr(status[0]); |
| | | staProtocol.setInfraredErr(status[1]); |
| | |
| | | staProtocol.setInverterErr(status[5]); |
| | | staProtocol.setContactErr(status[6]); |
| | | staProtocol.setUpcontactErr(status[7]); |
| | | |
| | | staProtocol.setPushTheEnvelopeErr(status[8]); |
| | | staProtocol.setRaiseTheLowerLimitErr(status[9]); |
| | | staProtocol.setLeftProtectionTriggersErr(status[10]); |
| | | staProtocol.setRightProtectionTriggersErr(status[11]); |
| | | staProtocol.setGratingBlockingErr(status[12]); |
| | | } |
| | | } |
| | | |
| | |
| | | //任务下发成功标识 |
| | | boolean writeFlag = false; |
| | | while (writeCount < 5) { |
| | | OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 目标站 |
| | | if (!Cools.isEmpty(staProtocol.getHeight()) && heightAddress != null) { |
| | | OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); // 目标站 |
| | | log.info("写入高度地址:{},{}", heightAddress, writeResult3); |
| | | OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | log.info("写入高度地址:{},{}", heightAddress, writeResult3); |
| | | if (!writeResult3.IsSuccess) { |
| | | //fangzhi xierukushibai,jiu duoxiejici,meixunhuan |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | |
| | | } |
| | | } |
| | | } |
| | | OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 目标站 |
| | | if (writeResult1.IsSuccess && writeResult2.IsSuccess) { |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 2); |