Compare commits
5 Commits
adfb5dc8ba
...
5bb04952be
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5bb04952be | ||
![]() |
3665002ba1 | ||
![]() |
740e725637 | ||
![]() |
faabc4151b | ||
![]() |
afccb0e06b |
@ -99,4 +99,13 @@ public class FileController {
|
||||
return success(BeanUtils.toBean(pageResult, FileRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/businessUpload")
|
||||
@Operation(summary = "上传业务类型附件【如:工作日/周报附件】")
|
||||
// @OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
|
||||
@PermitAll
|
||||
public CommonResult<BusinessFileVO> businessUpload(@RequestParam("uploadFiles") MultipartFile file) throws Exception {
|
||||
return success(fileService.createBusinessReturnFile(file));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.file.vo.file;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BusinessFileVO {
|
||||
/**
|
||||
* 编号,数据库自增
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
* 1 日志附件 2 签名附件 3 头像 5 考勤附件 6 人脸照片
|
||||
*/
|
||||
private Long businessType;
|
||||
/**
|
||||
* 配置编号
|
||||
*
|
||||
* 关联 {@link FileConfigDO#getId()}
|
||||
*/
|
||||
private Long configId;
|
||||
/**
|
||||
* 原文件名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 路径,即文件名
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* 访问地址
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 文件的 MIME 类型,例如 "application/octet-stream"
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
/**
|
||||
* 上传人ID
|
||||
*/
|
||||
private Long uploadUserId ;
|
||||
|
||||
/**
|
||||
* 流程实例编号
|
||||
*/
|
||||
private String businessInstanceId ;
|
||||
}
|
@ -1,10 +1,14 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.BusinessFileVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 文件 Service 接口
|
||||
@ -63,4 +67,11 @@ public interface FileService {
|
||||
*/
|
||||
FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param file
|
||||
* @param businessType
|
||||
* @return
|
||||
*/
|
||||
BusinessFileVO createBusinessReturnFile(MultipartFile file) throws IOException;
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.io.file.FileNameUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.BusinessFileVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
@ -15,9 +19,12 @@ import cn.iocoder.yudao.module.infra.framework.file.core.client.s3.FilePresigned
|
||||
import cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
|
||||
@ -114,4 +121,73 @@ public class FileServiceImpl implements FileService {
|
||||
object -> object.setConfigId(fileClient.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public BusinessFileVO createBusinessReturnFile(MultipartFile file) {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
long timestamp = System.currentTimeMillis();
|
||||
|
||||
String[] fileInfo = new String[4];
|
||||
String name = file.getOriginalFilename();
|
||||
String path = null;
|
||||
byte[] content = IoUtil.readBytes(file.getInputStream());
|
||||
|
||||
// 计算默认的 path 名
|
||||
String type = FileTypeUtils.getMineType(content, name);
|
||||
|
||||
StrUtil.isEmpty(path);//path = FileUtils.generatePath(content, name);
|
||||
path = userId + "_" + timestamp;
|
||||
String beginPath = name.replace(".", "_");
|
||||
path = beginPath + "_" + path + "." + FileNameUtil.extName(name);
|
||||
// 如果 name 为空,则使用 path 填充
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
name = path;
|
||||
}
|
||||
|
||||
// 上传到文件存储器
|
||||
FileClient client = fileConfigService.getMasterFileClient();
|
||||
Assert.notNull(client, "客户端(master) 不能为空");
|
||||
String url = client.upload(content, path, type);
|
||||
|
||||
// 保存到数据库
|
||||
BusinessFileVO fileDo = new BusinessFileVO();
|
||||
fileDo.setConfigId(client.getId());
|
||||
fileDo.setName(name);
|
||||
fileDo.setPath(path);
|
||||
fileDo.setUrl(url);
|
||||
fileDo.setType(type);
|
||||
fileDo.setSize(content.length);
|
||||
fileDo.setUploadUserId(userId);
|
||||
|
||||
|
||||
//如果业务类型是2 ,说明是保存用户签名图片,那么将用户ID存入businessInstanceId中
|
||||
/*if( businessType == 2) {
|
||||
//先查询当前用户,是否存有签名,如果没有新增,如果存在,则更新url,并删除infra_file_content中对应的记录
|
||||
BusinessFileDO businessFileDO = businessFileMapper.selectOneByBusinessInstanceId(businessType, userId.toString()) ;
|
||||
if (businessFileDO == null) {
|
||||
fileDo.setBusinessInstanceId(userId+"") ;
|
||||
businessFileMapper.insert(fileDo);
|
||||
}else {
|
||||
client.delete(businessFileDO.getPath());
|
||||
businessFileDO.setConfigId(client.getId());
|
||||
businessFileDO.setName(name);
|
||||
businessFileDO.setPath(path);
|
||||
businessFileDO.setUrl(url);
|
||||
businessFileDO.setType(type);
|
||||
businessFileDO.setSize(content.length);
|
||||
businessFileDO.setUploadUserId(userId);
|
||||
businessFileDO.setBusinessType(businessType) ;
|
||||
businessFileMapper.updateById(businessFileDO) ;
|
||||
fileDo = businessFileDO ;
|
||||
}
|
||||
}else {
|
||||
businessFileMapper.insert(fileDo);
|
||||
}*/
|
||||
|
||||
fileInfo[0] = name;
|
||||
fileInfo[1] = fileDo.getUrl();
|
||||
fileInfo[2] = fileDo.getType();
|
||||
return fileDo;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -223,4 +223,7 @@ public interface ErrorCodeConstants {
|
||||
// ========== 机器人告警码值映射 1_002_041_001 ==========
|
||||
ErrorCode WARN_CODE_MAPPING_NOT_EXISTS = new ErrorCode(1_002_041_001, "机器人告警码值映射不存在");
|
||||
|
||||
// ========== 通用配置 1_002_042_001 ==========
|
||||
ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1_002_042_001 , "通用配置不存在");
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getData().getPose2d().getX());
|
||||
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getData().getPose2d().getY());
|
||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
|
||||
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getPose2d().getFloor());
|
||||
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getPose2d().getArea());
|
||||
redisUtil.set(pose2dKey,JSON.toJSONString(robotStatusDataPoseDTO),robotPositionCacheTime);
|
||||
|
||||
if (ObjectUtil.isNotNull(robotStatusDataDTO.getData().getErr_code())) {
|
||||
|
@ -0,0 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.constant.device;
|
||||
|
||||
public class DeviceChcheConstant {
|
||||
//设备最后通讯时间
|
||||
public static String DEVICE_LAST_TIME = "device:last:time";
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.config;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
import cn.iocoder.yudao.module.system.service.config.CommonConfigService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 通用配置")
|
||||
@RestController
|
||||
@RequestMapping("/system/common/config")
|
||||
@Validated
|
||||
public class CommonConfigController {
|
||||
|
||||
@Resource
|
||||
private CommonConfigService configService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建通用配置")
|
||||
@PreAuthorize("@ss.hasPermission('common:config:create')")
|
||||
public CommonResult<Long> createConfig(@Valid @RequestBody CommonConfigSaveReqVO createReqVO) {
|
||||
return success(configService.createConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新通用配置")
|
||||
@PreAuthorize("@ss.hasPermission('common:config:update')")
|
||||
public CommonResult<Boolean> updateConfig(@Valid @RequestBody CommonConfigSaveReqVO updateReqVO) {
|
||||
configService.updateConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除通用配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('common:config:delete')")
|
||||
public CommonResult<Boolean> deleteConfig(@RequestParam("id") Long id) {
|
||||
configService.deleteConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得通用配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('common:config:query')")
|
||||
public CommonResult<CommonConfigDO> getConfig(@RequestParam("configType") Long configType) {
|
||||
CommonConfigDO config = configService.getConfig(configType);
|
||||
return success(config);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得通用配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('common:config:query')")
|
||||
public CommonResult<PageResult<CommonConfigRespVO>> getConfigPage(@Valid CommonConfigPageReqVO pageReqVO) {
|
||||
PageResult<CommonConfigDO> pageResult = configService.getConfigPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CommonConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出通用配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('common:config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportConfigExcel(@Valid CommonConfigPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CommonConfigDO> list = configService.getConfigPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "通用配置.xls", "数据", CommonConfigRespVO.class,
|
||||
BeanUtils.toBean(list, CommonConfigRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.config.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 通用配置分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CommonConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "类型(1:参数配置、2:备用)", example = "1")
|
||||
private Integer configType;
|
||||
|
||||
@Schema(description = "配置信息")
|
||||
private String configStr;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 通用配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CommonConfigRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22456")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "类型(1:参数配置、2:备用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("类型(1:参数配置、2:备用)")
|
||||
private Integer configType;
|
||||
|
||||
@Schema(description = "配置信息")
|
||||
@ExcelProperty("配置信息")
|
||||
private String configStr;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.config.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.framework.common.exception.enums.ServiceErrorCodeRange;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 通用配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class CommonConfigSaveReqVO implements Serializable {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22456")
|
||||
private Long id;
|
||||
|
||||
//查看 CommandConfigTypeEnum
|
||||
@Schema(description = "类型(1:参数配置、2:备用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer configType;
|
||||
|
||||
@Schema(description = "配置信息")
|
||||
private String configStr;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 参数设置
|
||||
*/
|
||||
@Data
|
||||
public class CommonConfigVO {
|
||||
|
||||
@Schema(description = "自动充电电量-充电-阀值")
|
||||
private Integer startAutoCharge;
|
||||
|
||||
@Schema(description = "自动充电电量-离开-阀值")
|
||||
private Integer endAutoCharge;
|
||||
|
||||
@Schema(description = "机会充电电量-充电-阀值")
|
||||
private Integer chanceChargeStart;
|
||||
|
||||
@Schema(description = "机会充电电量-离开-阀值")
|
||||
private Integer chanceChargeEnd;
|
||||
|
||||
@Schema(description = "定时充电时段-开始时间")
|
||||
private LocalDateTime chargeStartTime;
|
||||
|
||||
@Schema(description = "定时充电时段-结束时间")
|
||||
private LocalDateTime chargeEndTime;
|
||||
|
||||
@Schema(description = "冲满电周期")
|
||||
private Integer chanceCycle;
|
||||
|
||||
@Schema(description = "遇障告警设置-等待时间")
|
||||
private Integer warnWaitTime;
|
||||
}
|
@ -79,4 +79,12 @@ public class HouseAreaController {
|
||||
BeanUtils.toBean(list, HouseAreaRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getHouseAreaList")
|
||||
@Operation(summary = "获得全部库区")
|
||||
@PreAuthorize("@ss.hasPermission('ware:house-area:query')")
|
||||
public CommonResult<List<HouseAreaRespVO>> getHouseAreaList() {
|
||||
List<HouseAreaDO> list = houseAreaService.getHouseAreaList();
|
||||
return success(BeanUtils.toBean(list, HouseAreaRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,4 +54,12 @@ public class WareHouseLaneController {
|
||||
.eq(WareHouseLaneDO::getPositionMapId, positionMapId));
|
||||
return success(BeanUtils.toBean(list, WareHouseLaneRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getHouseLaneList")
|
||||
@Operation(summary = "获得所有线库列表")
|
||||
public CommonResult<List<WareHouseLaneRespVO>> getHouseLaneList() {
|
||||
List<WareHouseLaneDO> list = houseLaneService.list(new LambdaQueryWrapperX<WareHouseLaneDO>()
|
||||
.orderByAsc(WareHouseLaneDO::getId));
|
||||
return success(BeanUtils.toBean(list, WareHouseLaneRespVO.class));
|
||||
}
|
||||
}
|
||||
|
@ -80,10 +80,10 @@ public class WareHouseLocationController {
|
||||
return success(BeanUtils.toBean(list, WareHouseLocationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@PostMapping("/page")
|
||||
@Operation(summary = "获得库位分页")
|
||||
@PreAuthorize("@ss.hasPermission('ware:house-location:query')")
|
||||
public CommonResult<PageResult<WareHouseLocationRespVO>> getHouseLocationPage(@Valid WareHouseLocationPageReqVO pageReqVO) {
|
||||
public CommonResult<PageResult<WareHouseLocationRespVO>> getHouseLocationPage(@Valid @RequestBody WareHouseLocationPageReqVO pageReqVO) {
|
||||
PageResult<WareHouseLocationDO> pageResult = houseLocationService.getHouseLocationPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, WareHouseLocationRespVO.class));
|
||||
}
|
||||
|
@ -140,4 +140,8 @@ public class WareHouseLocationRespVO {
|
||||
@Schema(description = "ware_position_map的id", example = "1")
|
||||
@ExcelProperty("ware_position_map的id")
|
||||
private Long mapId;
|
||||
|
||||
@Schema(description = "ware_position_map_item的id", example = "1")
|
||||
@ExcelProperty("ware_position_map_item的id")
|
||||
private Long mapItemId;
|
||||
}
|
@ -109,4 +109,11 @@ public class DeviceInformationController {
|
||||
BeanUtils.toBean(list, DeviceInformationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/classification")
|
||||
@Operation(summary = "获得设备信息分类列表")
|
||||
public CommonResult<Map<Integer,List<DeviceInformationDO>>> classification() {
|
||||
Map<Integer,List<DeviceInformationDO>> map = informationService.classification();
|
||||
return success(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ public class DeviceInformationPageReqVO extends PageParam {
|
||||
@Schema(description = "设备编号")
|
||||
private String deviceNo;
|
||||
|
||||
@Schema(description = "设备位置")
|
||||
private String deviceLocation;
|
||||
|
||||
@Schema(description = "mac地址")
|
||||
private String macAddress;
|
||||
|
||||
|
@ -50,6 +50,10 @@ public class DeviceInformationRespVO {
|
||||
@ExcelProperty("设备编号")
|
||||
private String deviceNo;
|
||||
|
||||
@Schema(description = "设备位置")
|
||||
@ExcelProperty("设备位置")
|
||||
private String deviceLocation;
|
||||
|
||||
@Schema(description = "mac地址")
|
||||
@ExcelProperty("mac地址")
|
||||
private String macAddress;
|
||||
|
@ -41,6 +41,9 @@ public class DeviceInformationSaveReqVO {
|
||||
@Schema(description = "设备编号")
|
||||
private String deviceNo;
|
||||
|
||||
@Schema(description = "设备位置")
|
||||
private String deviceLocation;
|
||||
|
||||
@Schema(description = "mac地址")
|
||||
private String macAddress;
|
||||
|
||||
|
@ -89,4 +89,12 @@ public class PositionMapController {
|
||||
public void downloadFile(HttpServletResponse response) throws IOException {
|
||||
positionMapService.downloadFile(response);
|
||||
}
|
||||
|
||||
@GetMapping("/getAllMap")
|
||||
@Operation(summary = "获得楼层对应的区域集合")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-map:getAllMap')")
|
||||
public CommonResult<Map<Integer, List<PositionMapDO>>> getAllMap() {
|
||||
Map<Integer, List<PositionMapDO>> list = positionMapService.getAllMap();
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
@ -91,4 +91,12 @@ public class RobotModelController {
|
||||
BeanUtils.toBean(list, RobotModelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getAllModel")
|
||||
@Operation(summary = "获得车辆类型分页")
|
||||
@PreAuthorize("@ss.hasPermission('robot:model:getAllModel')")
|
||||
public CommonResult<List<RobotModelDO>> getAllModel() {
|
||||
List<RobotModelDO> list = modelService.getAllModel();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 机器人告警码值映射")
|
||||
@RestController
|
||||
@RequestMapping("/robot/warn-code-mapping")
|
||||
@RequestMapping("/system/robot/warn-code-mapping")
|
||||
@Validated
|
||||
public class RobotWarnCodeMappingController {
|
||||
|
||||
|
@ -33,7 +33,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 机器人告警信息")
|
||||
@RestController
|
||||
@RequestMapping("/robot/warn-msg")
|
||||
@RequestMapping("/system/robot/warn-msg")
|
||||
@Validated
|
||||
public class RobotWarnMsgController {
|
||||
|
||||
|
@ -27,6 +27,9 @@ public class RobotInformationPageReqVO extends PageParam {
|
||||
@Schema(description = "任务模式(0:拒收任务、1:正常)")
|
||||
private Integer robotTaskModel;
|
||||
|
||||
@Schema(description = "自动充电电量")
|
||||
private Integer autoCharge;
|
||||
|
||||
@Schema(description = "mac地址")
|
||||
private String macAddress;
|
||||
|
||||
|
@ -5,6 +5,9 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@Schema(description = "管理后台 - 车辆信息 Response VO")
|
||||
@Data
|
||||
@ -14,6 +17,9 @@ public class RobotInformationPageRespVO {
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "车辆类型表id", example = "28234")
|
||||
private Long robotModelId;
|
||||
|
||||
@Schema(description = "车辆类型")
|
||||
@ExcelProperty("车辆类型")
|
||||
private String robotModelNumber;
|
||||
@ -34,6 +40,9 @@ public class RobotInformationPageRespVO {
|
||||
@ExcelProperty("状态(0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障)")
|
||||
private Integer robotStatus;
|
||||
|
||||
@Schema(description = "自动充电电量")
|
||||
private Integer autoCharge;
|
||||
|
||||
@Schema(description = "楼层")
|
||||
@ExcelProperty("楼层")
|
||||
public String floor;
|
||||
@ -46,10 +55,13 @@ public class RobotInformationPageRespVO {
|
||||
@ExcelProperty("信息")
|
||||
public String msg;
|
||||
|
||||
@Schema(description = "mac地址")
|
||||
private String macAddress;
|
||||
/**
|
||||
* 任务模式(0:拒收任务、1:正常)
|
||||
*/
|
||||
|
||||
@Schema(description = "任务模式(0:拒收任务、1:正常)")
|
||||
private Integer robotTaskModel;
|
||||
|
||||
@Schema(description = "楼层/区域(json)")
|
||||
private Set<Long> floorAreaJson;
|
||||
|
||||
}
|
||||
|
@ -62,5 +62,9 @@ public class RobotInformationRespVO {
|
||||
@ExcelProperty("电量")
|
||||
private String electricity;
|
||||
|
||||
@Schema(description = "自动充电电量")
|
||||
@ExcelProperty("自动充电电量")
|
||||
private Integer autoCharge;
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.robot.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@ -19,7 +20,6 @@ public class RobotInformationSaveReqVO {
|
||||
private Long robotModelId;
|
||||
|
||||
@Schema(description = "车辆类型")
|
||||
@NotEmpty(message = "车辆类型不能为空")
|
||||
private String robotModelNumber;
|
||||
|
||||
@Schema(description = "AGV编号")
|
||||
@ -43,4 +43,7 @@ public class RobotInformationSaveReqVO {
|
||||
@NotEmpty(message = "楼层/区域不能为空")
|
||||
private Set<Long> floorAreaJson;
|
||||
|
||||
@Schema(description = "自动充电电量")
|
||||
private Integer autoCharge;
|
||||
|
||||
}
|
@ -28,4 +28,9 @@ public class RobotModelPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "上传图片附件", example = "https://www.iocoder.cn")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "是否自动充电(0:手动充电,1:自动充电)")
|
||||
private Integer autoCharge;
|
||||
}
|
@ -20,6 +20,13 @@ public class RobotModelRespVO {
|
||||
@ExcelProperty("车辆类型")
|
||||
private String robotModelNumber;
|
||||
|
||||
@Schema(description = "上传图片附件", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("上传图片附件")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "是否自动充电(0:手动充电,1:自动充电)")
|
||||
private Integer autoCharge;
|
||||
|
||||
@Schema(description = "偏移量")
|
||||
@ExcelProperty("偏移量")
|
||||
private String robotOffset;
|
||||
|
@ -19,4 +19,10 @@ public class RobotModelSaveReqVO {
|
||||
@Schema(description = "偏移量")
|
||||
private String robotOffset;
|
||||
|
||||
@Schema(description = "上传图片附件", example = "https://www.iocoder.cn")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "是否自动充电(0:手动充电,1:自动充电)")
|
||||
private Integer autoCharge;
|
||||
|
||||
}
|
@ -7,6 +7,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class RobotPositionMapVO {
|
||||
/**
|
||||
* ware_position_map的id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.config;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 通用配置 DO
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@TableName("common_config")
|
||||
@KeySequence("common_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CommonConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 类型(1:参数配置、2:备用)
|
||||
*/
|
||||
private Integer configType;
|
||||
/**
|
||||
* 配置信息
|
||||
*/
|
||||
private String configStr;
|
||||
|
||||
}
|
@ -1,6 +1,11 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.information;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
|
||||
@ -61,6 +66,10 @@ public class DeviceInformationDO extends BaseDO {
|
||||
* 设备编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
/**
|
||||
* 设备位置
|
||||
*/
|
||||
private String deviceLocation;
|
||||
/**
|
||||
* mac地址
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.robot;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@ -61,4 +62,9 @@ public class RobotInformationDO extends BaseDO {
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> floorAreaJson;
|
||||
|
||||
/**
|
||||
* 自动充电电量
|
||||
*/
|
||||
private Integer autoCharge;
|
||||
|
||||
}
|
@ -37,4 +37,14 @@ public class RobotModelDO extends BaseDO {
|
||||
*/
|
||||
private String robotOffset;
|
||||
|
||||
/**
|
||||
* 上传图片附件
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 是否自动充电(0:手动充电,1:自动充电)
|
||||
*/
|
||||
private Integer autoCharge;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.config;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 通用配置 Mapper
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@Mapper
|
||||
public interface CommonConfigMapper extends BaseMapperX<CommonConfigDO> {
|
||||
|
||||
default PageResult<CommonConfigDO> selectPage(CommonConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CommonConfigDO>()
|
||||
.eqIfPresent(CommonConfigDO::getConfigType, reqVO.getConfigType())
|
||||
.eqIfPresent(CommonConfigDO::getConfigStr, reqVO.getConfigStr())
|
||||
.betweenIfPresent(CommonConfigDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CommonConfigDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -28,10 +28,10 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
||||
.likeIfPresent(WareHouseLocationDO::getLaneName, reqVO.getLaneName())
|
||||
.eqIfPresent(WareHouseLocationDO::getAreaId, reqVO.getAreaId())
|
||||
.likeIfPresent(WareHouseLocationDO::getAreaName, reqVO.getAreaName())
|
||||
.eqIfPresent(WareHouseLocationDO::getLocationNo, reqVO.getLocationNo())
|
||||
.likeIfPresent(WareHouseLocationDO::getLocationNo, reqVO.getLocationNo())
|
||||
.likeIfPresent(WareHouseLocationDO::getGroupName, reqVO.getGroupName())
|
||||
.eqIfPresent(WareHouseLocationDO::getLocationYaw, reqVO.getLocationYaw())
|
||||
.eqIfPresent(WareHouseLocationDO::getSkuInfo, reqVO.getSkuInfo())
|
||||
.likeIfPresent(WareHouseLocationDO::getSkuInfo, reqVO.getSkuInfo())
|
||||
.eqIfPresent(WareHouseLocationDO::getSkuBatch, reqVO.getSkuBatch())
|
||||
.eqIfPresent(WareHouseLocationDO::getSkuNumber, reqVO.getSkuNumber())
|
||||
.eqIfPresent(WareHouseLocationDO::getTrayInfo, reqVO.getTrayInfo())
|
||||
|
@ -23,7 +23,7 @@ public interface RobotInformationMapper extends BaseMapperX<RobotInformationDO>
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RobotInformationDO>()
|
||||
.eqIfPresent(RobotInformationDO::getRobotModelId, reqVO.getRobotModelId())
|
||||
.eqIfPresent(RobotInformationDO::getRobotModelNumber, reqVO.getRobotModelNumber())
|
||||
.eqIfPresent(RobotInformationDO::getRobotNo, reqVO.getRobotNo())
|
||||
.likeIfPresent(RobotInformationDO::getRobotNo, reqVO.getRobotNo())
|
||||
.eqIfPresent(RobotInformationDO::getRobotTaskModel, reqVO.getRobotTaskModel())
|
||||
.eqIfPresent(RobotInformationDO::getMacAddress, reqVO.getMacAddress())
|
||||
.eqIfPresent(RobotInformationDO::getUrl, reqVO.getUrl())
|
||||
|
@ -21,7 +21,7 @@ public interface RobotWarnMsgMapper extends BaseMapperX<RobotWarnMsgDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RobotWarnMsgDO>()
|
||||
.eqIfPresent(RobotWarnMsgDO::getRobotNo, reqVO.getRobotNo())
|
||||
.eqIfPresent(RobotWarnMsgDO::getWarnLevel, reqVO.getWarnLevel())
|
||||
.eqIfPresent(RobotWarnMsgDO::getWarnCode, reqVO.getWarnCode())
|
||||
.likeIfPresent(RobotWarnMsgDO::getWarnCode, reqVO.getWarnCode())
|
||||
.eqIfPresent(RobotWarnMsgDO::getWarnMsg, reqVO.getWarnMsg())
|
||||
.eqIfPresent(RobotWarnMsgDO::getWarnSolve, reqVO.getWarnSolve())
|
||||
.betweenIfPresent(RobotWarnMsgDO::getSolveTime, reqVO.getSolveTime())
|
||||
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.enums.config;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* common_config的 config_type
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CommandConfigTypeEnum {
|
||||
ONE(1), //充电设置(页面)
|
||||
TWO(2); //充满电周期对应的冲电量
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.enums.device;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* device_information的device_status
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceStatusEnum {
|
||||
ON_LINE(1, "在线"),
|
||||
OFF_LINE(2, "离线"),
|
||||
EXECPTION(3, "异常");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private final String msg;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.enums.robot;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 车辆分页的状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RobotInformationPageStatusEnum {
|
||||
STANDBY(0),//待命
|
||||
INTASK(1),//任务中
|
||||
DOLOCK(2),//锁定
|
||||
OFFLINE(3),//离线
|
||||
CHARGE(4),//充电中
|
||||
FAULT(5);//故障
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
}
|
@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 机器人任务的状态
|
||||
* robot_information表的机器人任务的状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.enums.robot;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 0/1类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ZeroOneEnum {
|
||||
ZERO(0),//0
|
||||
ONE(1);//1
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.system.service.config;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
|
||||
/**
|
||||
* 通用配置 Service 接口
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
public interface CommonConfigService {
|
||||
|
||||
/**
|
||||
* 创建通用配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createConfig(@Valid CommonConfigSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新通用配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateConfig(@Valid CommonConfigSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除通用配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得通用配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 通用配置
|
||||
*/
|
||||
CommonConfigDO getConfig(Long configType);
|
||||
|
||||
/**
|
||||
* 获得通用配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 通用配置分页
|
||||
*/
|
||||
PageResult<CommonConfigDO> getConfigPage(CommonConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.system.service.config;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.CONFIG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 通用配置 Service 实现类
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CommonConfigServiceImpl implements CommonConfigService {
|
||||
|
||||
@Resource
|
||||
private CommonConfigMapper configMapper;
|
||||
|
||||
@Override
|
||||
public Long createConfig(CommonConfigSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CommonConfigDO config = BeanUtils.toBean(createReqVO, CommonConfigDO.class);
|
||||
configMapper.insert(config);
|
||||
// 返回
|
||||
return config.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfig(CommonConfigSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateConfigExists(updateReqVO.getId());
|
||||
// 更新
|
||||
CommonConfigDO updateObj = BeanUtils.toBean(updateReqVO, CommonConfigDO.class);
|
||||
configMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(Long id) {
|
||||
// 校验存在
|
||||
validateConfigExists(id);
|
||||
// 删除
|
||||
configMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateConfigExists(Long id) {
|
||||
if (configMapper.selectById(id) == null) {
|
||||
throw exception(CONFIG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonConfigDO getConfig(Long configType) {
|
||||
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||
.eq(CommonConfigDO::getConfigType, configType));
|
||||
return commonConfigDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CommonConfigDO> getConfigPage(CommonConfigPageReqVO pageReqVO) {
|
||||
return configMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.housearea.vo.HouseAreaSav
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.housearea.HouseAreaDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库区 Service 接口
|
||||
@ -58,4 +59,10 @@ public interface HouseAreaService {
|
||||
* @param createReqVO
|
||||
*/
|
||||
void createOrEditOrDel(@Valid HouseAreaSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 获得全部库区
|
||||
* @return
|
||||
*/
|
||||
List<HouseAreaDO> getHouseAreaList();
|
||||
}
|
||||
|
@ -14,9 +14,11 @@ import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionM
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.housearea.HouseAreaDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotModelDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.housearea.HouseAreaMapper;
|
||||
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ -154,4 +156,11 @@ public class HouseAreaServiceImpl implements HouseAreaService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HouseAreaDO> getHouseAreaList() {
|
||||
List<HouseAreaDO> list = houseAreaMapper.selectList(new LambdaQueryWrapper<HouseAreaDO>()
|
||||
.orderByAsc(HouseAreaDO::getId));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformati
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备信息 Service 接口
|
||||
@ -85,4 +86,10 @@ public interface DeviceInformationService {
|
||||
* @param dto
|
||||
*/
|
||||
void mapBindDeviceInfo(@Valid MapBindDeviceInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 获得设备信息分类列表
|
||||
* @return
|
||||
*/
|
||||
Map<Integer, List<DeviceInformationDO>> classification();
|
||||
}
|
||||
|
@ -5,12 +5,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.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.vo.DeviceInformationPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||
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.util.redis.RedisUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -19,7 +22,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.hutool.core.collection.CollUtil.isNotEmpty;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -43,6 +48,9 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
@Resource
|
||||
private GrpcServiceApi grpcServiceApi;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public Long createInformation(DeviceInformationSaveReqVO createReqVO) {
|
||||
DeviceInformationPageReqVO pageReqVO = new DeviceInformationPageReqVO();
|
||||
@ -54,7 +62,6 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
// 插入
|
||||
DeviceInformationDO information = BeanUtils.toBean(createReqVO, DeviceInformationDO.class);
|
||||
information.setDeviceStatus(1);
|
||||
information.setDeviceLastTime(LocalDateTime.now());
|
||||
informationMapper.insert(information);
|
||||
// 返回
|
||||
return information.getId();
|
||||
@ -85,7 +92,24 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
|
||||
@Override
|
||||
public DeviceInformationDO getInformation(Long id) {
|
||||
return informationMapper.selectById(id);
|
||||
// 校验存在
|
||||
validateInformationExists(id);
|
||||
DeviceInformationDO deviceInformationDO = informationMapper.selectById(id);
|
||||
String deviceKey = DeviceChcheConstant.DEVICE_LAST_TIME +deviceInformationDO.getMacAddress();
|
||||
Object object = redisUtil.get(deviceKey);
|
||||
if (ObjectUtil.isEmpty(object)) {
|
||||
deviceInformationDO.setDeviceStatus(DeviceStatusEnum.OFF_LINE.getType());
|
||||
return deviceInformationDO;
|
||||
}
|
||||
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 deviceInformationDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,6 +149,48 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得设备信息分类列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, List<DeviceInformationDO>> classification() {
|
||||
List<DeviceInformationDO> deviceInformationDOS = informationMapper.selectList(new LambdaQueryWrapper<DeviceInformationDO>());
|
||||
if (ObjectUtil.isEmpty(deviceInformationDOS)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
|
||||
Map<Integer, List<DeviceInformationDO>> collect =
|
||||
deviceInformationDOS.stream()
|
||||
.collect(Collectors.groupingBy(DeviceInformationDO::getDeviceType));
|
||||
|
||||
ArrayList<Map.Entry<Integer, List<DeviceInformationDO>>> list = new ArrayList<Map.Entry<Integer, List<DeviceInformationDO>>>(collect.entrySet());
|
||||
Collections.sort(list, new Comparator<Map.Entry<Integer, List<DeviceInformationDO>>>() {
|
||||
public int compare(Map.Entry<Integer, List<DeviceInformationDO>> o1, Map.Entry<Integer, List<DeviceInformationDO>> o2) {
|
||||
return o1.getKey().compareTo(o2.getKey()); // 按照值排序
|
||||
}
|
||||
});
|
||||
|
||||
return collect;
|
||||
}
|
||||
@Override
|
||||
public void mapBindDeviceInfo(MapBindDeviceInfoDTO dto) {
|
||||
DeviceInformationDO deviceInformationDO = informationMapper.selectById(dto.getDeviceInfoId());
|
||||
|
@ -10,6 +10,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 仓库点位地图 Service 接口
|
||||
@ -87,4 +89,10 @@ public interface PositionMapService extends IService<PositionMapDO> {
|
||||
* @param area
|
||||
*/
|
||||
String downloadPngBase64(Integer floor, String area);
|
||||
|
||||
/**
|
||||
* 获得所有仓库点位地图Map
|
||||
* @return
|
||||
*/
|
||||
Map<Integer, List<PositionMapDO>> getAllMap();
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -31,6 +33,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@ -295,5 +298,27 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
|
||||
return encodedString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, List<PositionMapDO>> getAllMap() {
|
||||
List<PositionMapDO> positionMapDOS = positionMapMapper.selectList(new LambdaQueryWrapperX<PositionMapDO>()
|
||||
.orderByAsc(PositionMapDO::getFloor));
|
||||
|
||||
if (ObjectUtil.isEmpty(positionMapDOS)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Integer, List<PositionMapDO>> collect =
|
||||
positionMapDOS.stream()
|
||||
.collect(Collectors.groupingBy(PositionMapDO::getFloor));
|
||||
|
||||
ArrayList<Map.Entry<Integer, List<PositionMapDO>>> list = new ArrayList<Map.Entry<Integer, List<PositionMapDO>>>(collect.entrySet());
|
||||
Collections.sort(list, new Comparator<Map.Entry<Integer, List<PositionMapDO>>>() {
|
||||
public int compare(Map.Entry<Integer, List<PositionMapDO>> o1, Map.Entry<Integer, List<PositionMapDO>> o2) {
|
||||
return o1.getKey().compareTo(o2.getKey()); // 按照值排序
|
||||
}
|
||||
});
|
||||
|
||||
return collect;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,9 +8,11 @@ import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotModelDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotModelMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
@ -46,6 +48,9 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
@Resource
|
||||
private RobotTaskDetailMapper taskDetailMapper;
|
||||
|
||||
@Resource
|
||||
private RobotModelMapper modelMapper;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@ -65,6 +70,9 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
if (ObjectUtil.isNotEmpty(existRobotNo)) {
|
||||
throw exception(ROBOT_ROBOT_NO_EXISTS);
|
||||
}
|
||||
RobotModelDO robotModelDO = modelMapper.selectById(createReqVO.getRobotModelId());
|
||||
createReqVO.setRobotModelNumber(robotModelDO.getRobotModelNumber());
|
||||
createReqVO.setUrl(robotModelDO.getUrl());
|
||||
// 插入
|
||||
RobotInformationDO information = BeanUtils.toBean(createReqVO, RobotInformationDO.class);
|
||||
informationMapper.insert(information);
|
||||
@ -97,6 +105,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
// 更新
|
||||
RobotInformationDO updateObj = BeanUtils.toBean(updateReqVO, RobotInformationDO.class);
|
||||
informationMapper.updateById(updateObj);
|
||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_NO_MAPPING_MAC + updateObj.getMacAddress(),updateObj.getRobotNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -164,12 +173,12 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
v.setArea(robotStatusDataPoseDTO.getArea());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(object)) {
|
||||
v.setRobotStatus(3);
|
||||
v.setMsg("车辆已经离线");
|
||||
}else if (RobotTaskModelEnum.REJECTION.getType().equals(v.getRobotTaskModel())) {
|
||||
v.setRobotStatus(2);
|
||||
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>()
|
||||
@ -179,20 +188,20 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
if (ObjectUtil.isNotEmpty(robotTaskDetailDO)
|
||||
&& RobotTaskTypeEnum.CHARGE.getType().equals(robotTaskDetailDO.getTaskType())
|
||||
&& RobotTaskStatusEnum.DOING.getType().equals(robotTaskDetailDO.getTaskStatus())) {
|
||||
v.setRobotStatus(4);
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.CHARGE.getType());
|
||||
v.setMsg("车辆正在充电");
|
||||
}else {
|
||||
v.setRobotStatus(0);
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.STANDBY.getType());
|
||||
v.setMsg("车辆正在待命");
|
||||
}
|
||||
}else if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus()) && ObjectUtil.isNotEmpty(action)) {
|
||||
v.setRobotStatus(1);
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.INTASK.getType());
|
||||
CommandTypeEnum commandType = CommandTypeEnum.getCommandType(String.valueOf(action));
|
||||
if (ObjectUtil.isNotEmpty(commandType)) {
|
||||
v.setMsg("车辆正在"+commandType.getMsg());
|
||||
}
|
||||
} else {
|
||||
v.setRobotStatus(5);
|
||||
v.setRobotStatus(RobotInformationPageStatusEnum.FAULT.getType());
|
||||
v.setMsg("车辆发生异常");
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotModelSaveRe
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotModelDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆类型 Service 接口
|
||||
@ -52,4 +53,5 @@ public interface RobotModelService {
|
||||
*/
|
||||
PageResult<RobotModelDO> getModelPage(RobotModelPageReqVO pageReqVO);
|
||||
|
||||
List<RobotModelDO> getAllModel();
|
||||
}
|
@ -5,12 +5,17 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotModelPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotModelSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotModelDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnCodeMappingDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotModelMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MODEL_NOT_EXISTS;
|
||||
|
||||
@ -70,4 +75,10 @@ public class RobotModelServiceImpl implements RobotModelService {
|
||||
return modelMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RobotModelDO> getAllModel() {
|
||||
List<RobotModelDO> robotModelDOS = modelMapper.selectList(new LambdaQueryWrapper<RobotModelDO>());
|
||||
return robotModelDOS;
|
||||
}
|
||||
|
||||
}
|
@ -129,15 +129,11 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
}
|
||||
//搬空任务只能选择线库或者区域
|
||||
if (MoveAllEnum.YES.getType().equals(createReqVO.getDoMoveAll())) {
|
||||
Set<Integer> releaseTypeList =
|
||||
createReqVO.getTaskDetailList().stream().map(v -> v.getReleaseType())
|
||||
.collect(Collectors.toSet());
|
||||
Set<Integer> takeTypeList =
|
||||
createReqVO.getTaskDetailList().stream().map(v -> v.getTakeType())
|
||||
.collect(Collectors.toSet());
|
||||
if (releaseTypeList.contains(ReleaseTakeEnum.TO_LOCATION.getType())
|
||||
|| takeTypeList.contains(ReleaseTakeEnum.TO_LOCATION.getType())) {
|
||||
throw exception(TASK_ONLY_CHOOSE_LOCATION);
|
||||
for (RobotTaskDetailAddVO robotTaskDetailAddVO : createReqVO.getTaskDetailList()) {
|
||||
if (ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskDetailAddVO.getTakeType())
|
||||
|| ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskDetailAddVO.getReleaseType())) {
|
||||
throw exception(TASK_ONLY_CHOOSE_LOCATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
//校验机器人是否禁用
|
||||
@ -164,6 +160,7 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
throw exception(TASK_CHECK_EXIST_NO);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,8 +172,6 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
RobotTaskDO task = BeanUtils.toBean(createReqVO, RobotTaskDO.class);
|
||||
taskMapper.insert(task);
|
||||
|
||||
// todo 更新数据库顺序 后续改为xxl-job一致
|
||||
|
||||
//查找库位
|
||||
List<Long> locationIds = new ArrayList<>();
|
||||
if (MoveAllEnum.NO.getType().equals(createReqVO.getDoMoveAll())) {
|
||||
|
@ -90,6 +90,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void distributeTasks() {
|
||||
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
Pair<List<RobotInformationDO>, List<RobotTaskDetailDO>> robotAndTaskDetails = getRobotAndTaskDetails();
|
||||
List<RobotInformationDO> robots = robotAndTaskDetails.getLeft();
|
||||
if (ObjectUtil.isEmpty(robots)) {
|
||||
@ -101,6 +102,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
return;
|
||||
}
|
||||
|
||||
// List<RobotTaskDetailDO> cycleTaskDetails = robotTaskMapper.getCycleTaskDetails();
|
||||
//任务下发给机器人
|
||||
distributeTasks(robots,taskDetailDOS);
|
||||
}
|
||||
@ -705,8 +707,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
RobotInformationDO robotInformationDO = robots.stream()
|
||||
.filter(v ->
|
||||
ObjectUtil.isNotEmpty(v.getMacAddress())
|
||||
&& v.getFloorAreaJson().contains(fromLocation.getAreaId())
|
||||
&& v.getFloorAreaJson().contains(toLocation.getAreaId()))
|
||||
&& v.getFloorAreaJson().contains(fromLocation.getMapId())
|
||||
&& v.getFloorAreaJson().contains(toLocation.getMapId()))
|
||||
.findFirst()
|
||||
.orElse(new RobotInformationDO());
|
||||
macAddress = robotInformationDO.getMacAddress();
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskAutoMov
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskAutoMoveDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
|
||||
@ -76,6 +77,9 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
@Value("${zn.lane_auto_move:true}")
|
||||
private Boolean laneAutoMove;
|
||||
|
||||
@Value("${zn.cycle_do_auto_move:true}")
|
||||
private Boolean cycleDoAutoMove;
|
||||
|
||||
@Override
|
||||
public Long createTaskAutoMove(RobotTaskAutoMoveSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -125,6 +129,18 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void distributeAutoMoveJob() {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
|
||||
//todo 有循环的任务,是否要关闭自动移库的功能.做成配置
|
||||
if (!cycleDoAutoMove) {
|
||||
RobotTaskDO robotTaskDO = robotTaskMapper.selectOne(new LambdaQueryWrapperX<RobotTaskDO>()
|
||||
.in(RobotTaskDO::getTaskStatus, RobotTaskStatusEnum.NEW.getType(), RobotTaskStatusEnum.DOING.getType())
|
||||
.eq(RobotTaskDO::getDoCycle, ZeroOneEnum.ONE.getType()));
|
||||
if (ObjectUtil.isNotEmpty(robotTaskDO)) {
|
||||
log.info("存在循环的任务,不开启自动移库功能 :{}",robotTaskDO.getTaskNo());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Pair<List<RobotInformationDO>, List<RobotTaskDetailDO>> robotAndTaskDetails =
|
||||
distributeTasksService.getRobotAndTaskDetails();
|
||||
|
||||
@ -200,8 +216,8 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
return result;
|
||||
}
|
||||
|
||||
Set<Long> doingLocationIds = new HashSet<>();
|
||||
for (RobotTaskDetailDO robotTaskDetailDO : details) {
|
||||
Set<Long> doingLocationIds = new HashSet<>();
|
||||
if (ObjectUtil.isNotEmpty(robotTaskDetailDO.getFromLocationId())) {
|
||||
doingLocationIds.add(robotTaskDetailDO.getFromLocationId());
|
||||
}
|
||||
@ -211,6 +227,8 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
if (ObjectUtil.isEmpty(doingLocationIds)) {
|
||||
continue;
|
||||
}
|
||||
//目前仅取一个
|
||||
// todo 等将来能控制好多台车机同时往一个点位取,再调整成同时取一个点位的多个库位
|
||||
List<WareHouseLocationDO> locationDOS = locationMapper.selectNeedMoveLocation(doingLocationIds);
|
||||
if (ObjectUtil.isEmpty(locationDOS)) {
|
||||
log.info("暂无需要自动移库的库位 :{}" ,JSON.toJSONString(robotTaskDetailDO));
|
||||
@ -260,36 +278,38 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
if (ObjectUtil.isEmpty(robots) || ObjectUtil.isEmpty(emptyLocations)) {
|
||||
return list;
|
||||
}
|
||||
// 校验机器人工作区域
|
||||
RobotInformationDO robotInformationDO = robots.stream()
|
||||
.filter(v ->
|
||||
ObjectUtil.isNotEmpty(v.getMacAddress())
|
||||
&& v.getFloorAreaJson().contains(wareHouseLocationDO.getAreaId())
|
||||
&& v.getFloorAreaJson().contains(emptyLocations.get(0).getAreaId()))
|
||||
.findFirst()
|
||||
.orElse(new RobotInformationDO());
|
||||
if (ObjectUtil.isEmpty(robotInformationDO) || ObjectUtil.isEmpty(robotInformationDO.getRobotNo())) {
|
||||
continue;
|
||||
for (WareHouseLocationDO emptyLocation : emptyLocations) {
|
||||
// 校验机器人工作区域
|
||||
RobotInformationDO robotInformationDO = robots.stream()
|
||||
.filter(v ->
|
||||
ObjectUtil.isNotEmpty(v.getMacAddress())
|
||||
&& v.getFloorAreaJson().contains(wareHouseLocationDO.getMapId())
|
||||
&& v.getFloorAreaJson().contains(emptyLocation.getMapId()))
|
||||
.findFirst()
|
||||
.orElse(new RobotInformationDO());
|
||||
if (ObjectUtil.isEmpty(robotInformationDO) || ObjectUtil.isEmpty(robotInformationDO.getRobotNo())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RobotTaskAutoMoveDO autoMoveDO = new RobotTaskAutoMoveDO();
|
||||
autoMoveDO.setRobotTaskDetailId(detailDO.getId());
|
||||
autoMoveDO.setRobotTaskId(detailDO.getRobotTaskId());
|
||||
autoMoveDO.setFromLocationId(wareHouseLocationDO.getId());
|
||||
autoMoveDO.setFromLocationNo(wareHouseLocationDO.getLocationNo());
|
||||
autoMoveDO.setToLocationId(emptyLocation.getId());
|
||||
autoMoveDO.setToLocationNo(emptyLocation.getLocationNo());
|
||||
autoMoveDO.setFromLaneId(wareHouseLocationDO.getLaneId());
|
||||
autoMoveDO.setTaskStatus(AutoMoveTaskStatusEnum.DOING.getType());
|
||||
autoMoveDO.setPriority(wareHouseLocationDO.getLocationNumber());
|
||||
autoMoveDO.setRobotNo(robotInformationDO.getRobotNo());
|
||||
autoMoveDO.setTaskType(AutoMoveTaskTypeEnum.AUTO_MOVE.getType());
|
||||
autoMoveDO.setMoveType(AutoMoveTypeEnum.GO.getType());
|
||||
autoMoveDO.setStartTime(LocalDateTime.now());
|
||||
list.add(autoMoveDO);
|
||||
|
||||
robots.removeIf(v -> v.getRobotNo().equals(autoMoveDO.getRobotNo()));
|
||||
emptyLocations.removeIf(v -> v.getId().equals(autoMoveDO.getToLocationId()));
|
||||
}
|
||||
|
||||
RobotTaskAutoMoveDO autoMoveDO = new RobotTaskAutoMoveDO();
|
||||
autoMoveDO.setRobotTaskDetailId(detailDO.getId());
|
||||
autoMoveDO.setRobotTaskId(detailDO.getRobotTaskId());
|
||||
autoMoveDO.setFromLocationId(wareHouseLocationDO.getId());
|
||||
autoMoveDO.setFromLocationNo(wareHouseLocationDO.getLocationNo());
|
||||
autoMoveDO.setToLocationId(emptyLocations.get(0).getId());
|
||||
autoMoveDO.setToLocationNo(emptyLocations.get(0).getLocationNo());
|
||||
autoMoveDO.setFromLaneId(wareHouseLocationDO.getLaneId());
|
||||
autoMoveDO.setTaskStatus(AutoMoveTaskStatusEnum.DOING.getType());
|
||||
autoMoveDO.setPriority(wareHouseLocationDO.getLocationNumber());
|
||||
autoMoveDO.setRobotNo(robotInformationDO.getRobotNo());
|
||||
autoMoveDO.setTaskType(AutoMoveTaskTypeEnum.AUTO_MOVE.getType());
|
||||
autoMoveDO.setMoveType(AutoMoveTypeEnum.GO.getType());
|
||||
autoMoveDO.setStartTime(LocalDateTime.now());
|
||||
list.add(autoMoveDO);
|
||||
|
||||
robots.removeIf(v -> v.getRobotNo().equals(autoMoveDO.getRobotNo()));
|
||||
emptyLocations.removeIf(v -> v.getId().equals(autoMoveDO.getToLocationId()));
|
||||
}
|
||||
|
||||
}
|
||||
@ -358,7 +378,7 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
Map<Long, List<RobotTaskDetailDO>> detailMaps =
|
||||
details.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getFromLaneId));
|
||||
//查找每一个线库最小的一个库位
|
||||
|
||||
// todo 等将来能控制好多台车机同时往一个线库取,再调整成同时取一个线库的多个库位
|
||||
for (Map.Entry<Long, List<RobotTaskDetailDO>> detaiMap : detailMaps.entrySet()) {
|
||||
List<WareHouseLocationDO> locations = new ArrayList<>();
|
||||
RobotTaskDetailDO robotTaskDetail = detaiMap.getValue()
|
||||
@ -367,18 +387,26 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
|
||||
if (ObjectUtil.isNotEmpty(robotTaskDetail) && ObjectUtil.isNotEmpty(robotTaskDetail.getLocationNumber())) {
|
||||
WareHouseLocationDO location = WareHouseLocationDO.builder().locationNumber(robotTaskDetail.getLocationNumber())
|
||||
.locationUseStatus(LocationUseStatusEnum.YES.getType())
|
||||
.locationLock(LocationLockEnum.YES.getType())
|
||||
// .locationLock(LocationLockEnum.YES.getType())
|
||||
.laneId(detaiMap.getKey()).build();
|
||||
locations.add(location);
|
||||
}
|
||||
|
||||
log.info("查询是否需要执行移库任务的线库id和对应的排序位置 :{}", JSON.toJSONString(locations));
|
||||
if (ObjectUtil.isNotEmpty(locations)) {
|
||||
List<WareHouseLocationDO> wareHouseLocationDOS = locationMapper.selectLocationByList(locations);
|
||||
if (ObjectUtil.isNotEmpty(wareHouseLocationDOS)) {
|
||||
Pair<RobotTaskDetailDO, List<WareHouseLocationDO>> pair = Pair.of(robotTaskDetail, wareHouseLocationDOS);
|
||||
result.add(pair);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(locations)) {
|
||||
continue;
|
||||
}
|
||||
List<WareHouseLocationDO> wareHouseLocationDOS = locationMapper.selectLocationByList(locations);
|
||||
if (ObjectUtil.isEmpty(wareHouseLocationDOS)) {
|
||||
continue;
|
||||
}
|
||||
WareHouseLocationDO wareHouseLocationDO = wareHouseLocationDOS.get(0);
|
||||
if (LocationEnableEnum.YES.getType().equals(wareHouseLocationDO.getLocationEnable())
|
||||
&& LocationLockEnum.YES.getType().equals(wareHouseLocationDO.getLocationLock())) {
|
||||
Pair<RobotTaskDetailDO, List<WareHouseLocationDO>> pair = Pair.of(robotTaskDetail, Lists.newArrayList(wareHouseLocationDO));
|
||||
result.add(pair);
|
||||
}else {
|
||||
log.info("线库--此库位被锁定或者禁用,无法执行移库 :{}",JSON.toJSONString(wareHouseLocationDO));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,4 +227,5 @@ zn:
|
||||
lift_height: 0.1 #抬高托盘高度
|
||||
move_height: 0.1 #行走高度
|
||||
lane_auto_move: true #线库是否自动移库 true:线库执行自动移库 、false:线库关闭执行自动移库
|
||||
robot_position_cache_time: 600 #机器人上报点位存储时间
|
||||
robot_position_cache_time: 600 #机器人上报点位存储时间
|
||||
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -755,6 +755,7 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
order by t2.location_number asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user