Compare commits

..

2 Commits

Author SHA1 Message Date
cbs
26c26007d0 电量 2025-05-14 17:32:01 +08:00
cbs
6966fe9b4c 障碍物 信号上报 2025-05-13 09:04:49 +08:00
33 changed files with 341 additions and 87 deletions

View File

@ -147,6 +147,8 @@ public class MqttFactory {
return BeanUtils.getBean(RobotUpdatePalletHeightServiceImpl.class); return BeanUtils.getBean(RobotUpdatePalletHeightServiceImpl.class);
case ROBOT_OBSTACLES_STATUS: case ROBOT_OBSTACLES_STATUS:
return BeanUtils.getBean(RobotObstaclesStatusServiceImpl.class); return BeanUtils.getBean(RobotObstaclesStatusServiceImpl.class);
case ROBOT_WIRELESS_SIGNAL_STATUS:
return BeanUtils.getBean(RobotWirelessSignalStatusServiceImpl.class);
case PLANNING_INIT_DATA: case PLANNING_INIT_DATA:
return BeanUtils.getBean(PathPlanningInitDataServiceImpl.class); return BeanUtils.getBean(PathPlanningInitDataServiceImpl.class);
case PLANNING_DISTRIBUTION_TASK: case PLANNING_DISTRIBUTION_TASK:

View File

@ -22,6 +22,7 @@ public enum DefineSubTopicEnum {
ROBOT_WORK_STATUS("ROBOT_WORK_STATUS", 2,"作业实时行为上报"), ROBOT_WORK_STATUS("ROBOT_WORK_STATUS", 2,"作业实时行为上报"),
ROBOT_UPDATE_PALLET_HEIGHT("UPDATE_PALLET_HEIGHT", 2,"放货后货物高度反馈和取货后货物高度反馈"), ROBOT_UPDATE_PALLET_HEIGHT("UPDATE_PALLET_HEIGHT", 2,"放货后货物高度反馈和取货后货物高度反馈"),
ROBOT_OBSTACLES_STATUS("ROBOT_OBSTACLES_STATUS", 2,"障碍物状态上报"), ROBOT_OBSTACLES_STATUS("ROBOT_OBSTACLES_STATUS", 2,"障碍物状态上报"),
ROBOT_WIRELESS_SIGNAL_STATUS("ROBOT_WIRELESS_SIGNAL_STATUS", 2,"信号强度上报"),
PLANNING_INIT_DATA("SYNCHRONOUS_ALL_MAP_REQUEST", 2,"路径规划需要初始数据上报"), PLANNING_INIT_DATA("SYNCHRONOUS_ALL_MAP_REQUEST", 2,"路径规划需要初始数据上报"),
PLANNING_DISTRIBUTION_TASK("TASK_ASSIGNMENT_FEEDBACK", 2,"路径规划任务分配上报"), PLANNING_DISTRIBUTION_TASK("TASK_ASSIGNMENT_FEEDBACK", 2,"路径规划任务分配上报"),
PLANNING_DISTRIBUTION_FAIL("TASK_ASSIGNMENT_FAIL", 2,"路径规划失败上报"), PLANNING_DISTRIBUTION_FAIL("TASK_ASSIGNMENT_FAIL", 2,"路径规划失败上报"),

View File

@ -0,0 +1,22 @@
package cn.iododer.yudao.module.mqtt.service;
import cn.iocoder.yudao.module.remote.api.path.RemotePathApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Slf4j
@Service
public class RobotWirelessSignalStatusServiceImpl implements MqttService{
@Resource
private RemotePathApi remotePathApi;
@Override
public void analysisMessage(String message) {
log.info("车辆信号上报 :{}",message);
remotePathApi.wirelessSignalStatus(message);
}
}

View File

@ -16,4 +16,7 @@ public interface RemotePathApi {
@Operation(summary = "远遥同步车辆导航行走路程信息") @Operation(summary = "远遥同步车辆导航行走路程信息")
void remoteDistanceInformation(@RequestParam("message") String message); void remoteDistanceInformation(@RequestParam("message") String message);
@PostMapping(PREFIX + "/wirelessSignalStatus")
@Operation(summary = "车辆信号信息")
void wirelessSignalStatus(@RequestParam("message") String message);
} }

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.remote.api.path.dto;
import lombok.Data;
@Data
public class RemoteRobotWirelessSignalDTO {
private String mac;
/**
* 整型单位dBm
*/
private String wirelessSignal;
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.remote.api.path; package cn.iocoder.yudao.module.remote.api.path;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO; import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.service.robot.RemoteRobotService; import cn.iocoder.yudao.module.remote.service.robot.RemoteRobotService;
import cn.iocoder.yudao.module.remote.util.redis.RedisUtil; import cn.iocoder.yudao.module.remote.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -31,5 +32,15 @@ public class RemotePathApiImpl implements RemotePathApi{
remoteRobotService.remoteDistanceInformation(data); remoteRobotService.remoteDistanceInformation(data);
} }
/**
* 车辆信号信息
* @param message
*/
@Override
public void wirelessSignalStatus(String message) {
RemoteRobotWirelessSignalDTO data = JSON.parseObject(message, RemoteRobotWirelessSignalDTO.class);
remoteRobotService.sendRobotWirelessSignalStatus(data);
}
} }

