Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud-wcs into aikai
This commit is contained in:
commit
c7b55614bb
@ -107,5 +107,10 @@ public class FileController {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -74,4 +74,11 @@ public interface FileService {
|
||||
* @return
|
||||
*/
|
||||
BusinessFileVO createBusinessReturnFile(MultipartFile file) throws IOException;
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
BusinessFileVO businessUploadFile(MultipartFile file) throws IOException;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ 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.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
||||
@ -18,12 +19,16 @@ 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.utils.FileTypeUtils;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
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.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
@ -42,6 +47,9 @@ public class FileServiceImpl implements FileService {
|
||||
@Resource
|
||||
private FileMapper fileMapper;
|
||||
|
||||
@Value("${file.upload-path}")
|
||||
private String uploadPath;
|
||||
|
||||
@Override
|
||||
public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) {
|
||||
return fileMapper.selectPage(pageReqVO);
|
||||
@ -190,4 +198,23 @@ public class FileServiceImpl implements FileService {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -157,3 +157,6 @@ yudao:
|
||||
mock-enable: true
|
||||
access-log: # 访问日志的配置项
|
||||
enable: false
|
||||
|
||||
file:
|
||||
upload-path: /Users/Documents/image/ # 文件上传路径
|
@ -178,7 +178,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 库位 1-002-032-000 ==========
|
||||
ErrorCode HOUSE_LOCATION_NOT_EXISTS = new ErrorCode(1-002-032-001, "库位不存在");
|
||||
ErrorCode HOUSE_LOCATION_NO_EXIST = new ErrorCode(1-002-032-002, "库位编号重复");
|
||||
ErrorCode HOUSE_LOCATION_HAVE_TASK = new ErrorCode(1-002-032-002, "库位存在处理中的任务");
|
||||
|
||||
// ========== 车辆类型 1-002-033-000==========
|
||||
ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1-002-033-001, "车辆类型不存在");
|
||||
@ -191,6 +191,7 @@ public interface ErrorCodeConstants {
|
||||
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_FREE_CHARGING_STATION = new ErrorCode(1-002-034-007, "没有空闲的充电桩");
|
||||
ErrorCode ROBOT_HAVE_DOING_TASK = new ErrorCode(1-002-034-010, "车辆有处理中的任务");
|
||||
|
||||
// ========== 机器人任务主表 1-002-035-000 ==========
|
||||
ErrorCode TASK_NOT_EXISTS = new ErrorCode(1-002-035-001, "机器人任务主表不存在");
|
||||
|
@ -142,19 +142,13 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
|
||||
/**
|
||||
* 上一条明细设置为完成
|
||||
*
|
||||
* @param mac
|
||||
* @return
|
||||
*/
|
||||
public RobotTaskDetailActionLogDO setLastLogDone(String mac){
|
||||
public RobotTaskDetailActionLogDO setLastLogDone(String mac) {
|
||||
String robotNo = robotInformationService.getRobotNoByMac(mac);
|
||||
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;
|
||||
return taskDetailActionLogService.setPreviousTaskDoneByRobotNo(robotNo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,13 +159,17 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
RobotTaskDetailActionLogDO lastLog = setLastLogDone(robotCompleteTaskDTO.getMac());
|
||||
|
||||
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())) {
|
||||
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
|
||||
logOne.setActionMsg("车辆正在前往等待点");
|
||||
logOne.setRobotNo(robotNo);
|
||||
logOne.setStartTime(LocalDateTime.now());
|
||||
logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId());
|
||||
if (ObjectUtil.isNotEmpty(lastLog)) {
|
||||
logOne.setCommandType(lastLog.getCommandType());
|
||||
logOne.setTaskNo(lastLog.getTaskNo());
|
||||
}
|
||||
taskDetailActionLogMapper.insert(logOne);
|
||||
redisUtil.set(robotDoingActionKey, logOne.getActionMsg(), doingActionCacheTime);
|
||||
moveToWaitService.updateWaitStatus(robotCompleteTaskDTO.getOrderId(), WaitStatusEnum.GO_TO_WAIT.getType());
|
||||
@ -181,10 +179,10 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
|
||||
if ((PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()))
|
||||
&& ObjectUtil.isNotEmpty(robotCompleteTaskDTO.getCommandStatus())
|
||||
&& CommandTypeEnum.MOVE_POSES.getType().equals(robotCompleteTaskDTO.getCommandStatus().getCommandType())
|
||||
&& RobotExecutionStateConstant.DONE.equals(robotCompleteTaskDTO.getCommandStatus().getExecutionState())) {
|
||||
log.info("充电任务准备让充电设备自动伸出 :{}",robotCompleteTaskDTO.getOrderId());
|
||||
&& ObjectUtil.isNotEmpty(robotCompleteTaskDTO.getCommandStatus())
|
||||
&& CommandTypeEnum.MOVE_POSES.getType().equals(robotCompleteTaskDTO.getCommandStatus().getCommandType())
|
||||
&& RobotExecutionStateConstant.DONE.equals(robotCompleteTaskDTO.getCommandStatus().getExecutionState())) {
|
||||
log.info("充电任务准备让充电设备自动伸出 :{}", robotCompleteTaskDTO.getOrderId());
|
||||
RobotChargeLogDO robotChargeLog = chargeLogMapper.selectById(robotCompleteTaskDTO.getOrderId());
|
||||
deviceInformationService.chargeDeviceExtend(robotChargeLog.getDeviceNo());
|
||||
}
|
||||
@ -192,7 +190,8 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
sendStartDoActionToPP(robotCompleteTaskDTO.getCommandStatus(), robotCompleteTaskDTO.getMac(),
|
||||
String.valueOf(robotCompleteTaskDTO.getOrderId()));
|
||||
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType());
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType()
|
||||
, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -244,7 +243,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
.build();
|
||||
chargeLogMapper.updateById(build);
|
||||
}
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType());
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
||||
}
|
||||
|
||||
|
||||
@ -329,7 +328,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
*
|
||||
* @param robotCompleteTaskDTO
|
||||
*/
|
||||
private void chargeDoing(RobotCompleteTaskDTO robotCompleteTaskDTO, String robotDoingActionKey,RobotTaskDetailActionLogDO lastLog) {
|
||||
private void chargeDoing(RobotCompleteTaskDTO robotCompleteTaskDTO, String robotDoingActionKey, RobotTaskDetailActionLogDO lastLog) {
|
||||
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
|
||||
RobotCommandStateDTO commandStatus = robotCompleteTaskDTO.getCommandStatus();
|
||||
Integer taskStatus = ChargeTaskStatusEnum.CHARGEING.getType();
|
||||
@ -479,6 +478,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
logOne.setTaskStage(robotTaskDetailDO.getTaskStage());
|
||||
logOne.setCommandType(PathTaskTypeEnum.getTaskType(robotTaskDetailDO.getTaskType()));
|
||||
logOne.setTaskNo(robotTask.getTaskNo());
|
||||
logOne.setActionStatus(ActionStatusEnum.DOING.getType());
|
||||
logOne.setStartTime(LocalDateTime.now());
|
||||
taskDetailActionLogMapper.insert(logOne);
|
||||
redisUtil.set(robotDoingActionKey, logOne.getActionMsg(), doingActionCacheTime);
|
||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
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.positionmap.dto.NodeBaseDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemRespVO;
|
||||
@ -48,6 +49,9 @@ public class PositionMapItemController {
|
||||
@Resource
|
||||
private UserOperationLogService userOperationLogService;
|
||||
|
||||
@Resource
|
||||
private PathApi pathApi;
|
||||
|
||||
// -- 前端给所有的节点信息 -
|
||||
@PostMapping("/batchSaveOrEditOrDel")
|
||||
@Operation(summary = "批量新增编辑删除节点")
|
||||
@ -71,6 +75,8 @@ public class PositionMapItemController {
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
|
||||
pathApi.pathInitData();
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -122,4 +122,18 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
||||
void releaseLocationLockList(@Param("locationIds") List<Long> locationIds,
|
||||
@Param("taskId") Long taskId,
|
||||
@Param("locationLock") Integer locationLock);
|
||||
|
||||
/**
|
||||
* 更新线库名称
|
||||
* @param laneId
|
||||
* @param laneName
|
||||
*/
|
||||
void updateLocationLaneNameByLaneId(@Param("laneId") Long laneId,
|
||||
@Param("laneName") String laneName);
|
||||
|
||||
/**
|
||||
* 设置库位的线库id和名称为空
|
||||
* @param laneId
|
||||
*/
|
||||
void updateLocationLaneNameEmptyByLaneId(@Param("laneId") Long laneId);
|
||||
}
|
@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLo
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 车辆动作记录 Mapper
|
||||
*
|
||||
@ -36,5 +38,6 @@ public interface RobotTaskDetailActionLogMapper extends BaseMapperX<RobotTaskDet
|
||||
* @param actionStatus
|
||||
*/
|
||||
void updateActionStatus(@Param("taskDetailId") Long taskDetailId,
|
||||
@Param("actionStatus") int actionStatus);
|
||||
@Param("actionStatus") int actionStatus,
|
||||
@Param("time") LocalDateTime time);
|
||||
}
|
@ -115,4 +115,11 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
|
||||
* @param ids
|
||||
*/
|
||||
void updateDoneByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询此库位处理中的任务
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(@Param("ids") List<Long> ids);
|
||||
}
|
@ -79,4 +79,11 @@ public interface RobotTaskMapper extends BaseMapperX<RobotTaskDO> {
|
||||
* @param ids
|
||||
*/
|
||||
void updateDoneByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询车辆当前在做的任务
|
||||
* @param robotNo
|
||||
* @return
|
||||
*/
|
||||
List<RobotTaskDO> selectDoingTaskByRobotNo(@Param("robotNo") String robotNo);
|
||||
}
|
@ -9,7 +9,9 @@ public enum ActionStatusEnum {
|
||||
|
||||
UN_DO(0,"未开始"),
|
||||
DOING(1,"正在进行"),
|
||||
DONE(2,"完成");
|
||||
DONE(2,"完成"),
|
||||
CLOSE(3,"已取消"),
|
||||
EXCEPTION(4,"异常");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
|
@ -8,8 +8,11 @@ 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.positionmap.dto.NodeBaseDTO;
|
||||
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.robot.RobotTaskDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -18,15 +21,21 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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.module.system.enums.ErrorCodeConstants.HOUSE_LOCATION_NO_EXIST;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_DETAIL_CHANGE_ROBOT;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
|
||||
@Resource
|
||||
private HouseLocationService houseLocationService;
|
||||
|
||||
@Resource
|
||||
private RobotTaskDetailService taskDetailService;
|
||||
|
||||
//库位编号格式 - 第一个通配符为地图id 第二个通配符为随机数四位最后一个通配符为库位点层数
|
||||
private static final String KW_NO_FORMAT = "KW-%s-%s-%s";
|
||||
|
||||
@ -83,6 +92,35 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
|
||||
List<WareHouseLocationDO> oldList = houseLocationService.getByMapId(positionMapId);
|
||||
List<List<WareHouseLocationDO>> list = CollectionUtils.compareLists(oldList, newList,
|
||||
(oldVal, newVal) -> ObjectUtil.equal(oldVal.getId(), newVal.getId()));
|
||||
|
||||
if (isNotEmpty(list.get(2))) {
|
||||
checkLocationHaveDoingTask(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,6 +166,7 @@ public class WareHouseLaneServiceImpl extends ServiceImpl<WareHouseLaneMapper, W
|
||||
if (CollUtil.isNotEmpty(wareHouseLocationList)) {
|
||||
houseLocationService.updateBatchById(wareHouseLocationList);
|
||||
}
|
||||
houseLocationService.updateLocationLaneNameByLaneId(createReqVO.getId(),createReqVO.getLaneName());
|
||||
return new HouseLaneVO().setId(houseLane.getId()).setLaneName(houseLane.getLaneName());
|
||||
}
|
||||
|
||||
@ -176,5 +177,6 @@ public class WareHouseLaneServiceImpl extends ServiceImpl<WareHouseLaneMapper, W
|
||||
this.removeById(id);
|
||||
// 点位中包含线库id的数据设为null
|
||||
positionMapItemService.emptyLaneId(wareHouseLaneDO.getPositionMapId(), id);
|
||||
houseLocationService.updateLocationLaneNameEmptyByLaneId(id);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLoca
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -93,4 +94,17 @@ public interface HouseLocationService extends IService<WareHouseLocationDO> {
|
||||
* @return
|
||||
*/
|
||||
List<WareHouseLocationDO> getLocationByLocationNumbers(List<Long> locationNumbers);
|
||||
|
||||
/**
|
||||
* 更新线库名称
|
||||
* @param laneId
|
||||
* @param laneName
|
||||
*/
|
||||
void updateLocationLaneNameByLaneId(Long laneId, String laneName);
|
||||
|
||||
/**
|
||||
* 设置线库名称和id为空
|
||||
* @param id
|
||||
*/
|
||||
void updateLocationLaneNameEmptyByLaneId(Long laneId);
|
||||
}
|
||||
|
@ -143,6 +143,16 @@ public class HouseLocationServiceImpl extends ServiceImpl<WareHouseLocationMappe
|
||||
.in(WareHouseLocationDO::getLocationNumber, locationNumbers));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLocationLaneNameByLaneId(Long laneId, String laneName) {
|
||||
houseLocationMapper.updateLocationLaneNameByLaneId(laneId,laneName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLocationLaneNameEmptyByLaneId(Long laneId) {
|
||||
houseLocationMapper.updateLocationLaneNameEmptyByLaneId(laneId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchSaveOrEditOrDel(Long positionMapId, List<List<WareHouseLocationDO>> list) {
|
||||
|
@ -58,6 +58,13 @@ public interface RobotTaskDetailActionLogService {
|
||||
*/
|
||||
void addLogInCache(List<RobotTaskDetailActionLogDO> logs);
|
||||
|
||||
/**
|
||||
* 设置上一条数据完成(非主任务)
|
||||
* @param robotNo
|
||||
* @return
|
||||
*/
|
||||
RobotTaskDetailActionLogDO setPreviousTaskDoneByRobotNo(String robotNo);
|
||||
|
||||
/**
|
||||
* 获取车辆的最后一条任务
|
||||
* @param robotNo
|
||||
|
@ -1,5 +1,6 @@
|
||||
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.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogPageReqVO;
|
||||
@ -8,6 +9,7 @@ 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.mysql.log.RobotTaskDetailActionLogMapper;
|
||||
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 com.alibaba.fastjson.JSON;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -16,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
@ -94,6 +97,20 @@ 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
|
||||
public RobotTaskDetailActionLogDO getLastTaskByRobotNo(String robotNo) {
|
||||
return taskDetailActionLogMapper.selectOne(new LambdaQueryWrapperX<RobotTaskDetailActionLogDO>()
|
||||
|
@ -258,14 +258,22 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteInformation(Long id) {
|
||||
// 校验存在
|
||||
validateInformationExists(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()
|
||||
.operateAction("删除车辆 " + robotInformationDO.getRobotNo())
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
// 校验存在
|
||||
validateInformationExists(id);
|
||||
// 删除
|
||||
informationMapper.deleteById(id);
|
||||
}
|
||||
|
@ -73,4 +73,11 @@ public interface RobotTaskDetailService {
|
||||
* @return
|
||||
*/
|
||||
void manuallyCompleted(Long id);
|
||||
|
||||
/**
|
||||
* 查询此库位处理中的任务
|
||||
* @param ids 库位id
|
||||
* @return
|
||||
*/
|
||||
List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(List<Long> ids);
|
||||
}
|
@ -26,6 +26,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -152,4 +153,9 @@ public class RobotTaskDetailServiceImpl implements RobotTaskDetailService {
|
||||
String mac = informationService.getMacByRobotNo(robotTaskDetailDO.getRobotNo());
|
||||
informationService.robotCloseTaskDetail(String.valueOf(taskDetailId),mac,"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(List<Long> ids) {
|
||||
return taskDetailMapper.getDoingTaskDetailByLocationIds(ids);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.service.robot;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -239,7 +240,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
.collect(Collectors.joining(" "));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(robotNo)) {
|
||||
throw exception0(TASK_CHECK_EXCEPTION.getCode(), "以下机器人已被禁用 ", robotNo);
|
||||
throw exception0(TASK_CHECK_EXCEPTION.getCode(), "以下机器人已被禁用 " +robotNo, robotNo);
|
||||
}
|
||||
}
|
||||
//校验任务号是否重复
|
||||
@ -487,6 +488,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
Integer robotStatus = RobotStatusEnum.DOING.getType();
|
||||
|
||||
RobotChargeLogDO robotChargeLogs = null;
|
||||
String taskNo ="";
|
||||
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getOrderType())) {
|
||||
robotChargeLogs = chargeLogMapper.selectById(taskAssignDTO.getOrderId());
|
||||
@ -495,13 +497,19 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
chargeLogMapper.updateById(robotChargeLogs);
|
||||
|
||||
robotStatus = RobotStatusEnum.CHARGE.getType();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId())) {
|
||||
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;
|
||||
|
||||
} else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(taskAssignDTO.getOrderType())) {
|
||||
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 {
|
||||
detailId = taskAssignDTO.getOrderId();
|
||||
}
|
||||
@ -511,7 +519,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getOrderId());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailId)) {
|
||||
setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap, taskAssignDTO.getWaitId());
|
||||
RobotTaskDO robotTaskDO = setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap, taskAssignDTO.getWaitId());
|
||||
taskNo = robotTaskDO.getTaskNo();
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(robotChargeLogs)) {
|
||||
@ -522,6 +531,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
logOne.setCommandType(taskAssignDTO.getOrderType());
|
||||
logOne.setActionMsg(taskAssignDTO.getRobotActionMsg());
|
||||
logOne.setRobotNo(taskAssignDTO.getRobotNo());
|
||||
logOne.setStartTime(LocalDateTime.now());
|
||||
logOne.setTaskNo(taskNo);
|
||||
logOne.setCommandId(-1L);
|
||||
logOne.setTaskDetailId(taskAssignDTO.getOrderId());
|
||||
taskDetailActionLogMapper.insert(logOne);
|
||||
@ -621,7 +632,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
build.setHeight(height);
|
||||
}
|
||||
|
||||
public RobotTaskDetailDO setTaskDoing(Long detailId, String robotNo, Map<Long, String> deviceNoMap,
|
||||
public RobotTaskDO setTaskDoing(Long detailId, String robotNo, Map<Long, String> deviceNoMap,
|
||||
String waitId) {
|
||||
RobotTaskDetailDO taskDetailDO = taskDetailMapper.selectById(detailId);
|
||||
taskDetailDO.setTaskStatus(RobotTaskDetailStatusEnum.DOING.getType());
|
||||
@ -643,7 +654,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
RobotTaskDO task = taskMapper.selectById(taskDetailDO.getRobotTaskId());
|
||||
task.setTaskStatus(RobotTaskStatusEnum.DOING.getType());
|
||||
taskMapper.updateById(task);
|
||||
return taskDetailDO;
|
||||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -506,6 +506,24 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateLocationLaneNameByLaneId">
|
||||
update
|
||||
ware_house_location
|
||||
set
|
||||
lane_name = #{laneName}
|
||||
where
|
||||
lane_id = #{laneId}
|
||||
</update>
|
||||
|
||||
<update id="updateLocationLaneNameEmptyByLaneId">
|
||||
update
|
||||
ware_house_location
|
||||
set
|
||||
lane_name = null,
|
||||
lane_id = null
|
||||
where
|
||||
lane_id = #{laneId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectByTypeAndId" resultMap="BaseResultMap">
|
||||
|
@ -13,7 +13,8 @@
|
||||
update
|
||||
robot_task_detail_action_log
|
||||
set
|
||||
action_status = #{actionStatus}
|
||||
action_status = #{actionStatus},
|
||||
end_time = #{time}
|
||||
where
|
||||
task_detail_id = #{taskDetailId}
|
||||
and command_id = '-1'
|
||||
|
@ -246,7 +246,30 @@
|
||||
t1.task_type = '5'
|
||||
and t1.task_status = '2'
|
||||
</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>
|
||||
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
|
@ -328,6 +328,22 @@
|
||||
order by t1.create_time desc
|
||||
</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">
|
||||
|
Loading…
Reference in New Issue
Block a user