| | |
| | | |
| | | OperateResult result = siemensS7Net.Write("DB83.0", array); |
| | | if (result != null && result.IsSuccess) { |
| | | liftProtocol.setSendTime(System.currentTimeMillis());//指令下发时间 |
| | | News.info("提升机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | return true; |
| | |
| | | redisCommand.setCommandStep(0);//命令执行步序 |
| | | redisCommand.setAssignCommand(assignCommand);//命令 |
| | | //任务数据保存到redis |
| | | redisUtil.set("lift_wrk_no_" + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand)); |
| | | redisUtil.set(RedisKeyType.LIFT.key + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand)); |
| | | liftProtocol.setAssignCommand(assignCommand); |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING); |
| | | //执行下发任务 |
| | |
| | | } |
| | | |
| | | WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class); |
| | | Object o = redisUtil.get("lift_wrk_no_" + wrkNo); |
| | | Object o = redisUtil.get(RedisKeyType.LIFT.key + wrkNo); |
| | | if (o == null) { |
| | | return false; |
| | | } |
| | |
| | | |
| | | //取出命令 |
| | | NyLiftCommand command = commands.get(commandStep); |
| | | |
| | | if (!redisCommand.getLiftNo().equals(liftProtocol.getLiftNo())) { |
| | | return false; |
| | | } |
| | | |
| | | //下发命令 |
| | | if (!write(command)) { |
| | |
| | | short[] commandArr = getCommandArr(command);//获取命令报文 |
| | | BasLiftOpt opt = new BasLiftOpt( |
| | | redisCommand.getWrkNo().intValue(), |
| | | redisCommand.getLiftNo().intValue(), |
| | | liftProtocol.getLiftNo().intValue(), |
| | | new Date(), |
| | | null, |
| | | null, |
| | |
| | | commandStep++; |
| | | redisCommand.setCommandStep(commandStep); |
| | | //任务数据保存到redis |
| | | redisUtil.set("lift_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | }else { |
| | | //已执行完成 |
| | | //删除redis |
| | | redisUtil.del("lift_wrk_no_" + redisCommand.getWrkNo()); |
| | | redisUtil.del(RedisKeyType.LIFT.key + redisCommand.getWrkNo()); |
| | | |
| | | //对主线程抛出等待确认状态waiting |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING); |