Compare commits

..

No commits in common. "0a18d3b5472cc32e22641b848b7d112c716af97e" and "e20ab5d933d193b31bf5033e2012e176408c8f98" have entirely different histories.

21 changed files with 32 additions and 234 deletions

View File

@ -107,10 +107,5 @@ public class FileController {
return success(fileService.createBusinessReturnFile(file)); return success(fileService.createBusinessReturnFile(file));
} }
@PostMapping("/businessUploadFile")
@Operation(summary = "上传文件")
@PermitAll
public CommonResult<BusinessFileVO> businessUploadFile(@RequestParam("uploadFiles") MultipartFile file) throws Exception {
return success(fileService.businessUploadFile(file));
}
} }

View File

@ -74,11 +74,4 @@ public interface FileService {
* @return * @return
*/ */
BusinessFileVO createBusinessReturnFile(MultipartFile file) throws IOException; BusinessFileVO createBusinessReturnFile(MultipartFile file) throws IOException;
/**
* 上传文件
* @param file
* @return
*/
BusinessFileVO businessUploadFile(MultipartFile file) throws IOException;
} }

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.service.file;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.file.FileNameUtil; import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.io.FileUtils; import cn.iocoder.yudao.framework.common.util.io.FileUtils;
@ -19,16 +18,12 @@ import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
import cn.iocoder.yudao.module.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO; import cn.iocoder.yudao.module.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO;
import cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils; import cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.*; import java.io.IOException;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.UUID;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
@ -47,9 +42,6 @@ public class FileServiceImpl implements FileService {
@Resource @Resource
private FileMapper fileMapper; private FileMapper fileMapper;
@Value("${file.upload-path}")
private String uploadPath;
@Override @Override
public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) { public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) {
return fileMapper.selectPage(pageReqVO); return fileMapper.selectPage(pageReqVO);
@ -198,23 +190,4 @@ public class FileServiceImpl implements FileService {
return fileDo; return fileDo;
} }
@Override
public BusinessFileVO businessUploadFile(MultipartFile file) throws IOException {
File files = new File("");
String filePath = files.getCanonicalPath() + uploadPath;
String fileName = file.getOriginalFilename();
fileName = UUID.randomUUID() + "_" + fileName;
File dir = new File(filePath);
if (!dir.exists()) {
dir.mkdirs();
}
File fileObj = new File(filePath, fileName);
file.transferTo(fileObj);
// 把上传上来的文件存储到磁盘上指定一个路径
// file.transferTo(uploadFile);
BusinessFileVO fileDo = new BusinessFileVO();
fileDo.setUrl(filePath+fileName);
return fileDo;
}
} }

View File

@ -157,6 +157,3 @@ yudao:
mock-enable: true mock-enable: true
access-log: # 访问日志的配置项 access-log: # 访问日志的配置项
enable: false enable: false
file:
upload-path: /Users/Documents/image/ # 文件上传路径

View File

