Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud-wcs into aikai
# Conflicts: # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/robot/RobotStatusApiImpl.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/robot/RobotInformationController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/robot/RobotInformationServiceImpl.java # yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml
This commit is contained in:
commit
0a3498bc7e
@ -19,16 +19,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.module.system.config.SystemJobConfiguration.NOTIFY_THREAD_POOL_TASK_EXECUTOR;
|
||||
|
||||
@Slf4j
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
@ -49,6 +51,9 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
@Value("${zn.robot_position_cache_time:600}")
|
||||
private Long robotPositionCacheTime;
|
||||
|
||||
@Value("${zn.robot_error_level_time:30}")
|
||||
private Long robotErrorLevelTime;
|
||||
|
||||
@Resource
|
||||
private RequestProcessor processor;
|
||||
|
||||
@ -59,6 +64,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Async(NOTIFY_THREAD_POOL_TASK_EXECUTOR)
|
||||
public void robotStatusUpdate(RobotStatusDTO robotStatusDataDTO) {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
if (ObjectUtil.isEmpty(robotStatusDataDTO) || ObjectUtil.isEmpty(robotStatusDataDTO.getMac())) {
|
||||
@ -109,7 +115,17 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
|
||||
List<RobotWarnMsgDO> warnMsgDOS = new ArrayList<>();
|
||||
|
||||
//机器人异常等级
|
||||
String errorLevelKey = RobotTaskChcheConstant.ROBOT_ERROR_LEVEL + robotStatusDataDTO.getMac();
|
||||
Object errorLevel = redisUtil.get(errorLevelKey);
|
||||
|
||||
Integer level = ObjectUtil.isEmpty(errorLevel) ? 0 : Integer.valueOf(errorLevel.toString());
|
||||
|
||||
for (RobotStatusDataErrorDTO robotStatusData : errCode) {
|
||||
if (level.intValue() < Integer.valueOf(robotStatusData.getCode_level()).intValue()) {
|
||||
level = Integer.valueOf(robotStatusData.getCode_level());
|
||||
}
|
||||
|
||||
List<RobotWarnCodeMappingDO> mappingDOS = warnCodeMapping.get(robotStatusData.getError_code());
|
||||
if (ObjectUtil.isEmpty(mappingDOS)) {
|
||||
log.info("当前告警类型查不到对应的告警信息 :{}", robotStatusData.getError_code());
|
||||
@ -124,6 +140,8 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
.build();
|
||||
warnMsgDOS.add(warnMsg);
|
||||
}
|
||||
redisUtil.set(errorLevelKey, level, robotErrorLevelTime);
|
||||
|
||||
warnMsgMapper.insertBatch(warnMsgDOS);
|
||||
}
|
||||
}
|
||||
|
@ -22,4 +22,7 @@ public class RobotTaskChcheConstant {
|
||||
|
||||
//机器人充电模式 1:自动充电、2:机会充电、3:充满电 (拼接的是机器人编号)
|
||||
public static String ROBOT_CHARGE_MODEL = "robot:information:charge:model";
|
||||
|
||||
//机器人异常等级 (拼接的是mac地址)
|
||||
public static String ROBOT_ERROR_LEVEL = "robot:information:error:level";
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.information;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.StatisticsInformationDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||
@ -116,4 +117,18 @@ public class DeviceInformationController {
|
||||
return success(map);
|
||||
}
|
||||
|
||||
@GetMapping("/deviceNumber")
|
||||
@Operation(summary = "统计设备数量")
|
||||
public CommonResult<List<StatisticsInformationDTO>> getDeviceNumber() {
|
||||
List<StatisticsInformationDTO> list = informationService.getDeviceNumber();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getInformationList")
|
||||
@Operation(summary = "获得所有设备信息(含最后通讯时间)")
|
||||
@PreAuthorize("@ss.hasPermission('device:information:query')")
|
||||
public CommonResult<List<DeviceInformationRespVO>> getInformationList(@Valid DeviceInformationPageReqVO pageReqVO) {
|
||||
List<DeviceInformationDO> list = informationService.getInformationList(pageReqVO);
|
||||
return success(BeanUtils.toBean(list, DeviceInformationRespVO.class));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.information.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StatisticsInformationDTO {
|
||||
@Schema(description = "设备类型 字典device_type", example = "2")
|
||||
private Integer deviceType;
|
||||
|
||||
@Schema(description = "设备数量", example = "2")
|
||||
private Integer number = 0;
|
||||
}
|
@ -35,6 +35,7 @@ public class DeviceInformationPageReqVO extends PageParam {
|
||||
@Schema(description = "深度")
|
||||
private BigDecimal locationDeep;
|
||||
|
||||
//1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||
@Schema(description = "设备类型 字典device_type", example = "2")
|
||||
private Integer deviceType;
|
||||
|
||||
|
@ -42,6 +42,7 @@ public class DeviceInformationRespVO {
|
||||
@ExcelProperty("深度")
|
||||
private BigDecimal locationDeep;
|
||||
|
||||
//1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||
@Schema(description = "设备类型 字典device_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("设备类型 字典device_type")
|
||||
private Integer deviceType;
|
||||
|
@ -35,6 +35,7 @@ public class DeviceInformationSaveReqVO {
|
||||
@Schema(description = "深度")
|
||||
private BigDecimal locationDeep;
|
||||
|
||||
//1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||
@Schema(description = "设备类型 字典device_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "设备类型不能为空")
|
||||
private Integer deviceType;
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.path;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.path.PathPlanningService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 同步信息给路径规划")
|
||||
@RestController
|
||||
@RequestMapping("/system/path/planning")
|
||||
@Validated
|
||||
public class PathPlanningController {
|
||||
|
||||
@Resource
|
||||
private PathPlanningService pathPlanningService;
|
||||
|
||||
@PutMapping("/synchronousPoint")
|
||||
@Operation(summary = "同步全部的点位信息")
|
||||
@PreAuthorize("@ss.hasPermission('robot:information:synchronousPoint')")
|
||||
public CommonResult<String> synchronousPoint() {
|
||||
pathPlanningService.synchronousPoint();
|
||||
return success("同步完成");
|
||||
}
|
||||
|
||||
}
|
@ -112,4 +112,12 @@ public class RobotInformationController {
|
||||
return success(BeanUtils.toBean(result, RobotInformationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得车辆信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('robot:information:list')")
|
||||
public CommonResult<PageResult<RobotInformationPageRespVO>> getRobotList(@Valid RobotInformationPageReqVO pageReqVO) {
|
||||
pageReqVO.setPageSize(300);
|
||||
PageResult<RobotInformationPageRespVO> pageResult = informationService.getInformationPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RobotInformationPageRespVO.class));
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,9 @@ public class RobotInformationPageReqVO extends PageParam {
|
||||
@Schema(description = "mac地址")
|
||||
private String macAddress;
|
||||
|
||||
@Schema(description = "车辆状态类型(待命:standby, 任务中:inTask, 锁定:doLock, 离线:offline, 充电中:charge, 故障:fault)")
|
||||
private String robotStatisticsType;
|
||||
|
||||
@Schema(description = "上传图片附件", example = "https://www.iocoder.cn")
|
||||
private String url;
|
||||
|
||||
|
@ -36,8 +36,24 @@ public class RobotInformationPageRespVO {
|
||||
@ExcelProperty("电量")
|
||||
private String electricity;
|
||||
|
||||
@Schema(description = "状态(0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障)")
|
||||
@Schema(description = "在线状态/离线状态(0:离线、1:在线)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("在线状态/离线状态(0:离线、1:在线)")
|
||||
private Integer onlineStatus = 0;
|
||||
|
||||
@Schema(description = "车机状态(0:空闲、1:锁定、2:异常)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("车机状态(0:空闲、1:锁定、2:异常)")
|
||||
private Integer robotEssenceStatus = 0;
|
||||
|
||||
@Schema(description = "任务状态(0:待命中、1:处理中、2:充电中)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("任务状态(0:待命中、1:处理中、2:充电中)")
|
||||
private Integer robotTaskStatus = 0;
|
||||
|
||||
@Schema(description = "异常等级(0,1,2,3,4)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("异常等级(0,1,2,3,4)")
|
||||
private Integer robotCodeLevel = 0;
|
||||
|
||||
@Schema(description = "AGV状态(0:暂停且无任务、1:暂停(有处理中的任务)、2:任务中、3:待命)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("AGV状态(0:暂停且无任务、1:暂停(有处理中的任务)、2:任务中、3:待命)")
|
||||
private Integer robotStatus;
|
||||
|
||||
@Schema(description = "自动充电电量")
|
||||
@ -58,7 +74,7 @@ public class RobotInformationPageRespVO {
|
||||
@Schema(description = "mac地址")
|
||||
private String macAddress;
|
||||
|
||||
@Schema(description = "任务模式(0:拒收任务、1:正常)")
|
||||
@Schema(description = "任务模式(0:拒收任务(锁定)、1:正常)")
|
||||
private Integer robotTaskModel;
|
||||
|
||||
@Schema(description = "楼层/区域(json)")
|
||||
|
@ -59,6 +59,7 @@ public class DeviceInformationDO extends BaseDO {
|
||||
*/
|
||||
private BigDecimal locationDeep;
|
||||
/**
|
||||
* 1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||
* 设备类型 字典device_type
|
||||
*/
|
||||
private Integer deviceType;
|
||||
|
@ -10,9 +10,10 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CommandConfigTypeEnum {
|
||||
ONE(1); //充电设置(页面)
|
||||
CHARG_CONFIG(1,"充电设置(页面)");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
private final String msg;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import lombok.Getter;
|
||||
public enum DeviceTypeEnum {
|
||||
|
||||
CHARGING_STATION(1, "充电桩"),
|
||||
Conveyor_line(2, "输送线"),
|
||||
CONVEYOR_LINE(2, "输送线"),
|
||||
PALLETIZER(3, "码垛机"),
|
||||
AUTOMATIC_DOOR(4, "自动门"),
|
||||
HOIST(5, "提升机"),
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.system.enums.device;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PictureConfigEnum {
|
||||
|
||||
DEFAULT(1, "默认图片"),
|
||||
UPLOAD(2, "上传图片"),
|
||||
NOT_DISPLAY(3, "不显示图片");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private final String msg;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.enums.robot.information;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 车辆分页-车辆状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RobotStatisticsTypeEnum {
|
||||
|
||||
STANDBY("standby","待命"),
|
||||
INTASK("inTask","任务中"),
|
||||
DOLOCK("doLock","锁定"),
|
||||
OFFLINE("offline","离线"),
|
||||
CHARGE("charge","充电中"),
|
||||
FAULT("fault","故障");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String type;
|
||||
private final String msg;
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.information;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.StatisticsInformationDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||
@ -92,4 +93,17 @@ public interface DeviceInformationService {
|
||||
* @return
|
||||
*/
|
||||
Map<Integer, List<DeviceInformationDO>> classification();
|
||||
|
||||
/**
|
||||
* 统计设备
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsInformationDTO> getDeviceNumber();
|
||||
|
||||
/**
|
||||
* 查看全部设备
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
List<DeviceInformationDO> getInformationList(@Valid DeviceInformationPageReqVO pageReqVO);
|
||||
}
|
||||
|
@ -8,11 +8,16 @@ import cn.iocoder.yudao.module.grpc.api.GrpcServiceApi;
|
||||
import cn.iocoder.yudao.module.system.constant.device.DeviceChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.StatisticsInformationDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.device.DeviceStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.device.PictureConfigEnum;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -45,6 +50,9 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
@Resource
|
||||
private DeviceInformationMapper informationMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataService dictDataService;
|
||||
|
||||
@Resource
|
||||
private GrpcServiceApi grpcServiceApi;
|
||||
|
||||
@ -59,6 +67,17 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
if (ObjectUtil.isNotEmpty(pageResult.getList())) {
|
||||
throw exception(INFORMATION_MAC_EXIST);
|
||||
}
|
||||
|
||||
//默认图片
|
||||
if (PictureConfigEnum.DEFAULT.getType().equals(createReqVO.getPictureConfig())) {
|
||||
List<DictDataDO> deviceType = dictDataService.getDictDataListByDictType("device_type");
|
||||
DictDataDO dictDataDO = deviceType.stream()
|
||||
.filter(v -> Integer.valueOf(v.getValue()).equals(createReqVO.getDeviceType()))
|
||||
.findFirst()
|
||||
.orElse(new DictDataDO());
|
||||
createReqVO.setUrl(dictDataDO.getRemark());
|
||||
}
|
||||
|
||||
// 插入
|
||||
DeviceInformationDO information = BeanUtils.toBean(createReqVO, DeviceInformationDO.class);
|
||||
information.setDeviceStatus(1);
|
||||
@ -191,6 +210,67 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
|
||||
return collect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计设备
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<StatisticsInformationDTO> getDeviceNumber() {
|
||||
List<DeviceInformationDO> deviceInformationDOS = informationMapper.selectList(new LambdaQueryWrapper<DeviceInformationDO>());
|
||||
if (ObjectUtil.isEmpty(deviceInformationDOS)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<StatisticsInformationDTO> list = deviceInformationDOS.stream()
|
||||
.filter(v -> ObjectUtil.isNotEmpty(v.getDeviceType()))
|
||||
.collect(Collectors.groupingBy(DeviceInformationDO::getDeviceType))
|
||||
.entrySet().stream()
|
||||
.map(v -> {
|
||||
Integer key = v.getKey();
|
||||
int number = v.getValue().size();
|
||||
StatisticsInformationDTO statisticsInformationDTO = new StatisticsInformationDTO();
|
||||
statisticsInformationDTO.setDeviceType(key);
|
||||
statisticsInformationDTO.setNumber(number);
|
||||
return statisticsInformationDTO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceInformationDO> getInformationList(DeviceInformationPageReqVO dto) {
|
||||
|
||||
List<DeviceInformationDO> deviceInformationDOS = informationMapper.selectList(new LambdaQueryWrapper<DeviceInformationDO>()
|
||||
.like(dto.getDeviceNo() != null, DeviceInformationDO::getDeviceNo, dto.getDeviceNo())
|
||||
.eq(dto.getDeviceType() != null, DeviceInformationDO::getDeviceType, dto.getDeviceType())
|
||||
);
|
||||
|
||||
if (ObjectUtil.isEmpty(deviceInformationDOS)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// todo 需要设置设备通讯的时间
|
||||
for (DeviceInformationDO deviceInformationDO : deviceInformationDOS) {
|
||||
String deviceKey = DeviceChcheConstant.DEVICE_LAST_TIME +deviceInformationDO.getMacAddress();
|
||||
Object object = redisUtil.get(deviceKey);
|
||||
if (ObjectUtil.isEmpty(object)) {
|
||||
deviceInformationDO.setDeviceStatus(DeviceStatusEnum.OFF_LINE.getType());
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime curTimeLDT = LocalDateTime.parse((String)object, df);
|
||||
deviceInformationDO.setDeviceLastTime(curTimeLDT);
|
||||
deviceInformationDO.setDeviceStatus(DeviceStatusEnum.ON_LINE.getType());
|
||||
} catch (Exception e) {
|
||||
log.info("查询设备最后通讯时间异常 :{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return deviceInformationDOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapBindDeviceInfo(MapBindDeviceInfoDTO dto) {
|
||||
DeviceInformationDO deviceInformationDO = informationMapper.selectById(dto.getDeviceInfoId());
|
||||
|
@ -0,0 +1,5 @@
|
||||
package cn.iocoder.yudao.module.system.service.path;
|
||||
|
||||
public interface PathPlanningService {
|
||||
void synchronousPoint();
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.system.service.path;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 同步信息给车辆
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
|
||||
|
||||
/**
|
||||
* 同步全部的点位信息
|
||||
*/
|
||||
@Override
|
||||
public void synchronousPoint() {
|
||||
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||
@ -151,7 +150,49 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
targetList.stream().forEach(v -> {
|
||||
setMsgAndRobotStatus(v);
|
||||
});
|
||||
dataPage.setList(targetList);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(pageReqVO.getRobotStatisticsType())) {
|
||||
List<RobotInformationPageRespVO> resultList = new ArrayList<>();
|
||||
for (RobotInformationPageRespVO v : targetList) {
|
||||
if (RobotStatisticsTypeEnum.STANDBY.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getRobotTaskStatus().equals(0)) {
|
||||
resultList.add(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RobotStatisticsTypeEnum.INTASK.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getRobotTaskStatus().equals(1)) {
|
||||
resultList.add(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RobotStatisticsTypeEnum.CHARGE.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getRobotTaskStatus().equals(2)) {
|
||||
resultList.add(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RobotStatisticsTypeEnum.DOLOCK.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getRobotEssenceStatus().equals(1)) {
|
||||
resultList.add(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RobotStatisticsTypeEnum.OFFLINE.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getOnlineStatus().equals(1)) {
|
||||
resultList.add(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RobotStatisticsTypeEnum.FAULT.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getRobotEssenceStatus().equals(2)) {
|
||||
resultList.add(v);
|
||||
}
|
||||
}
|
||||
dataPage.setList(resultList);
|
||||
} else {
|
||||
dataPage.setList(targetList);
|
||||
}
|
||||
|
||||
return dataPage;
|
||||
}
|
||||
@ -173,38 +214,37 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
v.setElectricity(robotStatusDataPoseDTO.getBat_soc());
|
||||
v.setFloor(robotStatusDataPoseDTO.getFloor());
|
||||
v.setArea(robotStatusDataPoseDTO.getArea());
|
||||
} else if (ObjectUtil.isEmpty(object)) {
|
||||
//离线
|
||||
v.setOnlineStatus(1);
|
||||
}
|
||||
|
||||
if (RobotTaskModelEnum.REJECTION.getType().equals(v.getRobotTaskModel())) {
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.DOLOCK.getType());
|
||||
v.setMsg("车辆已经锁定");
|
||||
} else if (ObjectUtil.isEmpty(object)) {
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.OFFLINE.getType());
|
||||
v.setMsg("车辆已经离线");
|
||||
} else if (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())) {
|
||||
//查看机器人最后做的任务是不是充电
|
||||
RobotTaskDetailDO robotTaskDetailDO = taskDetailMapper.selectOne(new LambdaQueryWrapper<RobotTaskDetailDO>()
|
||||
.eq(RobotTaskDetailDO::getRobotNo, v.getRobotNo())
|
||||
.orderByDesc(RobotTaskDetailDO::getCreateTime)
|
||||
.last("limit 1"));
|
||||
if (ObjectUtil.isNotEmpty(robotTaskDetailDO)
|
||||
&& RobotTaskTypeEnum.CHARGE.getType().equals(robotTaskDetailDO.getTaskType())
|
||||
&& RobotTaskStatusEnum.DOING.getType().equals(robotTaskDetailDO.getTaskStatus())) {
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.CHARGE.getType());
|
||||
v.setMsg("车辆正在充电");
|
||||
} else {
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.STANDBY.getType());
|
||||
v.setMsg("车辆正在待命");
|
||||
}
|
||||
} else if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus()) && ObjectUtil.isNotEmpty(action)) {
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.INTASK.getType());
|
||||
CommandTypeEnum commandType = CommandTypeEnum.getCommandType(String.valueOf(action));
|
||||
if (ObjectUtil.isNotEmpty(commandType)) {
|
||||
v.setMsg("车辆正在" + commandType.getMsg());
|
||||
}
|
||||
v.setRobotEssenceStatus(v.getRobotTaskModel());
|
||||
//设置异常
|
||||
String errorLevelKey = RobotTaskChcheConstant.ROBOT_ERROR_LEVEL + v.getMacAddress();
|
||||
Object errorLevel = redisUtil.get(errorLevelKey);
|
||||
if (ObjectUtil.isNotEmpty(errorLevel) && Integer.valueOf(errorLevel.toString()).intValue() >= 3) {
|
||||
v.setRobotEssenceStatus(2);
|
||||
}
|
||||
|
||||
if (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())) {
|
||||
//待命中
|
||||
v.setRobotTaskStatus(0);
|
||||
v.setMsg("车辆正在待命中");
|
||||
} else if (RobotStatusEnum.CHARGE.getType().equals(v.getRobotStatus())) {
|
||||
//充电中
|
||||
v.setRobotTaskStatus(2);
|
||||
v.setMsg("车辆正在充电");
|
||||
} else {
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.FAULT.getType());
|
||||
v.setMsg("车辆发生异常");
|
||||
//任务中
|
||||
v.setRobotTaskStatus(1);
|
||||
if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus()) && ObjectUtil.isNotEmpty(action)) {
|
||||
v.setRobotStatus(1);
|
||||
CommandTypeEnum commandType = CommandTypeEnum.getCommandType(String.valueOf(action));
|
||||
if (ObjectUtil.isNotEmpty(commandType)) {
|
||||
v.setMsg("车辆正在" + commandType.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class AutoChargeServiceImpl implements AutoChargeService {
|
||||
public void autoChargeJob() {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.ONE.getType()));
|
||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.CHARG_CONFIG.getType()));
|
||||
|
||||
if (ObjectUtil.isEmpty(commonConfigDO)) {
|
||||
log.info("暂未配置充电信息");
|
||||
|
@ -127,7 +127,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
Pair<List<RobotInformationDO>, List<RobotTaskDetailDO>> pair = Pair.of(new ArrayList<>(), new ArrayList<>());
|
||||
|
||||
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.ONE.getType()));
|
||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.CHARG_CONFIG.getType()));
|
||||
CommonConfigVO chargeConfig= JSONUtil.toBean(commonConfigDO.getConfigStr(),CommonConfigVO.class);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if ((ObjectUtil.isNotEmpty(chargeConfig.getScheduleChargeEndTime()) &&
|
||||
|
@ -227,6 +227,7 @@ zn:
|
||||
lift_height: 0.1 #抬高托盘高度
|
||||
move_height: 0.1 #行走高度
|
||||
lane_auto_move: true #线库是否自动移库 true:线库执行自动移库 、false:线库关闭执行自动移库
|
||||
robot_position_cache_time: 10 #机器人上报点位存储时间
|
||||
robot_position_cache_time: 10 #机器人上报点位存储时间(秒)
|
||||
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
||||
full_electricity: 100 #机器人充满电的电量
|
||||
robot_error_level_time: 30 #机器人异常存储时间(秒)
|
||||
|
Loading…
Reference in New Issue
Block a user