| | |
| | | |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int staNoSize = staNos.size(); |
| | | |
| | | OperateResultExOne<byte[]> result; |
| | | if (slave.getId() == 1) { |
| | | // 读正面货位信息反馈 |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (16 * 8)); |
| | | result = siemensS7Net.Read("DB101.0", (short) (16 * 8)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < 16; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 读侧面货位信息反馈 |
| | | OperateResultExOne<byte[]> resultCm = siemensS7Net.Read("DB101.800", (short) (12 * 8)); |
| | | if (resultCm.IsSuccess) { |
| | |
| | | |
| | | } |
| | | } |
| | | } else { |
| | | // 读外置输送线货位信息反馈 |
| | | result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 8)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8)); // 工作号 |
| | | |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4)); // 目标站 |
| | | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 2); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (result.IsSuccess) { |
| | | |