@ -178,7 +178,7 @@ public interface ErrorCodeConstants {
// ========== 库位 1-002-032-000 ========== // ========== 库位 1-002-032-000 ==========
ErrorCode HOUSE_LOCATION_NOT_EXISTS = new ErrorCode(1-002-032-001, "库位不存在"); ErrorCode HOUSE_LOCATION_NOT_EXISTS = new ErrorCode(1-002-032-001, "库位不存在");
ErrorCode HOUSE_LOCATION_HAVE_TASK = new ErrorCode(1-002-032-002, "库位存在处理中的任务"); ErrorCode HOUSE_LOCATION_NO_EXIST = new ErrorCode(1-002-032-002, "库位编号重复");
// ========== 车辆类型 1-002-033-000========== // ========== 车辆类型 1-002-033-000==========
ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1-002-033-001, "车辆类型不存在"); ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1-002-033-001, "车辆类型不存在");
@ -191,7 +191,6 @@ public interface ErrorCodeConstants {
ErrorCode ROBOT_LAST_TASK_DELETE = new ErrorCode(1-002-034-005, "超过限制的时间,无法继续执行前一个任务"); ErrorCode ROBOT_LAST_TASK_DELETE = new ErrorCode(1-002-034-005, "超过限制的时间,无法继续执行前一个任务");
ErrorCode ROBOT_NOT_FOUND_WAIT_ITEM = new ErrorCode(1-002-034-006, "没有空闲的停车点"); ErrorCode ROBOT_NOT_FOUND_WAIT_ITEM = new ErrorCode(1-002-034-006, "没有空闲的停车点");
ErrorCode ROBOT_NOT_FOUND_FREE_CHARGING_STATION = new ErrorCode(1-002-034-007, "没有空闲的充电桩"); ErrorCode ROBOT_NOT_FOUND_FREE_CHARGING_STATION = new ErrorCode(1-002-034-007, "没有空闲的充电桩");
ErrorCode ROBOT_HAVE_DOING_TASK = new ErrorCode(1-002-034-010, "车辆有处理中的任务");
// ========== 机器人任务主表 1-002-035-000 ========== // ========== 机器人任务主表 1-002-035-000 ==========
ErrorCode TASK_NOT_EXISTS = new ErrorCode(1-002-035-001, "机器人任务主表不存在"); ErrorCode TASK_NOT_EXISTS = new ErrorCode(1-002-035-001, "机器人任务主表不存在");

View File

@ -142,13 +142,19 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
/** /**
* 上一条明细设置为完成 * 上一条明细设置为完成
*
* @param mac * @param mac
* @return * @return
*/ */
public RobotTaskDetailActionLogDO setLastLogDone(String mac) { public RobotTaskDetailActionLogDO setLastLogDone(String mac){
String robotNo = robotInformationService.getRobotNoByMac(mac); String robotNo = robotInformationService.getRobotNoByMac(mac);
return taskDetailActionLogService.setPreviousTaskDoneByRobotNo(robotNo); RobotTaskDetailActionLogDO lastLog = taskDetailActionLogService.getLastTaskByRobotNo(robotNo);
if (ObjectUtil.isNotEmpty(lastLog)) {
lastLog.setEndTime(LocalDateTime.now());
lastLog.setActionStatus(ActionStatusEnum.DONE.getType());
RobotTaskDetailActionLogSaveReqVO updateObj = BeanUtils.toBean(lastLog, RobotTaskDetailActionLogSaveReqVO.class);
taskDetailActionLogService.updateTaskDetailActionLog(updateObj);
}
return lastLog;
} }
/** /**
@ -159,17 +165,13 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
RobotTaskDetailActionLogDO lastLog = setLastLogDone(robotCompleteTaskDTO.getMac()); RobotTaskDetailActionLogDO lastLog = setLastLogDone(robotCompleteTaskDTO.getMac());
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) { if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
chargeDoing(robotCompleteTaskDTO, robotDoingActionKey, lastLog); chargeDoing(robotCompleteTaskDTO, robotDoingActionKey,lastLog);
} else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())) { } else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())) {
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO(); RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
logOne.setActionMsg("车辆正在前往等待点"); logOne.setActionMsg("车辆正在前往等待点");
logOne.setRobotNo(robotNo); logOne.setRobotNo(robotNo);
logOne.setStartTime(LocalDateTime.now()); logOne.setStartTime(LocalDateTime.now());
logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId()); logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId());
if (ObjectUtil.isNotEmpty(lastLog)) {
logOne.setCommandType(lastLog.getCommandType());
logOne.setTaskNo(lastLog.getTaskNo());
}
taskDetailActionLogMapper.insert(logOne); taskDetailActionLogMapper.insert(logOne);
redisUtil.set(robotDoingActionKey, logOne.getActionMsg(), doingActionCacheTime); redisUtil.set(robotDoingActionKey, logOne.getActionMsg(), doingActionCacheTime);
moveToWaitService.updateWaitStatus(robotCompleteTaskDTO.getOrderId(), WaitStatusEnum.GO_TO_WAIT.getType()); moveToWaitService.updateWaitStatus(robotCompleteTaskDTO.getOrderId(), WaitStatusEnum.GO_TO_WAIT.getType());
@ -179,10 +181,10 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
if ((PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()) if ((PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) || PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()))
&& ObjectUtil.isNotEmpty(robotCompleteTaskDTO.getCommandStatus()) && ObjectUtil.isNotEmpty(robotCompleteTaskDTO.getCommandStatus())
&& CommandTypeEnum.MOVE_POSES.getType().equals(robotCompleteTaskDTO.getCommandStatus().getCommandType()) && CommandTypeEnum.MOVE_POSES.getType().equals(robotCompleteTaskDTO.getCommandStatus().getCommandType())
&& RobotExecutionStateConstant.DONE.equals(robotCompleteTaskDTO.getCommandStatus().getExecutionState())) { && RobotExecutionStateConstant.DONE.equals(robotCompleteTaskDTO.getCommandStatus().getExecutionState())) {
log.info("充电任务准备让充电设备自动伸出 :{}", robotCompleteTaskDTO.getOrderId()); log.info("充电任务准备让充电设备自动伸出 :{}",robotCompleteTaskDTO.getOrderId());
RobotChargeLogDO robotChargeLog = chargeLogMapper.selectById(robotCompleteTaskDTO.getOrderId()); RobotChargeLogDO robotChargeLog = chargeLogMapper.selectById(robotCompleteTaskDTO.getOrderId());
deviceInformationService.chargeDeviceExtend(robotChargeLog.getDeviceNo()); deviceInformationService.chargeDeviceExtend(robotChargeLog.getDeviceNo());
} }
@ -190,8 +192,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
sendStartDoActionToPP(robotCompleteTaskDTO.getCommandStatus(), robotCompleteTaskDTO.getMac(), sendStartDoActionToPP(robotCompleteTaskDTO.getCommandStatus(), robotCompleteTaskDTO.getMac(),
String.valueOf(robotCompleteTaskDTO.getOrderId())); String.valueOf(robotCompleteTaskDTO.getOrderId()));
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType() taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType());
, null);
} }
/** /**
@ -243,7 +244,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
.build(); .build();
chargeLogMapper.updateById(build); chargeLogMapper.updateById(build);
} }
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now()); taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType());
} }
@ -328,7 +329,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
* *
* @param robotCompleteTaskDTO * @param robotCompleteTaskDTO
*/ */
private void chargeDoing(RobotCompleteTaskDTO robotCompleteTaskDTO, String robotDoingActionKey, RobotTaskDetailActionLogDO lastLog) { private void chargeDoing(RobotCompleteTaskDTO robotCompleteTaskDTO, String robotDoingActionKey,RobotTaskDetailActionLogDO lastLog) {
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO(); RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
RobotCommandStateDTO commandStatus = robotCompleteTaskDTO.getCommandStatus(); RobotCommandStateDTO commandStatus = robotCompleteTaskDTO.getCommandStatus();
Integer taskStatus = ChargeTaskStatusEnum.CHARGEING.getType(); Integer taskStatus = ChargeTaskStatusEnum.CHARGEING.getType();
@ -478,7 +479,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
logOne.setTaskStage(robotTaskDetailDO.getTaskStage()); logOne.setTaskStage(robotTaskDetailDO.getTaskStage());
logOne.setCommandType(PathTaskTypeEnum.getTaskType(robotTaskDetailDO.getTaskType())); logOne.setCommandType(PathTaskTypeEnum.getTaskType(robotTaskDetailDO.getTaskType()));
logOne.setTaskNo(robotTask.getTaskNo()); logOne.setTaskNo(robotTask.getTaskNo());
logOne.setActionStatus(ActionStatusEnum.DOING.getType());
logOne.setStartTime(LocalDateTime.now()); logOne.setStartTime(LocalDateTime.now());
taskDetailActionLogMapper.insert(logOne); taskDetailActionLogMapper.insert(logOne);
redisUtil.set(robotDoingActionKey, logOne.getActionMsg(), doingActionCacheTime); redisUtil.set(robotDoingActionKey, logOne.getActionMsg(), doingActionCacheTime);

View File

@ -8,7 +8,6 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.api.path.PathApi;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO; import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO; import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO;
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemRespVO; import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemRespVO;
@ -49,9 +48,6 @@ public class PositionMapItemController {
@Resource @Resource
private UserOperationLogService userOperationLogService; private UserOperationLogService userOperationLogService;
@Resource
private PathApi pathApi;
// -- 前端给所有的节点信息 - // -- 前端给所有的节点信息 -
@PostMapping("/batchSaveOrEditOrDel") @PostMapping("/batchSaveOrEditOrDel")
@Operation(summary = "批量新增编辑删除节点") @Operation(summary = "批量新增编辑删除节点")
@ -75,8 +71,6 @@ public class PositionMapItemController {
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build(); .nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
userOperationLogService.createUserOperationLog(operationLog); userOperationLogService.createUserOperationLog(operationLog);
pathApi.pathInitData();
return success(true); return success(true);
} }

View File

@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLo
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
/** /**
* 车辆动作记录 Mapper * 车辆动作记录 Mapper
* *
@ -38,6 +36,5 @@ public interface RobotTaskDetailActionLogMapper extends BaseMapperX<RobotTaskDet
* @param actionStatus * @param actionStatus
*/ */
void updateActionStatus(@Param("taskDetailId") Long taskDetailId, void updateActionStatus(@Param("taskDetailId") Long taskDetailId,
@Param("actionStatus") int actionStatus, @Param("actionStatus") int actionStatus);
@Param("time") LocalDateTime time);
} }

View File

@ -115,11 +115,4 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
* @param ids * @param ids
*/ */
void updateDoneByIds(@Param("ids") List<Long> ids); void updateDoneByIds(@Param("ids") List<Long> ids);
/**
* 查询此库位处理中的任务
* @param ids
* @return
*/
List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(@Param("ids") List<Long> ids);
} }

