| | |
| | | } |
| | | |
| | | StationCommand command = stationThread.getCommand(StationCommandType.MOVE, taskNo, stationId, targetStationId, 0); |
| | | if (command == null) { |
| | | return R.error("生成输送命令失败,路径为空或不可达"); |
| | | } |
| | | MessageQueue.offer(SlaveType.Devp, devpNo, new Task(2, command)); |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/command/clearPath") |
| | | public R commandClearPath(@RequestBody StationCommandMoveParam param) { |
| | | if (Cools.isEmpty(param) || Cools.isEmpty(param.getStationId()) || Cools.isEmpty(param.getTaskNo())) { |
| | | return R.error("缺少参数"); |
| | | } |
| | | |
| | | StationObjModel finalStation = findStation(param.getStationId()); |
| | | if (finalStation == null) { |
| | | return R.error("站点不存在"); |
| | | } |
| | | |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, finalStation.getDeviceNo()); |
| | | if (stationThread == null) { |
| | | return R.error("线程不存在"); |
| | | } |
| | | |
| | | boolean cleared = stationThread.clearPath(param.getTaskNo()); |
| | | if (!cleared) { |
| | | return R.error("未匹配到可清理路径或清理失败"); |
| | | } |
| | | return R.ok("清理路径成功"); |
| | | } |
| | | |
| | | private StationObjModel findStation(Integer stationId) { |
| | | if (Cools.isEmpty(stationId)) { |
| | | return null; |