| | |
| | | add(115);add(116);add(117);add(118);add(119);add(120);add(121);add(122);add(123);add(124);add(125);add(126);add(127);add(128); |
| | | add(200);add(201);add(202);add(203);add(204);add(205); |
| | | add(300);add(301);add(302);add(303);add(304);add(305);add(306);add(307);add(308); |
| | | add(129); |
| | | }}; |
| | | |
| | | public SiemensDevpThread(DevpSlave slave) { |
| | |
| | | } |
| | | } |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.226", (short) 4); |
| | | if (result3.IsSuccess) { |
| | | for (int i = 0; i < 1; i++) { |
| | | Integer siteId = staNos.get(i + 44); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result3.Content, i*2)); // 工作号 |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result3.Content, i*2 + 2)); // 目标站 |
| | | } |
| | | } |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.140", (short) 35); |
| | | if (result1.IsSuccess) { |
| | | for (int i = 0; i < 35; i++) { |
| | |
| | | } |
| | | } |
| | | } |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB100.230", (short) 1); |
| | | if (result4.IsSuccess) { |
| | | for (int i = 0; i < 1; i++) { |
| | | Integer siteId = staNos.get(i + 44); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result4.Content, i, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | 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 (result.IsSuccess && result0.IsSuccess && result1.IsSuccess && result2.IsSuccess) { |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (result.IsSuccess && result0.IsSuccess && result1.IsSuccess && result2.IsSuccess && result3.IsSuccess && result4.IsSuccess) { |
| | | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | OperateResult write; |
| | | OperateResult write1; |
| | | // 一期 |
| | | if (staProtocol.getSiteId() < 300) { |
| | | if (staProtocol.getSiteId() < 300 && staProtocol.getSiteId() != 129) { |
| | | write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 工作号 |
| | | Thread.sleep(100); |
| | | write1 = siemensS7Net.Write("DB100." + (index*2 + 70), staProtocol.getStaNo()); // 目标站 |
| | | // 二期 |
| | | } else { |
| | | } else if (staProtocol.getSiteId() >= 300 && staProtocol.getSiteId() != 129){ |
| | | write = siemensS7Net.Write("DB100." + ((index-35)*2 + 180), staProtocol.getWorkNo()); // 工作号 |
| | | Thread.sleep(100); |
| | | write1 = siemensS7Net.Write("DB100." + ((index-35)*2 + 198), staProtocol.getStaNo()); // 目标站 |
| | | // 三期 129 |
| | | } else { |
| | | write = siemensS7Net.Write("DB100." + ((index-44)*2 + 226), staProtocol.getWorkNo()); // 工作号 |
| | | Thread.sleep(100); |
| | | write1 = siemensS7Net.Write("DB100." + ((index-44)*2 + 228), staProtocol.getStaNo()); // 目标站 |
| | | } |
| | | |
| | | if (!write.IsSuccess || !write1.IsSuccess) { |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(staNos.indexOf(129)); |
| | | System.out.println(staNos.size()); |
| | | for (int i = 0; i<staNos.size(); i++) { |
| | | // System.out.println(i*2); |