| | |
| | | import com.zy.common.utils.NyHttpUtils; |
| | | import com.zy.common.utils.NyShuttleOperaUtils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.common.utils.ShuttleDispatchUtils; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private ShuttleDispatchUtils shuttleDispatchUtils; |
| | | |
| | | @PostMapping("/table/shuttle/state") |
| | | @ManagerAuth(memo = "四向穿梭车信息表") |
| | |
| | | NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | JSONObject shuttleData = JSON.parseObject(JSON.toJSONString(shuttleProtocol)); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo()==null) { |
| | | list.add(shuttleData); |
| | | if (shuttleData != null) { |
| | | list.add(shuttleData); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | |
| | | assignCommand.setCommands(commands); |
| | | } else if (shuttleTaskModeType == ShuttleTaskModeType.CHARGE) { |
| | | //充电开关 |
| | | NyShuttleHttpCommand command = NyHttpUtils.getChargeCommand(shuttleSlave.getId(), assignCommand.getTaskNo().intValue(), true); |
| | | boolean charge = false; |
| | | if (shuttleProtocol.getChargState() == 1) { |
| | | //已充电,关闭充电 |
| | | charge = false; |
| | | }else { |
| | | //开启充电 |
| | | charge = true; |
| | | } |
| | | NyShuttleHttpCommand command = NyHttpUtils.getChargeCommand(shuttleSlave.getId(), assignCommand.getTaskNo().intValue(), charge); |
| | | ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>(); |
| | | commands.add(command); |
| | | assignCommand.setCommands(commands); |
| | | } else if (shuttleTaskModeType == ShuttleTaskModeType.RESET) { |
| | | //复位 |
| | | shuttleProtocol.setTaskNo(0);//工作号清空 |
| | | shuttleProtocol.setToken(0);//令牌清空 |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);//任务状态-空闲 |
| | | shuttleProtocol.setPakMk(false);//作业标记复位 |
| | | return R.ok(); |
| | |
| | | ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>(); |
| | | commands.add(suspendCommand); |
| | | assignCommand.setCommands(commands); |
| | | } else if (shuttleTaskModeType == ShuttleTaskModeType.MOVE_LOC_NO_WRK_MAST) { |
| | | //移动到目标库位(生成移动任务) |
| | | shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(3), param.getDistLocNo(), param.getShuttleNo()); |
| | | return R.ok(); |
| | | } else { |
| | | throw new CoolException("未知命令"); |
| | | } |