View File

@ -145,7 +145,7 @@ public class RemoteControllerProcessor {
cache.remove(remoteControllerIp); cache.remove(remoteControllerIp);
Socket socket = remoteControllerSocketDTO.getSocket(); Socket socket = remoteControllerSocketDTO.getSocket();
if (socket == null ||socket.isClosed()) { if (socket == null || socket.isClosed()) {
try { try {
socket = new Socket(); socket = new Socket();
socket.connect(new InetSocketAddress(remoteControllerIp, remoteControllerPort), 1000); socket.connect(new InetSocketAddress(remoteControllerIp, remoteControllerPort), 1000);
@ -186,7 +186,7 @@ public class RemoteControllerProcessor {
if (ObjectUtil.isEmpty(cache)) { if (ObjectUtil.isEmpty(cache)) {
return; return;
} }
log.info("socket发送数据开始"); // log.info("socket发送数据开始");
for (Map.Entry<String, RemoteControllerSocketDTO> v : cache.entrySet()) { for (Map.Entry<String, RemoteControllerSocketDTO> v : cache.entrySet()) {
RemoteControllerSocketDTO remoteControllerSocketDTO = v.getValue(); RemoteControllerSocketDTO remoteControllerSocketDTO = v.getValue();
if (ObjectUtil.isEmpty(remoteControllerSocketDTO)) { if (ObjectUtil.isEmpty(remoteControllerSocketDTO)) {
@ -218,8 +218,8 @@ public class RemoteControllerProcessor {
try { try {
os = socket.getOutputStream(); os = socket.getOutputStream();
String str = remoteControllerSocketDTO.getMsg(); String str = remoteControllerSocketDTO.getMsg();
log.info("socket推送的数据 :{}", str);
os.write(remoteControllerSocketDTO.getMsg().getBytes()); os.write(remoteControllerSocketDTO.getMsg().getBytes());
log.info("socket推送的数据 :{}", str);
} catch (IOException e) { } catch (IOException e) {
log.error("socket发送异常 :{}", e); log.error("socket发送异常 :{}", e);
} finally { } finally {
@ -230,7 +230,6 @@ public class RemoteControllerProcessor {
} }
} }
} }
log.info("socket发送数据成功");
} }
} }

View File

@ -8,4 +8,6 @@ public class RobotTaskChcheConstant {
//机器人编号和mac地址映射(通过机器人编号查询mac地址) (拼接的是机器人编号) //机器人编号和mac地址映射(通过机器人编号查询mac地址) (拼接的是机器人编号)
public static String ROBOT_GET_MAC_BY_NO = "robot:information:getMac:ByNo"; public static String ROBOT_GET_MAC_BY_NO = "robot:information:getMac:ByNo";
//机器人mac地址和机器人编号映射(通过mac地址查询机器人编号) (拼接的是mac地址)
public static String ROBOT_GET_ROBOTNO_BY_MAC = "robot:information:getRobotNo:ByMac";
} }

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.remote.service.robot; package cn.iocoder.yudao.module.remote.service.robot;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO; import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.PositionMapRespDTO; import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.PositionMapRespDTO;
import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteRobotChangeModeDTO; import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteRobotChangeModeDTO;
import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteRobotTaskDoneDTO; import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteRobotTaskDoneDTO;
@ -76,4 +77,10 @@ public interface RemoteRobotService {
* @param data * @param data
*/ */
void remoteDistanceInformation(RemoteRobotDistanceInformationDTO data); void remoteDistanceInformation(RemoteRobotDistanceInformationDTO data);
/**
* 上报车辆信号信息
* @param data
*/
void sendRobotWirelessSignalStatus(RemoteRobotWirelessSignalDTO data);
} }

View File

@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO; import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.api.robot.RemoteControllerProcessor; import cn.iocoder.yudao.module.remote.api.robot.RemoteControllerProcessor;
import cn.iocoder.yudao.module.remote.api.webSocket.RequestProcessor; import cn.iocoder.yudao.module.remote.api.webSocket.RequestProcessor;
import cn.iocoder.yudao.module.remote.constant.robot.RobotTaskChcheConstant; import cn.iocoder.yudao.module.remote.constant.robot.RobotTaskChcheConstant;
@ -207,6 +208,21 @@ public class RemoteRobotServiceImpl implements RemoteRobotService {
mac, JSONUtil.toJsonStr(build)); mac, JSONUtil.toJsonStr(build));
} }
/**
* 上报车辆信息信息
* @param data
*/
@Override
public void sendRobotWirelessSignalStatus(RemoteRobotWirelessSignalDTO data) {
TenantContextHolder.setTenantId(1L);
String robotNo = (String) redisUtil.get(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + data.getMac());
if (ObjectUtil.isEmpty(robotNo)) {
robotNo = remoteRobotApi.getRobotNoByMac(data.getMac());
}
log.info("车辆编号 :{}",robotNo);
}
/** /**
* 组装 * 组装
* *

View File

@ -62,4 +62,8 @@ public interface RemoteRobotApi {
@PostMapping(PREFIX + "/getMacByRobotNo") @PostMapping(PREFIX + "/getMacByRobotNo")
@Operation(summary = "根据车辆编号获取MAC地址") @Operation(summary = "根据车辆编号获取MAC地址")
String getMacByRobotNo( @RequestParam(value = "robotNo") String robotNo); String getMacByRobotNo( @RequestParam(value = "robotNo") String robotNo);
@PostMapping(PREFIX + "/getRobotNoByMac")
@Operation(summary = "根据车辆MAC地址获取车辆编号")
String getRobotNoByMac( @RequestParam(value = "mac") String mac);
} }

View File

@ -14,4 +14,29 @@ public class RobotObstaclesStatusDTO {
* true表示有障碍物false表示没有障碍物 * true表示有障碍物false表示没有障碍物
*/ */
public Boolean obstacles; public Boolean obstacles;
/**
* 左前方障碍物距离 float单位是米
*/
private String frontLeft;
/**
* 右前方障碍物距离 float单位是米
*/
private String frontRight;
/**
* 左后方障碍物距离 float单位是米
*/
private String reaLeft;
/**
* 右后方障碍物距离 float单位是米
*/
private String reaRight;
/**
* 正后方障碍物距离 float单位是米
*/
private String rearCenter;
} }

