|
|
@ -62,11 +62,10 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
} |
|
|
|
|
|
|
|
public boolean updateCoordAndStatus(int taskId, String currentCoord, int status, boolean updateStartTime, boolean updateEndTime, Integer order) throws IOException { |
|
|
|
UpdateWrapper<Task> taskUpdateWrapper = new UpdateWrapper<>(); |
|
|
|
taskUpdateWrapper.eq("id",taskId); |
|
|
|
Task task = new Task(); |
|
|
|
task.setEndTime(null); |
|
|
|
task.setStartTime(null); |
|
|
|
// 根据taskId查询出来Task对象,更新时回填回去 |
|
|
|
QueryWrapper<Task> taskQueryWrapper = new QueryWrapper<>(); |
|
|
|
taskQueryWrapper.eq("id",taskId); |
|
|
|
Task task = taskService.getOne(taskQueryWrapper); |
|
|
|
if (currentCoord != null){ |
|
|
|
task.setCurrentCoord(currentCoord); |
|
|
|
} |
|
|
@ -81,7 +80,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
if (order != null){ |
|
|
|
task.setCheckOrder(order); |
|
|
|
} |
|
|
|
boolean update = taskService.update(task, taskUpdateWrapper); |
|
|
|
boolean update = taskService.updateById(task); |
|
|
|
this.sendMessageToPage(); |
|
|
|
return update; |
|
|
|
} |
|
|
@ -208,22 +207,34 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
QueryWrapper<Path> pathQueryWrapper = new QueryWrapper<>(); |
|
|
|
pathQueryWrapper.eq("task_id", taskId); |
|
|
|
List<Path> pathList = pathService.list(pathQueryWrapper); |
|
|
|
if (startIndex == null) { |
|
|
|
// startIndex 取复杂路径第一项 |
|
|
|
// 直接取order_number 为1 的 |
|
|
|
for(int i=0; i < pathList.size(); i++) { |
|
|
|
Path item = pathList.get(i); |
|
|
|
if (item.getOrderNumber() == 1) { |
|
|
|
startIndex = item.getCoord(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
pathQueryWrapper.eq("coord", startIndex); |
|
|
|
Path currentPath = pathService.getOne(pathQueryWrapper); |
|
|
|
int orderNumber = currentPath.getOrderNumber(); |
|
|
|
int size = pathList.size(); |
|
|
|
// 逻辑理顺后 将该处转换为while循环形成路径 |
|
|
|
if (orderNumber == size) { |
|
|
|
// 检测到最后一项 |
|
|
|
}else { |
|
|
|
// 如果未结束 则使用order_numer + 1获取下一次的坐标,移动机械臂到此位置进行处理 |
|
|
|
// 下一坐标的order_number 为 order_numer + 1 |
|
|
|
int nextOrderNumber = orderNumber + 1; |
|
|
|
QueryWrapper<Path> pathQueryWrapper1 = new QueryWrapper<>(); |
|
|
|
pathQueryWrapper1.eq("order_number", nextOrderNumber).eq("task_id", taskId); |
|
|
|
Path nextPath = pathService.getOne(pathQueryWrapper1); |
|
|
|
String coord = nextPath.getCoord(); |
|
|
|
// 将该coord转换为机械臂的x y坐标移动 |
|
|
|
if (currentPath != null){ |
|
|
|
int orderNumber = currentPath.getOrderNumber(); |
|
|
|
int size = pathList.size(); |
|
|
|
// 逻辑理顺后 将该处转换为while循环形成路径 |
|
|
|
if (orderNumber == size) { |
|
|
|
// 检测到最后一项 |
|
|
|
}else { |
|
|
|
// 如果未结束 则使用order_numer + 1获取下一次的坐标,移动机械臂到此位置进行处理 |
|
|
|
// 下一坐标的order_number 为 order_numer + 1 |
|
|
|
int nextOrderNumber = orderNumber + 1; |
|
|
|
QueryWrapper<Path> pathQueryWrapper1 = new QueryWrapper<>(); |
|
|
|
pathQueryWrapper1.eq("order_number", nextOrderNumber).eq("task_id", taskId); |
|
|
|
Path nextPath = pathService.getOne(pathQueryWrapper1); |
|
|
|
String coord = nextPath.getCoord(); |
|
|
|
// 将该coord转换为机械臂的x y坐标移动 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
CheckResult checkResult = new CheckResult(); |
|
|
|