|
|
@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.iflytop.nuclear.entity.CheckInfo; |
|
|
|
import com.iflytop.nuclear.entity.CheckResult; |
|
|
|
import com.iflytop.nuclear.entity.DetectionMessage; |
|
|
|
import com.iflytop.nuclear.model.Path; |
|
|
|
import com.iflytop.nuclear.model.Task; |
|
|
|
import com.iflytop.nuclear.service.CheckService; |
|
|
|
import com.iflytop.nuclear.service.PathService; |
|
|
|
import com.iflytop.nuclear.service.TaskService; |
|
|
|
import com.iflytop.nuclear.websocket.SocketClient; |
|
|
|
import com.iflytop.nuclear.websocket.WebSocketServer; |
|
|
@ -16,6 +18,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author cool |
|
|
@ -30,6 +33,8 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
WebSocketServer webSocketServer; |
|
|
|
@Autowired |
|
|
|
SocketClient socketClient; |
|
|
|
@Autowired |
|
|
|
PathService pathService; |
|
|
|
|
|
|
|
private static boolean messageReceived = false; |
|
|
|
|
|
|
@ -197,6 +202,29 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
}else { |
|
|
|
nextCoord = this.continueCheck(taskId, order); |
|
|
|
} |
|
|
|
}else { |
|
|
|
// 复杂路径 |
|
|
|
// 首先先获取当前task的startIndex 当前startIndex所对应的path =》 order_number 等于查询数据列表长度时说明当前复杂路径结束 |
|
|
|
QueryWrapper<Path> pathQueryWrapper = new QueryWrapper<>(); |
|
|
|
pathQueryWrapper.eq("task_id", taskId); |
|
|
|
List<Path> pathList = pathService.list(pathQueryWrapper); |
|
|
|
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坐标移动 |
|
|
|
} |
|
|
|
} |
|
|
|
CheckResult checkResult = new CheckResult(); |
|
|
|
checkResult.setCurrentTestCoord(nextCoord); |
|
|
|