| | |
| | | if (commandStep != 0) { |
| | | //判断上一条指令是否完成 |
| | | ShuttleCommand command = commands.get(commandStep - 1); |
| | | if (command.getDistCodeNum().intValue() == shuttleProtocol.getCurrentCode().intValue()) { |
| | | //上一条指令的目标位置 |
| | | if (command.getCommandWord().intValue() == 1) { |
| | | //移动命令 |
| | | if (command.getDistCodeNum().intValue() == shuttleProtocol.getCurrentCode().intValue()) { |
| | | //上一条指令的目标位置和当前小车位置相同,则认定上一条任务完成 |
| | | command.setComplete(true); |
| | | } |
| | | } else if (command.getCommandWord().intValue() == 2) { |
| | | //托盘顶升命令 |
| | | if (command.getPalletLift().intValue() == 1) { |
| | | //顶升 |
| | | //判断是否顶升到位 |
| | | if (shuttleProtocol.getPlcOutputLift()) { |
| | | //自动模式 |
| | | if (assignCommand.getAuto() && shuttleProtocol.getPlcInputStatus().intValue() == 1) { |
| | | //顶升到位,且托盘雷达有物,认定任务完成 |
| | | command.setComplete(true); |
| | | }else { |
| | | //手动模式,不判断托盘雷达 |
| | | //顶升到位,认定任务完成 |
| | | command.setComplete(true); |
| | | } |
| | | } |
| | | }else { |
| | | //下降 |
| | | //判断是否下降到位,判断托盘雷达是否无物 |
| | | if (!shuttleProtocol.getPlcOutputLift() && !shuttleProtocol.getPlcOutputTransfer()) { |
| | | //自动模式 |
| | | if (assignCommand.getAuto() && shuttleProtocol.getPlcInputStatus().intValue() == 0) { |
| | | //下降到位,且托盘雷达无物,认定任务完成 |
| | | command.setComplete(true); |
| | | }else { |
| | | //手动模式,不判断托盘雷达 |
| | | //下降到位,且托盘雷达无物,认定任务完成 |
| | | command.setComplete(true); |
| | | } |
| | | } |
| | | } |
| | | } else if (command.getCommandWord().intValue() == 5) { |
| | | //充电命令 |
| | | //判断小车充电开关 |
| | | if (shuttleProtocol.getPlcOutputCharge()) { |
| | | //正常充电,认定任务完成 |
| | | command.setComplete(true); |
| | | } |
| | | } |
| | | //任务数据保存到redis |
| | | redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | |
| | | if (!command.getComplete()) { |
| | | //上一条任务未完成,禁止下发命令 |
| | | return false; |
| | | } |
| | | } |
| | | |