Compare commits
4 Commits
3aaff006c2
...
248b0bdeba
Author | SHA1 | Date | |
---|---|---|---|
![]() |
248b0bdeba | ||
![]() |
5c2a8cfe9d | ||
![]() |
b270a21595 | ||
![]() |
94a34981c6 |
@ -237,4 +237,6 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 车辆动作记录 1_002_045_001 ==========
|
// ========== 车辆动作记录 1_002_045_001 ==========
|
||||||
ErrorCode TASK_DETAIL_ACTION_LOG_NOT_EXISTS = new ErrorCode(1_002_045_001, "车辆动作记录不存在");
|
ErrorCode TASK_DETAIL_ACTION_LOG_NOT_EXISTS = new ErrorCode(1_002_045_001, "车辆动作记录不存在");
|
||||||
|
|
||||||
|
// ========== 循环任务点位 1_002_046_001==========
|
||||||
|
ErrorCode TASK_CYCLE_NOT_EXISTS = new ErrorCode(1_002_046_001, "循环任务点位不存在");
|
||||||
}
|
}
|
||||||
|
@ -76,16 +76,28 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
String taskStatusKey = RobotTaskChcheConstant.ROBOT_TASK_STATUS + robotStatusDataDTO.getMac();
|
String taskStatusKey = RobotTaskChcheConstant.ROBOT_TASK_STATUS + robotStatusDataDTO.getMac();
|
||||||
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + robotStatusDataDTO.getMac();
|
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + robotStatusDataDTO.getMac();
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
|
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
|
||||||
redisUtil.set(taskStatusKey, robotStatusDataDTO.getData().getTask_status(), robotPositionCacheTime);
|
// todo 后续需要改为从车机上报
|
||||||
redisUtil.set(cargoDetectedKey, robotStatusDataDTO.getData().getCargo_detected(), robotPositionCacheTime);
|
redisUtil.set(taskStatusKey, "IDLE", robotPositionCacheTime);
|
||||||
|
redisUtil.set(cargoDetectedKey, false, robotPositionCacheTime);
|
||||||
|
/*redisUtil.set(taskStatusKey, robotStatusDataDTO.getData().getTask_status(), robotPositionCacheTime);
|
||||||
|
redisUtil.set(cargoDetectedKey, robotStatusDataDTO.getData().getCargo_detected(), robotPositionCacheTime);*/
|
||||||
|
|
||||||
Object object = redisUtil.get(pose2dKey);
|
Object object = redisUtil.get(pose2dKey);
|
||||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
||||||
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getData().getPose2d().getX());
|
|
||||||
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getData().getPose2d().getY());
|
if (ObjectUtil.isNotEmpty(robotStatusDataDTO.getData())
|
||||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
|
&& ObjectUtil.isNotEmpty(robotStatusDataDTO.getData().getPose2d())) {
|
||||||
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor());
|
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getData().getPose2d().getX());
|
||||||
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea());
|
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getData().getPose2d().getY());
|
||||||
|
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(robotStatusDataDTO.getData())
|
||||||
|
&& ObjectUtil.isNotEmpty(robotStatusDataDTO.getData().getFloor_zone())) {
|
||||||
|
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor());
|
||||||
|
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea());
|
||||||
|
}
|
||||||
|
|
||||||
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
||||||
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
||||||
pathPlanningApi.synchronousLineObject(robotStatusDataPoseDTO, PathPlanningTopicConstant.AGV_POSE);
|
pathPlanningApi.synchronousLineObject(robotStatusDataPoseDTO, PathPlanningTopicConstant.AGV_POSE);
|
||||||
|
@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.actionlog.RobotTaskDetailActionLogMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.actionlog.RobotTaskDetailActionLogMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.cycle.TaskCycleMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||||
@ -65,6 +66,9 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ThreadPoolTaskExecutor taskExecutor;
|
private ThreadPoolTaskExecutor taskExecutor;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskCycleMapper taskCycleMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WareHouseLocationMapper houseLocationMapper;
|
private WareHouseLocationMapper houseLocationMapper;
|
||||||
|
|
||||||
@ -157,6 +161,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
robotTaskDO.setEndTime(LocalDateTime.now());
|
robotTaskDO.setEndTime(LocalDateTime.now());
|
||||||
robotTaskDO.setTaskStatus(RobotTaskDetailStatusEnum.DONE.getType());
|
robotTaskDO.setTaskStatus(RobotTaskDetailStatusEnum.DONE.getType());
|
||||||
robotTaskMapper.updateRobot(robotTaskDO);
|
robotTaskMapper.updateRobot(robotTaskDO);
|
||||||
|
taskCycleMapper.deletByRobotTaskId(taskDetails.get(0).getRobotTaskId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RobotTaskTypeEnum.MOVE.getType().equals(robotTaskDetailDO.getTaskType())) {
|
if (RobotTaskTypeEnum.MOVE.getType().equals(robotTaskDetailDO.getTaskType())) {
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.cycle;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCyclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCycleRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCycleSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.cycle.TaskCycleDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.cycle.TaskCycleService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 循环任务点位")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/robot/task-cycle")
|
||||||
|
@Validated
|
||||||
|
public class TaskCycleController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskCycleService taskCycleService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建循环任务点位")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task-cycle:create')")
|
||||||
|
public CommonResult<Long> createTaskCycle(@Valid @RequestBody TaskCycleSaveReqVO createReqVO) {
|
||||||
|
return success(taskCycleService.createTaskCycle(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新循环任务点位")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task-cycle:update')")
|
||||||
|
public CommonResult<Boolean> updateTaskCycle(@Valid @RequestBody TaskCycleSaveReqVO updateReqVO) {
|
||||||
|
taskCycleService.updateTaskCycle(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除循环任务点位")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task-cycle:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTaskCycle(@RequestParam("id") Long id) {
|
||||||
|
taskCycleService.deleteTaskCycle(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得循环任务点位")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task-cycle:query')")
|
||||||
|
public CommonResult<TaskCycleRespVO> getTaskCycle(@RequestParam("id") Long id) {
|
||||||
|
TaskCycleDO taskCycle = taskCycleService.getTaskCycle(id);
|
||||||
|
return success(BeanUtils.toBean(taskCycle, TaskCycleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得循环任务点位分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task-cycle:query')")
|
||||||
|
public CommonResult<PageResult<TaskCycleRespVO>> getTaskCyclePage(@Valid TaskCyclePageReqVO pageReqVO) {
|
||||||
|
PageResult<TaskCycleDO> pageResult = taskCycleService.getTaskCyclePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TaskCycleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出循环任务点位 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task-cycle:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTaskCycleExcel(@Valid TaskCyclePageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<TaskCycleDO> list = taskCycleService.getTaskCyclePage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "循环任务点位.xls", "数据", TaskCycleRespVO.class,
|
||||||
|
BeanUtils.toBean(list, TaskCycleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.cycle.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 循环任务点位分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class TaskCyclePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "机器人任务主表id", example = "2231")
|
||||||
|
private Long robotTaskId;
|
||||||
|
|
||||||
|
@Schema(description = "ware_position_map_item的id", example = "923")
|
||||||
|
private Long mapItemId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.cycle.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 循环任务点位 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class TaskCycleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9553")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "机器人任务主表id", example = "2231")
|
||||||
|
@ExcelProperty("机器人任务主表id")
|
||||||
|
private Long robotTaskId;
|
||||||
|
|
||||||
|
@Schema(description = "ware_position_map_item的id", example = "923")
|
||||||
|
@ExcelProperty("ware_position_map_item的id")
|
||||||
|
private Long mapItemId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.cycle.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 循环任务点位新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TaskCycleSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9553")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "机器人任务主表id", example = "2231")
|
||||||
|
private Long robotTaskId;
|
||||||
|
|
||||||
|
@Schema(description = "ware_position_map_item的id", example = "923")
|
||||||
|
private Long mapItemId;
|
||||||
|
|
||||||
|
}
|
@ -110,8 +110,8 @@ public class RobotInformationController {
|
|||||||
@Operation(summary = "查询所有车辆")
|
@Operation(summary = "查询所有车辆")
|
||||||
@PreAuthorize("@ss.hasPermission('robot:information:getAllRobot')")
|
@PreAuthorize("@ss.hasPermission('robot:information:getAllRobot')")
|
||||||
public CommonResult<List<RobotInformationRespVO>> getAllRobot() {
|
public CommonResult<List<RobotInformationRespVO>> getAllRobot() {
|
||||||
List<RobotInformationDO> result = informationService.getAllRobot();
|
List<RobotInformationRespVO> result = informationService.getAllRobotAndErrorMsg();
|
||||||
return success(BeanUtils.toBean(result, RobotInformationRespVO.class));
|
return success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ -58,6 +58,14 @@ public class RobotTaskController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/close")
|
||||||
|
@Operation(summary = "更新机器人任务主表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:task:close')")
|
||||||
|
public CommonResult<Boolean> closeTask(@Valid @RequestBody RobotTaskSaveReqVO updateReqVO) {
|
||||||
|
taskService.closeTask(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除机器人任务主表")
|
@Operation(summary = "删除机器人任务主表")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@ -78,4 +78,7 @@ public class RobotInformationRespVO {
|
|||||||
@ExcelProperty("区域")
|
@ExcelProperty("区域")
|
||||||
public String area;
|
public String area;
|
||||||
|
|
||||||
|
@Schema(description = "机器人错误信息")
|
||||||
|
public String errorMsg;
|
||||||
|
|
||||||
}
|
}
|
@ -66,11 +66,11 @@ public class RobotTaskDetailAddVO {
|
|||||||
@Schema(description = "放货库位的排序")
|
@Schema(description = "放货库位的排序")
|
||||||
private Long toLocationNumber;
|
private Long toLocationNumber;
|
||||||
|
|
||||||
@Schema(description = "取货库位ware_position_map的id")
|
@Schema(description = "取货库位ware_position_map_item的id")
|
||||||
private Long fromMapId;
|
private Long fromMapItemId;
|
||||||
|
|
||||||
@Schema(description = "放货库位ware_position_map的id")
|
@Schema(description = "放货库位ware_position_map_item的id")
|
||||||
private Long toMapId;
|
private Long toMapItemId;
|
||||||
|
|
||||||
public Long getPriority() {
|
public Long getPriority() {
|
||||||
if (ObjectUtil.isEmpty(priority)) {
|
if (ObjectUtil.isEmpty(priority)) {
|
||||||
|
@ -88,9 +88,9 @@ public class RobotTaskDetailPageReqVO extends PageParam {
|
|||||||
@Schema(description = "放货库位的排序")
|
@Schema(description = "放货库位的排序")
|
||||||
private Long toLocationNumber;
|
private Long toLocationNumber;
|
||||||
|
|
||||||
@Schema(description = "取货库位ware_position_map的id")
|
@Schema(description = "取货库位ware_position_map_item的id")
|
||||||
private Long fromMapId;
|
private Long fromMapItemId;
|
||||||
|
|
||||||
@Schema(description = "放货库位ware_position_map的id")
|
@Schema(description = "放货库位ware_position_map_item的id")
|
||||||
private Long toMapId;
|
private Long toMapItemId;
|
||||||
}
|
}
|
@ -110,11 +110,9 @@ public class RobotTaskDetailRespVO {
|
|||||||
@ExcelProperty("放货库位的排序")
|
@ExcelProperty("放货库位的排序")
|
||||||
private Long toLocationNumber;
|
private Long toLocationNumber;
|
||||||
|
|
||||||
@Schema(description = "取货库位ware_position_map的id")
|
@Schema(description = "取货库位ware_position_map_item的id")
|
||||||
@ExcelProperty("取货库位ware_position_map的id")
|
private Long fromMapItemId;
|
||||||
private Long fromMapId;
|
|
||||||
|
|
||||||
@Schema(description = "放货库位ware_position_map的id")
|
@Schema(description = "放货库位ware_position_map_item的id")
|
||||||
@ExcelProperty("放货库位ware_position_map的id")
|
private Long toMapItemId;
|
||||||
private Long toMapId;
|
|
||||||
}
|
}
|
@ -88,10 +88,10 @@ public class RobotTaskDetailSaveReqVO {
|
|||||||
@Schema(description = "放货库位的排序")
|
@Schema(description = "放货库位的排序")
|
||||||
private Long toLocationNumber;
|
private Long toLocationNumber;
|
||||||
|
|
||||||
@Schema(description = "取货库位ware_position_map的id")
|
@Schema(description = "取货库位ware_position_map_item的id")
|
||||||
private Long fromMapId;
|
private Long fromMapItemId;
|
||||||
|
|
||||||
@Schema(description = "放货库位ware_position_map的id")
|
@Schema(description = "放货库位ware_position_map_item的id")
|
||||||
private Long toMapId;
|
private Long toMapItemId;
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.cycle;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环任务点位 DO
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
@TableName("robot_task_cycle")
|
||||||
|
@KeySequence("robot_task_cycle_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TaskCycleDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 机器人任务主表id
|
||||||
|
*/
|
||||||
|
private Long robotTaskId;
|
||||||
|
/**
|
||||||
|
* ware_position_map_item的id
|
||||||
|
*/
|
||||||
|
private Long mapItemId;
|
||||||
|
|
||||||
|
}
|
@ -129,12 +129,14 @@ public class RobotTaskDetailDO extends BaseDO {
|
|||||||
private Integer electricity;
|
private Integer electricity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ware_position_map的id
|
* ware_position_map_item的id的id
|
||||||
*/
|
*/
|
||||||
private Long fromMapId;
|
private Long fromMapItemId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ware_position_map的id
|
* ware_position_map_item的id的id
|
||||||
*/
|
*/
|
||||||
private Long toMapId;
|
private Long toMapItemId;
|
||||||
|
|
||||||
|
//todo 需要改为ware_position_map_item的id
|
||||||
}
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.cycle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCyclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.cycle.TaskCycleDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环任务点位 Mapper
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TaskCycleMapper extends BaseMapperX<TaskCycleDO> {
|
||||||
|
|
||||||
|
default PageResult<TaskCycleDO> selectPage(TaskCyclePageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TaskCycleDO>()
|
||||||
|
.eqIfPresent(TaskCycleDO::getRobotTaskId, reqVO.getRobotTaskId())
|
||||||
|
.eqIfPresent(TaskCycleDO::getMapItemId, reqVO.getMapItemId())
|
||||||
|
.betweenIfPresent(TaskCycleDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(TaskCycleDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
void deletByRobotTaskId(@Param("robotTaskId") Long robotTaskId);
|
||||||
|
}
|
@ -64,7 +64,10 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
|||||||
@Param("takeType") Integer takeType,
|
@Param("takeType") Integer takeType,
|
||||||
@Param("id") Long id,
|
@Param("id") Long id,
|
||||||
@Param("locationIds") List<Long> locationIds,
|
@Param("locationIds") List<Long> locationIds,
|
||||||
@Param("mapIds") Set<Long> mapIds);
|
@Param("mapIds") Set<Long> mapIds,
|
||||||
|
@Param("takeMapItemIds") List<Long> takeMapItemIds,
|
||||||
|
@Param("laneIds") List<Long> laneIds,
|
||||||
|
@Param("areaIds") List<Long> areaIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 普通查询(未删除)
|
* 普通查询(未删除)
|
||||||
@ -76,13 +79,14 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询库位
|
* 查询库位
|
||||||
* @param query
|
* (注意:----------不能修改排序-----------------)
|
||||||
* @param locationIds
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
List<WareHouseLocationDO> selectLocations(@Param("query") WareHouseLocationDO query,
|
List<WareHouseLocationDO> selectLocations(@Param("query") WareHouseLocationDO query,
|
||||||
@Param("locationIds") List<Long> locationIds,
|
@Param("locationIds") List<Long> locationIds,
|
||||||
@Param("mapIds") Set<Long> mapIds);
|
@Param("mapIds") Set<Long> mapIds,
|
||||||
|
@Param("laneIds") List<Long> laneIds,
|
||||||
|
@Param("areaIds") List<Long> areaIds,
|
||||||
|
@Param("mapItemIds") List<Long> mapItemIds);
|
||||||
|
|
||||||
void updateLocationLockList( @Param("locationIds") List<Long> locationIds,
|
void updateLocationLockList( @Param("locationIds") List<Long> locationIds,
|
||||||
@Param("taskId") Long taskId,
|
@Param("taskId") Long taskId,
|
||||||
@ -114,4 +118,8 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
|||||||
* @param wareHouseLocationDO
|
* @param wareHouseLocationDO
|
||||||
*/
|
*/
|
||||||
void updateEntity(WareHouseLocationDO wareHouseLocationDO);
|
void updateEntity(WareHouseLocationDO wareHouseLocationDO);
|
||||||
|
|
||||||
|
void releaseLocationLockList(@Param("locationIds") List<Long> locationIds,
|
||||||
|
@Param("taskId") Long taskId,
|
||||||
|
@Param("locationLock") Integer locationLock);
|
||||||
}
|
}
|
@ -65,10 +65,10 @@ public interface RobotInformationMapper extends BaseMapperX<RobotInformationDO>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量更新机器人状态
|
* 批量更新机器人状态
|
||||||
* @param robotNos
|
* @param robotNo
|
||||||
* @param robotStatus
|
* @param robotStatus
|
||||||
*/
|
*/
|
||||||
void updateRobotListStatus(@Param("robotNos") Set<String> robotNos, @Param("robotStatus") Integer robotStatus);
|
void updateRobotListStatus(@Param("robotNo") String robotNo, @Param("robotStatus") Integer robotStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆尺寸
|
* 查询车辆尺寸
|
||||||
|
@ -92,4 +92,21 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
|
|||||||
*/
|
*/
|
||||||
List<RobotTaskDetailDO> getChargeTaskDetail();
|
List<RobotTaskDetailDO> getChargeTaskDetail();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取货中的map_item_id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> selectTakeMapItemIds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 放货中的map_item_id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> selectReleaseMapItemIds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询需要创建循环任务且已经完成的订单
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RobotTaskDetailDO> selectAutoCreateCycleTask();
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.enums.robot.charge;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* robot_charge_log的task_status
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ChargeTaskStatusEnum {
|
||||||
|
NEW(0),//未开始
|
||||||
|
DOING(1),//执行中
|
||||||
|
DONE(2),//已完成
|
||||||
|
CLOSE(3), //已取消
|
||||||
|
ABNORMAL(4); //异常
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final Integer type;
|
||||||
|
}
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
|||||||
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.job.AutoChargeService;
|
import cn.iocoder.yudao.module.system.service.robot.job.AutoChargeService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.robot.job.CycleService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.job.DistributeTasksService;
|
import cn.iocoder.yudao.module.system.service.robot.job.DistributeTasksService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.job.RobotTaskAutoMoveService;
|
import cn.iocoder.yudao.module.system.service.robot.job.RobotTaskAutoMoveService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.pathplanning.RobotPathPlanningService;
|
import cn.iocoder.yudao.module.system.service.robot.pathplanning.RobotPathPlanningService;
|
||||||
@ -39,6 +40,9 @@ public class RobotJob {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AutoChargeService autoChargeService;
|
private AutoChargeService autoChargeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CycleService cycleService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RobotPathPlanningService robotPathPlanningService;
|
private RobotPathPlanningService robotPathPlanningService;
|
||||||
|
|
||||||
@ -129,4 +133,28 @@ public class RobotJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建循环任务
|
||||||
|
*/
|
||||||
|
@XxlJob("CycleTaskJob")
|
||||||
|
@TenantJob
|
||||||
|
public void cycleTaskJob() {
|
||||||
|
|
||||||
|
RLock lock = redissonUtils.getLock(RobotCacheLockEnum.ROBOT_TASK_ADD_LOCK.getKey());
|
||||||
|
if (lock.tryLock()){
|
||||||
|
try {
|
||||||
|
log.info("----创建循环任务----");
|
||||||
|
cycleService.cycleTaskJob();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("创建循环任务异常 :{}", e);
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
log.info("下发任务给路径规划未获取到锁");
|
||||||
|
throw exception(REDISSON_NOT_OBTAIN_LOCK);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.cycle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCyclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCycleSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.cycle.TaskCycleDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环任务点位 Service 接口
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
public interface TaskCycleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建循环任务点位
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTaskCycle(@Valid TaskCycleSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新循环任务点位
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTaskCycle(@Valid TaskCycleSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除循环任务点位
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTaskCycle(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得循环任务点位
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 循环任务点位
|
||||||
|
*/
|
||||||
|
TaskCycleDO getTaskCycle(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得循环任务点位分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 循环任务点位分页
|
||||||
|
*/
|
||||||
|
PageResult<TaskCycleDO> getTaskCyclePage(TaskCyclePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.cycle;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCyclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.cycle.vo.TaskCycleSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.cycle.TaskCycleDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.cycle.TaskCycleMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_CYCLE_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环任务点位 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TaskCycleServiceImpl implements TaskCycleService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskCycleMapper taskCycleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTaskCycle(TaskCycleSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
TaskCycleDO taskCycle = BeanUtils.toBean(createReqVO, TaskCycleDO.class);
|
||||||
|
taskCycleMapper.insert(taskCycle);
|
||||||
|
// 返回
|
||||||
|
return taskCycle.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTaskCycle(TaskCycleSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateTaskCycleExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
TaskCycleDO updateObj = BeanUtils.toBean(updateReqVO, TaskCycleDO.class);
|
||||||
|
taskCycleMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTaskCycle(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTaskCycleExists(id);
|
||||||
|
// 删除
|
||||||
|
taskCycleMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTaskCycleExists(Long id) {
|
||||||
|
if (taskCycleMapper.selectById(id) == null) {
|
||||||
|
throw exception(TASK_CYCLE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskCycleDO getTaskCycle(Long id) {
|
||||||
|
return taskCycleMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TaskCycleDO> getTaskCyclePage(TaskCyclePageReqVO pageReqVO) {
|
||||||
|
return taskCycleMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -117,4 +117,11 @@ public interface RobotInformationService extends IService<RobotInformationDO> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getMacByRobotNo(String robotNo);
|
String getMacByRobotNo(String robotNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机器人全部信息和异常信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RobotInformationRespVO> getAllRobotAndErrorMsg();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -513,4 +510,24 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RobotInformationRespVO> getAllRobotAndErrorMsg() {
|
||||||
|
RobotInformationDO query = new RobotInformationDO();
|
||||||
|
List<RobotInformationDO> robotInformationDOS = informationMapper.queryAllByLimit(query);
|
||||||
|
if (ObjectUtil.isEmpty(robotInformationDOS)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RobotInformationRespVO> list = BeanUtils.toBean(robotInformationDOS, RobotInformationRespVO.class);
|
||||||
|
for (RobotInformationRespVO v : list) {
|
||||||
|
String errorMsgKey = RobotTaskChcheConstant.ROBOT_ERROR_MSG + v.getMacAddress();
|
||||||
|
Object errorMsg = redisUtil.get(errorMsgKey);
|
||||||
|
if (ObjectUtil.isNotEmpty(errorMsg)) {
|
||||||
|
v.setErrorMsg(String.valueOf(errorMsg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.robot;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||||
@ -86,6 +87,8 @@ public class RobotTaskDetailServiceImpl implements RobotTaskDetailService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void insertRobotDetailList(List<RobotTaskDetailAddVO> taskDetailList) {
|
public void insertRobotDetailList(List<RobotTaskDetailAddVO> taskDetailList) {
|
||||||
taskDetailMapper.insertBatchList(taskDetailList);
|
List<RobotTaskDetailDO> bean = BeanUtils.toBean(taskDetailList, RobotTaskDetailDO.class);
|
||||||
|
taskDetailMapper.insertBatch(bean);
|
||||||
|
// taskDetailMapper.insertBatchList(taskDetailList);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.detail.RobotTaskDetailLogResoVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.detail.RobotTaskDetailLogResoVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.detail.RobotTaskDetailLogVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.detail.RobotTaskDetailLogVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskSaveReqVO;
|
||||||
@ -75,4 +76,13 @@ public interface RobotTaskService extends IService<RobotTaskDO> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PageResult<RobotTaskDetailLogResoVO> logPage( RobotTaskDetailLogVO pageReqVO);
|
PageResult<RobotTaskDetailLogResoVO> logPage( RobotTaskDetailLogVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加循环任务点位
|
||||||
|
* @param id
|
||||||
|
* @param taskDetailList
|
||||||
|
*/
|
||||||
|
void addCycle(Long id, List<RobotTaskDetailAddVO> taskDetailList);
|
||||||
|
|
||||||
|
void closeTask(@Valid RobotTaskSaveReqVO updateReqVO);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.robot.job;
|
||||||
|
|
||||||
|
public interface CycleService {
|
||||||
|
void cycleTaskJob();
|
||||||
|
}
|
@ -0,0 +1,220 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.robot.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnCodeMappingDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.robot.LocationLockEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskDetailStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.service.robot.RobotTaskDetailService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
||||||
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class CycleServiceImpl implements CycleService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotTaskMapper taskMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotTaskDetailMapper taskDetailMapper;
|
||||||
|
|
||||||
|
@Value("${zn.do_cycle:true}")
|
||||||
|
private Boolean doCycle;
|
||||||
|
|
||||||
|
@Value("${zn.task-no:ZN}")
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WareHouseLocationMapper locationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotTaskService robotTaskService;
|
||||||
|
/**
|
||||||
|
* 创建循环任务
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void cycleTaskJob() {
|
||||||
|
TenantContextHolder.setTenantId(1L);
|
||||||
|
|
||||||
|
if (!doCycle) {
|
||||||
|
log.info("循环任务关闭了--不自动创建循环任务");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RobotTaskDetailDO> detailDOS = taskDetailMapper.selectAutoCreateCycleTask();
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(detailDOS)) {
|
||||||
|
log.info("---不存在需要自动创建循环的任务--");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Long> taskIds = detailDOS.stream().map(RobotTaskDetailDO::getRobotTaskId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<RobotTaskDO> taskList = taskMapper.selectList(new LambdaQueryWrapper<RobotTaskDO>()
|
||||||
|
.in(RobotTaskDO::getId, taskIds));
|
||||||
|
|
||||||
|
Map<Long, List<RobotTaskDetailDO>> taskIdMap =
|
||||||
|
detailDOS.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getRobotTaskId));
|
||||||
|
|
||||||
|
String incrementByKey = redisUtil.getIncrementByKey(RobotCacheLockEnum.TASK_NO.getKey());
|
||||||
|
|
||||||
|
List<RobotTaskDO> taskDOList = new ArrayList<>();
|
||||||
|
List<RobotTaskDetailDO> taskDetailList = new ArrayList<>();
|
||||||
|
for (RobotTaskDO v : taskList) {
|
||||||
|
RobotTaskDO taskData = getTaskData(incrementByKey, v);
|
||||||
|
List<RobotTaskDetailDO> taskDetailDOS = getTaskDetailData(taskData,taskIdMap,v.getId());
|
||||||
|
taskDOList.add(taskData);
|
||||||
|
taskDetailList.addAll(taskDetailDOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
taskMapper.insertBatch(taskDOList);
|
||||||
|
taskDetailMapper.insertBatch(taskDetailList);
|
||||||
|
|
||||||
|
List<Long> fromLocationIds = taskDetailList.stream().map(RobotTaskDetailDO::getFromLocationId).collect(Collectors.toList());
|
||||||
|
List<Long> toLocationIds = taskDetailList.stream().map(RobotTaskDetailDO::getToLocationId).collect(Collectors.toList());
|
||||||
|
List<Long> locationIds = new ArrayList<>();
|
||||||
|
locationIds.addAll(fromLocationIds);
|
||||||
|
locationIds.addAll(toLocationIds);
|
||||||
|
|
||||||
|
List<List<Long>> fromPartition = Lists.partition(locationIds, 100);
|
||||||
|
fromPartition.forEach(list -> {
|
||||||
|
locationMapper.updateLocationLockList(list, -1l, LocationLockEnum.NO.getType());
|
||||||
|
});
|
||||||
|
|
||||||
|
List<RobotTaskDetailAddVO> bean = BeanUtils.toBean(taskDetailList, RobotTaskDetailAddVO.class);
|
||||||
|
Map<Long, List<RobotTaskDetailAddVO>> taskDetailMap =
|
||||||
|
bean.stream().collect(Collectors.groupingBy(RobotTaskDetailAddVO::getRobotTaskId));
|
||||||
|
taskDetailMap.forEach((k,v) ->{
|
||||||
|
robotTaskService.addCycle(k,v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<RobotTaskDetailDO> getTaskDetailData(RobotTaskDO taskData, Map<Long,
|
||||||
|
List<RobotTaskDetailDO>> taskIdMap, Long id) {
|
||||||
|
|
||||||
|
List<RobotTaskDetailDO> taskDetailDOList = new ArrayList<>();
|
||||||
|
List<RobotTaskDetailDO> taskDetailDOS = taskIdMap.get(id);
|
||||||
|
for (RobotTaskDetailDO v : taskDetailDOS) {
|
||||||
|
RobotTaskDetailDO build = RobotTaskDetailDO.builder()
|
||||||
|
.robotTaskId(taskData.getId())
|
||||||
|
.taskType(v.getTaskType())
|
||||||
|
.releaseType(v.getTakeType())
|
||||||
|
.takeType(v.getReleaseType())
|
||||||
|
.releaseId(v.getTakeId())
|
||||||
|
.takeId(v.getReleaseId())
|
||||||
|
.fromLocationNo(v.getToLocationNo())
|
||||||
|
.fromLocationId(v.getToLocationId())
|
||||||
|
.fromLaneId(v.getToLaneId())
|
||||||
|
.toLaneId(v.getFromLaneId())
|
||||||
|
.toLocationNo(v.getFromLocationNo())
|
||||||
|
.toLocationId(v.getFromLocationId())
|
||||||
|
.fromLocationStorey(v.getToLocationStorey())
|
||||||
|
.toLocationStorey(v.getFromLocationStorey())
|
||||||
|
.priority(v.getPriority())
|
||||||
|
.taskStatus(RobotTaskDetailStatusEnum.NEW.getType())
|
||||||
|
.taskStage(0l)
|
||||||
|
.needLock(v.getNeedLock())
|
||||||
|
.startTime(null)
|
||||||
|
.endTime(null)
|
||||||
|
.fromLocationNumber(v.getToLocationNumber())
|
||||||
|
.toLocationNumber(v.getFromLocationNumber())
|
||||||
|
.fromMapItemId(v.getToMapItemId())
|
||||||
|
.toMapItemId(v.getFromMapItemId())
|
||||||
|
.build();
|
||||||
|
taskDetailDOList.add(build);
|
||||||
|
}
|
||||||
|
|
||||||
|
return taskDetailDOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置任务主表数据
|
||||||
|
* @param incrementByKey
|
||||||
|
* @param v
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public RobotTaskDO getTaskData(String incrementByKey, RobotTaskDO v ) {
|
||||||
|
String taskNoStr = taskNo + DateUtils.getYearMonthDay() + incrementByKey;
|
||||||
|
RobotTaskDO task = new RobotTaskDO();
|
||||||
|
BeanUtils.copyProperties(v, task);
|
||||||
|
task.setRemainingCycleNumber(v.getRemainingCycleNumber() - 1);
|
||||||
|
task.setTaskNo(taskNoStr);
|
||||||
|
task.setTaskStatus(RobotTaskStatusEnum.NEW.getType());
|
||||||
|
task.setTaskStage(0l);
|
||||||
|
task.setStartTime(null);
|
||||||
|
task.setEndTime(null);
|
||||||
|
task.setCreateTime(LocalDateTime.now());
|
||||||
|
task.setUpdateTime(LocalDateTime.now());
|
||||||
|
task.setId(getId());
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -192,7 +192,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
|
|
||||||
//不拼接
|
//不拼接
|
||||||
List<Long> singleTaskIds =taskDOList.stream()
|
List<Long> singleTaskIds =taskDOList.stream()
|
||||||
.filter(v -> MontageTaskEnum.YES.getType().equals(v.getMontageTask()))
|
.filter(v -> MontageTaskEnum.NO.getType().equals(v.getMontageTask()))
|
||||||
.map(RobotTaskDO::getId)
|
.map(RobotTaskDO::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
@ -366,9 +366,6 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
if (ObjectUtil.isNotEmpty(updateTaskDetails)) {
|
if (ObjectUtil.isNotEmpty(updateTaskDetails)) {
|
||||||
robotTaskDetailMapper.updateBatch(updateTaskDetails);
|
robotTaskDetailMapper.updateBatch(updateTaskDetails);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(robotNos)) {
|
|
||||||
robotInformationMapper.updateRobotListStatus(robotNos, RobotStatusEnum.DOING.getType());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -664,7 +661,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
taskNigth.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
taskNigth.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
||||||
List<Pose2ds> pose2dsNight = new ArrayList<>();
|
List<Pose2ds> pose2dsNight = new ArrayList<>();
|
||||||
|
|
||||||
WareHouseLocationDO ware = WareHouseLocationDO.builder()
|
/* WareHouseLocationDO ware = WareHouseLocationDO.builder()
|
||||||
.laneId(-2l)
|
.laneId(-2l)
|
||||||
.build();
|
.build();
|
||||||
List<WareHouseLocationDO> releaseStockList =
|
List<WareHouseLocationDO> releaseStockList =
|
||||||
@ -672,7 +669,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
for (WareHouseLocationDO wareHouseLocationDO : releaseStockList) {
|
for (WareHouseLocationDO wareHouseLocationDO : releaseStockList) {
|
||||||
Pose2ds pose = positionMapItemMapper.selectByLocationId(wareHouseLocationDO.getId());
|
Pose2ds pose = positionMapItemMapper.selectByLocationId(wareHouseLocationDO.getId());
|
||||||
pose2dsNight.add(pose);
|
pose2dsNight.add(pose);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// taskNigth.setPose2ds(pose2dsNight);
|
// taskNigth.setPose2ds(pose2dsNight);
|
||||||
|
@ -192,7 +192,7 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
|||||||
|
|
||||||
List<List<Long>> fromPartition = Lists.partition(locationIds, 100);
|
List<List<Long>> fromPartition = Lists.partition(locationIds, 100);
|
||||||
fromPartition.forEach(list-> {
|
fromPartition.forEach(list-> {
|
||||||
locationMapper.updateLocationLockList(list,0l,LocationLockEnum.NO.getType());
|
// locationMapper.updateLocationLockList(list,0l,LocationLockEnum.NO.getType());
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo 搬运任务下发给机器人
|
// todo 搬运任务下发给机器人
|
||||||
|
@ -254,7 +254,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
} else if (ObjectUtil.isNotEmpty(taskDetailDO.getFromLocationId())
|
} else if (ObjectUtil.isNotEmpty(taskDetailDO.getFromLocationId())
|
||||||
&& ObjectUtil.isEmpty(taskDetailDO.getFromLaneId())) {
|
&& ObjectUtil.isEmpty(taskDetailDO.getFromLaneId())) {
|
||||||
//取的是普通点位
|
//取的是普通点位
|
||||||
pathPlanning.setTakeGroupId("POINT_" + taskDetailDO.getFromMapId());
|
pathPlanning.setTakeGroupId("POINT_" + taskDetailDO.getFromMapItemId());
|
||||||
pathPlanning.setTakeLocationNumber(Math.abs(locationNumberReduce - taskDetailDO.getFromLocationNumber()));
|
pathPlanning.setTakeLocationNumber(Math.abs(locationNumberReduce - taskDetailDO.getFromLocationNumber()));
|
||||||
pathPlanning.setTakePointId(locationDOMap.get(taskDetailDO.getFromLocationId()).getMapItemId());
|
pathPlanning.setTakePointId(locationDOMap.get(taskDetailDO.getFromLocationId()).getMapItemId());
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
} else if (ObjectUtil.isNotEmpty(taskDetailDO.getToLocationId())
|
} else if (ObjectUtil.isNotEmpty(taskDetailDO.getToLocationId())
|
||||||
&& ObjectUtil.isEmpty(taskDetailDO.getToLaneId())) {
|
&& ObjectUtil.isEmpty(taskDetailDO.getToLaneId())) {
|
||||||
//放的是普通点位
|
//放的是普通点位
|
||||||
pathPlanning.setReleaseGroupId("POINT_" + taskDetailDO.getToMapId());
|
pathPlanning.setReleaseGroupId("POINT_" + taskDetailDO.getToMapItemId());
|
||||||
pathPlanning.setReleaseLocationNumber(taskDetailDO.getToLocationNumber());
|
pathPlanning.setReleaseLocationNumber(taskDetailDO.getToLocationNumber());
|
||||||
pathPlanning.setReleasePointId(locationDOMap.get(taskDetailDO.getToLocationId()).getMapItemId());
|
pathPlanning.setReleasePointId(locationDOMap.get(taskDetailDO.getToLocationId()).getMapItemId());
|
||||||
}
|
}
|
||||||
@ -340,8 +340,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
|| RobotTaskTypeEnum.RELEASE.getType().equals(detail.getTaskType())) {
|
|| RobotTaskTypeEnum.RELEASE.getType().equals(detail.getTaskType())) {
|
||||||
laneIds.add(detail.getFromLaneId());
|
laneIds.add(detail.getFromLaneId());
|
||||||
laneIds.add(detail.getToLaneId());
|
laneIds.add(detail.getToLaneId());
|
||||||
mapIds.add(detail.getFromMapId());
|
mapIds.add(detail.getFromMapItemId());
|
||||||
mapIds.add(detail.getToMapId());
|
mapIds.add(detail.getToMapItemId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,8 +352,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
&& !laneIds.contains(v.getToLaneId())
|
&& !laneIds.contains(v.getToLaneId())
|
||||||
&& !RobotTaskTypeEnum.PARK.getType().equals(v.getTaskType()) //停车在充电的任务做
|
&& !RobotTaskTypeEnum.PARK.getType().equals(v.getTaskType()) //停车在充电的任务做
|
||||||
&& !RobotTaskTypeEnum.CHARGE.getType().equals(v.getTaskType()) //停车在充电的任务做
|
&& !RobotTaskTypeEnum.CHARGE.getType().equals(v.getTaskType()) //停车在充电的任务做
|
||||||
&& !mapIds.contains(v.getFromMapId())
|
&& !mapIds.contains(v.getFromMapItemId())
|
||||||
&& !mapIds.contains(v.getToMapId()))
|
&& !mapIds.contains(v.getToMapItemId()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(detailDOS)) {
|
if (ObjectUtil.isEmpty(detailDOS)) {
|
||||||
@ -375,15 +375,15 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
|
|
||||||
//取货点位--最小
|
//取货点位--最小
|
||||||
Map<Long, Long> fromLocationMap = detailDOS.stream()
|
Map<Long, Long> fromLocationMap = detailDOS.stream()
|
||||||
.filter(v -> ObjectUtil.isNotEmpty(v.getFromMapId()))
|
.filter(v -> ObjectUtil.isNotEmpty(v.getFromMapItemId()))
|
||||||
.collect(Collectors.groupingBy(RobotTaskDetailDO::getFromMapId,
|
.collect(Collectors.groupingBy(RobotTaskDetailDO::getFromMapItemId,
|
||||||
Collectors.collectingAndThen(Collectors.minBy(Comparator.comparingLong(RobotTaskDetailDO::getFromLocationNumber)),
|
Collectors.collectingAndThen(Collectors.minBy(Comparator.comparingLong(RobotTaskDetailDO::getFromLocationNumber)),
|
||||||
a -> a.isPresent() ? a.get().getFromLocationNumber() : null)));
|
a -> a.isPresent() ? a.get().getFromLocationNumber() : null)));
|
||||||
|
|
||||||
//放货点位--最大
|
//放货点位--最大
|
||||||
Map<Long, Long> toLocationMap = detailDOS.stream()
|
Map<Long, Long> toLocationMap = detailDOS.stream()
|
||||||
.filter(v -> ObjectUtil.isNotEmpty(v.getToMapId()))
|
.filter(v -> ObjectUtil.isNotEmpty(v.getToMapItemId()))
|
||||||
.collect(Collectors.groupingBy(RobotTaskDetailDO::getToMapId,
|
.collect(Collectors.groupingBy(RobotTaskDetailDO::getToMapItemId,
|
||||||
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)),
|
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)),
|
||||||
a -> a.isPresent() ? a.get().getToLocationNumber() : null)));
|
a -> a.isPresent() ? a.get().getToLocationNumber() : null)));
|
||||||
|
|
||||||
@ -392,14 +392,14 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
for (RobotTaskDetailDO v : detailDOS) {
|
for (RobotTaskDetailDO v : detailDOS) {
|
||||||
RobotTaskDetailDO fromLane = ObjectUtil.isNotEmpty(v.getFromLaneId()) ? fromLaneMap.get(v.getFromLaneId()) : null;
|
RobotTaskDetailDO fromLane = ObjectUtil.isNotEmpty(v.getFromLaneId()) ? fromLaneMap.get(v.getFromLaneId()) : null;
|
||||||
RobotTaskDetailDO toLane = ObjectUtil.isNotEmpty(v.getToLaneId()) ? toLaneMap.get(v.getToLaneId()) : null;
|
RobotTaskDetailDO toLane = ObjectUtil.isNotEmpty(v.getToLaneId()) ? toLaneMap.get(v.getToLaneId()) : null;
|
||||||
Long fromLocation = ObjectUtil.isNotEmpty(v.getFromMapId()) ? fromLocationMap.get(v.getFromMapId()) : null;
|
Long fromLocation = ObjectUtil.isNotEmpty(v.getFromMapItemId()) ? fromLocationMap.get(v.getFromMapItemId()) : null;
|
||||||
Long toLocation = ObjectUtil.isNotEmpty(v.getToMapId()) ? toLocationMap.get(v.getToMapId()) : null;
|
Long toLocation = ObjectUtil.isNotEmpty(v.getToMapItemId()) ? toLocationMap.get(v.getToMapItemId()) : null;
|
||||||
//校验放货线库,有取的任务
|
//校验放货线库,有取的任务
|
||||||
RobotTaskDetailDO fromLaneDoRelease = ObjectUtil.isNotEmpty(v.getToLaneId()) ? fromLaneMap.get(v.getToLaneId()) : null;
|
RobotTaskDetailDO fromLaneDoRelease = ObjectUtil.isNotEmpty(v.getToLaneId()) ? fromLaneMap.get(v.getToLaneId()) : null;
|
||||||
//校验放的普通库位,有取的任务
|
//校验放的普通库位,有取的任务
|
||||||
Long toHaveFrom = ObjectUtil.isNotEmpty(v.getToMapId()) ? fromLocationMap.get(v.getToMapId()) : null;
|
Long toHaveFrom = ObjectUtil.isNotEmpty(v.getToMapItemId()) ? fromLocationMap.get(v.getToMapItemId()) : null;
|
||||||
//校验取货库位,有放的任务
|
//校验取货库位,有放的任务
|
||||||
Long fromHaveTo = ObjectUtil.isNotEmpty(v.getFromMapId()) ? toLocationMap.get(v.getFromMapId()) : null;
|
Long fromHaveTo = ObjectUtil.isNotEmpty(v.getFromMapItemId()) ? toLocationMap.get(v.getFromMapItemId()) : null;
|
||||||
|
|
||||||
//取放模式
|
//取放模式
|
||||||
if (RobotTaskTypeEnum.TAKE_RELEASE.getType().equals(v.getTaskType())) {
|
if (RobotTaskTypeEnum.TAKE_RELEASE.getType().equals(v.getTaskType())) {
|
||||||
@ -694,7 +694,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
taskNigth.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
taskNigth.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
||||||
List<Pose2ds> pose2dsNight = new ArrayList<>();
|
List<Pose2ds> pose2dsNight = new ArrayList<>();
|
||||||
|
|
||||||
WareHouseLocationDO ware = WareHouseLocationDO.builder()
|
/*WareHouseLocationDO ware = WareHouseLocationDO.builder()
|
||||||
.laneId(-2l)
|
.laneId(-2l)
|
||||||
.build();
|
.build();
|
||||||
List<WareHouseLocationDO> releaseStockList =
|
List<WareHouseLocationDO> releaseStockList =
|
||||||
@ -702,7 +702,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
for (WareHouseLocationDO wareHouseLocationDO : releaseStockList) {
|
for (WareHouseLocationDO wareHouseLocationDO : releaseStockList) {
|
||||||
Pose2ds pose = positionMapItemMapper.selectByLocationId(wareHouseLocationDO.getId());
|
Pose2ds pose = positionMapItemMapper.selectByLocationId(wareHouseLocationDO.getId());
|
||||||
pose2dsNight.add(pose);
|
pose2dsNight.add(pose);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// taskNigth.setPose2ds(pose2dsNight);
|
// taskNigth.setPose2ds(pose2dsNight);
|
||||||
|
@ -250,4 +250,6 @@ zn:
|
|||||||
robot_chearg: #机器人充电的配置
|
robot_chearg: #机器人充电的配置
|
||||||
release_location_number_config: 50 #同一组序号,越大越先执行
|
release_location_number_config: 50 #同一组序号,越大越先执行
|
||||||
priority_config: 50 #优先级
|
priority_config: 50 #优先级
|
||||||
|
task: #任务相关的配置
|
||||||
|
check_sku_info: true #校验物料信息
|
||||||
|
|
||||||
|
@ -496,47 +496,90 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
<update id="releaseLocationLockList">
|
||||||
|
update
|
||||||
|
ware_house_location
|
||||||
|
set
|
||||||
|
location_lock = #{locationLock}
|
||||||
|
where
|
||||||
|
task_id = #{taskId}
|
||||||
|
and location_lock = '0'
|
||||||
|
and id in
|
||||||
|
<foreach collection="locationIds" item="id" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectByTypeAndId" resultMap="BaseResultMap">
|
<select id="selectByTypeAndId" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="base_sql"></include>
|
<include refid="base_sql"></include>
|
||||||
from
|
from
|
||||||
ware_house_location
|
ware_house_location t1
|
||||||
<where>
|
<where>
|
||||||
<if test= " locationUseStatus != null ">
|
<if test= " locationUseStatus != null ">
|
||||||
AND location_use_status = #{locationUseStatus}
|
AND t1.location_use_status = #{locationUseStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test= "takeType != null and takeType == '1'.toString()">
|
<if test= "takeType != null and takeType == '1'.toString()">
|
||||||
AND id = #{id}
|
AND t1.id = #{id}
|
||||||
</if>
|
</if>
|
||||||
<if test= "takeType != null and takeType == '2'.toString()">
|
<if test= "takeType != null and takeType == '2'.toString()">
|
||||||
AND lane_id = #{id}
|
AND t1.lane_id = #{id}
|
||||||
</if>
|
</if>
|
||||||
<if test= "takeType != null and takeType == '3'.toString()">
|
<if test= "takeType != null and takeType == '3'.toString()">
|
||||||
AND area_id = #{id}
|
AND t1.area_id = #{id}
|
||||||
</if>
|
</if>
|
||||||
<if test= " locationIds != null and locationIds.size() > 0">
|
<if test= " locationIds != null and locationIds.size() > 0">
|
||||||
AND id not in
|
AND t1.id not in
|
||||||
<foreach collection="locationIds" item="id" index="index" open="(" close=")"
|
<foreach collection="locationIds" item="id" index="index" open="(" close=")"
|
||||||
separator=",">
|
separator=",">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test= " mapIds != null and mapIds.size() > 0">
|
<if test= " mapIds != null and mapIds.size() > 0">
|
||||||
AND map_id in
|
AND t1.map_id in
|
||||||
<foreach collection="mapIds" item="mapId" index="index" open="(" close=")"
|
<foreach collection="mapIds" item="mapId" index="index" open="(" close=")"
|
||||||
separator=",">
|
separator=",">
|
||||||
#{mapId}
|
#{mapId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test= '"1"=="1"'>
|
<if test= '"1"=="1"'>
|
||||||
AND location_enable = '1'
|
AND t1.location_enable = '1'
|
||||||
AND location_lock = '1'
|
AND t1.location_lock = '1'
|
||||||
AND location_type = '0'
|
AND t1.location_type = '0'
|
||||||
|
</if>
|
||||||
|
<if test= "locationUseStatus != null and locationUseStatus == '0'.toString()">
|
||||||
|
AND ((t1.lane_id > 0
|
||||||
|
and t1.location_number < (SELECT IFNULL(min( t2.location_number ) ,10000000000) from ware_house_location t2
|
||||||
|
where t1.lane_id = t2.lane_id
|
||||||
|
AND t2.location_type = '0'
|
||||||
|
AND (t2.location_use_status = '1' or t2.location_enable = '0' or t2.location_lock = '0'))
|
||||||
|
) or t1.lane_id is null)
|
||||||
|
</if>
|
||||||
|
<if test= " takeMapItemIds != null and takeMapItemIds.size() > 0">
|
||||||
|
AND t1.map_item_id not in
|
||||||
|
<foreach collection="takeMapItemIds" item="mapItemId" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{mapItemId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test= " laneIds != null and laneIds.size() > 0">
|
||||||
|
AND t1.lane_id in
|
||||||
|
<foreach collection="laneIds" item="laneId" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{laneId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test= " areaIds != null and areaIds.size() > 0">
|
||||||
|
AND t1.area_id in
|
||||||
|
<foreach collection="areaIds" item="areaId" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{areaId}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by location_number desc , location_storey asc
|
order by t1.location_number desc , t1.location_storey asc
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -642,8 +685,29 @@
|
|||||||
#{mapId}
|
#{mapId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="laneIds != null and laneIds.size() > 0">
|
||||||
|
and lane_id in
|
||||||
|
<foreach collection="laneIds" item="item" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="areaIds != null and areaIds.size() > 0">
|
||||||
|
and area_id in
|
||||||
|
<foreach collection="areaIds" item="item" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="mapItemIds != null and mapItemIds.size() > 0">
|
||||||
|
and map_item_id not in
|
||||||
|
<foreach collection="mapItemIds" item="item" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by id asc
|
order by location_number asc
|
||||||
</select>
|
</select>
|
||||||
<select id="getLocationByName" resultType="cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO">
|
<select id="getLocationByName" resultType="cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO">
|
||||||
<choose>
|
<choose>
|
||||||
|
@ -267,11 +267,7 @@
|
|||||||
set
|
set
|
||||||
robot_status = #{robotStatus}
|
robot_status = #{robotStatus}
|
||||||
where
|
where
|
||||||
robot_no in
|
robot_no = #{robotNo}
|
||||||
<foreach collection="robotNos" item="robotNo" index="index" open="(" close=")"
|
|
||||||
separator=",">
|
|
||||||
#{robotNo}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!--通过主键删除-->
|
<!--通过主键删除-->
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<result property="toLaneId" column="to_lane_id" jdbcType="INTEGER"/>
|
<result property="toLaneId" column="to_lane_id" jdbcType="INTEGER"/>
|
||||||
<result property="fromLocationNumber" column="from_location_number" jdbcType="INTEGER"/>
|
<result property="fromLocationNumber" column="from_location_number" jdbcType="INTEGER"/>
|
||||||
<result property="toLocationNumber" column="to_location_number" jdbcType="INTEGER"/>
|
<result property="toLocationNumber" column="to_location_number" jdbcType="INTEGER"/>
|
||||||
<result property="fromMapId" column="from_map_id" jdbcType="INTEGER"/>
|
<result property="fromMapItemId" column="from_map_item_id" jdbcType="INTEGER"/>
|
||||||
<result property="toMapId" column="to_map_id" jdbcType="INTEGER"/>
|
<result property="toMapItemId" column="to_map_item_id" jdbcType="INTEGER"/>
|
||||||
<result property="toLocationNo" column="to_location_no" jdbcType="VARCHAR"/>
|
<result property="toLocationNo" column="to_location_no" jdbcType="VARCHAR"/>
|
||||||
<result property="toLocationId" column="to_location_id" jdbcType="INTEGER"/>
|
<result property="toLocationId" column="to_location_id" jdbcType="INTEGER"/>
|
||||||
<result property="fromLocationStorey" column="from_location_storey" jdbcType="INTEGER"/>
|
<result property="fromLocationStorey" column="from_location_storey" jdbcType="INTEGER"/>
|
||||||
@ -69,8 +69,8 @@
|
|||||||
priority,
|
priority,
|
||||||
from_location_number,
|
from_location_number,
|
||||||
to_location_number,
|
to_location_number,
|
||||||
from_map_id,
|
from_map_item_id,
|
||||||
to_map_id
|
to_map_item_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
@ -197,20 +197,55 @@
|
|||||||
and t2.task_type = '3'
|
and t2.task_type = '3'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTakeMapItemIds" resultType="java.lang.Long">
|
||||||
|
select
|
||||||
|
t2.map_item_id
|
||||||
|
from
|
||||||
|
robot_task_detail t1, ware_house_location t2
|
||||||
|
where
|
||||||
|
t1.from_location_id = t2.id
|
||||||
|
and t1.task_status in ('0','1')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReleaseMapItemIds" resultType="java.lang.Long">
|
||||||
|
select
|
||||||
|
t2.map_item_id
|
||||||
|
from
|
||||||
|
robot_task_detail t1, ware_house_location t2
|
||||||
|
where
|
||||||
|
t1.to_location_id = t2.id
|
||||||
|
and t1.task_status in ('0','1')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAutoCreateCycleTask"
|
||||||
|
resultType="cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO">
|
||||||
|
select
|
||||||
|
t1.*
|
||||||
|
from
|
||||||
|
robot_task_detail t1, robot_task t2
|
||||||
|
where
|
||||||
|
t2.id = t1.robot_task_id
|
||||||
|
and t2.remaining_cycle_number > 1
|
||||||
|
and t2.task_status = '2'
|
||||||
|
and t1.task_status = '2'
|
||||||
|
and t1.deleted = '0'
|
||||||
|
and t2.deleted = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!--keyProperty="id" useGeneratedKeys="true"-->
|
<!--keyProperty="id" useGeneratedKeys="true"-->
|
||||||
<insert id="insertBatchList" >
|
<insert id="insertBatchList" >
|
||||||
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
|
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
|
||||||
from_location_no, from_location_id, to_location_no, to_location_id, robot_no,from_location_storey,
|
from_location_no, from_location_id, to_location_no, to_location_id, robot_no,from_location_storey,
|
||||||
to_location_storey,priority,from_lane_id,to_lane_id,from_location_number,to_location_number,
|
to_location_storey,priority,from_lane_id,to_lane_id,from_location_number,to_location_number,
|
||||||
from_map_id,to_map_id)
|
from_map_item_id,to_map_item_id)
|
||||||
values
|
values
|
||||||
<foreach collection="taskDetailList" item="entity" separator=",">
|
<foreach collection="taskDetailList" item="entity" separator=",">
|
||||||
(#{entity.robotTaskId}, #{entity.taskType}, #{entity.releaseType}, #{entity.takeType}, #{entity.releaseId},
|
(#{entity.robotTaskId}, #{entity.taskType}, #{entity.releaseType}, #{entity.takeType}, #{entity.releaseId},
|
||||||
#{entity.takeId}, #{entity.fromLocationNo}, #{entity.fromLocationId}, #{entity.toLocationNo},
|
#{entity.takeId}, #{entity.fromLocationNo}, #{entity.fromLocationId}, #{entity.toLocationNo},
|
||||||
#{entity.toLocationId}, #{entity.robotNo}, #{entity.fromLocationStorey}, #{entity.toLocationStorey}
|
#{entity.toLocationId}, #{entity.robotNo}, #{entity.fromLocationStorey}, #{entity.toLocationStorey}
|
||||||
, #{entity.priority}, #{entity.fromLaneId}, #{entity.toLaneId}, #{entity.fromLocationNumber},
|
, #{entity.priority}, #{entity.fromLaneId}, #{entity.toLaneId}, #{entity.fromLocationNumber},
|
||||||
#{entity.toLocationNumber}, #{entity.fromMapId}, #{entity.toMapId})
|
#{entity.toLocationNumber}, #{entity.fromMapItemId}, #{entity.toMapItemId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.cycle.TaskCycleMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<delete id="deletByRobotTaskId">
|
||||||
|
delete from robot_task_cycle where robot_task_id = #{robotTaskId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user