| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.param.CancelTaskParam; |
| | | import com.zy.asrs.domain.param.CompleteTaskParam; |
| | | import com.zy.asrs.domain.param.CreateMoveTaskParam; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.core.dispatcher.ShuttleDispatchUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | private ShuttleDispatchUtils shuttleDispatchUtils; |
| | | |
| | | @PostMapping("/createMoveTask") |
| | | public R createMoveTask(CreateMoveTaskParam param) { |
| | | public R createMoveTask(@RequestBody CreateMoveTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(99), param.getLocNo(), param.getShuttleNo()); |
| | | boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(null, param.getLocNo(), param.getShuttleNo()); |
| | | if (dispatchShuttle) { |
| | | return R.ok(); |
| | | } |
| | | return R.error(); |
| | | return R.error("生成失败"); |
| | | } |
| | | |
| | | @PostMapping("/completeTask") |
| | | public R completeTask(@RequestBody CompleteTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean completeTask = commonService.completeTask(param); |
| | | if (completeTask) { |
| | | return R.ok(); |
| | | } |
| | | return R.error("任务完成失败"); |
| | | } |
| | | |
| | | @PostMapping("/cancelTask") |
| | | public R cancelTask(@RequestBody CancelTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean completeTask = commonService.cancelTask(param); |
| | | if (completeTask) { |
| | | return R.ok(); |
| | | } |
| | | return R.error("任务取消失败"); |
| | | } |
| | | |
| | | } |