| | |
| | | int staNoSize = staNos.size(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (500 * 8)); |
| | | OperateResultExOne<byte[]> resultWeight = siemensS7Net.Read("DB102.0", (short) (8 * 4)); |
| | | OperateResultExOne<byte[]> resultWeight2 = siemensS7Net.Read("DB102.0", (short) (4 * 4)); |
| | | |
| | | if (result.IsSuccess && resultWeight.IsSuccess) { |
| | | int j = 0; |
| | | for(int i = 0 ; i<staNoSize;i++){ |
| | |
| | | |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result.Content, offset)); // 工作号 |
| | | if (staNoWeight.contains(siteId)) { |
| | | if(staNoWeight.size() == 4){ |
| | | staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight2.Content, j)); |
| | | j = j + 4; |
| | | }else{ |
| | | staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight.Content, j)); |
| | | j = j + 4; |
| | | |
| | | } |
| | | } |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, offset+ 4)); // 目标站 |
| | | status = siemensS7Net.getByteTransform().TransBool(result.Content, offset+ 6, 2); |
| | |
| | | Integer siteId = staNoErrs.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 4 + 2, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (staProtocol == null) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |