| | |
| | | //总步序 |
| | | int size = commands.size(); |
| | | |
| | | //取出命令 |
| | | NyLiftCommand command = commands.get(commandStep); |
| | | |
| | | if (!redisCommand.getLiftNo().equals(liftProtocol.getLiftNo())) { |
| | | return false; |
| | | } |
| | | |
| | | if (commandStep != 0) { |
| | | //判断上一条指令是否做完 |
| | | NyLiftCommand lastCommand = commands.get(commandStep - 1);//上一条指令 |
| | | if (!liftProtocol.getBusy() && liftProtocol.getTaskNo().equals(lastCommand.getTaskNo())) { |
| | | //提升机空闲、且提升机工作号与上一条指令工作号相同 |
| | | lastCommand.setComplete(true);//标记任务完成 |
| | | } |
| | | |
| | | //任务数据保存到redis |
| | | redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | |
| | | if (!lastCommand.getComplete()) { |
| | | //上一条任务未完成,禁止下发命令 |
| | | return false; |
| | | } |
| | | |
| | | //判断是否为最后一条命令且命令执行完成,抛出等待确认状态 |
| | | NyLiftCommand endCommand = commands.get(commands.size() - 1); |
| | | if (endCommand.getComplete()) { |
| | | //已执行完成 |
| | | //删除redis |
| | | redisUtil.del(RedisKeyType.LIFT.key + redisCommand.getWrkNo()); |
| | | |
| | | //对主线程抛出等待确认状态waiting |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING); |
| | | News.info("提升机任务执行下发完成执行结束,提升机号={},任务数据={}", redisCommand.getLiftNo(), JSON.toJSON(redisCommand)); |
| | | } |
| | | } |
| | | |
| | | //取出命令 |
| | | NyLiftCommand command = commands.get(commandStep); |
| | | |
| | | //下发命令 |
| | | if (!write(command)) { |
| | |
| | | liftOptService.insert(opt); |
| | | } |
| | | |
| | | //判断数据是否执行完成 |
| | | if (commandStep < size - 1) { |
| | | //更新redis数据 |
| | | //步序增加 |
| | | commandStep++; |
| | | redisCommand.setCommandStep(commandStep); |
| | | //任务数据保存到redis |
| | | redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | }else { |
| | | //已执行完成 |
| | | //删除redis |
| | | redisUtil.del(RedisKeyType.LIFT.key + redisCommand.getWrkNo()); |
| | | //更新redis数据 |
| | | //步序增加 |
| | | commandStep++; |
| | | redisCommand.setCommandStep(commandStep); |
| | | //任务数据保存到redis |
| | | redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | |
| | | //对主线程抛出等待确认状态waiting |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING); |
| | | News.info("提升机任务执行下发完成等待执行结束,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |
| | | } |
| | | // //判断数据是否执行完成 |
| | | // if (commandStep < size - 1) { |
| | | // //更新redis数据 |
| | | // //步序增加 |
| | | // commandStep++; |
| | | // redisCommand.setCommandStep(commandStep); |
| | | // //任务数据保存到redis |
| | | // redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | // }else { |
| | | // //已执行完成 |
| | | // //删除redis |
| | | // redisUtil.del(RedisKeyType.LIFT.key + redisCommand.getWrkNo()); |
| | | // |
| | | // //对主线程抛出等待确认状态waiting |
| | | // liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING); |
| | | // News.info("提升机任务执行下发完成等待执行结束,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |
| | | // } |
| | | |
| | | if (redisCommand.getAssignCommand().getTaskMode() == NyLiftTaskModelType.RESET.id.shortValue()) { |
| | | //复位命令 |