View File

@ -16,6 +16,6 @@ public class RobotStatusDataPoseDTO {
public String floor; public String floor;
//区域 //区域
public String area; public String area;
//电池剩余容量 //电池剩余容量 废弃 从ROBOT_INFORMATION_SOC 获取电量
public String batSoc; // public String batSoc;
} }

View File

@ -142,5 +142,10 @@ public class RemoteRobotApiImpl implements RemoteRobotApi {
return robotInformationService.getMacByRobotNo(robotNo); return robotInformationService.getMacByRobotNo(robotNo);
} }
@Override
public String getRobotNoByMac(String mac) {
return robotInformationService.getRobotNoByMac(mac);
}
} }

View File

@ -3,15 +3,11 @@ package cn.iocoder.yudao.module.system.api.robot;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotGenericsDataDTO; import cn.iocoder.yudao.module.system.api.robot.dto.RobotGenericsDataDTO;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter; import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant; import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.util.redis.RedisUtil; import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -26,8 +22,6 @@ public class RobotGenericsStatusApiImpl implements RobotGenericsStatusApi {
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Resource@Value("${zn.robot_position_cache_time:10}")
private Long robotPositionCacheTime;
@Override @Override
@SystemRateLimiter(time = 1, count = 20, keyArg = "updateRobotCommonStatus",message = "机器人上报车辆其他信息") @SystemRateLimiter(time = 1, count = 20, keyArg = "updateRobotCommonStatus",message = "机器人上报车辆其他信息")
@ -43,17 +37,13 @@ public class RobotGenericsStatusApiImpl implements RobotGenericsStatusApi {
} }
String mac = robotStatusData.getMac(); String mac = robotStatusData.getMac();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +mac; String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +mac;
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO= JSONUtil.toBean((String)object, RobotStatusDataPoseDTO.class);
String batSoc = robotStatusData.getHwStates().getBatSoc(); String batSoc = robotStatusData.getHwStates().getBatSoc();
if (ObjectUtil.isNotEmpty(batSoc)) { if (ObjectUtil.isNotEmpty(batSoc)) {
String[] split = batSoc.split("\\."); String[] split = batSoc.split("\\.");
batSoc = split[1].substring(0,2); batSoc = split[1].substring(0,2);
robotStatusDataPoseDTO.setBatSoc(batSoc); redisUtil.set(socKey,batSoc);
} }
redisUtil.set(pose2dKey,JSON.toJSONString(robotStatusDataPoseDTO),robotPositionCacheTime);
} }
} }

View File

@ -51,7 +51,6 @@ public class RobotObstaclesStatusApiImpl implements RobotObstaclesStatusApi{
Object floorAreaObject = redisUtil.get(floorAreaKey); Object floorAreaObject = redisUtil.get(floorAreaKey);
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class); FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
String robotNo = robotInformationService.getRobotNoByMac(data.getMac()); String robotNo = robotInformationService.getRobotNoByMac(data.getMac());
RobotWarnMsgSaveReqVO warnMsg = new RobotWarnMsgSaveReqVO(); RobotWarnMsgSaveReqVO warnMsg = new RobotWarnMsgSaveReqVO();

