| | |
| | | |
| | | if (shuttleProtocol.getErrorCode() != 0 && shuttleProtocol.getProtocolStatusType() == ShuttleProtocolStatusType.WORKING) { |
| | | //出现错误 |
| | | reset(shuttleProtocol.getAssignCommand()); |
| | | reset(shuttleProtocol.getTaskNo()); |
| | | } |
| | | |
| | | if(shuttleProtocol.getProtocolStatusType() == ShuttleProtocolStatusType.FIXING |
| | |
| | | /** |
| | | * 复位并尝试修复错误 |
| | | */ |
| | | private boolean reset(ShuttleAssignCommand assignCommand) { |
| | | private boolean reset(Short wrkNo) { |
| | | //读取redis数据 |
| | | if (assignCommand == null) { |
| | | if (wrkNo == null) { |
| | | return false; |
| | | } |
| | | |
| | | Object o = redisUtil.get("wrk_no_" + assignCommand.getTaskNo()); |
| | | Object o = redisUtil.get("wrk_no_" + wrkNo); |
| | | if (o == null) { |
| | | return false; |
| | | } |
| | | |
| | | ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class); |
| | | List<ShuttleCommand> commands = assignCommand.getCommands(); |
| | | List<ShuttleCommand> commands = redisCommand.getAssignCommand().getCommands(); |
| | | //当前步序 |
| | | int commandStep = redisCommand.getCommandStep(); |
| | | //path路径数目 |
| | |
| | | |
| | | redisCommand.setErrorCommands(list); |
| | | //任务数据保存到redis |
| | | redisUtil.set("wrk_no_" + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand)); |
| | | redisUtil.set("wrk_no_" + wrkNo, JSON.toJSONString(redisCommand)); |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.FIXING); |
| | | return true; |
| | | } |