任务查询/更新、校验机器人区域
This commit is contained in:
parent
ee6f39faa0
commit
4c62f8b205
@ -31,7 +31,8 @@ management:
|
|||||||
|
|
||||||
# MQTT
|
# MQTT
|
||||||
mqtt:
|
mqtt:
|
||||||
host: tcp://192.168.0.116:1883
|
# host: tcp://192.168.0.54:1883
|
||||||
|
host: tcp://127.0.0.1:1883
|
||||||
username: adminuser
|
username: adminuser
|
||||||
password: adminuser
|
password: adminuser
|
||||||
qos: 1
|
qos: 1
|
||||||
|
@ -194,6 +194,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode TASK_CHECK_ID_EXCEPTION = new ErrorCode(1-002-035-006, "请输入ID");
|
ErrorCode TASK_CHECK_ID_EXCEPTION = new ErrorCode(1-002-035-006, "请输入ID");
|
||||||
ErrorCode TASK_CHECK_TASK_PRIORITY = new ErrorCode(1-002-035-007, "非新单据不能修改优先级");
|
ErrorCode TASK_CHECK_TASK_PRIORITY = new ErrorCode(1-002-035-007, "非新单据不能修改优先级");
|
||||||
ErrorCode TASK_CHECK_TASK_STATUS = new ErrorCode(1-002-035-100, "订单已完成");
|
ErrorCode TASK_CHECK_TASK_STATUS = new ErrorCode(1-002-035-100, "订单已完成");
|
||||||
|
ErrorCode TASK_CHECK_UPDATE_STATUS = new ErrorCode(1-002-035-101, "订单更新失败");
|
||||||
|
|
||||||
// ========== 机器人任务明细 1-002-036-000 ==========
|
// ========== 机器人任务明细 1-002-036-000 ==========
|
||||||
ErrorCode TASK_DETAIL_NOT_EXISTS = new ErrorCode(1-002-036-001, "机器人任务明细不存在");
|
ErrorCode TASK_DETAIL_NOT_EXISTS = new ErrorCode(1-002-036-001, "机器人任务明细不存在");
|
||||||
|
@ -82,10 +82,10 @@ public class RobotTaskController {
|
|||||||
return success(taskService.getTaskNo());
|
return success(taskService.getTaskNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@PostMapping("/page")
|
||||||
@Operation(summary = "获得机器人任务主表分页")
|
@Operation(summary = "获得机器人任务主表分页")
|
||||||
@PreAuthorize("@ss.hasPermission('robot:task:query')")
|
@PreAuthorize("@ss.hasPermission('robot:task:query')")
|
||||||
public CommonResult<PageResult<RobotTaskRespVO>> getTaskPage(@Valid RobotTaskPageReqVO pageReqVO) {
|
public CommonResult<PageResult<RobotTaskRespVO>> getTaskPage(@Valid @RequestBody RobotTaskPageReqVO pageReqVO) {
|
||||||
PageResult<RobotTaskRespVO> pageResult = taskService.getTaskPage(pageReqVO);
|
PageResult<RobotTaskRespVO> pageResult = taskService.getTaskPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, RobotTaskRespVO.class));
|
return success(BeanUtils.toBean(pageResult, RobotTaskRespVO.class));
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ public class RobotTaskPageReqVO extends PageParam {
|
|||||||
@Schema(description = "任务号")
|
@Schema(description = "任务号")
|
||||||
private String taskNo;
|
private String taskNo;
|
||||||
|
|
||||||
|
@Schema(description = "机器人编号")
|
||||||
|
private String robotNo;
|
||||||
|
|
||||||
@Schema(description = "任务状态(0:未开始、1:执行中、2:已完成、3:已取消)", example = "2")
|
@Schema(description = "任务状态(0:未开始、1:执行中、2:已完成、3:已取消)", example = "2")
|
||||||
private Integer taskStatus;
|
private Integer taskStatus;
|
||||||
|
|
||||||
|
@ -146,4 +146,8 @@ public class WareHouseLocationDO extends BaseDO {
|
|||||||
* ware_position_map的id
|
* ware_position_map的id
|
||||||
*/
|
*/
|
||||||
private Long mapId;
|
private Long mapId;
|
||||||
|
/**
|
||||||
|
* ware_position_map_item的id
|
||||||
|
*/
|
||||||
|
private Long mapItemId;
|
||||||
}
|
}
|
@ -47,6 +47,10 @@ public class PositionMapItemDO extends BaseDO {
|
|||||||
* 坐标y轴
|
* 坐标y轴
|
||||||
*/
|
*/
|
||||||
private String locationY;
|
private String locationY;
|
||||||
|
/**
|
||||||
|
* 对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向
|
||||||
|
*/
|
||||||
|
private String dataJson;
|
||||||
/**
|
/**
|
||||||
* 类型 1.行走点位 2.库位 3.充电桩 --- 后续补充
|
* 类型 1.行走点位 2.库位 3.充电桩 --- 后续补充
|
||||||
*/
|
*/
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.positionmap;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.Pose2ds;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -26,4 +27,10 @@ public interface PositionMapItemMapper extends BaseMapperX<PositionMapItemDO> {
|
|||||||
.orderByDesc(PositionMapItemDO::getId));
|
.orderByDesc(PositionMapItemDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据库位id查询
|
||||||
|
* @param locationId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Pose2ds selectByLocationId(Long locationId);
|
||||||
}
|
}
|
||||||
|
@ -86,4 +86,10 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
|
|||||||
void updateRobotDetailById(RobotTaskDetailDO detailDO);
|
void updateRobotDetailById(RobotTaskDetailDO detailDO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询正在处理中的任务主表id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> getDoingTaskIds();
|
||||||
|
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -50,6 +51,15 @@ public interface RobotTaskMapper extends BaseMapperX<RobotTaskDO> {
|
|||||||
* 获取未完成的订单id
|
* 获取未完成的订单id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Long> getUnDoAndDoingTaskIds(@Param("montageTask") Integer montageTask);
|
List<Long> getUnDoAndDoingTaskIds(@Param("montageTask") Integer montageTask,
|
||||||
|
@Param("ids") List<Long> ids );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param mpPage
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<RobotTaskDO> selectPageList(@Param("mpPage") IPage mpPage,
|
||||||
|
@Param("pageReqVO") RobotTaskPageReqVO pageReqVO);
|
||||||
}
|
}
|
@ -16,6 +16,8 @@ public enum CommandTypeEnum {
|
|||||||
STOP("STOP"),//停止
|
STOP("STOP"),//停止
|
||||||
START("START"),//启动
|
START("START"),//启动
|
||||||
WAIT("WAIT"),//等待
|
WAIT("WAIT"),//等待
|
||||||
|
GET_PALLET_TOPIC("GET_PALLET_TOPIC"),//获取托盘位置
|
||||||
|
MOVE_TO_PALLET_POSE("MOVE_TO_PALLET_POSE"),//让车机移动到取货终点
|
||||||
FORK("FORK"); //控制货叉上下移动
|
FORK("FORK"); //控制货叉上下移动
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
|
@ -9,7 +9,8 @@ public enum RobotTaskStatusEnum {
|
|||||||
NEW(0),//未开始
|
NEW(0),//未开始
|
||||||
DOING(1),//执行中
|
DOING(1),//执行中
|
||||||
DONE(2),//已完成
|
DONE(2),//已完成
|
||||||
CLOSE(3); //已取消
|
CLOSE(3), //已取消
|
||||||
|
Exc(4); //异常
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.robot;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||||
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.RobotInformationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||||
@ -16,6 +17,7 @@ import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
|||||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
@ -364,7 +366,8 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void doDetectingTrays(RobotTaskDetailAddVO robotTaskVo) {
|
public void doDetectingTrays(RobotTaskDetailAddVO robotTaskVo) {
|
||||||
|
setToLocation(robotTaskVo,getMapIdsByRobotNo(robotTaskVo.getRobotNo()),new ArrayList<>());
|
||||||
|
locationMapper.updateLocationLockStatus(robotTaskVo.getToLocationId(),0,robotTaskVo.getRobotTaskId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -373,7 +376,8 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void doScan(RobotTaskDetailAddVO robotTaskVo) {
|
public void doScan(RobotTaskDetailAddVO robotTaskVo) {
|
||||||
|
setToLocation(robotTaskVo,getMapIdsByRobotNo(robotTaskVo.getRobotNo()),new ArrayList<>());
|
||||||
|
locationMapper.updateLocationLockStatus(robotTaskVo.getToLocationId(),0,robotTaskVo.getRobotTaskId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -445,7 +449,7 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置停车/目标库位
|
* 设置停车/目标库位/扫描库位
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void setToLocation(RobotTaskDetailAddVO robotTaskVo, Set<Long> mapIds, List<Long> locationIds){
|
public void setToLocation(RobotTaskDetailAddVO robotTaskVo, Set<Long> mapIds, List<Long> locationIds){
|
||||||
@ -530,7 +534,7 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
List<RobotTaskDetailDO> doingTasks = taskDetailMapper.queryDoingTaskByIds(set);
|
List<RobotTaskDetailDO> doingTasks = taskDetailMapper.queryDoingTaskByIds(set);
|
||||||
if (ObjectUtil.isNotEmpty(doingTasks)) {
|
if (ObjectUtil.isNotEmpty(doingTasks)) {
|
||||||
log.error("取货库位,存在未完成的任务 :{}", robotTaskVo.getTakeId());
|
log.error("取货库位,存在未完成的任务 :{}", robotTaskVo.getTakeId());
|
||||||
throw new RuntimeException("取货库位,存在未完成的任务");
|
throw new RuntimeException("取货库位,存在未完成的任务 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置为锁定
|
//设置为锁定
|
||||||
@ -542,6 +546,7 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateTask(RobotTaskSaveReqVO updateReqVO) {
|
public void updateTask(RobotTaskSaveReqVO updateReqVO) {
|
||||||
RLock lock = redissonUtils.getLock(RobotCacheLockEnum.ROBOT_TASK_DISTRIBUTE_LOCK.getKey());
|
RLock lock = redissonUtils.getLock(RobotCacheLockEnum.ROBOT_TASK_DISTRIBUTE_LOCK.getKey());
|
||||||
|
String msg = "";
|
||||||
if (lock.tryLock()){
|
if (lock.tryLock()){
|
||||||
try {
|
try {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
@ -550,33 +555,53 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
throw exception(TASK_CHECK_ID_EXCEPTION);
|
throw exception(TASK_CHECK_ID_EXCEPTION);
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
//修改优先级需要订单状态为未开始
|
//修改优先级需要订单状态为未开始/处理中
|
||||||
RobotTaskDO robotTaskDO = taskMapper.selectById(updateReqVO.getId());
|
RobotTaskDO robotTaskDO = taskMapper.selectById(updateReqVO.getId());
|
||||||
if (ObjectUtil.isNotEmpty(updateReqVO.getPriority())) {
|
List<RobotTaskDetailDO> taskDetailDOS = taskDetailMapper.queryByTaskId(updateReqVO.getId());
|
||||||
if (!RobotTaskStatusEnum.NEW.getType().equals(robotTaskDO.getTaskStatus())) {
|
if (ObjectUtil.isNotEmpty(updateReqVO.getPriority())
|
||||||
|
&& !updateReqVO.getPriority().equals(robotTaskDO.getPriority())) {
|
||||||
|
if (!RobotTaskStatusEnum.NEW.getType().equals(robotTaskDO.getTaskStatus())
|
||||||
|
&& !RobotTaskStatusEnum.DOING.getType().equals(robotTaskDO.getTaskStatus())) {
|
||||||
throw exception(TASK_CHECK_TASK_PRIORITY);
|
throw exception(TASK_CHECK_TASK_PRIORITY);
|
||||||
}
|
}
|
||||||
List<RobotTaskDetailDO> taskDetailDOS = taskDetailMapper.queryByTaskId(updateReqVO.getId());
|
|
||||||
for (RobotTaskDetailDO taskDetailDO : taskDetailDOS) {
|
for (RobotTaskDetailDO taskDetailDO : taskDetailDOS) {
|
||||||
taskDetailDO.setPriority(updateReqVO.getPriority());
|
taskDetailDO.setPriority(updateReqVO.getPriority());
|
||||||
taskDetailMapper.updateRobotDetailById(taskDetailDO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//修改订单状态
|
//修改订单状态
|
||||||
if (ObjectUtil.isNotEmpty(updateReqVO.getTaskStatus()) &&
|
if (ObjectUtil.isNotEmpty(updateReqVO.getTaskStatus())
|
||||||
RobotTaskStatusEnum.DONE.getType().equals(robotTaskDO.getTaskStatus())) {
|
&& RobotTaskStatusEnum.DONE.getType().equals(robotTaskDO.getTaskStatus())
|
||||||
|
&& !robotTaskDO.getTaskStatus().equals(updateReqVO.getTaskStatus())) {
|
||||||
throw exception(TASK_CHECK_TASK_STATUS);
|
throw exception(TASK_CHECK_TASK_STATUS);
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(updateReqVO.getTaskStatus())
|
||||||
|
&& !robotTaskDO.getTaskStatus().equals(updateReqVO.getTaskStatus())) {
|
||||||
|
for (RobotTaskDetailDO taskDetailDO : taskDetailDOS) {
|
||||||
|
if (RobotTaskDetailStatusEnum.DONE.getType().equals(taskDetailDO.getTaskStatus())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//后期需做状态映射
|
||||||
|
taskDetailDO.setTaskStatus(updateReqVO.getTaskStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RobotTaskDO updateObj = BeanUtils.toBean(updateReqVO, RobotTaskDO.class);
|
RobotTaskDO updateObj = BeanUtils.toBean(updateReqVO, RobotTaskDO.class);
|
||||||
taskMapper.updateById(updateObj);
|
taskMapper.updateById(updateObj);
|
||||||
|
|
||||||
|
taskDetailMapper.updateBatch(taskDetailDOS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("下发任务给车机出现异常 :{}",e.getMessage());
|
log.error("更新任务失败 :{}",e.getMessage());
|
||||||
|
msg = e.getMessage();
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw exception(REDISSON_NOT_OBTAIN_LOCK);
|
throw exception(REDISSON_NOT_OBTAIN_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(msg)) {
|
||||||
|
throw exception0(TASK_CHECK_UPDATE_STATUS.getCode(), msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -600,10 +625,21 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<RobotTaskRespVO> getTaskPage(RobotTaskPageReqVO pageReqVO) {
|
public PageResult<RobotTaskRespVO> getTaskPage(RobotTaskPageReqVO pageReqVO) {
|
||||||
PageResult<RobotTaskDO> pageResult = taskMapper.selectPage(pageReqVO);
|
|
||||||
|
PageResult<RobotTaskDO> pageResult = null;
|
||||||
PageResult<RobotTaskRespVO> dataPage = new PageResult<>();
|
PageResult<RobotTaskRespVO> dataPage = new PageResult<>();
|
||||||
dataPage.setTotal(pageResult.getTotal());
|
List<RobotTaskDO> list = new ArrayList<>();
|
||||||
List<RobotTaskDO> list = pageResult.getList();
|
if (ObjectUtil.isEmpty(pageReqVO.getRobotNo())) {
|
||||||
|
pageResult = taskMapper.selectPage(pageReqVO);
|
||||||
|
dataPage.setTotal(pageResult.getTotal());
|
||||||
|
list = pageResult.getList();
|
||||||
|
}else {
|
||||||
|
IPage mpPage = MyBatisUtils.buildPage(pageReqVO);
|
||||||
|
IPage<RobotTaskDO> page = taskMapper.selectPageList(mpPage, pageReqVO);
|
||||||
|
dataPage.setTotal(page.getTotal());
|
||||||
|
list = page.getRecords();
|
||||||
|
}
|
||||||
|
|
||||||
List<RobotTaskRespVO> targetList = BeanUtil.copyToList(list, RobotTaskRespVO.class);
|
List<RobotTaskRespVO> targetList = BeanUtil.copyToList(list, RobotTaskRespVO.class);
|
||||||
for (RobotTaskRespVO robotTaskRespVO : targetList) {
|
for (RobotTaskRespVO robotTaskRespVO : targetList) {
|
||||||
robotTaskRespVO.setDetails(taskDetailMapper.queryByTaskId(robotTaskRespVO.getId()));
|
robotTaskRespVO.setDetails(taskDetailMapper.queryByTaskId(robotTaskRespVO.getId()));
|
||||||
|
@ -6,25 +6,29 @@ import cn.iocoder.yudao.module.mqtt.api.task.RobotTaskApi;
|
|||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.Pose2ds;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.Pose2ds;
|
||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskDTO;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskDTO;
|
||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskData;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskData;
|
||||||
|
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.RobotInformationDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
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;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskMapper;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import java.util.List;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -42,6 +46,28 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RobotTaskApi robotTaskApi;
|
private RobotTaskApi robotTaskApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PositionMapItemMapper positionMapItemMapper;
|
||||||
|
|
||||||
|
@Value("${zn.init_height:0.0}")
|
||||||
|
private double initHeight;
|
||||||
|
|
||||||
|
@Value("${zn.scan_height:0.4}")
|
||||||
|
private double scanHeight;
|
||||||
|
|
||||||
|
@Value("${zn.parm:5000}")
|
||||||
|
private Integer parm;
|
||||||
|
|
||||||
|
@Value("${zn.lift_height:0.1}")
|
||||||
|
private double liftHeight;
|
||||||
|
|
||||||
|
@Value("${zn.move_height:0.1}")
|
||||||
|
private double moveHeight;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WareHouseLocationMapper locationMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发搬运任务
|
* 下发搬运任务
|
||||||
*/
|
*/
|
||||||
@ -56,9 +82,10 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//拼接任务id
|
//拼接任务id
|
||||||
List<Long> montageTaskIds = robotTaskMapper.getUnDoAndDoingTaskIds(MontageTaskEnum.YES.getType());
|
List<Long> detailDongIds = robotTaskDetailMapper.getDoingTaskIds();
|
||||||
|
List<Long> montageTaskIds = robotTaskMapper.getUnDoAndDoingTaskIds(MontageTaskEnum.YES.getType(),detailDongIds);
|
||||||
//不拼接的任务id
|
//不拼接的任务id
|
||||||
List<Long> singleTaskIds = robotTaskMapper.getUnDoAndDoingTaskIds(MontageTaskEnum.NO.getType());
|
List<Long> singleTaskIds = robotTaskMapper.getUnDoAndDoingTaskIds(MontageTaskEnum.NO.getType(),new ArrayList<>());
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(montageTaskIds) && ObjectUtil.isEmpty(singleTaskIds)) {
|
if (ObjectUtil.isEmpty(montageTaskIds) && ObjectUtil.isEmpty(singleTaskIds)) {
|
||||||
log.info("暂无需要处理的主任务");
|
log.info("暂无需要处理的主任务");
|
||||||
@ -111,7 +138,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
case TAKE_RELEASE:
|
case TAKE_RELEASE:
|
||||||
doTakeReleaseDistribute(taskDetailDO, robots,robotTaskDOS);
|
doTakeReleaseDistribute(taskDetailDO, robots,robotTaskDOS);
|
||||||
break;
|
break;
|
||||||
case PARK:
|
/*case PARK:
|
||||||
doParkDistribute(taskDetailDO, robots,robotTaskDOS);
|
doParkDistribute(taskDetailDO, robots,robotTaskDOS);
|
||||||
break;
|
break;
|
||||||
case CHARGE:
|
case CHARGE:
|
||||||
@ -131,13 +158,14 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
break;
|
break;
|
||||||
case DETECTING_TRAYS:
|
case DETECTING_TRAYS:
|
||||||
doDetectingTraysDistribute(taskDetailDO,robots,robotTaskDOS);
|
doDetectingTraysDistribute(taskDetailDO,robots,robotTaskDOS);
|
||||||
break;
|
break;*/
|
||||||
default:
|
default:
|
||||||
log.error("下发任务的类型不存在");
|
log.error("下发任务的类型不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(robotTaskDOS)) {
|
if (ObjectUtil.isNotEmpty(robotTaskDOS)) {
|
||||||
|
log.info("任务下发给车机 :{}", JSON.toJSONString(robotTaskDOS));
|
||||||
robotTaskApi.sendTaskToRobot(robotTaskDOS);
|
robotTaskApi.sendTaskToRobot(robotTaskDOS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +176,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doDetectingTraysDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doDetectingTraysDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -159,7 +188,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doScanDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doScanDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -170,7 +200,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doReleaseDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doReleaseDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -181,7 +212,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doTakeDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doTakeDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -192,7 +224,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doMoveDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doMoveDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
String macAddress = "";
|
String macAddress = "";
|
||||||
String robotNo = taskDetailDO.getRobotNo();
|
String robotNo = taskDetailDO.getRobotNo();
|
||||||
@ -250,7 +283,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doChargeDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doChargeDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -261,7 +295,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
* @param robots
|
* @param robots
|
||||||
* @param robotTaskDOS
|
* @param robotTaskDOS
|
||||||
*/
|
*/
|
||||||
private void doParkDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void doParkDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
String macAddress = "";
|
String macAddress = "";
|
||||||
String robotNo = taskDetailDO.getRobotNo();
|
String robotNo = taskDetailDO.getRobotNo();
|
||||||
@ -308,21 +343,19 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void doTakeReleaseDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
public void doTakeReleaseDistribute(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
List<RobotAcceptTaskDTO> robotTaskDOS) {
|
||||||
|
WareHouseLocationDO query = WareHouseLocationDO.builder().id(taskDetailDO.getFromLocationId()).build();
|
||||||
|
WareHouseLocationDO fromLocation = locationMapper.queryAllByLimit(query);
|
||||||
|
|
||||||
String macAddress = "";
|
WareHouseLocationDO toQuery = WareHouseLocationDO.builder().id(taskDetailDO.getToLocationId()).build();
|
||||||
String robotNo = taskDetailDO.getRobotNo();
|
WareHouseLocationDO toLocation = locationMapper.queryAllByLimit(toQuery);
|
||||||
if (ObjectUtil.isNotEmpty(taskDetailDO.getRobotNo())) {
|
|
||||||
macAddress = robots.stream()
|
Pair<String,String> pair = getMadAddressRobotNo(taskDetailDO,robots,fromLocation,toLocation);
|
||||||
.filter(v -> v.getRobotNo().equals(taskDetailDO.getRobotNo()))
|
String macAddress = pair.getLeft();
|
||||||
.map(RobotInformationDO::getMacAddress)
|
String robotNo = pair.getRight();
|
||||||
.findFirst()
|
|
||||||
.orElse("");
|
if (ObjectUtil.isEmpty(macAddress) || ObjectUtil.isEmpty(robotNo)) {
|
||||||
if (ObjectUtil.isEmpty(macAddress) ) {
|
log.info("mac地址为空 :{}, 机器人编号 :{}", macAddress, robotNo);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
macAddress = robots.get(0).getMacAddress();
|
|
||||||
robotNo = robots.get(0).getRobotNo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RobotAcceptTaskDTO robotTaskDO = new RobotAcceptTaskDTO();
|
RobotAcceptTaskDTO robotTaskDO = new RobotAcceptTaskDTO();
|
||||||
@ -337,17 +370,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
taskOne.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
taskOne.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
||||||
|
|
||||||
List<Pose2ds> pose2ds = new ArrayList<>();
|
List<Pose2ds> pose2ds = new ArrayList<>();
|
||||||
Pose2ds pose2d1 = new Pose2ds();
|
Pose2ds pose2 = positionMapItemMapper.selectByLocationId(taskDetailDO.getFromLocationId());
|
||||||
pose2d1.setX(-1.305);
|
pose2ds.add(pose2);
|
||||||
pose2d1.setY(-0.553);
|
|
||||||
pose2d1.setYaw(0.091);
|
|
||||||
Pose2ds pose2d2 = new Pose2ds();
|
|
||||||
pose2d2.setX(-0.407);
|
|
||||||
pose2d2.setY(-0.566);
|
|
||||||
pose2d2.setYaw(0.117);
|
|
||||||
pose2ds.add(pose2d1);
|
|
||||||
pose2ds.add(pose2d2);
|
|
||||||
|
|
||||||
taskOne.setPose2ds(pose2ds);
|
taskOne.setPose2ds(pose2ds);
|
||||||
|
|
||||||
//2
|
//2
|
||||||
@ -355,57 +379,157 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
taskTwo.setSerial("1");
|
taskTwo.setSerial("1");
|
||||||
taskTwo.setCommand_id(taskDetailDO.getId().toString());
|
taskTwo.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskTwo.setCommand_type(CommandTypeEnum.FORK.getType());
|
taskTwo.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
taskTwo.setTarget_height(0.0d);
|
taskTwo.setTarget_height(initHeight);
|
||||||
|
|
||||||
//3
|
//3
|
||||||
RobotAcceptTaskData taskThree = new RobotAcceptTaskData();
|
RobotAcceptTaskData taskThree = new RobotAcceptTaskData();
|
||||||
taskThree.setSerial("2");
|
taskThree.setSerial("2");
|
||||||
taskThree.setCommand_id(taskDetailDO.getId().toString());
|
taskThree.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskThree.setCommand_type(CommandTypeEnum.WAIT.getType());
|
taskThree.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
taskThree.setParm(2000);
|
taskThree.setTarget_height(scanHeight);
|
||||||
|
|
||||||
//4
|
//4
|
||||||
RobotAcceptTaskData taskFour = new RobotAcceptTaskData();
|
RobotAcceptTaskData taskFour = new RobotAcceptTaskData();
|
||||||
taskFour.setSerial("3");
|
taskFour.setSerial("3");
|
||||||
taskFour.setCommand_id(taskDetailDO.getId().toString());
|
taskFour.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskFour.setCommand_type(CommandTypeEnum.FORK.getType());
|
taskFour.setCommand_type(CommandTypeEnum.WAIT.getType());
|
||||||
taskFour.setTarget_height(0.5);
|
taskFour.setParm(parm);
|
||||||
|
|
||||||
//5
|
//5
|
||||||
RobotAcceptTaskData taskFive = new RobotAcceptTaskData();
|
RobotAcceptTaskData taskFive = new RobotAcceptTaskData();
|
||||||
taskFive.setSerial("4");
|
taskFive.setSerial("4");
|
||||||
taskFive.setCommand_id(taskDetailDO.getId().toString());
|
taskFive.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskFive.setCommand_type(CommandTypeEnum.MOVE_POSE.getType());
|
taskFive.setCommand_type(CommandTypeEnum.GET_PALLET_TOPIC.getType());
|
||||||
Pose2ds pose2d = new Pose2ds();
|
|
||||||
pose2d.setX(0.183);
|
|
||||||
pose2d.setY(-0.572);
|
|
||||||
pose2d.setYaw(-0.088);
|
|
||||||
taskFive.setPose2d(pose2d);
|
|
||||||
|
|
||||||
//6
|
//6
|
||||||
RobotAcceptTaskData taskSix = new RobotAcceptTaskData();
|
RobotAcceptTaskData taskSix = new RobotAcceptTaskData();
|
||||||
taskSix.setSerial("5");
|
taskSix.setSerial("5");
|
||||||
taskSix.setCommand_id(taskDetailDO.getId().toString());
|
taskSix.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskSix.setCommand_type(CommandTypeEnum.FORK.getType());
|
taskSix.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
taskSix.setTarget_height(0.05);
|
|
||||||
|
|
||||||
|
double fromLocationTotalHeight = fromLocation.getLocationTotalHeight().doubleValue();
|
||||||
|
taskSix.setTarget_height(fromLocationTotalHeight);
|
||||||
|
|
||||||
//7
|
//7
|
||||||
RobotAcceptTaskData taskSeven = new RobotAcceptTaskData();
|
RobotAcceptTaskData taskSeven = new RobotAcceptTaskData();
|
||||||
taskSeven.setSerial("6");
|
taskSeven.setSerial("6");
|
||||||
taskSeven.setCommand_id(taskDetailDO.getId().toString());
|
taskSeven.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskSeven.setCommand_type(CommandTypeEnum.MOVE_POSE.getType());
|
taskSeven.setCommand_type(CommandTypeEnum.MOVE_TO_PALLET_POSE.getType());
|
||||||
Pose2ds pose2d7 = new Pose2ds();
|
|
||||||
pose2d7.setX(-0.407);
|
|
||||||
pose2d7.setY(-0.566);
|
|
||||||
pose2d7.setYaw(0.117);
|
|
||||||
taskSeven.setPose2d(pose2d7);
|
|
||||||
|
|
||||||
//8
|
//8
|
||||||
RobotAcceptTaskData taskEight = new RobotAcceptTaskData();
|
RobotAcceptTaskData taskEigth = new RobotAcceptTaskData();
|
||||||
taskEight.setSerial("7");
|
taskEigth.setSerial("7");
|
||||||
taskEight.setCommand_id(taskDetailDO.getId().toString());
|
taskEigth.setCommand_id(taskDetailDO.getId().toString());
|
||||||
taskEight.setCommand_type(CommandTypeEnum.FORK.getType());
|
taskEigth.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
taskEight.setTarget_height(0.05);
|
BigDecimal b1 = new BigDecimal(Double.toString(fromLocationTotalHeight));
|
||||||
|
BigDecimal b2 = new BigDecimal(Double.toString(liftHeight));
|
||||||
|
taskEigth.setTarget_height(b1.add(b2).doubleValue());
|
||||||
|
|
||||||
|
|
||||||
|
//8-2
|
||||||
|
RobotAcceptTaskData taskEigth2 = new RobotAcceptTaskData();
|
||||||
|
taskEigth2.setSerial("8");
|
||||||
|
taskEigth2.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskEigth2.setCommand_type(CommandTypeEnum.MOVE_POSE.getType());
|
||||||
|
Pose2ds poseWait1 = positionMapItemMapper.selectByLocationId(100l);
|
||||||
|
taskEigth2.setPose2d(poseWait1);
|
||||||
|
|
||||||
|
//9
|
||||||
|
RobotAcceptTaskData taskNigth = new RobotAcceptTaskData();
|
||||||
|
taskNigth.setSerial("9");
|
||||||
|
taskNigth.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskNigth.setCommand_type(CommandTypeEnum.MOVE_POSES.getType());
|
||||||
|
List<Pose2ds> pose2dsNight = new ArrayList<>();
|
||||||
|
|
||||||
|
WareHouseLocationDO ware = WareHouseLocationDO.builder()
|
||||||
|
.laneId(-2l)
|
||||||
|
.build();
|
||||||
|
List<WareHouseLocationDO> releaseStockList =
|
||||||
|
locationMapper.selectLocations(ware,new ArrayList<>(),new HashSet<>());
|
||||||
|
for (WareHouseLocationDO wareHouseLocationDO : releaseStockList) {
|
||||||
|
Pose2ds pose = positionMapItemMapper.selectByLocationId(wareHouseLocationDO.getId());
|
||||||
|
pose2dsNight.add(pose);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*Pose2ds poseOne = new Pose2ds();
|
||||||
|
poseOne.setX(-2.097);
|
||||||
|
poseOne.setY(-0.325);
|
||||||
|
poseOne.setYaw(1.571);
|
||||||
|
Pose2ds poseTwo = new Pose2ds();
|
||||||
|
poseTwo.setX(-0.856);
|
||||||
|
poseTwo.setY(1.622);
|
||||||
|
poseTwo.setYaw(0.034);
|
||||||
|
Pose2ds poseThree = new Pose2ds();
|
||||||
|
poseThree.setX(1.955);
|
||||||
|
poseThree.setY(-0.381);
|
||||||
|
poseThree.setYaw(-1.540);
|
||||||
|
Pose2ds poseFour = new Pose2ds();
|
||||||
|
poseFour.setX(3.046);
|
||||||
|
poseFour.setY(3.219);
|
||||||
|
poseFour.setYaw(-3.141);
|
||||||
|
pose2dsNight.add(poseOne);
|
||||||
|
pose2dsNight.add(poseTwo);
|
||||||
|
pose2dsNight.add(poseThree);
|
||||||
|
pose2dsNight.add(poseFour);*/
|
||||||
|
taskNigth.setPose2ds(pose2dsNight);
|
||||||
|
|
||||||
|
//10
|
||||||
|
RobotAcceptTaskData taskTen = new RobotAcceptTaskData();
|
||||||
|
taskTen.setSerial("9");
|
||||||
|
taskTen.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskTen.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
|
taskTen.setTarget_height(moveHeight);
|
||||||
|
|
||||||
|
//11
|
||||||
|
RobotAcceptTaskData taskEleven = new RobotAcceptTaskData();
|
||||||
|
taskEleven.setSerial("10");
|
||||||
|
taskEleven.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskEleven.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
|
|
||||||
|
double toLocationTotalHeight = toLocation.getLocationTotalHeight().doubleValue();
|
||||||
|
BigDecimal b3 = new BigDecimal(Double.toString(toLocationTotalHeight));
|
||||||
|
BigDecimal b4 = new BigDecimal(Double.toString(liftHeight));
|
||||||
|
taskEleven.setTarget_height(b3.add(b4).doubleValue());
|
||||||
|
|
||||||
|
//12
|
||||||
|
RobotAcceptTaskData taskTwelve = new RobotAcceptTaskData();
|
||||||
|
taskTwelve.setSerial("11");
|
||||||
|
taskTwelve.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskTwelve.setCommand_type(CommandTypeEnum.MOVE_POSE.getType());
|
||||||
|
Pose2ds poseEnd = positionMapItemMapper.selectByLocationId(taskDetailDO.getToLocationId());
|
||||||
|
taskTwelve.setPose2d(poseEnd);
|
||||||
|
|
||||||
|
//13
|
||||||
|
RobotAcceptTaskData taskThirteen = new RobotAcceptTaskData();
|
||||||
|
taskThirteen.setSerial("12");
|
||||||
|
taskThirteen.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskThirteen.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
|
taskThirteen.setTarget_height(toLocationTotalHeight);
|
||||||
|
|
||||||
|
//14
|
||||||
|
RobotAcceptTaskData taskFourteen = new RobotAcceptTaskData();
|
||||||
|
taskFourteen.setSerial("13");
|
||||||
|
taskFourteen.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskFourteen.setCommand_type(CommandTypeEnum.MOVE_POSE.getType());
|
||||||
|
Pose2ds poseWait = positionMapItemMapper.selectByLocationId(99l);
|
||||||
|
taskFourteen.setPose2d(poseWait);
|
||||||
|
/*
|
||||||
|
Pose2ds poseWait = new Pose2ds();
|
||||||
|
poseWait.setX(3.046);
|
||||||
|
poseWait.setY(3.219);
|
||||||
|
poseWait.setYaw(-3.141);
|
||||||
|
taskFourteen.setPose2d(poseWait);*/
|
||||||
|
|
||||||
|
//15
|
||||||
|
RobotAcceptTaskData taskFifteen = new RobotAcceptTaskData();
|
||||||
|
taskFifteen.setSerial("14");
|
||||||
|
taskFifteen.setCommand_id(taskDetailDO.getId().toString());
|
||||||
|
taskFifteen.setCommand_type(CommandTypeEnum.FORK.getType());
|
||||||
|
taskFifteen.setTarget_height(initHeight);
|
||||||
|
|
||||||
List<RobotAcceptTaskData> data = new ArrayList<>();
|
List<RobotAcceptTaskData> data = new ArrayList<>();
|
||||||
data.add(taskOne);
|
data.add(taskOne);
|
||||||
@ -415,7 +539,17 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
data.add(taskFive);
|
data.add(taskFive);
|
||||||
data.add(taskSix);
|
data.add(taskSix);
|
||||||
data.add(taskSeven);
|
data.add(taskSeven);
|
||||||
data.add(taskEight);
|
data.add(taskEigth);
|
||||||
|
data.add(taskEigth2);
|
||||||
|
data.add(taskNigth);
|
||||||
|
data.add(taskTen);
|
||||||
|
data.add(taskEleven);
|
||||||
|
data.add(taskTwelve);
|
||||||
|
data.add(taskThirteen);
|
||||||
|
data.add(taskFourteen);
|
||||||
|
data.add(taskFifteen);
|
||||||
|
|
||||||
|
|
||||||
robotTaskDO.setData(data);
|
robotTaskDO.setData(data);
|
||||||
|
|
||||||
robotTaskDOS.add(robotTaskDO);
|
robotTaskDOS.add(robotTaskDO);
|
||||||
@ -426,6 +560,29 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
updateTaskStatus(robotNo,taskDetailDO);
|
updateTaskStatus(robotNo,taskDetailDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Pair<String, String> getMadAddressRobotNo(RobotTaskDetailDO taskDetailDO, List<RobotInformationDO> robots,
|
||||||
|
WareHouseLocationDO fromLocation, WareHouseLocationDO toLocation) {
|
||||||
|
String macAddress = "";
|
||||||
|
String robotNo = taskDetailDO.getRobotNo();
|
||||||
|
if (ObjectUtil.isNotEmpty(robotNo)) {
|
||||||
|
macAddress = robots.stream()
|
||||||
|
.filter(v -> v.getRobotNo().equals(taskDetailDO.getRobotNo()))
|
||||||
|
.map(RobotInformationDO::getMacAddress)
|
||||||
|
.findFirst()
|
||||||
|
.orElse("");
|
||||||
|
} else {
|
||||||
|
RobotInformationDO robotInformationDO = robots.stream()
|
||||||
|
.filter(v -> v.getFloorAreaJson().contains(fromLocation.getAreaId())
|
||||||
|
&& v.getFloorAreaJson().contains(toLocation.getAreaId()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(new RobotInformationDO());
|
||||||
|
macAddress = robotInformationDO.getMacAddress();
|
||||||
|
robotNo = robotInformationDO.getRobotNo();
|
||||||
|
}
|
||||||
|
Pair<String,String> pair = new ImmutablePair<>(macAddress,robotNo);
|
||||||
|
return pair;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateTaskStatus(String robotNo, RobotTaskDetailDO taskDetailDO) {
|
public void updateTaskStatus(String robotNo, RobotTaskDetailDO taskDetailDO) {
|
||||||
robotInformationMapper.updateRobotStatus(robotNo, RobotStatusEnum.DOING.getType());
|
robotInformationMapper.updateRobotStatus(robotNo, RobotStatusEnum.DOING.getType());
|
||||||
|
@ -182,3 +182,12 @@ justauth:
|
|||||||
type: REDIS
|
type: REDIS
|
||||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||||
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
||||||
|
|
||||||
|
zn:
|
||||||
|
task-no: ZN #任务号开头
|
||||||
|
do_cycle: true #是否开启循环
|
||||||
|
init_height: 0.0 #初始化高度
|
||||||
|
scan_height: 0.4 #扫描高度
|
||||||
|
parm: 5000 #等待时间
|
||||||
|
lift_height: 0.1 #抬高托盘高度
|
||||||
|
move_height: 0.1 #行走高度
|
@ -223,3 +223,12 @@ justauth:
|
|||||||
map:
|
map:
|
||||||
file:
|
file:
|
||||||
upload-path: /Users/aikai/Documents/map/ # 地图文件上传路径
|
upload-path: /Users/aikai/Documents/map/ # 地图文件上传路径
|
||||||
|
|
||||||
|
zn:
|
||||||
|
task-no: ZN #任务号开头
|
||||||
|
do_cycle: true #是否开启循环
|
||||||
|
init_height: 0.0 #初始化高度
|
||||||
|
scan_height: 0.4 #扫描高度
|
||||||
|
parm: 5000 #等待时间
|
||||||
|
lift_height: 0.1 #抬高托盘高度
|
||||||
|
move_height: 0.1 #行走高度
|
@ -207,6 +207,3 @@ yudao:
|
|||||||
|
|
||||||
debug: false
|
debug: false
|
||||||
|
|
||||||
zn:
|
|
||||||
task-no: ZN #任务号开头
|
|
||||||
do_cycle: true #是否开启循环
|
|
@ -30,6 +30,8 @@
|
|||||||
<result property="locationStorey" column="location_storey" jdbcType="INTEGER"/>
|
<result property="locationStorey" column="location_storey" jdbcType="INTEGER"/>
|
||||||
<result property="locationType" column="location_type" jdbcType="INTEGER"/>
|
<result property="locationType" column="location_type" jdbcType="INTEGER"/>
|
||||||
<result property="locationNumber" column="location_number" jdbcType="INTEGER"/>
|
<result property="locationNumber" column="location_number" jdbcType="INTEGER"/>
|
||||||
|
<result property="mapId" column="map_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="mapItemId" column="map_item_id" jdbcType="INTEGER"/>
|
||||||
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
||||||
@ -67,6 +69,8 @@
|
|||||||
location_storey,
|
location_storey,
|
||||||
location_type,
|
location_type,
|
||||||
location_number,
|
location_number,
|
||||||
|
map_id,
|
||||||
|
map_item_id,
|
||||||
creator,
|
creator,
|
||||||
create_time,
|
create_time,
|
||||||
updater,
|
updater,
|
||||||
@ -652,6 +656,7 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by id asc
|
||||||
</select>
|
</select>
|
||||||
<select id="getLocationByName" resultType="cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO">
|
<select id="getLocationByName" resultType="cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO">
|
||||||
<choose>
|
<choose>
|
||||||
|
@ -8,5 +8,258 @@
|
|||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO">
|
||||||
|
<!--@Table ware_position_map_item-->
|
||||||
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
|
<result property="positionMapId" column="position_map_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="areaId" column="area_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="laneId" column="lane_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="locationX" column="location_x" jdbcType="VARCHAR"/>
|
||||||
|
<result property="locationY" column="location_y" jdbcType="VARCHAR"/>
|
||||||
|
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||||
|
<result property="dataJson" column="data_json" jdbcType="VARCHAR"/>
|
||||||
|
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
||||||
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<sql id="base_sql" >
|
||||||
|
id,
|
||||||
|
position_map_id,
|
||||||
|
area_id,
|
||||||
|
lane_id,
|
||||||
|
location_x,
|
||||||
|
location_y,
|
||||||
|
type,
|
||||||
|
data_json,
|
||||||
|
creator,
|
||||||
|
create_time,
|
||||||
|
updater,
|
||||||
|
update_time,
|
||||||
|
deleted,
|
||||||
|
tenant_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAllByLimit" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
id, position_map_id, area_id, lane_id, location_x, location_y, type, data_json, creator, create_time, updater,
|
||||||
|
update_time, deleted, tenant_id
|
||||||
|
from ware_position_map_item
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="positionMapId != null">
|
||||||
|
and position_map_id = #{positionMapId}
|
||||||
|
</if>
|
||||||
|
<if test="areaId != null">
|
||||||
|
and area_id = #{areaId}
|
||||||
|
</if>
|
||||||
|
<if test="laneId != null">
|
||||||
|
and lane_id = #{laneId}
|
||||||
|
</if>
|
||||||
|
<if test="locationX != null and locationX != ''">
|
||||||
|
and location_x = #{locationX}
|
||||||
|
</if>
|
||||||
|
<if test="locationY != null and locationY != ''">
|
||||||
|
and location_y = #{locationY}
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="dataJson != null and dataJson != ''">
|
||||||
|
and data_json = #{dataJson}
|
||||||
|
</if>
|
||||||
|
<if test="creator != null and creator != ''">
|
||||||
|
and creator = #{creator}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and create_time = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updater != null and updater != ''">
|
||||||
|
and updater = #{updater}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and update_time = #{updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
and deleted = #{deleted}
|
||||||
|
</if>
|
||||||
|
<if test="tenantId != null">
|
||||||
|
and tenant_id = #{tenantId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
limit #{pageable.offset}, #{pageable.pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--通过实体作为筛选条件查询-->
|
||||||
|
<select id="queryAll" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
id, position_map_id, area_id, lane_id, location_x, location_y, type, data_json, creator, create_time, updater,
|
||||||
|
update_time, deleted, tenant_id
|
||||||
|
from zn_wcs.ware_position_map_item
|
||||||
|
</select>
|
||||||
|
<!--统计总行数-->
|
||||||
|
<select id="count" resultType="java.lang.Long">
|
||||||
|
select count(1)
|
||||||
|
from ware_position_map_item
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="positionMapId != null">
|
||||||
|
and position_map_id = #{positionMapId}
|
||||||
|
</if>
|
||||||
|
<if test="areaId != null">
|
||||||
|
and area_id = #{areaId}
|
||||||
|
</if>
|
||||||
|
<if test="laneId != null">
|
||||||
|
and lane_id = #{laneId}
|
||||||
|
</if>
|
||||||
|
<if test="locationX != null and locationX != ''">
|
||||||
|
and location_x = #{locationX}
|
||||||
|
</if>
|
||||||
|
<if test="locationY != null and locationY != ''">
|
||||||
|
and location_y = #{locationY}
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="dataJson != null and dataJson != ''">
|
||||||
|
and data_json = #{dataJson}
|
||||||
|
</if>
|
||||||
|
<if test="creator != null and creator != ''">
|
||||||
|
and creator = #{creator}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and create_time = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updater != null and updater != ''">
|
||||||
|
and updater = #{updater}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and update_time = #{updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
and deleted = #{deleted}
|
||||||
|
</if>
|
||||||
|
<if test="tenantId != null">
|
||||||
|
and tenant_id = #{tenantId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectByLocationId" resultType="cn.iocoder.yudao.module.mqtt.api.task.dto.Pose2ds">
|
||||||
|
select
|
||||||
|
t1.location_x as x,
|
||||||
|
t1.location_y as y,
|
||||||
|
t2.location_yaw as yaw
|
||||||
|
from
|
||||||
|
ware_position_map_item t1 ,ware_house_location t2
|
||||||
|
where t1.id = t2.map_item_id
|
||||||
|
and t2.id = #{locationId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insertEntity" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into ware_position_map_item(position_map_id, area_id, lane_id, location_x, location_y, type, data_json,
|
||||||
|
creator, create_time, updater, update_time, deleted, tenant_id)
|
||||||
|
values (#{positionMapId}, #{areaId}, #{laneId}, #{locationX}, #{locationY}, #{type}, #{dataJson}, #{creator},
|
||||||
|
#{createTime}, #{updater}, #{updateTime}, #{deleted}, #{tenantId})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into ware_position_map_item(position_map_id, area_id, lane_id, location_x, location_y, type, data_json,
|
||||||
|
creator, create_time, updater, update_time, deleted, tenant_id)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.positionMapId}, #{entity.areaId}, #{entity.laneId}, #{entity.locationX}, #{entity.locationY},
|
||||||
|
#{entity.type}, #{entity.dataJson}, #{entity.creator}, #{entity.createTime}, #{entity.updater},
|
||||||
|
#{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into ware_position_map_item(position_map_id, area_id, lane_id, location_x, location_y, type, data_json,
|
||||||
|
creator, create_time, updater, update_time, deleted, tenant_id)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.positionMapId}, #{entity.areaId}, #{entity.laneId}, #{entity.locationX}, #{entity.locationY},
|
||||||
|
#{entity.type}, #{entity.dataJson}, #{entity.creator}, #{entity.createTime}, #{entity.updater},
|
||||||
|
#{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
|
||||||
|
</foreach>
|
||||||
|
on duplicate key update
|
||||||
|
position_map_id = values(position_map_id),
|
||||||
|
area_id = values(area_id),
|
||||||
|
lane_id = values(lane_id),
|
||||||
|
location_x = values(location_x),
|
||||||
|
location_y = values(location_y),
|
||||||
|
type = values(type),
|
||||||
|
data_json = values(data_json),
|
||||||
|
creator = values(creator),
|
||||||
|
create_time = values(create_time),
|
||||||
|
updater = values(updater),
|
||||||
|
update_time = values(update_time),
|
||||||
|
deleted = values(deleted),
|
||||||
|
tenant_id = values(tenant_id)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update ware_position_map_item
|
||||||
|
<set>
|
||||||
|
<if test="positionMapId != null">
|
||||||
|
position_map_id = #{positionMapId},
|
||||||
|
</if>
|
||||||
|
<if test="areaId != null">
|
||||||
|
area_id = #{areaId},
|
||||||
|
</if>
|
||||||
|
<if test="laneId != null">
|
||||||
|
lane_id = #{laneId},
|
||||||
|
</if>
|
||||||
|
<if test="locationX != null and locationX != ''">
|
||||||
|
location_x = #{locationX},
|
||||||
|
</if>
|
||||||
|
<if test="locationY != null and locationY != ''">
|
||||||
|
location_y = #{locationY},
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
type = #{type},
|
||||||
|
</if>
|
||||||
|
<if test="dataJson != null and dataJson != ''">
|
||||||
|
data_json = #{dataJson},
|
||||||
|
</if>
|
||||||
|
<if test="creator != null and creator != ''">
|
||||||
|
creator = #{creator},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updater != null and updater != ''">
|
||||||
|
updater = #{updater},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
deleted = #{deleted},
|
||||||
|
</if>
|
||||||
|
<if test="tenantId != null">
|
||||||
|
tenant_id = #{tenantId},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from ware_position_map_item
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -148,7 +148,7 @@
|
|||||||
id, robot_task_id, task_type, release_type, take_type, release_id, take_id, from_location_no, from_location_id,
|
id, robot_task_id, task_type, release_type, take_type, release_id, take_id, from_location_no, from_location_id,
|
||||||
to_location_no, to_location_id, robot_no, robot_action, task_status, task_stage, start_time, end_time, creator,
|
to_location_no, to_location_id, robot_no, robot_action, task_status, task_stage, start_time, end_time, creator,
|
||||||
create_time, updater, update_time, deleted, tenant_id
|
create_time, updater, update_time, deleted, tenant_id
|
||||||
from zn_wcs.robot_task_detail
|
from robot_task_detail
|
||||||
</select>
|
</select>
|
||||||
<!--统计总行数-->
|
<!--统计总行数-->
|
||||||
<select id="count" resultType="java.lang.Long">
|
<select id="count" resultType="java.lang.Long">
|
||||||
@ -333,6 +333,17 @@
|
|||||||
order by priority desc, create_time asc ,robot_no desc
|
order by priority desc, create_time asc ,robot_no desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDoingTaskIds" resultType="java.lang.Long">
|
||||||
|
select
|
||||||
|
distinct
|
||||||
|
robot_task_id
|
||||||
|
from
|
||||||
|
robot_task_detail
|
||||||
|
where
|
||||||
|
task_status = '1'
|
||||||
|
and deleted = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--新增所有列-->
|
<!--新增所有列-->
|
||||||
<insert id="insertSelect" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insertSelect" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
|
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
|
||||||
|
@ -236,6 +236,55 @@
|
|||||||
deleted = '0'
|
deleted = '0'
|
||||||
and montage_task = #{montageTask}
|
and montage_task = #{montageTask}
|
||||||
and task_status in ('0','1')
|
and task_status in ('0','1')
|
||||||
|
<if test= " ids != null and ids.size() > 0">
|
||||||
|
AND id not in
|
||||||
|
<foreach collection="ids" item="id" index="index" open="(" close=")"
|
||||||
|
separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPageList" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
DISTINCT
|
||||||
|
t1.id,
|
||||||
|
t1.montage_task,
|
||||||
|
t1.montage_number,
|
||||||
|
t1.sku_info,
|
||||||
|
t1.sku_batch,
|
||||||
|
t1.sku_number,
|
||||||
|
t1.priority,
|
||||||
|
t1.other_msg,
|
||||||
|
t1.do_cycle,
|
||||||
|
t1.do_move_all,
|
||||||
|
t1.cycle_number,
|
||||||
|
t1.remaining_cycle_number,
|
||||||
|
t1.task_no,
|
||||||
|
t1.task_status,
|
||||||
|
t1.task_stage,
|
||||||
|
t1.start_time,
|
||||||
|
t1.end_time
|
||||||
|
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'
|
||||||
|
<if test="pageReqVO.taskNo != null and pageReqVO.taskNo != ''">
|
||||||
|
and t1.task_no like concat('%', #{pageReqVO.taskNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="pageReqVO.taskStatus != null">
|
||||||
|
and t1.task_status = #{pageReqVO.taskStatus}
|
||||||
|
</if>
|
||||||
|
<if test="pageReqVO.taskStage != null">
|
||||||
|
and t1.task_stage = #{pageReqVO.taskStage}
|
||||||
|
</if>
|
||||||
|
<if test="pageReqVO.robotNo != null">
|
||||||
|
and t2.robot_no like concat('%', #{pageReqVO.robotNo}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by t1.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user