View File

@ -9,29 +9,18 @@ import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter; import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant; import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant; import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnCodeMappingDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnMsgDO;
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnCodeMappingMapper;
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnMsgMapper;
import cn.iocoder.yudao.module.system.enums.robot.RobotWarnType;
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService; import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
import cn.iocoder.yudao.module.system.util.redis.RedisUtil; import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@RestController // 提供 RESTful API 接口 Feign 调用 @RestController // 提供 RESTful API 接口 Feign 调用
@ -82,7 +71,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
Object floorAreaObject = redisUtil.get(floorAreaKey); Object floorAreaObject = redisUtil.get(floorAreaKey);
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class); FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac()); String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac());
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robotStatusDataDTO.getMac();
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);

View File

@ -9,7 +9,10 @@ public class RobotTaskChcheConstant {
public static String ROBOT_CARGO_DETECTED = "robot:information:cargo:detected"; public static String ROBOT_CARGO_DETECTED = "robot:information:cargo:detected";
//机器人点位和电量 (拼接的是mac地址) //机器人点位和电量 (拼接的是mac地址)
public static String ROBOT_INFORMATION_POSE_BAT_SOC = "robot:information:pose:bat:soc"; public static String ROBOT_INFORMATION_POSE_BAT = "robot:information:pose:bat";
//机器人电量
public static String ROBOT_INFORMATION_SOC = "robot:information:soc";
//机器人楼层和区域 (拼接的是mac地址) //机器人楼层和区域 (拼接的是mac地址)
public static String ROBOT_FLOOR_AREA = "robot:floor:area"; public static String ROBOT_FLOOR_AREA = "robot:floor:area";

View File

@ -6,10 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO; import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService; import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -123,4 +120,12 @@ public class WareHouseLocationController {
houseLocationService.updateHouseLocationList(list); houseLocationService.updateHouseLocationList(list);
return success(true); return success(true);
} }
@GetMapping("/getLocationsXYByMapId")
@Operation(summary = "根据地图id查询此地图对应的所有库位,包括库位坐标")
@Parameter(name = "mapId", description = "地图id", required = true, example = "1024")
public CommonResult<List<WareHouseLocationItemRespVO>> getLocationsXYByMapId(@RequestParam("mapId") Long mapId) {
List<WareHouseLocationItemRespVO> list = houseLocationService.getLocationsXYByMapId(mapId);
return success(list);
}
} }

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.system.controller.admin.houselocation.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 库位和坐标 Response VO")
@Data
public class WareHouseLocationItemRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31866")
private Long id;
@Schema(description = "库位编号")
private String locationNo;
@Schema(description = "物料信息")
private String skuInfo;
@Schema(description = "物料数量")
private Long skuNumber;
@Schema(description = "启用/禁用0禁用、1启用")
private Integer locationEnable;
@Schema(description = "锁定/正常0锁定、1正常")
private Integer locationLock;
@Schema(description = "状态0空闲、1占用", example = "2")
private Integer locationUseStatus;
@Schema(description = "宽度")
private BigDecimal locationWide;
@Schema(description = "长度")
private BigDecimal locationDeep;
@Schema(description = "层数")
private Integer locationStorey;
@Schema(description = "实际坐标x轴")
private String actualLocationX;
@Schema(description = "实际坐标y轴")
private String actualLocationY;
}

View File

@ -121,4 +121,13 @@ public class RobotTaskController {
return success(pageResult); return success(pageResult);
} }
@PostMapping("/checkHaveTask")
@Operation(summary = "判断是否存在任务")
@PreAuthorize("@ss.hasPermission('robot:task:checkHaveTask')")
public CommonResult<Boolean> checkHaveTask() {
//校验是否存在未完成的任务
taskService.checkHaveDoingTask();
return success(true);
}
} }

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.houselocation;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationItemRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
@ -161,4 +162,11 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
*/ */
List<WareHouseLocationDO> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId, List<WareHouseLocationDO> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
@Param("locationStorey") Integer locationStorey); @Param("locationStorey") Integer locationStorey);
/**
* 获取这个地图对应的库位和坐标信息
* @param mapId
* @return
*/
List<WareHouseLocationItemRespVO> getLocationsXYByMapId(@Param("mapId") Long mapId);
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO; import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
@ -19,6 +20,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformati
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO; 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.RobotWarnMsgDO; import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnMsgDO;
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskDetailStatusEnum; import cn.iocoder.yudao.module.system.enums.robot.RobotTaskDetailStatusEnum;
import cn.iocoder.yudao.module.system.service.dict.DictDataService; import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.information.DeviceInformationService; import cn.iocoder.yudao.module.system.service.information.DeviceInformationService;
@ -116,7 +118,7 @@ public class BulletinBoardServiceImpl implements BulletinBoardService {
map = agvListStatusInfo.stream().collect(Collectors.toMap(RobotInfoStatusVO::getMacAddress, Function.identity())); map = agvListStatusInfo.stream().collect(Collectors.toMap(RobotInfoStatusVO::getMacAddress, Function.identity()));
} }
for (RobotInformationDO robotInformationDO : allRobot) { for (RobotInformationDO robotInformationDO : allRobot) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotInformationDO.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robotInformationDO.getMacAddress();
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);
if (robotStatusDataPoseDTO != null) { if (robotStatusDataPoseDTO != null) {
@ -127,7 +129,10 @@ public class BulletinBoardServiceImpl implements BulletinBoardService {
BeanUtil.copyProperties(item, robotElectricityLevelVO); BeanUtil.copyProperties(item, robotElectricityLevelVO);
} }
robotElectricityLevelVO.setRobotNo(robotInformationDO.getRobotNo()); robotElectricityLevelVO.setRobotNo(robotInformationDO.getRobotNo());
robotElectricityLevelVO.setBatSoc(robotStatusDataPoseDTO.getBatSoc()); String socByMac = robotInformationService.getSocByMac(robotInformationDO.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(socByMac)) {
robotElectricityLevelVO.setBatSoc(socByMac);
}
robotElectricityLevelVOS.add(robotElectricityLevelVO); robotElectricityLevelVOS.add(robotElectricityLevelVO);
} }
} }