View File

@ -79,11 +79,4 @@ public interface RobotTaskMapper extends BaseMapperX<RobotTaskDO> {
* @param ids * @param ids
*/ */
void updateDoneByIds(@Param("ids") List<Long> ids); void updateDoneByIds(@Param("ids") List<Long> ids);
/**
* 查询车辆当前在做的任务
* @param robotNo
* @return
*/
List<RobotTaskDO> selectDoingTaskByRobotNo(@Param("robotNo") String robotNo);
} }

View File

@ -9,9 +9,7 @@ public enum ActionStatusEnum {
UN_DO(0,"未开始"), UN_DO(0,"未开始"),
DOING(1,"正在进行"), DOING(1,"正在进行"),
DONE(2,"完成"), DONE(2,"完成");
CLOSE(3,"已取消"),
EXCEPTION(4,"异常");
/** /**
* 类型 * 类型
*/ */

View File

@ -8,11 +8,8 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO; import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO; import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO; import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService; import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
import cn.iocoder.yudao.module.system.service.robot.RobotTaskDetailService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -21,21 +18,15 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.hutool.core.collection.CollUtil.isNotEmpty;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.HOUSE_LOCATION_NO_EXIST;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_DETAIL_CHANGE_ROBOT;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId; import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
@Slf4j @Slf4j
@Component @Component
public class HouseLocationStrategyImpl implements NodeProcessingStrategy { public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
@Resource @Resource
private HouseLocationService houseLocationService; private HouseLocationService houseLocationService;
@Resource
private RobotTaskDetailService taskDetailService;
//库位编号格式 - 第一个通配符为地图id 第二个通配符为随机数四位最后一个通配符为库位点层数 //库位编号格式 - 第一个通配符为地图id 第二个通配符为随机数四位最后一个通配符为库位点层数
private static final String KW_NO_FORMAT = "KW-%s-%s-%s"; private static final String KW_NO_FORMAT = "KW-%s-%s-%s";
@ -92,35 +83,6 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
List<WareHouseLocationDO> oldList = houseLocationService.getByMapId(positionMapId); List<WareHouseLocationDO> oldList = houseLocationService.getByMapId(positionMapId);
List<List<WareHouseLocationDO>> list = CollectionUtils.compareLists(oldList, newList, List<List<WareHouseLocationDO>> list = CollectionUtils.compareLists(oldList, newList,
(oldVal, newVal) -> ObjectUtil.equal(oldVal.getId(), newVal.getId())); (oldVal, newVal) -> ObjectUtil.equal(oldVal.getId(), newVal.getId()));
if (isNotEmpty(list.get(2))) {
checkLocationHaveDoingTask(list);
}
houseLocationService.batchSaveOrEditOrDel(positionMapId, list); houseLocationService.batchSaveOrEditOrDel(positionMapId, list);
} }
/**
* 校验要删除的库位是否有处理中的任务
* @param list
*/
public void checkLocationHaveDoingTask(List<List<WareHouseLocationDO>> list) {
List<Long> ids = convertList(list.get(2), WareHouseLocationDO::getId);
List<RobotTaskDetailDO> details = taskDetailService.getDoingTaskDetailByLocationIds(ids);
if (ObjectUtil.isNotEmpty(details)) {
List<String> locationNos = new ArrayList<>();
for (RobotTaskDetailDO detail : details) {
if (ObjectUtil.isNotEmpty(detail.getFromLocationId()) && ids.contains(detail.getFromLocationId())) {
locationNos.add(detail.getFromLocationNo());
continue;
}
if (ObjectUtil.isNotEmpty(detail.getToLocationId()) && ids.contains(detail.getToLocationId())) {
locationNos.add(detail.getToLocationNo());
}
}
String join = StringUtils.join(locationNos, ",");
throw exception0(HOUSE_LOCATION_HAVE_TASK.getCode(), "以下库位存在处理中的任务:"+join,join);
}
}
} }

