| | |
| | | } |
| | | Thread.sleep(500); |
| | | } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | |
| | | crnCommand.setDestinationPosY((short) cal.get(Calendar.HOUR_OF_DAY)); // 时:0~23 |
| | | crnCommand.setDestinationPosZ((short) cal.get(Calendar.MINUTE)); // 分:0~59 |
| | | crnCommand.setDestinationPosX((short) cal.get(Calendar.SECOND)); // 秒:0~59 |
| | | crnCommand.setTaskNo((short) (cal.get(Calendar.DAY_OF_WEEK) - 1)); // 星期:0(日)~6(六) |
| | | // crnCommand.setTaskNo((short) (cal.get(Calendar.DAY_OF_WEEK) - 1)); // 星期:0(日)~6(六) |
| | | crnCommand.setTaskNo((short) 0); // 星期:0(日)~6(六) |
| | | crnCommand.setTaskSend((short) 1); |
| | | crnCommand.setAckFinish((short) 0); |
| | | if (write(crnCommand)) { |
| | |
| | | } |
| | | |
| | | melsecMcNet.ConnectClose(); |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException ignore) {} |
| | | return result; |
| | | } |
| | | |
| | |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | BasCrnp basCrnp = new BasCrnp(); |
| | | basCrnp.setCrnNo(slave.getId()); |
| | | crnProtocol.setAlarm1((short) (crnProtocol.getAlarm1() + 1000)); |
| | | if (!basCrnpService.updateById(crnProtocol.toSqlModel(basCrnp))){ |
| | | log.error("堆垛机plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | |
| | | } |
| | | if (command.getAckFinish() == 1) { |
| | | command.setTaskSend((short) 0); |
| | | command.setTaskNo((short) 0); |
| | | } else if (command.getAckFinish() == 0) { |
| | | command.setTaskSend((short) 1); |
| | | } |