View File

@ -1,10 +1,7 @@
package cn.iocoder.yudao.module.system.service.houselocation; package cn.iocoder.yudao.module.system.service.houselocation;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO; import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -119,4 +116,11 @@ public interface HouseLocationService extends IService<WareHouseLocationDO> {
* @param id * @param id
*/ */
void updateLocationAreaNameEmptyByAreaId(Long areaId); void updateLocationAreaNameEmptyByAreaId(Long areaId);
/**
* 获取这个地图对应的库位和坐标信息
* @param mapId
* @return
*/
List<WareHouseLocationItemRespVO> getLocationsXYByMapId(Long mapId);
} }

View File

@ -6,10 +6,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO; import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO; import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO; import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper; import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
@ -186,6 +183,16 @@ public class HouseLocationServiceImpl extends ServiceImpl<WareHouseLocationMappe
houseLocationMapper.updateLocationAreaNameEmptyByAreaId(areaId); houseLocationMapper.updateLocationAreaNameEmptyByAreaId(areaId);
} }
/**
* 获取这个地图对应的库位和坐标信息
* @param mapId
* @return
*/
@Override
public List<WareHouseLocationItemRespVO> getLocationsXYByMapId(Long mapId) {
return houseLocationMapper.getLocationsXYByMapId(mapId);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateHouseLocationList(List<WareHouseLocationSaveReqVO> list) { public void updateHouseLocationList(List<WareHouseLocationSaveReqVO> list) {

View File

@ -23,7 +23,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.List; import java.util.List;
import static cn.hutool.core.collection.CollUtil.isNotEmpty; import static cn.hutool.core.collection.CollUtil.isNotEmpty;
@ -128,7 +127,7 @@ public class PositionMapItemServiceImpl extends ServiceImpl<PositionMapItemMappe
@Override @Override
public Object getAGVPointInformation(String macAddress) { public Object getAGVPointInformation(String macAddress) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + macAddress; String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + macAddress;
try { try {
// 睡眠 0.5s 以确保获取到是最新的数据 // 睡眠 0.5s 以确保获取到是最新的数据
Thread.sleep(500); Thread.sleep(500);

View File

@ -67,6 +67,14 @@ public interface RobotInformationService extends IService<RobotInformationDO> {
*/ */
RobotInformationStatisticsVO statisticsInformation(); RobotInformationStatisticsVO statisticsInformation();
/**
* 车机mac地址获取电量
* @param str
* type 1:是mac 0 :是车辆编号
* @return
*/
String getSocByMac(String str, Integer type);
/** /**
* 获取所有AGV状态 * 获取所有AGV状态
* @return * @return

View File

@ -484,7 +484,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
RobotInformationDO robotInformationDO = informationMapper.selectById(id); RobotInformationDO robotInformationDO = informationMapper.selectById(id);
RobotInformationRespVO bean = BeanUtils.toBean(robotInformationDO, RobotInformationRespVO.class); RobotInformationRespVO bean = BeanUtils.toBean(robotInformationDO, RobotInformationRespVO.class);
setPositionMapList(bean); setPositionMapList(bean);
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + bean.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + bean.getMacAddress();
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);
@ -492,7 +492,10 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
Object floorAreaObject = redisUtil.get(floorAreaKey); Object floorAreaObject = redisUtil.get(floorAreaKey);
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class); FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) { if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
bean.setElectricity(robotStatusDataPoseDTO.getBatSoc()); String soc = getSocByMac(robotInformationDO.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(soc)) {
bean.setElectricity(soc);
}
bean.setFloor(floorZoneDTO.getFloor()); bean.setFloor(floorZoneDTO.getFloor());
bean.setArea(floorZoneDTO.getArea()); bean.setArea(floorZoneDTO.getArea());
} }
@ -576,7 +579,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
* @param v * @param v
*/ */
private void setMsgAndRobotStatus(RobotInformationPageRespVO v, String robotStatisticsType) { private void setMsgAndRobotStatus(RobotInformationPageRespVO v, String robotStatisticsType) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + v.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + v.getMacAddress();
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);
@ -588,7 +591,10 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class); FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) { if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
v.setElectricity(robotStatusDataPoseDTO.getBatSoc()); String soc = getSocByMac(v.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(soc)) {
v.setElectricity(soc);
}
v.setFloor(floorZoneDTO.getFloor()); v.setFloor(floorZoneDTO.getFloor());
v.setArea(floorZoneDTO.getArea()); v.setArea(floorZoneDTO.getArea());
v.setOnlineStatus(1); v.setOnlineStatus(1);
@ -653,7 +659,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
Integer fault = 0; Integer fault = 0;
//0待命1任务中2锁定3离线4:充电中5:故障 //0待命1任务中2锁定3离线4:充电中5:故障
for (RobotInformationDO v : existRobot) { for (RobotInformationDO v : existRobot) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + v.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + v.getMacAddress();
Object object = redisUtil.get(pose2dKey); Object object = redisUtil.get(pose2dKey);
if (ObjectUtil.isEmpty(object)) { if (ObjectUtil.isEmpty(object)) {
@ -694,6 +700,26 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
return info; return info;
} }
/**
*
* @param str
* type 1:是mac 0 :是车辆编号
* @param type
* @return
*/
@Override
public String getSocByMac(String str, Integer type) {
if (ZeroOneEnum.ZERO.getType().equals(type)) {
str = getMacByRobotNo(str);
}
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +str;
Object o = redisUtil.get(socKey);
if (ObjectUtil.isEmpty(o)){
return null;
}
return o.toString();
}
@Override @Override
public List<RobotInfoStatusVO> getAGVListStatusInfo() { public List<RobotInfoStatusVO> getAGVListStatusInfo() {
List<RobotInfoStatusVO> list = new ArrayList<>(); List<RobotInfoStatusVO> list = new ArrayList<>();
@ -706,7 +732,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
RobotInfoStatusVO vo = new RobotInfoStatusVO(); RobotInfoStatusVO vo = new RobotInfoStatusVO();
vo.setMacAddress(informationDO.getMacAddress()); vo.setMacAddress(informationDO.getMacAddress());
//0待命1任务中2锁定3离线4:充电中5:故障 //0待命1任务中2锁定3离线4:充电中5:故障
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + informationDO.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + informationDO.getMacAddress();
Object object = redisUtil.get(pose2dKey); Object object = redisUtil.get(pose2dKey);
if (ObjectUtil.isEmpty(object)) { if (ObjectUtil.isEmpty(object)) {
//离线 //离线
@ -799,7 +825,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw()); robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor()); robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor());
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea()); robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea());
robotStatusDataPoseDTO.setBatSoc(robotStatusDataDTO.getData().getPose2d().getBatSoc()); // robotStatusDataPoseDTO.setBatSoc(robotStatusDataDTO.getData().getPose2d().getBatSoc());
robotInformationVO.setPose2d(robotStatusDataPoseDTO); robotInformationVO.setPose2d(robotStatusDataPoseDTO);
@ -1369,20 +1395,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfig.getConfigStr(), CommonConfigVO.class); CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfig.getConfigStr(), CommonConfigVO.class);
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotInformation.getMacAddress(); String soc = getSocByMac(robotInformation.getMacAddress(), ZeroOneEnum.ONE.getType());
Object poseCache = redisUtil.get(pose2dKey); if (ObjectUtil.isEmpty(soc)) {
if (ObjectUtil.isEmpty(poseCache)) {
log.info("车机没有电量信息 :{}", robotInformation.getRobotNo());
return false;
}
RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) {
log.info("车机没有电量信息 :{}", robotInformation.getRobotNo()); log.info("车机没有电量信息 :{}", robotInformation.getRobotNo());
return false; return false;
} }
if (ObjectUtil.isNotEmpty(chargeConfig) && ObjectUtil.isNotEmpty(chargeConfig.getStartAutoCharge())) { if (ObjectUtil.isNotEmpty(chargeConfig) && ObjectUtil.isNotEmpty(chargeConfig.getStartAutoCharge())) {
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc()); BigDecimal robotRemainingElectricity = new BigDecimal(soc);
BigDecimal robotEndElectricity = new BigDecimal(chargeConfig.getStartAutoCharge() + ""); BigDecimal robotEndElectricity = new BigDecimal(chargeConfig.getStartAutoCharge() + "");
if (robotRemainingElectricity.compareTo(robotEndElectricity) < 0) { if (robotRemainingElectricity.compareTo(robotEndElectricity) < 0) {
log.info("机器人的电量少于自动充电电量,不能接任务 :{}", robotInformation.getRobotNo()); log.info("机器人的电量少于自动充电电量,不能接任务 :{}", robotInformation.getRobotNo());
@ -1390,7 +1410,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
} }
} }
return checkElectricity(chargeConfig, robotInformation, dataPoseDTO); return checkElectricity(chargeConfig, robotInformation,soc);
} }
@Override @Override
@ -1490,13 +1510,13 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
informationMapper.updateById(robotInformationDO); informationMapper.updateById(robotInformationDO);
} }
private Boolean checkElectricity(CommonConfigVO chargeConfig, RobotInformationDO robot, RobotStatusDataPoseDTO dataPoseDTO) { private Boolean checkElectricity(CommonConfigVO chargeConfig, RobotInformationDO robot, String soc) {
String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo(); String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo();
Object chargeModelCache = redisUtil.get(chargeModelKey); Object chargeModelCache = redisUtil.get(chargeModelKey);
log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo(), JSON.toJSONString(dataPoseDTO)); log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo());
//车子剩余电量 //车子剩余电量
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc()); BigDecimal robotRemainingElectricity = new BigDecimal(soc);
//设置离开的电量 //设置离开的电量
BigDecimal robotEndElectricity = new BigDecimal("10"); BigDecimal robotEndElectricity = new BigDecimal("10");

