| | |
| | | while (true) { |
| | | try { |
| | | Task task = MessageQueue.poll(SlaveType.Devp, slave.getId()); |
| | | if (task == null) { |
| | | if (task != null) { |
| | | System.out.println("任务"+task.getId()); |
| | | } |
| | | Thread.sleep(3000); |
| | |
| | | melsecMcNet = new MelsecMcNet(slave.getIp(), slave.getPort()); |
| | | OperateResult operateResult = melsecMcNet.ConnectServer(); |
| | | if (operateResult.IsSuccess) { |
| | | log.info("输送线plc连接成功 ===>> [ip:{}] [port:{}]", slave.getIp(), slave.getPort()); |
| | | log.info("输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | return true; |
| | | } else { |
| | | log.info("输送线plc连接失败!!! ===>> [ip:{}] [port:{}]", slave.getIp(), slave.getPort()); |
| | | log.info("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | return false; |
| | | } |
| | | } |