View File

@ -58,13 +58,6 @@ public interface RobotTaskDetailActionLogService {
*/ */
void addLogInCache(List<RobotTaskDetailActionLogDO> logs); void addLogInCache(List<RobotTaskDetailActionLogDO> logs);
/**
* 设置上一条数据完成非主任务
* @param robotNo
* @return
*/
RobotTaskDetailActionLogDO setPreviousTaskDoneByRobotNo(String robotNo);
/** /**
* 获取车辆的最后一条任务 * 获取车辆的最后一条任务
* @param robotNo * @param robotNo

View File

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.system.service.log; package cn.iocoder.yudao.module.system.service.log;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant; import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogPageReqVO;
@ -9,7 +8,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLo
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO; import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
import cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskDetailActionLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskDetailActionLogMapper;
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskStatusEnum; import cn.iocoder.yudao.module.system.enums.robot.RobotTaskStatusEnum;
import cn.iocoder.yudao.module.system.enums.robot.actionlog.ActionStatusEnum;
import cn.iocoder.yudao.module.system.util.redis.RedisUtil; import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -18,7 +16,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@ -97,20 +94,6 @@ public class RobotTaskDetailActionLogServiceImpl implements RobotTaskDetailActio
} }
} }
@Override
public RobotTaskDetailActionLogDO setPreviousTaskDoneByRobotNo(String robotNo) {
RobotTaskDetailActionLogDO lastLog = taskDetailActionLogMapper.selectOne(new LambdaQueryWrapperX<RobotTaskDetailActionLogDO>()
.eq(RobotTaskDetailActionLogDO::getRobotNo, robotNo)
.orderByDesc(RobotTaskDetailActionLogDO::getCreateTime)
.last("limit 1"));
if (ObjectUtil.isNotEmpty(lastLog) && ObjectUtil.isEmpty(lastLog.getCommandId())) {
lastLog.setEndTime(LocalDateTime.now());
lastLog.setActionStatus(ActionStatusEnum.DONE.getType());
taskDetailActionLogMapper.updateById(lastLog);
}
return lastLog;
}
@Override @Override
public RobotTaskDetailActionLogDO getLastTaskByRobotNo(String robotNo) { public RobotTaskDetailActionLogDO getLastTaskByRobotNo(String robotNo) {
return taskDetailActionLogMapper.selectOne(new LambdaQueryWrapperX<RobotTaskDetailActionLogDO>() return taskDetailActionLogMapper.selectOne(new LambdaQueryWrapperX<RobotTaskDetailActionLogDO>()

View File

@ -258,22 +258,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void deleteInformation(Long id) { public void deleteInformation(Long id) {
// 校验存在
validateInformationExists(id);
RobotInformationDO robotInformationDO = informationMapper.selectById(id); RobotInformationDO robotInformationDO = informationMapper.selectById(id);
List<RobotTaskDO> list = taskMapper.selectDoingTaskByRobotNo(robotInformationDO.getRobotNo());
if (ObjectUtil.isNotEmpty(list)) {
throw exception(ROBOT_HAVE_DOING_TASK);
}
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder() UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder()
.operateAction("删除车辆 " + robotInformationDO.getRobotNo()) .operateAction("删除车辆 " + robotInformationDO.getRobotNo())
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build(); .nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
userOperationLogService.createUserOperationLog(operationLog); userOperationLogService.createUserOperationLog(operationLog);
// 校验存在
validateInformationExists(id);
// 删除 // 删除
informationMapper.deleteById(id); informationMapper.deleteById(id);
} }

View File

@ -73,11 +73,4 @@ public interface RobotTaskDetailService {
* @return * @return
*/ */
void manuallyCompleted(Long id); void manuallyCompleted(Long id);
/**
* 查询此库位处理中的任务
* @param ids 库位id
* @return
*/
List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(List<Long> ids);
} }