View File

@ -991,8 +991,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
* @param robotTaskVo * @param robotTaskVo
*/ */
private void doMoveToPoint(RobotTaskDetailAddVO robotTaskVo) { private void doMoveToPoint(RobotTaskDetailAddVO robotTaskVo) {
PositionMapItemDO positionMapItem = positionMapItemService.getPositionMapItem(robotTaskVo.getReleaseId());
robotTaskVo.setToLocationNo(String.valueOf(positionMapItem.getSortNum()));
} }
/** /**
@ -1474,12 +1474,11 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
robotChargeLogDO.setEndTime(LocalDateTime.now()); robotChargeLogDO.setEndTime(LocalDateTime.now());
deviceInformationService.chargeDeviceShrink(robotChargeLogDO.getDeviceNo()); deviceInformationService.chargeDeviceShrink(robotChargeLogDO.getDeviceNo());
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotInformationDO.getMacAddress(); String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robotInformationDO.getMacAddress();
Object object = redisUtil.get(pose2dKey); Object socObject = redisUtil.get(socKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) { if (ObjectUtil.isNotEmpty(socObject)) {
robotChargeLogDO.setEndElectricity(Integer.valueOf(robotStatusDataPoseDTO.getBatSoc())); robotChargeLogDO.setEndElectricity(Integer.valueOf(socObject.toString()));
} }
robotChargeLogDO.setTaskStatus(ChargeTaskStatusEnum.DONE.getType()); robotChargeLogDO.setTaskStatus(ChargeTaskStatusEnum.DONE.getType());
chargeLogMapper.updateById(robotChargeLogDO); chargeLogMapper.updateById(robotChargeLogDO);

View File

@ -160,10 +160,14 @@ public class AutoChargeServiceImpl implements AutoChargeService {
List<RobotChargeLogDO> logs, Map<String, List<RobotTaskDetailDO>> detailMap) { List<RobotChargeLogDO> logs, Map<String, List<RobotTaskDetailDO>> detailMap) {
//判断机器人身上的电量少于设定的电量 //判断机器人身上的电量少于设定的电量
for (RobotInformationDO robot : robots) { for (RobotInformationDO robot : robots) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +robot.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT +robot.getMacAddress();
Object poseCache = redisUtil.get(pose2dKey); Object poseCache = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO dataPoseDTO= JSON.parseObject((String)poseCache, RobotStatusDataPoseDTO.class); RobotStatusDataPoseDTO dataPoseDTO= JSON.parseObject((String)poseCache, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isEmpty(dataPoseDTO) || ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) {
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robot.getMacAddress();
Object socObject = redisUtil.get(socKey);
if (ObjectUtil.isEmpty(dataPoseDTO) || ObjectUtil.isEmpty(socObject)) {
log.info("当前机器人查不到电量信息,所以不执行充电 :{}",robot.getRobotNo()); log.info("当前机器人查不到电量信息,所以不执行充电 :{}",robot.getRobotNo());
continue; continue;
} }
@ -187,7 +191,8 @@ public class AutoChargeServiceImpl implements AutoChargeService {
logDo.setRobotNo(robot.getRobotNo()); logDo.setRobotNo(robot.getRobotNo());
logDo.setDeviceNo(deviceInformationDO.getDeviceNo()); logDo.setDeviceNo(deviceInformationDO.getDeviceNo());
logDo.setPositionMapItemId(deviceInformationDO.getPositionMapItemId()); logDo.setPositionMapItemId(deviceInformationDO.getPositionMapItemId());
String[] split = dataPoseDTO.getBatSoc().split("\\.");
String[] split = socObject.toString().split("\\.");
logDo.setStartElectricity(Integer.valueOf(split[0])); logDo.setStartElectricity(Integer.valueOf(split[0]));
//配置的充满电电量 //配置的充满电电量
BigDecimal robotFullElectricity = new BigDecimal(fullElectricity); BigDecimal robotFullElectricity = new BigDecimal(fullElectricity);

View File

@ -129,15 +129,15 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
} }
if (ObjectUtil.isNotEmpty(chargeConfig) && ObjectUtil.isNotEmpty(chargeConfig.getStartAutoCharge())) { if (ObjectUtil.isNotEmpty(chargeConfig) && ObjectUtil.isNotEmpty(chargeConfig.getStartAutoCharge())) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robot.getMacAddress(); String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robot.getMacAddress();
Object poseCache = redisUtil.get(pose2dKey); Object socObject = redisUtil.get(socKey);
RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) { if (ObjectUtil.isEmpty(socObject)) {
robot.setRobotStatus(RobotStatusEnum.DOING.getType()); robot.setRobotStatus(RobotStatusEnum.DOING.getType());
log.info("车机没有电量信息 :{}",robot.getRobotNo()); log.info("车机没有电量信息 :{}",robot.getRobotNo());
continue; continue;
} }
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc()); BigDecimal robotRemainingElectricity = new BigDecimal(socObject.toString());
BigDecimal robotEndElectricity = new BigDecimal(chargeConfig.getStartAutoCharge()+""); BigDecimal robotEndElectricity = new BigDecimal(chargeConfig.getStartAutoCharge()+"");
if (robotRemainingElectricity.compareTo(robotEndElectricity) < 0) { if (robotRemainingElectricity.compareTo(robotEndElectricity) < 0) {
robot.setRobotStatus(RobotStatusEnum.DOING.getType()); robot.setRobotStatus(RobotStatusEnum.DOING.getType());
@ -235,21 +235,25 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
* @param robot * @param robot
*/ */
private void setRobotStatus(CommonConfigDO commonConfigDO, RobotInformationDO robot) { private void setRobotStatus(CommonConfigDO commonConfigDO, RobotInformationDO robot) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robot.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo(); String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo();
Object chargeModelCache = redisUtil.get(chargeModelKey); Object chargeModelCache = redisUtil.get(chargeModelKey);
Object poseCache = redisUtil.get(pose2dKey); Object poseCache = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class); RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo(), JSON.toJSONString(dataPoseDTO)); log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo(), JSON.toJSONString(dataPoseDTO));
if (ObjectUtil.isEmpty(commonConfigDO) || ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) { String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robot.getMacAddress();
Object o = redisUtil.get(socKey);
String soc = ObjectUtil.isEmpty(o) ? "0": o.toString();
if (ObjectUtil.isEmpty(commonConfigDO) || ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(o)) {
return; return;
} }
CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfigDO.getConfigStr(), CommonConfigVO.class); CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfigDO.getConfigStr(), CommonConfigVO.class);
//车子剩余电量 //车子剩余电量
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc()); BigDecimal robotRemainingElectricity = new BigDecimal(soc);
//设置离开的电量 //设置离开的电量
BigDecimal robotEndElectricity = new BigDecimal("10"); BigDecimal robotEndElectricity = new BigDecimal("10");

View File

@ -196,7 +196,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
List<RobotPositionMapDTO> list = new ArrayList<>(); List<RobotPositionMapDTO> list = new ArrayList<>();
for (RobotInformationDO robot : robots) { for (RobotInformationDO robot : robots) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robot.getMacAddress(); String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
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);
if (ObjectUtil.isEmpty(object) || ObjectUtil.isEmpty(robotStatusDataPoseDTO)) { if (ObjectUtil.isEmpty(object) || ObjectUtil.isEmpty(robotStatusDataPoseDTO)) {

View File

@ -894,4 +894,29 @@
</where> </where>
</select> </select>
<select id="getLocationsXYByMapId"
resultType="cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationItemRespVO">
SELECT
t1.id,
t1.location_no as locationNo,
t1.sku_info as skuInfo,
t1.sku_number as skuNumber,
t1.location_enable as locationEnable,
t1.location_lock as locationLock,
t1.location_use_status as locationUseStatus,
t1.location_wide as locationWide,
t1.location_deep as locationDeep,
t1.location_storey as locationStorey,
t2.actual_location_x as actualLocationX,
t2.actual_location_y as actualLocationY
FROM
ware_house_location t1
LEFT JOIN ware_position_map_item t2
on t1.map_item_id = t2.id
WHERE
t1.deleted = '0'
AND t2.deleted = '0'
AND t1.map_id = #{mapId}
</select>
</mapper> </mapper>