From 2f9c8a38bceb07a9c21102e83e950f915ac66c90 Mon Sep 17 00:00:00 2001 From: cbs <18617195505@163.com> Date: Thu, 5 Jun 2025 17:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E8=BD=A6=E8=BE=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/mqtt/api/common/CommonApiImpl.java | 9 +-- .../system/enums/ErrorCodeConstants.java | 8 +-- .../system/api/robot/RobotStatusApiImpl.java | 3 - .../information/DeviceInformationMapper.java | 13 ++++ .../positionmap/PositionMapItemMapper.java | 13 ++++ .../RemoteControllerInformationMapper.java | 9 +++ .../dal/mysql/robot/RobotMapStopMapper.java | 7 ++ .../dal/mysql/wait/MoveToWaitMapper.java | 8 +++ .../service/path/PathPlanningServiceImpl.java | 5 +- ...emoteControllerInformationServiceImpl.java | 1 - .../robot/RobotInformationServiceImpl.java | 66 ++++++++++++++++--- .../robot/RobotTaskDetailServiceImpl.java | 3 +- .../RobotPathPlanningServiceImpl.java | 1 - .../information/DeviceInformationMapper.xml | 22 +++++++ .../positionmap/PositionMapItemMapper.xml | 20 ++++++ .../RemoteControllerInformationMapper.xml | 9 +++ .../mapper/robot/RobotMapStopMapper.xml | 9 +++ .../mapper/wait/MoveToWaitMapper.xml | 9 +++ 18 files changed, 190 insertions(+), 25 deletions(-) diff --git a/yudao-module-mqtt/yudao-module-mqtt-biz/src/main/java/cn/iododer/yudao/module/mqtt/api/common/CommonApiImpl.java b/yudao-module-mqtt/yudao-module-mqtt-biz/src/main/java/cn/iododer/yudao/module/mqtt/api/common/CommonApiImpl.java index 91762ff26..4ce25ce8b 100644 --- a/yudao-module-mqtt/yudao-module-mqtt-biz/src/main/java/cn/iododer/yudao/module/mqtt/api/common/CommonApiImpl.java +++ b/yudao-module-mqtt/yudao-module-mqtt-biz/src/main/java/cn/iododer/yudao/module/mqtt/api/common/CommonApiImpl.java @@ -1,6 +1,7 @@ package cn.iododer.yudao.module.mqtt.api.common; import cn.iocoder.yudao.module.mqtt.api.common.CommonApi; +import cn.iododer.yudao.module.mqtt.config.MqttFactory; import cn.iododer.yudao.module.mqtt.util.MqttUtils; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; @@ -23,9 +24,9 @@ public class CommonApiImpl implements CommonApi { String str = JSON.toJSONString(obj); mqttUtils.pub(topic, JSON.toJSONString(obj)); if (str.length() > 510) { -// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500)); + log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500)); }else { -// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str); + log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str); } } catch (MqttException e) { log.info("MQTT消息发送异常 :{}",e); @@ -37,9 +38,9 @@ public class CommonApiImpl implements CommonApi { try { mqttUtils.pub(topic, str); if (str.length() > 510) { -// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500)); + log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500)); }else { -// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str); + log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str); } } catch (MqttException e) { log.info("MQTT消息发送异常 :{}",e); diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index b446c48fb..bf930a7e3 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -236,11 +236,11 @@ public interface ErrorCodeConstants { ErrorCode PATH_PLANNING_DOING_DISTRIBUTE = new ErrorCode(1-002-037-002, "有正在分配的PP任务!"); // ========== 地图信息 1-002-038-000 ========== - ErrorCode AGV_UPLOAD_INFORMATION_DOES_NOT_INCLUDE_FLOOR_OR_AREA_INFORMATION = new ErrorCode(1_002_038_001, "AGV上传信息未包含楼层或区域信息"); - ErrorCode AGV_FILE_UPLOAD_CONTENT_IS_EMPTY = new ErrorCode(1_002_038_002, "AGV文件上传内容为空"); + ErrorCode AGV_UPLOAD_INFORMATION_DOES_NOT_INCLUDE_FLOOR_OR_AREA_INFORMATION = new ErrorCode(1_002_038_001, "车辆上传信息未包含楼层或区域信息"); + ErrorCode AGV_FILE_UPLOAD_CONTENT_IS_EMPTY = new ErrorCode(1_002_038_002, "车辆文件上传内容为空"); ErrorCode PLEASE_UPLOAD_PNG_AND_YAML_FILES = new ErrorCode(1_002_038_003, "请上传png和yaml两个文件并且文件内容不为空"); - ErrorCode AGV_MAP_NOT_FOUND = new ErrorCode(1_002_038_004, "找不到AGV地图信息"); - ErrorCode AGV_IMAGE_CONVERSION_TO_BASE64_FAILED = new ErrorCode(1_002_038_005, "AGV图片转base64失败"); + ErrorCode AGV_MAP_NOT_FOUND = new ErrorCode(1_002_038_004, "找不到车辆地图信息"); + ErrorCode AGV_IMAGE_CONVERSION_TO_BASE64_FAILED = new ErrorCode(1_002_038_005, "车辆图片转base64失败"); ErrorCode THE_LINE_LIBRARY_POINTS_ARE_NOT_LOCATED_IN_THE_SAME_AREA = new ErrorCode(1_002_038_006, "线库点位不在同一区域内"); ErrorCode THERE_ARE_ALREADY_STORAGE_LOCATIONS_IN_OTHER_LINE_WAREHOUSES = new ErrorCode(1_002_038_007, "已有库位在其他线库内"); ErrorCode THERE_ARE_ALREADY_STORAGE_LOCATIONS_IN_OTHER_STORAGE_AREAS = new ErrorCode(1_002_038_008, "已有库位在其它区域内"); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotStatusApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotStatusApiImpl.java index ce8a7b843..1108715ef 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotStatusApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotStatusApiImpl.java @@ -49,9 +49,6 @@ public class RobotStatusApiImpl implements RobotStatusApi { private static final ExecutorService executorService = Executors.newFixedThreadPool(5); - /*@Autowired - private ThreadPoolTaskExecutor taskExecutor; -*/ @Resource private CommonApi commonApi; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/information/DeviceInformationMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/information/DeviceInformationMapper.java index f80a749a1..1e9cc28ce 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/information/DeviceInformationMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/information/DeviceInformationMapper.java @@ -54,4 +54,17 @@ public interface DeviceInformationMapper extends BaseMapperX { * @param mapId */ void deleteByMapId(@Param("mapId") Long mapId); + + /** + * 更新车辆编号 + * @param oldRobotNo + * @param newRobotNo + */ + void updateRobotNo(@Param("oldRobotNo") String oldRobotNo, @Param("newRobotNo") String newRobotNo); + + /** + * 释放车辆 + * @param robotNo + */ + void clearRobotNo(@Param("robotNo") String robotNo); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java index 0a8bc73dc..76afd62b2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/remote/RemoteControllerInformationMapper.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationPageReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.remote.RemoteControllerInformationDO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 远遥设备信息 Mapper @@ -33,4 +34,12 @@ public interface RemoteControllerInformationMapper extends BaseMapperX getRemoteControllerRobotNos(); + + /** + * 更新车辆编号 + * @param oldRobotNo + * @param newRobotNo + */ + void updateRobotNo(@Param("oldRobotNo") String oldRobotNo, @Param("newRobotNo") String newRobotNo); + } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/robot/RobotMapStopMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/robot/RobotMapStopMapper.java index 5f862fa00..9342af7b4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/robot/RobotMapStopMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/robot/RobotMapStopMapper.java @@ -38,4 +38,11 @@ public interface RobotMapStopMapper extends BaseMapperX { * @param robotNos */ void deleteRobotMapStopByRobotNos(@Param("robotNos") List robotNos); + + /** + * 更新车辆编号 + * @param oldRobotNo + * @param newRobotNo + */ + void updateRobotNo(@Param("oldRobotNo") String oldRobotNo, @Param("newRobotNo") String newRobotNo); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wait/MoveToWaitMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wait/MoveToWaitMapper.java index 0aa57f816..27476cd19 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wait/MoveToWaitMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/wait/MoveToWaitMapper.java @@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.wait.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.wait.MoveToWaitDO; +import org.apache.ibatis.annotations.Param; + /** * 车辆前往等待点记录 Mapper * @@ -26,4 +28,10 @@ public interface MoveToWaitMapper extends BaseMapperX { .orderByDesc(MoveToWaitDO::getId)); } + /** + * 更新车辆编号 + * @param oldRobotNo + * @param newRobotNo + */ + void updateRobotNo(@Param("oldRobotNo") String oldRobotNo, @Param("newRobotNo") String newRobotNo); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/path/PathPlanningServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/path/PathPlanningServiceImpl.java index 8b8b643e3..c212c1c27 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/path/PathPlanningServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/path/PathPlanningServiceImpl.java @@ -167,7 +167,7 @@ public class PathPlanningServiceImpl implements PathPlanningService { */ @Override public void synchronousAllItem(PositionMapSaveReqVO data) { - log.info("synchronousAllItem----start"); + log.info("开始同步点位信息"); List positionMapDOS = positionMapMapper.selectList(new LambdaQueryWrapperX() .eq(ObjectUtil.isNotEmpty(data.getFloor()), PositionMapDO::getFloor, data.getFloor()) .eq(ObjectUtil.isNotEmpty(data.getArea()), PositionMapDO::getArea, data.getArea())); @@ -187,11 +187,10 @@ public class PathPlanningServiceImpl implements PathPlanningService { relatedPathNode.setType(PathTypeEnum.INIT.getType()); relatedPathNode.setControl_nodes(positionMapItemSynDTOS); - log.info("synchronousAllItem----doing :{}",JSON.toJSONString(relatedPathNode)); commonApi.commonMethod(relatedPathNode, PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_NODE); } - log.info("synchronousAllItem----end"); + log.info("同步点位信息结束"); } /** diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java index 26631f62b..1a8980202 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/remote/RemoteControllerInformationServiceImpl.java @@ -587,7 +587,6 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl robotMapStops = mapStopMapper.selectList(new LambdaQueryWrapperX() - .eq(RobotMapStopDO::getRobotNo, robotInformationDO.getRobotNo())); - if (ObjectUtil.isNotEmpty(robotMapStops)) { - robotMapStops.forEach(v -> v.setRobotNo(updateReqVO.getRobotNo())); - mapStopMapper.updateById(robotMapStops); - } - } // 更新AGV于地图关系表 ----- List> list = CollectionUtils.compareLists( @@ -475,6 +481,36 @@ public class RobotInformationServiceImpl extends ServiceImpl() + .eq(RobotChargeLogDO::getRobotNo, oldRobotNo) + .orderByDesc(RobotChargeLogDO::getCreateTime) + .last("limit 1")); + if (ObjectUtil.isNotEmpty(robotChargeLog)) { + robotChargeLog.setRobotNo(newRobotNo); + chargeLogMapper.updateById(robotChargeLog); + } + + //这表暂时不改 +// robotWorkingHoursStatisticsMapper + mapStopMapper.updateRobotNo(oldRobotNo,newRobotNo); + + moveToWaitMapper.updateRobotNo(oldRobotNo,newRobotNo); + + positionMapItemMapper.updateRobotNo(oldRobotNo,newRobotNo); + } + @Override @Transactional(rollbackFor = Exception.class) public void deleteInformation(Long id) { @@ -482,6 +518,13 @@ public class RobotInformationServiceImpl extends ServiceImpl() + .eq(RemoteControllerInformationDO::getRobotNo, robotInformationDO.getRobotNo()) + .last("limit 1")); + if (ObjectUtil.isNotEmpty(remoteControllerInformation)) { + throw exception(ROBOT_DOING_REMOTE); + } + cameraService.deleteCameraByRobotNo(robotInformationDO.getRobotNo()); List list = taskMapper.selectDoingTaskByRobotNo(robotInformationDO.getRobotNo()); @@ -519,6 +562,13 @@ public class RobotInformationServiceImpl extends ServiceImpl, List> robotAndTaskDetails = distributeTasksService.getRobotAndTaskDetails(); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/information/DeviceInformationMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/information/DeviceInformationMapper.xml index 0cd0ae357..ddcbc80bc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/information/DeviceInformationMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/information/DeviceInformationMapper.xml @@ -36,4 +36,26 @@ where position_map_id = #{mapId} + + + update + device_information + set + last_user = #{newRobotNo} + where + last_user = #{oldRobotNo} + and deleted = '0' + and device_type = '1' + + + update + device_information + set + last_user = '', + device_use_status = '0' + where + last_user = #{robotNo} + and deleted = '0' + and device_type = '1' + \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/positionmap/PositionMapItemMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/positionmap/PositionMapItemMapper.xml index 0399c9b84..790378994 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/positionmap/PositionMapItemMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/positionmap/PositionMapItemMapper.xml @@ -158,4 +158,24 @@ set deleted = 1 where position_map_id = #{mapId} + + + update + ware_position_map_item + set + robot_no = #{newRobotNo} + where + robot_no = #{oldRobotNo} + and deleted = '0' + + + update + ware_position_map_item + set + robot_no = '', + use_status = '0' + where + robot_no = #{robotNo} + and deleted = '0' + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml index 898c24c51..42b4dbed9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/remote/RemoteControllerInformationMapper.xml @@ -1,6 +1,15 @@ + + update + remote_controller_information + set + robot_no = #{newRobotNo} + where + robot_no = #{oldRobotNo} + and deleted = '0' + + + update + robot_move_to_wait + set + robot_no = #{newRobotNo} + where + robot_no = #{oldRobotNo} + and deleted = '0' + \ No newline at end of file