View File

@ -26,7 +26,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import java.util.Collections;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -153,9 +152,4 @@ public class RobotTaskDetailServiceImpl implements RobotTaskDetailService {
String mac = informationService.getMacByRobotNo(robotTaskDetailDO.getRobotNo()); String mac = informationService.getMacByRobotNo(robotTaskDetailDO.getRobotNo());
informationService.robotCloseTaskDetail(String.valueOf(taskDetailId),mac,""); informationService.robotCloseTaskDetail(String.valueOf(taskDetailId),mac,"");
} }
@Override
public List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(List<Long> ids) {
return taskDetailMapper.getDoingTaskDetailByLocationIds(ids);
}
} }

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.system.service.robot; package cn.iocoder.yudao.module.system.service.robot;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -240,7 +239,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
.collect(Collectors.joining(" ")); .collect(Collectors.joining(" "));
if (ObjectUtil.isNotEmpty(robotNo)) { if (ObjectUtil.isNotEmpty(robotNo)) {
throw exception0(TASK_CHECK_EXCEPTION.getCode(), "以下机器人已被禁用 " +robotNo, robotNo); throw exception0(TASK_CHECK_EXCEPTION.getCode(), "以下机器人已被禁用 ", robotNo);
} }
} }
//校验任务号是否重复 //校验任务号是否重复
@ -488,7 +487,6 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
Integer robotStatus = RobotStatusEnum.DOING.getType(); Integer robotStatus = RobotStatusEnum.DOING.getType();
RobotChargeLogDO robotChargeLogs = null; RobotChargeLogDO robotChargeLogs = null;
String taskNo ="";
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getOrderType()) if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getOrderType())
|| PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getOrderType())) { || PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getOrderType())) {
robotChargeLogs = chargeLogMapper.selectById(taskAssignDTO.getOrderId()); robotChargeLogs = chargeLogMapper.selectById(taskAssignDTO.getOrderId());
@ -497,19 +495,13 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
chargeLogMapper.updateById(robotChargeLogs); chargeLogMapper.updateById(robotChargeLogs);
robotStatus = RobotStatusEnum.CHARGE.getType(); robotStatus = RobotStatusEnum.CHARGE.getType();
if (ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId())) { if (ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId())) {
deviceNoMap.put(robotChargeLogs.getTaskDetailId(), robotChargeLogs.getDeviceNo()); deviceNoMap.put(robotChargeLogs.getTaskDetailId(), robotChargeLogs.getDeviceNo());
}else {
String signDate = DateUtil.date().setTimeZone(TimeZone.getTimeZone("UTC")).toString("yyyyMMdd'T'HHmmss'Z'");
taskNo = "AUTO_CHARGE_"+ signDate;
} }
detailId = ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId()) ? robotChargeLogs.getTaskDetailId() : null; detailId = ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId()) ? robotChargeLogs.getTaskDetailId() : null;
} else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(taskAssignDTO.getOrderType())) { } else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(taskAssignDTO.getOrderType())) {
moveToWaitService.updateWaitStatusAndItrmId(taskAssignDTO.getOrderId(), WaitStatusEnum.GO_TO_WAIT.getType(), taskAssignDTO.getWaitId()); moveToWaitService.updateWaitStatusAndItrmId(taskAssignDTO.getOrderId(), WaitStatusEnum.GO_TO_WAIT.getType(), taskAssignDTO.getWaitId());
String signDate = DateUtil.date().setTimeZone(TimeZone.getTimeZone("UTC")).toString("yyyyMMdd'T'HHmmss'Z'");
taskNo = "MOVE_TO_WAIT_"+ signDate;
} else { } else {
detailId = taskAssignDTO.getOrderId(); detailId = taskAssignDTO.getOrderId();
} }
@ -519,8 +511,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getOrderId()); robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getOrderId());
if (ObjectUtil.isNotEmpty(detailId)) { if (ObjectUtil.isNotEmpty(detailId)) {
RobotTaskDO robotTaskDO = setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap, taskAssignDTO.getWaitId()); setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap, taskAssignDTO.getWaitId());
taskNo = robotTaskDO.getTaskNo();
} }
if (ObjectUtil.isNotEmpty(robotChargeLogs)) { if (ObjectUtil.isNotEmpty(robotChargeLogs)) {
@ -531,8 +522,6 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
logOne.setCommandType(taskAssignDTO.getOrderType()); logOne.setCommandType(taskAssignDTO.getOrderType());
logOne.setActionMsg(taskAssignDTO.getRobotActionMsg()); logOne.setActionMsg(taskAssignDTO.getRobotActionMsg());
logOne.setRobotNo(taskAssignDTO.getRobotNo()); logOne.setRobotNo(taskAssignDTO.getRobotNo());
logOne.setStartTime(LocalDateTime.now());
logOne.setTaskNo(taskNo);
logOne.setCommandId(-1L); logOne.setCommandId(-1L);
logOne.setTaskDetailId(taskAssignDTO.getOrderId()); logOne.setTaskDetailId(taskAssignDTO.getOrderId());
taskDetailActionLogMapper.insert(logOne); taskDetailActionLogMapper.insert(logOne);
@ -632,7 +621,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
build.setHeight(height); build.setHeight(height);
} }
public RobotTaskDO setTaskDoing(Long detailId, String robotNo, Map<Long, String> deviceNoMap, public RobotTaskDetailDO setTaskDoing(Long detailId, String robotNo, Map<Long, String> deviceNoMap,
String waitId) { String waitId) {
RobotTaskDetailDO taskDetailDO = taskDetailMapper.selectById(detailId); RobotTaskDetailDO taskDetailDO = taskDetailMapper.selectById(detailId);
taskDetailDO.setTaskStatus(RobotTaskDetailStatusEnum.DOING.getType()); taskDetailDO.setTaskStatus(RobotTaskDetailStatusEnum.DOING.getType());
@ -654,7 +643,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
RobotTaskDO task = taskMapper.selectById(taskDetailDO.getRobotTaskId()); RobotTaskDO task = taskMapper.selectById(taskDetailDO.getRobotTaskId());
task.setTaskStatus(RobotTaskStatusEnum.DOING.getType()); task.setTaskStatus(RobotTaskStatusEnum.DOING.getType());
taskMapper.updateById(task); taskMapper.updateById(task);
return task; return taskDetailDO;
} }
/** /**

View File

@ -13,8 +13,7 @@
update update
robot_task_detail_action_log robot_task_detail_action_log
set set
action_status = #{actionStatus}, action_status = #{actionStatus}
end_time = #{time}
where where
task_detail_id = #{taskDetailId} task_detail_id = #{taskDetailId}
and command_id = '-1' and command_id = '-1'

View File

@ -246,30 +246,7 @@
t1.task_type = '5' t1.task_type = '5'
and t1.task_status = '2' and t1.task_status = '2'
</select> </select>
<select id="getDoingTaskDetailByLocationIds"
resultType="cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO">
select
t2.*
from
robot_task t1 left join robot_task_detail t2
on t1.id = t2.robot_task_id
where
t1.deleted = '0'
and t2.deleted = '0'
and t2.task_status in('0','1')
and t1.task_status in('0','1')
and (t2.to_location_id in
<foreach collection="ids" item="locationId" index="index" open="(" close=")"
separator=",">
#{locationId}
</foreach> or
t2.from_location_id in
<foreach collection="ids" item="locationId" index="index" open="(" close=")"
separator=",">
#{locationId}
</foreach>
)
</select>
<!--通过主键修改数据--> <!--通过主键修改数据-->

View File

@ -328,22 +328,6 @@
order by t1.create_time desc order by t1.create_time desc
</select> </select>
<select id="selectDoingTaskByRobotNo"
resultType="cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO">
select
DISTINCT
t1.*
from
robot_task t1 left join robot_task_detail t2
on t1.id = t2.robot_task_id
where
t1.deleted = '0'
and t2.deleted = '0'
and t2.robot_no = #{robotNo}
and t1.task_status in ('0','1')
and t2.task_status in ('0','1')
</select>
<!--新增所有列--> <!--新增所有列-->
<insert id="insertEntity" keyProperty="id" useGeneratedKeys="true"> <insert id="insertEntity" keyProperty="id" useGeneratedKeys="true">