|
|
|
@ -91,44 +91,6 @@ public class AgvTaskController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 变更任务位置 |
|
|
|
* @param params 包含任务ID和新位置的参数 |
|
|
|
* @return 变更结果 |
|
|
|
*/ |
|
|
|
@PostMapping("/changeLocation") |
|
|
|
public R changeLocation(@RequestBody Map<String, Object> params) { |
|
|
|
try { |
|
|
|
String taskId = (String) params.get("taskId"); |
|
|
|
String fromLocation = (String) params.get("fromLocation"); |
|
|
|
String toLocation = (String) params.get("toLocation"); |
|
|
|
|
|
|
|
if (taskId == null || taskId.trim().isEmpty()) { |
|
|
|
return R.error().put("msg", "任务ID不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
if (toLocation == null || toLocation.trim().isEmpty()) { |
|
|
|
return R.error().put("msg", "终点位置不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 创建新的任务请求 |
|
|
|
CreateTaskRequest request = CreateTaskRequest.createSimpleTask(taskId, fromLocation, toLocation); |
|
|
|
|
|
|
|
// 先取消原任务,再创建新任务 |
|
|
|
tuskClientService.cancelTask(taskId); |
|
|
|
TuskResponse<Void> response = tuskClientService.createTask(request); |
|
|
|
|
|
|
|
if (response.isSuccess()) { |
|
|
|
return R.ok().put("msg", "任务位置变更成功"); |
|
|
|
} else { |
|
|
|
return R.error().put("msg", "任务位置变更失败: " + response.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
return R.error().put("msg", "变更任务位置异常: " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 取消TUSK任务 |
|
|
|
* @param params 包含任务号的参数 |
|
|
|
|