Compare commits
3 Commits
627a99bf2f
...
c8d229f7c1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c8d229f7c1 | ||
![]() |
5c4dc77269 | ||
![]() |
d59d80517e |
@ -14,6 +14,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -33,6 +34,8 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final String ATTRIBUTE_STOP_WATCH = "ApiAccessLogInterceptor.StopWatch";
|
||||
|
||||
private static final List<String> ignoreInterfaceUrls = Arrays.asList("/rpc-api/system/task/robotStatusUpdate","/rpc-api/system/task/updateRobotCommonStatus");
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
// 记录 HandlerMethod,提供给 ApiAccessLogFilter 使用
|
||||
@ -45,9 +48,9 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor {
|
||||
if (!SpringUtils.isProd()) {
|
||||
Map<String, String> queryString = ServletUtils.getParamMap(request);
|
||||
String requestBody = ServletUtils.isJsonRequest(request) ? ServletUtils.getBody(request) : null;
|
||||
if (CollUtil.isEmpty(queryString) && StrUtil.isEmpty(requestBody)) {
|
||||
if (CollUtil.isEmpty(queryString) && StrUtil.isEmpty(requestBody) && !ignoreInterfaceUrls.contains(request.getRequestURI())) {
|
||||
log.info("[preHandle][开始请求 URL({}) 无参数]", request.getRequestURI());
|
||||
} else {
|
||||
} else if( !ignoreInterfaceUrls.contains(request.getRequestURI())) {
|
||||
log.info("[preHandle][开始请求 URL({}) 参数({})]", request.getRequestURI(),
|
||||
StrUtil.blankToDefault(requestBody, queryString.toString()));
|
||||
}
|
||||
@ -67,8 +70,10 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor {
|
||||
if (!SpringUtils.isProd()) {
|
||||
StopWatch stopWatch = (StopWatch) request.getAttribute(ATTRIBUTE_STOP_WATCH);
|
||||
stopWatch.stop();
|
||||
log.info("[afterCompletion][完成请求 URL({}) 耗时({} ms)]",
|
||||
request.getRequestURI(), stopWatch.getTotalTimeMillis());
|
||||
if( !ignoreInterfaceUrls.contains(request.getRequestURI())) {
|
||||
log.info("[afterCompletion][完成请求 URL({}) 耗时({} ms)]",
|
||||
request.getRequestURI(), stopWatch.getTotalTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +99,7 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor {
|
||||
return;
|
||||
}
|
||||
// 打印结果
|
||||
System.out.printf("\tController 方法路径:%s(%s.java:%d)\n", clazz.getName(), clazz.getSimpleName(), lineNumber.get());
|
||||
// System.out.printf("\tController 方法路径:%s(%s.java:%d)\n", clazz.getName(), clazz.getSimpleName(), lineNumber.get());
|
||||
} catch (Exception ignore) {
|
||||
// 忽略异常。原因:仅仅打印,非重要逻辑
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class MqttFactory {
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
// 是否清空session,设置false表示服务器会保留客户端的连接记录(订阅主题,qos),客户端重连之后能获取到服务器在客户端断开连接期间推送的消息
|
||||
// 设置为true表示每次连接服务器都是以新的身份
|
||||
options.setCleanSession(true);
|
||||
options.setCleanSession(false);
|
||||
// 设置连接用户名
|
||||
options.setUserName(factory.config.getUsername());
|
||||
// 设置连接密码
|
||||
|
@ -31,7 +31,7 @@ management:
|
||||
|
||||
# MQTT
|
||||
mqtt:
|
||||
# host: tcp://192.168.0.54:1883
|
||||
# host: tcp://123.57.12.40:1883
|
||||
host: tcp://127.0.0.1:1883
|
||||
username: adminuser
|
||||
password: adminuser
|
||||
|
@ -193,6 +193,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ROBOT_NOT_FOUND_WAIT_ITEM = new ErrorCode(1-002-034-006, "没有空闲的停车点");
|
||||
ErrorCode ROBOT_NOT_FOUND_FREE_CHARGING_STATION = new ErrorCode(1-002-034-007, "没有空闲的充电桩");
|
||||
ErrorCode ROBOT_HAVE_DOING_TASK = new ErrorCode(1-002-034-010, "车辆有处理中的任务,不允许修改/删除车辆编号和Mac地址");
|
||||
ErrorCode ROBOT_REJECTION = new ErrorCode(1-002-034-011, "车辆已锁定");
|
||||
|
||||
// ========== 机器人任务主表 1-002-035-000 ==========
|
||||
ErrorCode TASK_NOT_EXISTS = new ErrorCode(1-002-035-001, "机器人任务主表不存在");
|
||||
@ -203,7 +204,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TASK_CHECK_ID_EXCEPTION = new ErrorCode(1-002-035-006, "请输入ID");
|
||||
ErrorCode TASK_CHECK_TASK_PRIORITY = new ErrorCode(1-002-035-007, "非新单据不能修改优先级");
|
||||
ErrorCode TASK_CHECK_TASK_STATUS = new ErrorCode(1-002-035-100, "任务已完成");
|
||||
ErrorCode TASK_CHECK_UPDATE_STATUS = new ErrorCode(1-002-035-101, "任务更新失败");
|
||||
ErrorCode TASK_CHECK_HAVE_DOING_TASK = new ErrorCode(1-002-035-101, "存在未完成的任务,无法更新地图信息");
|
||||
ErrorCode TASK_CHECK_EXIST_NO = new ErrorCode(1-002-035-102, "任务号已存在");
|
||||
ErrorCode TASK_TYPE_UN_EXIST = new ErrorCode(1-002-035-103, "找不到对应的任务类型");
|
||||
ErrorCode TASK_TAKE_LOCATION_EMPTY = new ErrorCode(1-002-035-104, "取货库位没有库存");
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
||||
import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotCommandStateDTO;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotCompleteTaskDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotExecutionStateConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
@ -36,6 +37,7 @@ import cn.iocoder.yudao.module.system.service.wait.MoveToWaitService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
@ -46,6 +48,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@ -116,6 +119,11 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + robotCompleteTaskDTO.getMac();
|
||||
|
||||
if (ObjectUtil.isEmpty(robotCompleteTaskDTO.getOrderId())) {
|
||||
log.info("没有任务id :{}",JSON.toJSONString(robotCompleteTaskDTO));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RobotStatusCodeEnum.SUCCESS.getType().equals(robotCompleteTaskDTO.getStatusCode())) {
|
||||
log.info("车机上报异常 :{}", JSON.toJSONString(robotCompleteTaskDTO));
|
||||
closeTask(robotCompleteTaskDTO);//todo 取不了和放不了的异常
|
||||
@ -222,7 +230,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
} else if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
RobotTaskDetailDO robotTaskDetailDO = robotTaskDetailMapper.selectById(robotCompleteTaskDTO.getOrderId());
|
||||
if (RobotTaskStageEnum.TAKEING.getType().equals(robotTaskDetailDO.getTaskStage())) {
|
||||
log.info("告诉路径规划任务完成 :{}, 状态: {}",robotCompleteTaskDTO.getOrderId(),PathIsReachEnum.END_WORK.getType());
|
||||
log.info("告诉路径规划任务完成 :{}, 状态: {}", robotCompleteTaskDTO.getOrderId(), PathIsReachEnum.END_WORK.getType());
|
||||
pathPlanningService.updateBehavior(String.valueOf(robotCompleteTaskDTO.getOrderId()), robotTaskDetailDO.getRobotNo()
|
||||
, "", PathIsReachEnum.END_WORK.getType());
|
||||
} else if (RobotTaskStageEnum.RELEASEING.getType().equals(robotTaskDetailDO.getTaskStage())) {
|
||||
@ -299,8 +307,8 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
|
||||
String solve = "";
|
||||
if (!PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
&& !PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()) ) {
|
||||
String taskNo= taskDetailService.getTaskNoByDetailId(robotCompleteTaskDTO.getOrderId());
|
||||
&& !PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
String taskNo = taskDetailService.getTaskNoByDetailId(robotCompleteTaskDTO.getOrderId());
|
||||
solve = " 并且到任务列表关闭任务 " + taskNo;
|
||||
}
|
||||
|
||||
@ -344,6 +352,12 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
logOne.setTaskStage(RobotTaskStageEnum.CHARGEING.getType());
|
||||
}
|
||||
|
||||
//编辑地图会判断这表的状态,所以自动充电任务,移动到充电点就改为完成
|
||||
if (ObjectUtil.isNotEmpty(commandStatus) && CommandTypeEnum.MOVE_POSES.getType().equals(commandStatus.getCommandType())
|
||||
&& RobotExecutionStateConstant.DONE.equals(commandStatus.getExecutionState())) {
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
||||
}
|
||||
|
||||
String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac());
|
||||
logOne.setRobotNo(robotNo);
|
||||
logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId());
|
||||
@ -474,6 +488,13 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
}
|
||||
}
|
||||
|
||||
//编辑地图会判断这表的状态,所以自动充电任务,移动到充电点就改为完成
|
||||
if (ObjectUtil.isNotEmpty(commandStatus) && CommandTypeEnum.MOVE_POSES.getType().equals(commandStatus.getCommandType())
|
||||
&& RobotExecutionStateConstant.DONE.equals(commandStatus.getExecutionState())
|
||||
&& PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
||||
}
|
||||
|
||||
String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac());
|
||||
logOne.setRobotNo(robotNo);
|
||||
logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId());
|
||||
@ -522,10 +543,15 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void robotDoneTask(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
||||
taskExecutor.execute(() -> {
|
||||
doRobotDoneTask(robotCompleteTaskDTO);
|
||||
String requestId = UUID.randomUUID().toString().replace("-","");;
|
||||
MDC.put(CommonConstant.REQUEST_ID, requestId);
|
||||
try {
|
||||
doRobotDoneTask(robotCompleteTaskDTO);
|
||||
} finally {
|
||||
MDC.clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.system.config.mdc;
|
||||
|
||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 在日志上下文增加参数,在日志中可以打印该参数,如RequestId,则日志配置:%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{RequestId}] [%thread] %-5level %logger{36} - %msg%n
|
||||
* 则 RequestId 会打印在中括号里,%X{参数名} 是格式
|
||||
*
|
||||
* 该bean自动被注册,默认的mapping是/*,参考文档
|
||||
*
|
||||
* 如果需要复杂点的配置,例如多个Filter的顺序、mapping路径的指定,可以在@Configuration类里使用@Bean来产生所需的bean,产生的过程即可指定顺序和mapping路径
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class MDCFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
String requestId = UUID.randomUUID().toString().replace("-","");;
|
||||
MDC.put(CommonConstant.REQUEST_ID, requestId);
|
||||
try {
|
||||
chain.doFilter(request, response);
|
||||
} finally {
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.system.config.mdc;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.After;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class MDCJobAopConfig {
|
||||
private static final String REQUEST_ID = "requestId";
|
||||
|
||||
/**
|
||||
* xxl-job 切点
|
||||
*/
|
||||
@Pointcut("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
|
||||
public void pointCutExecution() {}
|
||||
|
||||
@Before("pointCutExecution()")
|
||||
public void doBefore(JoinPoint point) {
|
||||
// 增加xxl-job任务的链式日志id
|
||||
MDC.put(REQUEST_ID, UUID.randomUUID().toString().replace("-", ""));
|
||||
}
|
||||
|
||||
@After("pointCutExecution()")
|
||||
public void doAfter(JoinPoint point) {
|
||||
// xxl-job任务结束,MDC移除
|
||||
MDC.remove(REQUEST_ID);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.system.constant;
|
||||
|
||||
|
||||
public class CommonConstant {
|
||||
/**
|
||||
* MDC请求常亮
|
||||
*/
|
||||
public static final String REQUEST_ID = "requestId";
|
||||
}
|
@ -11,11 +11,17 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.system.api.path.PathApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionMapItemNodeDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapLineSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapLineDO;
|
||||
import cn.iocoder.yudao.module.system.handler.mapnode.NodeProcessingContext;
|
||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapLineService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -43,12 +49,19 @@ public class PositionMapItemController {
|
||||
|
||||
@Resource
|
||||
private PositionMapItemService positionMapItemService;
|
||||
|
||||
@Resource
|
||||
private NodeProcessingContext nodeProcessingContext;
|
||||
|
||||
@Resource
|
||||
private UserOperationLogService userOperationLogService;
|
||||
|
||||
@Resource
|
||||
private PositionMapLineService positionMapLineService;
|
||||
|
||||
@Resource
|
||||
private RobotTaskService taskService;
|
||||
|
||||
@Resource
|
||||
private PathApi pathApi;
|
||||
|
||||
@ -56,6 +69,8 @@ public class PositionMapItemController {
|
||||
@PostMapping("/batchSaveOrEditOrDel")
|
||||
@Operation(summary = "批量新增编辑删除节点")
|
||||
public CommonResult<Boolean> batchSaveOrEditOrDel(@RequestParam Long positionMapId, @Valid @RequestBody List<NodeBaseDTO> nodeBaseDTOS) {
|
||||
//校验是否存在未完成的任务
|
||||
taskService.checkHaveDoingTask();
|
||||
// -- 这里使用策略模式 - 根据各个类型区分 - 如果需要新增类型,新增策略实现类即可 - 如果不需要关联存储具体的表,直接将json存储到dataJson字段即可
|
||||
Map<Integer, List<NodeBaseDTO>> map = nodeBaseDTOS.stream().collect(Collectors.groupingBy(NodeBaseDTO::getType));
|
||||
// -- 获取到对应地图的所有点位
|
||||
@ -109,4 +124,30 @@ public class PositionMapItemController {
|
||||
.eqIfPresent(PositionMapItemDO::getLaneId, laneId));
|
||||
return success(BeanUtils.toBean(list, PositionMapItemRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getUUid")
|
||||
@Operation(summary = "获取id")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-map-item:getUUid')")
|
||||
public CommonResult<Long> getUUid() {
|
||||
Long id = positionMapItemService.getUUid();
|
||||
return success(id);
|
||||
}
|
||||
|
||||
@PostMapping("/lineAddItem")
|
||||
@Operation(summary = "线上加点保存点位")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-map-item:lineAddItem')")
|
||||
public CommonResult<Boolean> lineAddItem(@Valid @RequestBody List<PositionMapItemNodeDTO> list) {
|
||||
|
||||
PositionMapItemSaveReqVO positionMapItem = BeanUtils.toBean(list.get(0), PositionMapItemSaveReqVO.class);
|
||||
positionMapItemService.createPositionMapItem(positionMapItem);
|
||||
|
||||
positionMapLineService.deletePositionMapLine(list.get(0).getOldLineId());
|
||||
List<PositionMapLineSaveReqVO> positionMapLines = list.get(0).getPositionMapLines();
|
||||
List<PositionMapLineDO> lineList = BeanUtils.toBean(positionMapLines, PositionMapLineDO.class);
|
||||
for (PositionMapLineDO positionMapLineDO : lineList) {
|
||||
positionMapLineDO.setPositionMapId(positionMapItem.getPositionMapId());
|
||||
}
|
||||
positionMapLineService.batchSaveLines(lineList);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapLineSaveReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "仓库点位地图子表")
|
||||
@Data
|
||||
public class PositionMapItemNodeDTO {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "仓库点位地图表id")
|
||||
private Long positionMapId;
|
||||
|
||||
@Schema(description = "库区id(自定义)")
|
||||
private Long areaId;
|
||||
|
||||
@Schema(description = "巷道id(自定义)")
|
||||
private Long laneId;
|
||||
|
||||
@Schema(description = "坐标x轴")
|
||||
private String locationX;
|
||||
|
||||
@Schema(description = "坐标y轴")
|
||||
private String locationY;
|
||||
|
||||
@Schema(description = "实际坐标x轴")
|
||||
private String actualLocationX;
|
||||
|
||||
@Schema(description = "实际坐标y轴")
|
||||
private String actualLocationY;
|
||||
|
||||
@Schema(description = "点位自增排序")
|
||||
private Long sortNum;
|
||||
|
||||
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向})", example = "1")
|
||||
private String dataJson;
|
||||
|
||||
@Schema(description = "排序的位置,越大越优先堆放")
|
||||
private Long locationNumber;
|
||||
|
||||
@Schema(description = " 弧度")
|
||||
private String locationYaw;
|
||||
|
||||
@Schema(description = "旧的线id")
|
||||
private Long oldLineId;
|
||||
|
||||
@Schema(description = "新的路线")
|
||||
private List<PositionMapLineSaveReqVO> positionMapLines;
|
||||
|
||||
}
|
@ -33,21 +33,23 @@ public class TaskAssignDTO {
|
||||
*/
|
||||
public String getRobotActionMsg() {
|
||||
if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(orderType)) {
|
||||
return "机器人分配到取放货任务";
|
||||
return "机器人分配到取放货任务 ";
|
||||
}if (PathTaskTypeEnum.CHARGE.getType().equals(orderType)) {
|
||||
return "机器人分配到充电任务";
|
||||
return "机器人分配到充电任务 ";
|
||||
}if (PathTaskTypeEnum.MOVE.getType().equals(orderType)) {
|
||||
return "机器人分配到移动任务";
|
||||
return "机器人分配到移动任务 ";
|
||||
}if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(orderType)) {
|
||||
return "机器人分配移动到等待点的任务";
|
||||
return "机器人分配移动到等待点的任务 ";
|
||||
}if (PathTaskTypeEnum.MOVE_TO_WAIT_STOP.getType().equals(orderType)) {
|
||||
return "机器人分配停车任务";
|
||||
return "机器人分配停车任务 ";
|
||||
}if (PathTaskTypeEnum.TAKE.getType().equals(orderType)) {
|
||||
return "机器人分配到仅取货任务";
|
||||
return "机器人分配到仅取货任务 ";
|
||||
}if (PathTaskTypeEnum.RELEASE.getType().equals(orderType)) {
|
||||
return "机器人分配到仅放货任务";
|
||||
return "机器人分配到仅放货任务 ";
|
||||
}if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(orderType)) {
|
||||
return "机器人分配到自动充电任务";
|
||||
return "机器人分配到自动充电任务 ";
|
||||
}if (PathTaskTypeEnum.MOVE_TO_POINT.getType().equals(orderType)) {
|
||||
return "机器人分配到移动到点位任务 ";
|
||||
}
|
||||
return "未知任务";
|
||||
}
|
||||
|
@ -56,4 +56,10 @@ public class RobotInformationPageReqVO extends PageParam {
|
||||
@Schema(description = "robot_task_detail的id")
|
||||
private Long taskDetailId;
|
||||
|
||||
@Schema(description = "车辆IP")
|
||||
private String robotIp;
|
||||
|
||||
@Schema(description = "车辆端口")
|
||||
private Long robotPort;
|
||||
|
||||
}
|
@ -90,4 +90,10 @@ public class RobotInformationPageRespVO {
|
||||
@Schema(description = "robot_task_detail的id")
|
||||
private Long taskDetailId;
|
||||
|
||||
@Schema(description = "车辆IP")
|
||||
private String robotIp;
|
||||
|
||||
@Schema(description = "车辆端口")
|
||||
private Long robotPort;
|
||||
|
||||
}
|
||||
|
@ -84,4 +84,10 @@ public class RobotInformationRespVO {
|
||||
@Schema(description = "robot_task_detail的id")
|
||||
private Long taskDetailId;
|
||||
|
||||
@Schema(description = "车辆IP")
|
||||
private String robotIp;
|
||||
|
||||
@Schema(description = "车辆端口")
|
||||
private Long robotPort;
|
||||
|
||||
}
|
@ -2,9 +2,11 @@ package cn.iocoder.yudao.module.system.controller.admin.robot.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 车辆信息新增/修改 Request VO")
|
||||
@ -50,4 +52,12 @@ public class RobotInformationSaveReqVO {
|
||||
|
||||
@Schema(description = "robot_task_detail的id")
|
||||
private Long taskDetailId;
|
||||
|
||||
@Schema(description = "车辆IP")
|
||||
@Size(min = 0, max = 20, message = "车辆IP长度超过限制")
|
||||
private String robotIp;
|
||||
|
||||
@Schema(description = "车辆端口")
|
||||
@Range(min = 0, max = 6, message = "车辆端口长度超过限制")
|
||||
private Long robotPort;
|
||||
}
|
||||
|
@ -78,4 +78,14 @@ public class RobotInformationDO extends BaseDO {
|
||||
*/
|
||||
private Long taskDetailId;
|
||||
|
||||
/**
|
||||
* 车辆IP
|
||||
*/
|
||||
private String robotIp;
|
||||
|
||||
/**
|
||||
* 车辆端口
|
||||
*/
|
||||
private Long robotPort;
|
||||
|
||||
}
|
@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆动作记录 Mapper
|
||||
@ -40,4 +41,11 @@ public interface RobotTaskDetailActionLogMapper extends BaseMapperX<RobotTaskDet
|
||||
void updateActionStatus(@Param("taskDetailId") Long taskDetailId,
|
||||
@Param("actionStatus") int actionStatus,
|
||||
@Param("time") LocalDateTime time);
|
||||
|
||||
/**
|
||||
* 获取未完成的任务
|
||||
* @param commandTypes
|
||||
* @return
|
||||
*/
|
||||
List<RobotTaskDetailActionLogDO> getMistakeTaskByCommandType(@Param("commandTypes") List<String> commandTypes);
|
||||
}
|
@ -4,20 +4,23 @@ import cn.iocoder.yudao.module.system.enums.robot.RobotTaskTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 下发路径规划的任务类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PathTaskTypeEnum {
|
||||
TAKE_RELEASE("TAKE_RELEASE","取放货"),
|
||||
TAKE_RELEASE("TAKE_RELEASE","取放货任务"),
|
||||
CHARGE("CHARGE","充电任务"),
|
||||
MOVE("MOVE","移动任务"),//移动到库位
|
||||
MOVE_TO_WAIT("MOVE_TO_WAIT","移动到等待点(没任务时去等待点)"),
|
||||
MOVE_TO_WAIT_STOP("MOVE_TO_WAIT_STOP","停车任务"),
|
||||
MOVE_TO_POINT("MOVE_TO_POINT","移动到路径点"),
|
||||
TAKE("TAKE","仅取货"),
|
||||
RELEASE("RELEASE","仅放货"),
|
||||
MOVE_TO_POINT("MOVE_TO_POINT","移动到路径点任务"),
|
||||
TAKE("TAKE","仅取货任务"),
|
||||
RELEASE("RELEASE","仅放货任务"),
|
||||
AUTO_CHARGE("AUTO_CHARGE","自动充电");
|
||||
/**
|
||||
* 类型
|
||||
@ -50,4 +53,15 @@ public enum PathTaskTypeEnum {
|
||||
return AUTO_CHARGE.getType();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取非任务的类型
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getMistakeTaskTypes() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(MOVE_TO_WAIT.getType());
|
||||
list.add(AUTO_CHARGE.getType());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -93,9 +93,9 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
|
||||
List<List<WareHouseLocationDO>> list = CollectionUtils.compareLists(oldList, newList,
|
||||
(oldVal, newVal) -> ObjectUtil.equal(oldVal.getId(), newVal.getId()));
|
||||
|
||||
if (isNotEmpty(list.get(2))) {
|
||||
/*if (isNotEmpty(list.get(2))) {
|
||||
checkLocationHaveDoingTask(list);
|
||||
}
|
||||
}*/
|
||||
|
||||
houseLocationService.batchSaveOrEditOrDel(positionMapId, list);
|
||||
}
|
||||
|
@ -64,9 +64,7 @@ public class RobotJob {
|
||||
if (lock.tryLock()){
|
||||
try {
|
||||
robotTaskAutoMoveService.distributeAutoMoveJob();
|
||||
} catch (Exception e) {
|
||||
log.error("下发自动移库任务出现异常 :{}",e);
|
||||
} finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}else {
|
||||
@ -85,9 +83,7 @@ public class RobotJob {
|
||||
try {
|
||||
log.info("----下发自动充电任务----");
|
||||
autoChargeService.autoChargeJob();
|
||||
} catch (Exception e) {
|
||||
log.error("下发自动充电任务出现异常 :{}",e);
|
||||
} finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}else {
|
||||
@ -108,9 +104,7 @@ public class RobotJob {
|
||||
try {
|
||||
log.info("----下发任务给路径规划----");
|
||||
robotPathPlanningService.sendTaskToPP();
|
||||
} catch (Exception e) {
|
||||
log.error("下发任务给路径规划现异常 :{}",e);
|
||||
} finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}else {
|
||||
@ -133,9 +127,7 @@ public class RobotJob {
|
||||
try {
|
||||
log.info("----创建循环任务----");
|
||||
cycleService.cycleTaskJob();
|
||||
} catch (Exception e) {
|
||||
log.error("创建循环任务异常 :{}", e);
|
||||
} finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}else {
|
||||
@ -146,7 +138,7 @@ public class RobotJob {
|
||||
|
||||
|
||||
/**
|
||||
* 维护车机心跳
|
||||
* 维护车机心跳(废弃 目前车机没这功能)
|
||||
*/
|
||||
// @XxlJob("RcsHeartBeat")
|
||||
@TenantJob
|
||||
@ -158,9 +150,7 @@ public class RobotJob {
|
||||
log.info("----维护车机心跳----");
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
informationService.rcsHeartBeat();
|
||||
} catch (Exception e) {
|
||||
log.error("维护车机心跳异常 :{}", e);
|
||||
} finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}else {
|
||||
|
@ -524,6 +524,13 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
simulationRobotPoseDTO.setLocationYaw(itemDOList.get(i).getLocationYaw());
|
||||
simulationRobotPoseDTO.setFloor(positionMap.getFloor()+"");
|
||||
simulationRobotPoseDTO.setArea(positionMap.getArea());
|
||||
|
||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robot.getMacAddress();
|
||||
FloorZoneDTO floorZoneDTO = new FloorZoneDTO();
|
||||
floorZoneDTO.setFloor(simulationRobotPoseDTO.getFloor());
|
||||
floorZoneDTO.setArea(simulationRobotPoseDTO.getArea());
|
||||
redisUtil.set(floorAreaKey, JSON.toJSONString(floorZoneDTO));
|
||||
|
||||
simulationList.add(simulationRobotPoseDTO);
|
||||
i++;
|
||||
}
|
||||
@ -548,6 +555,15 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
.expansionZoneLeft(positionMapLineDO.getExpansionZoneRight())
|
||||
.expansionZoneRight(positionMapLineDO.getExpansionZoneLeft())
|
||||
.ppToward(positionMapLineDO.changeToward(positionMapLineDO.getToward()))
|
||||
.method(positionMapLineDO.getMethod())
|
||||
.actualEndControlX(positionMapLineDO.getActualBeginControlX())
|
||||
.actualEndControlY(positionMapLineDO.getActualBeginControlY())
|
||||
.actualBeginControlX(positionMapLineDO.getActualEndControlX())
|
||||
.actualBeginControlY(positionMapLineDO.getActualEndControlY())
|
||||
.actualEndPointX(positionMapLineDO.getActualStartPointX())
|
||||
.actualEndPointY(positionMapLineDO.getActualStartPointY())
|
||||
.actualStartPointX(positionMapLineDO.getActualEndPointX())
|
||||
.actualStartPointY(positionMapLineDO.getActualEndPointY())
|
||||
.build();
|
||||
return build;
|
||||
}
|
||||
|
@ -118,4 +118,11 @@ public interface PositionMapItemService extends IService<PositionMapItemDO> {
|
||||
* @return
|
||||
*/
|
||||
List<PositionMapItemDO> getPositionMapItemByIds(List<Long> pointList);
|
||||
|
||||
/**
|
||||
* 获取随机数id
|
||||
* @return
|
||||
*/
|
||||
Long getUUid();
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionMapConditionDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -37,11 +41,18 @@ public class PositionMapItemServiceImpl extends ServiceImpl<PositionMapItemMappe
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Resource
|
||||
private UserOperationLogService userOperationLogService;
|
||||
|
||||
@Override
|
||||
public Long createPositionMapItem(PositionMapItemSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PositionMapItemDO positionMapItem = BeanUtils.toBean(createReqVO, PositionMapItemDO.class);
|
||||
positionMapItemMapper.insert(positionMapItem);
|
||||
|
||||
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder().operateAction("添加路径点 " + positionMapItem.getSortNum())
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
// 返回
|
||||
return positionMapItem.getId();
|
||||
}
|
||||
@ -149,4 +160,9 @@ public class PositionMapItemServiceImpl extends ServiceImpl<PositionMapItemMappe
|
||||
.in(PositionMapItemDO::getId, idList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getUUid() {
|
||||
return IdUtil.getSnowflakeNextId();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,4 +62,10 @@ public interface PositionMapLineService extends IService<PositionMapLineDO> {
|
||||
* @param list
|
||||
*/
|
||||
void batchSaveOrEditOrDel(List<List<PositionMapLineDO>> list);
|
||||
|
||||
/**
|
||||
* 批量添加
|
||||
* @param lineList
|
||||
*/
|
||||
void batchSaveLines(List<PositionMapLineDO> lineList);
|
||||
}
|
||||
|
@ -78,4 +78,9 @@ public class PositionMapLineServiceImpl extends ServiceImpl<PositionMapLineMappe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSaveLines(List<PositionMapLineDO> lineList) {
|
||||
positionMapLineMapper.insertBatch(lineList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.RobotDimensionsDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskRobotNoLimittationAreaDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskDTO;
|
||||
@ -162,6 +163,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
@Value("${zn.is_simulation:false}")
|
||||
private Boolean isSimulation;
|
||||
|
||||
@Value("${zn.restore_task_restart:true}")
|
||||
private Boolean restoreTaskRestart;
|
||||
|
||||
@Override
|
||||
public Long createInformation(RobotInformationSaveReqVO createReqVO) {
|
||||
//判断mac地址是否重复
|
||||
@ -203,6 +207,11 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
.operateAction("新增车辆 " + createReqVO.getRobotNo())
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
|
||||
List<RobotDimensionsDTO> list = informationMapper.selectRobotDimensions();
|
||||
pathPlanningApi.synchronousLineObject(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
|
||||
|
||||
redisUtil.del(key);
|
||||
// 返回
|
||||
return information.getId();
|
||||
}
|
||||
@ -243,14 +252,16 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
// 更新
|
||||
RobotInformationDO updateObj = BeanUtils.toBean(updateReqVO, RobotInformationDO.class);
|
||||
informationMapper.updateById(updateObj);
|
||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + updateObj.getMacAddress(), updateObj.getRobotNo());
|
||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_MAC_BY_NO + updateObj.getRobotNo(), updateObj.getMacAddress());
|
||||
// 更新AGV于地图关系表 -----
|
||||
List<List<Long>> list = CollectionUtils.compareLists(
|
||||
(CollUtil.isEmpty(robotInformationDO.getFloorAreaJson()) ? Collections.emptyList() : new ArrayList<>(robotInformationDO.getFloorAreaJson())),
|
||||
(CollUtil.isEmpty(updateReqVO.getFloorAreaJson()) ? Collections.emptyList() : new ArrayList<>(updateReqVO.getFloorAreaJson())),
|
||||
ObjectUtil::equal);
|
||||
informationMapAssociationService.saveOrUpdateOrDel(updateReqVO.getId(), list);
|
||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + updateObj.getMacAddress(), updateObj.getRobotNo());
|
||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_MAC_BY_NO + updateObj.getRobotNo(), updateObj.getMacAddress());
|
||||
|
||||
redisUtil.del(key);
|
||||
|
||||
String str = "";
|
||||
if (!robotInformationDO.getRobotTaskModel().equals(updateReqVO.getRobotTaskModel())
|
||||
@ -265,6 +276,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
.operateAction("更新车辆信息" + str)
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
|
||||
List<RobotDimensionsDTO> RobotDimensions = informationMapper.selectRobotDimensions();
|
||||
pathPlanningApi.synchronousLineObject(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -289,6 +303,11 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
// 删除
|
||||
informationMapper.deleteById(id);
|
||||
|
||||
List<RobotDimensionsDTO> RobotDimensions = informationMapper.selectRobotDimensions();
|
||||
pathPlanningApi.synchronousLineObject(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
|
||||
|
||||
redisUtil.del(key);
|
||||
}
|
||||
|
||||
private void validateInformationExists(Long id) {
|
||||
@ -792,8 +811,8 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
|
||||
CleanAgvDTO build = CleanAgvDTO.builder().robotNo(robotNo).build();
|
||||
commonApi.commonMethod(build, PathPlanningTopicConstant.CLEAN_AGV);
|
||||
/*CleanAgvDTO build = CleanAgvDTO.builder().robotNo(robotNo).build();
|
||||
commonApi.commonMethod(build, PathPlanningTopicConstant.CLEAN_AGV);*/
|
||||
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getLastTaskByRobotNo(robotNo);
|
||||
if (ObjectUtil.isEmpty(actionLog)) {
|
||||
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
|
||||
@ -817,6 +836,10 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
.eq(RobotInformationDO::getRobotNo, robotNo)
|
||||
.last("limit 1"));
|
||||
|
||||
if (RobotTaskModelEnum.REJECTION.getType().equals(robotInformationDO.getRobotTaskModel())) {
|
||||
throw exception(ROBOT_REJECTION);
|
||||
}
|
||||
|
||||
String taskStatusKey = RobotTaskChcheConstant.ROBOT_TASK_STATUS + robotInformationDO.getMacAddress();
|
||||
Object taskStatus = redisUtil.get(taskStatusKey);
|
||||
if (ObjectUtil.isEmpty(taskStatus) || !RobotStatusCodeConstant.CAN_DO_TASK.equals(Boolean.parseBoolean(String.valueOf(taskStatus)))) {
|
||||
@ -831,14 +854,13 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
try {
|
||||
resendToPP(pathPlanning,actionLog);
|
||||
|
||||
|
||||
if (PathTaskTypeEnum.CHARGE.getType().equals(pathPlanning.getOrderType())
|
||||
/*if (PathTaskTypeEnum.CHARGE.getType().equals(pathPlanning.getOrderType())
|
||||
|| PathTaskTypeEnum.AUTO_CHARGE.getType().equals(pathPlanning.getOrderType())) {
|
||||
robotInformationDO.setRobotStatus(RobotStatusEnum.CHARGE.getType());
|
||||
}else {
|
||||
robotInformationDO.setRobotStatus(RobotStatusEnum.DOING.getType());
|
||||
}
|
||||
informationMapper.updateById(robotInformationDO);
|
||||
informationMapper.updateById(robotInformationDO);*/
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@ -863,7 +885,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
List<TaskRobotNoLimittationAreaDTO> robotNoLimitions = Arrays.asList(taskRobotNoLimittationAreaDTO);
|
||||
pathPlanning.setRobotNoLimitationAreaDTOS(robotNoLimitions);
|
||||
|
||||
if (!isSimulation) {
|
||||
if (!isSimulation || !restoreTaskRestart) {
|
||||
resendToPPData(pathPlanning,actionLog,robotInformationDO);
|
||||
}
|
||||
|
||||
|
@ -104,4 +104,9 @@ public interface RobotTaskService extends IService<RobotTaskDO> {
|
||||
* @param mac
|
||||
*/
|
||||
void closeTaskDetail(String id, String mac, String orderType);
|
||||
|
||||
/**
|
||||
* 校验是否存在未完成的任务
|
||||
*/
|
||||
void checkHaveDoingTask();
|
||||
}
|
||||
|
@ -301,6 +301,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addTask(RobotTaskSaveReqVO createReqVO) {
|
||||
RobotTaskDO task = BeanUtils.toBean(createReqVO, RobotTaskDO.class);
|
||||
task.setRemainingCycleNumber(task.getCycleNumber());
|
||||
taskMapper.insert(task);
|
||||
|
||||
List<Long> laneIds = new ArrayList<>();
|
||||
@ -363,11 +364,11 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
}
|
||||
|
||||
if (ReleaseTakeEnum.TO_LANE.getType().equals(detailAddVO.getReleaseType())) {
|
||||
laneIds.add(detailAddVO.getTakeId());
|
||||
laneIds.add(detailAddVO.getReleaseId());
|
||||
} else if (ReleaseTakeEnum.TO_AREA.getType().equals(detailAddVO.getReleaseType())) {
|
||||
areaIds.add(detailAddVO.getTakeId());
|
||||
areaIds.add(detailAddVO.getReleaseId());
|
||||
} else if (ReleaseTakeEnum.TO_LOCATION.getType().equals(detailAddVO.getReleaseType())) {
|
||||
locationIds.add(detailAddVO.getTakeId());
|
||||
locationIds.add(detailAddVO.getReleaseId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,6 +506,26 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
commonApi.commonMethod(robotTask, robotTask.getTopic());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否存在未完成的任务
|
||||
*/
|
||||
@Override
|
||||
public void checkHaveDoingTask() {
|
||||
List<RobotTaskDO> taskDOS = taskMapper.selectList(new LambdaQueryWrapper<RobotTaskDO>()
|
||||
.in(RobotTaskDO::getTaskStatus, RobotTaskStatusEnum.NEW.getType(), RobotTaskStatusEnum.DOING.getType()));
|
||||
if (ObjectUtil.isNotEmpty(taskDOS)) {
|
||||
log.info("编辑地图存在未完成的任务");
|
||||
throw exception(TASK_CHECK_HAVE_DOING_TASK);
|
||||
}
|
||||
|
||||
List<String> commandTypes = PathTaskTypeEnum.getMistakeTaskTypes();
|
||||
List<RobotTaskDetailActionLogDO> actionLogDOList = taskDetailActionLogMapper.getMistakeTaskByCommandType(commandTypes);
|
||||
if (ObjectUtil.isNotEmpty(actionLogDOList)) {
|
||||
log.info("编辑地图存在未完成的移动到等待点/自动充电任务");
|
||||
throw exception(TASK_CHECK_HAVE_DOING_TASK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PP分配任务
|
||||
*
|
||||
@ -568,7 +589,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
|
||||
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
|
||||
logOne.setCommandType(taskAssignDTO.getOrderType());
|
||||
logOne.setActionMsg(taskAssignDTO.getRobotActionMsg());
|
||||
String actionMsg = ObjectUtil.isEmpty(taskNo) ? taskAssignDTO.getRobotActionMsg() : taskAssignDTO.getRobotActionMsg() + taskNo;
|
||||
logOne.setActionMsg(actionMsg);
|
||||
logOne.setRobotNo(taskAssignDTO.getRobotNo());
|
||||
logOne.setStartTime(LocalDateTime.now());
|
||||
logOne.setTaskNo(taskNo);
|
||||
@ -582,6 +604,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
|
||||
/**
|
||||
* 释放ware_position_map_item的使用状态
|
||||
*
|
||||
* @param robotNo
|
||||
*/
|
||||
private void releaseMapItemUseStatus(String robotNo) {
|
||||
@ -710,7 +733,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
}
|
||||
|
||||
taskDetailMapper.updateById(taskDetailDO);
|
||||
RobotTaskDO task = taskMapper.selectById(taskDetailDO.getRobotTaskId());
|
||||
RobotTaskDO task = new RobotTaskDO();
|
||||
task.setId(taskDetailDO.getRobotTaskId());
|
||||
task.setTaskStatus(RobotTaskStatusEnum.DOING.getType());
|
||||
taskMapper.updateById(task);
|
||||
return task;
|
||||
|
@ -208,3 +208,4 @@ zn:
|
||||
path_planning:
|
||||
task_chche_time: 604800 #任务缓存的时间, 默认一星期
|
||||
is_simulation: true # 是否为仿真环境
|
||||
restore_task_restart: true # 恢复任务是否全部重新执行 true:全部重新开始
|
||||
|
@ -243,6 +243,7 @@ zn:
|
||||
path_planning:
|
||||
task_chche_time: 604800 #任务缓存的时间, 默认一星期
|
||||
is_simulation: true # 是否为仿真环境
|
||||
restore_task_restart: true # 恢复任务是否全部重新执行 true:全部重新开始
|
||||
|
||||
logging:
|
||||
file:
|
||||
|
@ -4,7 +4,7 @@
|
||||
<!-- 变量 yudao.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %X{requestId} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
|
@ -188,7 +188,7 @@
|
||||
tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide,
|
||||
location_deep, location_height, location_default_height, location_total_height, location_tray_height,
|
||||
location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
|
||||
from zn_wcs.ware_house_location
|
||||
from ware_house_location
|
||||
</select>
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
@ -775,6 +775,7 @@
|
||||
where
|
||||
sort_num like concat('%', #{locationNo}, '%')
|
||||
and deleted = '0'
|
||||
and type != '2'
|
||||
</when>
|
||||
</choose>
|
||||
</select>
|
||||
|
@ -26,6 +26,8 @@
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
||||
<result property="taskDetailId" column="task_detail_id" jdbcType="INTEGER"/>
|
||||
<result property="robotIp" column="robot_ip" jdbcType="VARCHAR"/>
|
||||
<result property="robotPort" column="robot_port" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
@ -45,7 +47,9 @@
|
||||
update_time,
|
||||
deleted,
|
||||
tenant_id,
|
||||
task_detail_id
|
||||
task_detail_id,
|
||||
robot_ip,
|
||||
robot_port
|
||||
</sql>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
@ -93,6 +97,12 @@
|
||||
<if test="taskDetailId != null">
|
||||
and task_detail_id = #{taskDetailId}
|
||||
</if>
|
||||
<if test="robotIp != null">
|
||||
and robot_ip = #{robotIp}
|
||||
</if>
|
||||
<if test="robotPort != null">
|
||||
and robot_port = #{robotPort}
|
||||
</if>
|
||||
<if test="1==1">
|
||||
and deleted = '0'
|
||||
</if>
|
||||
@ -103,105 +113,10 @@
|
||||
<select id="queryAll" resultMap="BaseResultMap">
|
||||
select
|
||||
id, robot_model_id, robot_model_number, robot_no, robot_task_model, mac_address, url, robot_status, creator,
|
||||
create_time, updater, update_time, deleted, tenant_id,task_detail_id
|
||||
from zn_wcs.robot_information
|
||||
</select>
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from robot_information
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="robotModelId != null">
|
||||
and robot_model_id = #{robotModelId}
|
||||
</if>
|
||||
<if test="robotModelNumber != null and robotModelNumber != ''">
|
||||
and robot_model_number = #{robotModelNumber}
|
||||
</if>
|
||||
<if test="robotNo != null and robotNo != ''">
|
||||
and robot_no = #{robotNo}
|
||||
</if>
|
||||
<if test="robotTaskModel != null">
|
||||
and robot_task_model = #{robotTaskModel}
|
||||
</if>
|
||||
<if test="macAddress != null and macAddress != ''">
|
||||
and mac_address = #{macAddress}
|
||||
</if>
|
||||
<if test="url != null and url != ''">
|
||||
and url = #{url}
|
||||
</if>
|
||||
<if test="robotStatus != null">
|
||||
and robot_status = #{robotStatus}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
and creator = #{creator}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
and updater = #{updater}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
and deleted = #{deleted}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
create_time, updater, update_time, deleted, tenant_id,task_detail_id,robot_ip,robot_port
|
||||
from robot_information
|
||||
</select>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="doUpdateById">
|
||||
update robot_information
|
||||
<set>
|
||||
<if test="robotModelId != null">
|
||||
robot_model_id = #{robotModelId},
|
||||
</if>
|
||||
<if test="robotModelNumber != null and robotModelNumber != ''">
|
||||
robot_model_number = #{robotModelNumber},
|
||||
</if>
|
||||
<if test="robotNo != null and robotNo != ''">
|
||||
robot_no = #{robotNo},
|
||||
</if>
|
||||
<if test="robotTaskModel != null">
|
||||
robot_task_model = #{robotTaskModel},
|
||||
</if>
|
||||
<if test="macAddress != null and macAddress != ''">
|
||||
mac_address = #{macAddress},
|
||||
</if>
|
||||
<if test="url != null and url != ''">
|
||||
url = #{url},
|
||||
</if>
|
||||
<if test="robotStatus != null">
|
||||
robot_status = #{robotStatus},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateRobotStatus">
|
||||
update
|
||||
|
@ -19,4 +19,21 @@
|
||||
task_detail_id = #{taskDetailId}
|
||||
and command_id = '-1'
|
||||
</update>
|
||||
<select id="getMistakeTaskByCommandType"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO">
|
||||
select
|
||||
*
|
||||
from
|
||||
robot_task_detail_action_log
|
||||
where
|
||||
command_id = '-1'
|
||||
and deleted = '0'
|
||||
and action_status in ('0','1')
|
||||
and create_time >= DATE_SUB(NOW(), INTERVAL 1 DAY)
|
||||
and command_type in
|
||||
<foreach collection="commandTypes" item="commandType" index="index" open="(" close=")"
|
||||
separator=",">
|
||||
#{commandType}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -148,7 +148,7 @@
|
||||
id, montage_task, montage_number, sku_info, sku_batch, sku_number, priority, other_msg, do_cycle, do_move_all,
|
||||
cycle_number, remaining_cycle_number, task_no, task_status, task_stage, start_time, end_time, creator, create_time,
|
||||
updater, update_time, deleted, tenant_id
|
||||
from zn_wcs.robot_task
|
||||
from robot_task
|
||||
</select>
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
|
Loading…
Reference in New Issue
Block a user