| | |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(100); |
| | | for (Integer staNo : staNos2) { |
| | | OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48); |
| | | if (result5.IsSuccess) { |
| | | StaProtocol staProtocol = station.get(staNo); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(staNo); |
| | | station.put(staNo, staProtocol); |
| | | } |
| | | |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 8, 1); |
| | | boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result5.Content, 21, 1); |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 34)); // 工作号 |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 40)); // 目标站 |
| | | staProtocol.setAutoing(status1[0]); // 自动 |
| | | staProtocol.setLoading(status2[2]); // 有物 |
| | | } |
| | | } |
| | | // Thread.sleep(100); |
| | | // for (Integer staNo : staNos2) { |
| | | // OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48); |
| | | // if (result5.IsSuccess) { |
| | | // StaProtocol staProtocol = station.get(staNo); |
| | | // if (null == staProtocol) { |
| | | // staProtocol = new StaProtocol(); |
| | | // staProtocol.setSiteId(staNo); |
| | | // station.put(staNo, staProtocol); |
| | | // } |
| | | // |
| | | // boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 8, 1); |
| | | // boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result5.Content, 21, 1); |
| | | // staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 34)); // 工作号 |
| | | // staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 40)); // 目标站 |
| | | // staProtocol.setAutoing(status1[0]); // 自动 |
| | | // staProtocol.setLoading(status2[2]); // 有物 |
| | | // } |
| | | // } |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |