Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud-wcs into aikai
This commit is contained in:
commit
9b7819387e
@ -29,22 +29,6 @@ public class BannerApplicationRunner implements ApplicationRunner {
|
||||
"https://cloud.iocoder.cn",
|
||||
"https://t.zsxq.com/02Yf6M7Qn");
|
||||
|
||||
// 数据报表
|
||||
System.out.println("[报表模块 yudao-module-report 教程][参考 https://cloud.iocoder.cn/report/ 开启]");
|
||||
// 工作流
|
||||
System.out.println("[工作流模块 yudao-module-bpm 教程][参考 https://cloud.iocoder.cn/bpm/ 开启]");
|
||||
// 商城系统
|
||||
System.out.println("[商城系统 yudao-module-mall 教程][参考 https://cloud.iocoder.cn/mall/build/ 开启]");
|
||||
// ERP 系统
|
||||
System.out.println("[ERP 系统 yudao-module-erp - 教程][参考 https://cloud.iocoder.cn/erp/build/ 开启]");
|
||||
// CRM 系统
|
||||
System.out.println("[CRM 系统 yudao-module-crm - 教程][参考 https://cloud.iocoder.cn/crm/build/ 开启]");
|
||||
// 微信公众号
|
||||
System.out.println("[微信公众号 yudao-module-mp 教程][参考 https://cloud.iocoder.cn/mp/build/ 开启]");
|
||||
// 支付平台
|
||||
System.out.println("[支付系统 yudao-module-pay - 教程][参考 https://cloud.iocoder.cn/pay/build/ 开启]");
|
||||
// AI 大模型
|
||||
System.out.println("[AI 大模型 yudao-module-ai - 教程][参考 https://cloud.iocoder.cn/ai/build/ 开启]");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RobotSimulationPoseDTO {
|
||||
private String commandType;
|
||||
private RobotSimulationPoseDataDTO pose2d;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RobotSimulationPoseDataDTO {
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double yaw;
|
||||
}
|
@ -43,7 +43,7 @@ public class MqttCallBack implements MqttCallback {
|
||||
mqttService.analysisMessage(msg);
|
||||
} catch (Exception e) {
|
||||
log.info("消费失败的消息主题 :{},消息内容 :{}", topic, msg);
|
||||
log.info("消费消息异常 :{}", e.getMessage());
|
||||
log.info("消费消息异常 :{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,8 @@ mqtt:
|
||||
password: adminuser
|
||||
qos: 0
|
||||
clientId: mqttx_b82345a52
|
||||
maxInflight: 10
|
||||
# 表示允许同时在传输中的最大消息数量
|
||||
maxInflight: 1000
|
||||
timeout: 10
|
||||
keepalive: 20
|
||||
|
||||
|
@ -37,7 +37,8 @@ mqtt:
|
||||
password: adminuser
|
||||
qos: 2
|
||||
clientId: mqttx_b82345a52
|
||||
maxInflight: 10
|
||||
# 表示允许同时在传输中的最大消息数量
|
||||
maxInflight: 1000
|
||||
timeout: 10
|
||||
keepalive: 20
|
||||
|
||||
|
@ -37,7 +37,8 @@ mqtt:
|
||||
password: adminuser
|
||||
qos: 0
|
||||
clientId: mqttx_b82345a52
|
||||
maxInflight: 10
|
||||
# 表示允许同时在传输中的最大消息数量
|
||||
maxInflight: 1000
|
||||
timeout: 10
|
||||
keepalive: 20
|
||||
|
||||
|
@ -83,6 +83,7 @@ public class PathApiImpl implements PathApi {
|
||||
public void ppDistributionTaskFail(String message) {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
warnMsgService.addWarnMsg(message);
|
||||
warnMsgService.sendWarnMsgToWebsocket(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -269,8 +269,8 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void closeTask(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
||||
/*PPCloseOrder(robotCompleteTaskDTO);
|
||||
taskService.closeTaskDetail(robotCompleteTaskDTO.getOrderId().toString(),robotCompleteTaskDTO.getMac());*/
|
||||
PPCloseOrder(robotCompleteTaskDTO);
|
||||
// taskService.closeTaskDetail(robotCompleteTaskDTO.getOrderId().toString(),robotCompleteTaskDTO.getMac());
|
||||
String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac());
|
||||
|
||||
//先不释放库位状态
|
||||
@ -302,12 +302,19 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
DeviceUseStatusEnum.IDLE.getType(), ZeroOneEnum.ZERO.getType());
|
||||
}*/
|
||||
|
||||
String solve = "";
|
||||
if (!PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
&& !PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()) ) {
|
||||
String taskNo= taskDetailService.getTaskNoByDetailId(robotCompleteTaskDTO.getOrderId());
|
||||
solve = " 并且到任务列表关闭任务 " + taskNo;
|
||||
}
|
||||
|
||||
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(4)
|
||||
.warnCode(robotCompleteTaskDTO.getStatusCode())
|
||||
.robotNo(robotNo)
|
||||
.warnType(RobotWarnType.ROBOT_WARN.getType())
|
||||
.warnMsg(robotNo + "_" + robotCompleteTaskDTO.getMessage())
|
||||
.warnSolve(robotCompleteTaskDTO.getSolution())
|
||||
.warnSolve(robotCompleteTaskDTO.getSolution() + solve)
|
||||
.build();
|
||||
warnMsgMapper.insert(warnMsg);
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.config;
|
||||
|
||||
import cn.iocoder.yudao.module.system.service.tool.ToolsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SystemApplicationRunner implements ApplicationRunner {
|
||||
|
||||
@Resource
|
||||
private ToolsService toolsService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
toolsService.simulationPose();
|
||||
}
|
||||
}
|
@ -24,4 +24,9 @@ public class RobotTopicConstant {
|
||||
* 让机器人同步告警码值映射的topic (拼接mac地址)
|
||||
*/
|
||||
public static String WARN_WAIT_TIME_TOPIC = "WARN_WAIT_TIME";
|
||||
|
||||
/**
|
||||
* 仿真初始化点位信息
|
||||
*/
|
||||
public static String ROBOT_COMMAND_TOPIC = "ROBOT_COMMAND_";
|
||||
}
|
||||
|
@ -47,4 +47,12 @@ public class ToolsController {
|
||||
public CommonResult<String> updateWarnCode() {
|
||||
return success(toolsService.updateWarnCode());
|
||||
}
|
||||
|
||||
@PostMapping("/robot/simulationPose")
|
||||
@Operation(summary = "机器人---仿真环境--初始化点位")
|
||||
@PermitAll
|
||||
public CommonResult<String> simulationPose() {
|
||||
toolsService.simulationPose();
|
||||
return success("同步完成");
|
||||
}
|
||||
}
|
||||
|
@ -142,4 +142,22 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
||||
* @param areaId
|
||||
*/
|
||||
void updateLocationAreaNameEmptyByAreaId(@Param("areaId") Long areaId);
|
||||
|
||||
/**
|
||||
* 查询此库位的上层, 是否有货
|
||||
* @param mapItemId
|
||||
* @param locationStorey
|
||||
* @return
|
||||
*/
|
||||
List<WareHouseLocationDO> queryUpperLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
|
||||
@Param("locationStorey") Integer locationStorey);
|
||||
|
||||
/**
|
||||
* 查询此库位的下层,是否没货
|
||||
* @param mapItemId
|
||||
* @param locationStorey
|
||||
* @return
|
||||
*/
|
||||
List<WareHouseLocationDO> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
|
||||
@Param("locationStorey") Integer locationStorey);
|
||||
}
|
||||
|
@ -122,4 +122,11 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
|
||||
* @return
|
||||
*/
|
||||
List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询任务明细对应的任务编号
|
||||
* @param taskDetailId
|
||||
* @return
|
||||
*/
|
||||
String getTaskNoByDetailId(@Param("taskDetailId") Long taskDetailId);
|
||||
}
|
@ -9,7 +9,8 @@ public enum RobotCommandTypeEnum {
|
||||
MOVE_POSES("MOVE_POSES","移动"),
|
||||
WORK_START_CHARGE("WORK_START_CHARGE","充电"),
|
||||
WORD_PICK_UP_GOODS("WORD_PICK_UP_GOODS","取货"),
|
||||
WORD_DROP_OFF_GOODS("WORD_DROP_OFF_GOODS","放货");
|
||||
WORD_DROP_OFF_GOODS("WORD_DROP_OFF_GOODS","放货"),
|
||||
MOVE_POSE("MOVE_POSE","仿真移动点位");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
|
@ -37,6 +37,7 @@ import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import com.serotonin.modbus4j.ModbusMaster;
|
||||
import com.serotonin.modbus4j.exception.ModbusInitException;
|
||||
import com.serotonin.modbus4j.exception.ModbusTransportException;
|
||||
@ -143,11 +144,19 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
if (ObjectUtil.isNotEmpty(updateObj.getPositionMapItemId())) {
|
||||
PositionMapItemDO positionMapItem = positionMapItemService.getPositionMapItem(updateObj.getPositionMapItemId());
|
||||
String dataJson = positionMapItem.getDataJson();
|
||||
DeviceInformationDataJsonDTO data = JSON.parseObject(dataJson, DeviceInformationDataJsonDTO.class);
|
||||
/*DeviceInformationDataJsonDTO data = JSON.parseObject(dataJson, DeviceInformationDataJsonDTO.class);
|
||||
data.setDeviceType(updateObj.getDeviceType());
|
||||
data.setDeviceNo(updateObj.getDeviceNo());
|
||||
data.setMapImageUrl(updateObj.getMapImageUrl());
|
||||
positionMapItem.setDataJson(JSON.toJSONString(data));
|
||||
data.setMapImageUrl(updateObj.getMapImageUrl());*/
|
||||
|
||||
Gson gson = new Gson();
|
||||
Map<Object,Object> map = new HashMap();
|
||||
map = gson.fromJson(dataJson, map.getClass());
|
||||
map.put("deviceType",updateObj.getDeviceType());
|
||||
map.put("deviceNo",updateObj.getDeviceNo());
|
||||
map.put("mapImageUrl",updateObj.getMapImageUrl());
|
||||
|
||||
positionMapItem.setDataJson(JSON.toJSONString(map));
|
||||
positionMapItemService.updateById(positionMapItem);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,11 @@ public interface RobotTaskDetailService {
|
||||
* @return
|
||||
*/
|
||||
List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取任务编号
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
String getTaskNoByDetailId(Long orderId);
|
||||
}
|
@ -168,4 +168,9 @@ public class RobotTaskDetailServiceImpl implements RobotTaskDetailService {
|
||||
public List<RobotTaskDetailDO> getDoingTaskDetailByLocationIds(List<Long> ids) {
|
||||
return taskDetailMapper.getDoingTaskDetailByLocationIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTaskNoByDetailId(Long taskDetailId) {
|
||||
return taskDetailMapper.getTaskNoByDetailId(taskDetailId);
|
||||
}
|
||||
}
|
@ -91,8 +91,6 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
@Validated
|
||||
public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTaskDO> implements RobotTaskService {
|
||||
|
||||
private final String RESULT = "SUCCESS";
|
||||
|
||||
@Resource
|
||||
private RobotTaskMapper taskMapper;
|
||||
|
||||
@ -179,10 +177,9 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
//获取库位id
|
||||
RLock lock = redissonUtils.getLock(RobotCacheLockEnum.ROBOT_TASK_ADD_LOCK.getKey());
|
||||
|
||||
String addResult = "";
|
||||
if (lock.tryLock(60l, TimeUnit.MINUTES)) {
|
||||
try {
|
||||
addResult = addTask(createReqVO);
|
||||
addTask(createReqVO);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@ -190,10 +187,6 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
throw exception(REDISSON_NOT_OBTAIN_LOCK);
|
||||
}
|
||||
|
||||
if (!RESULT.equals(addResult)) {
|
||||
throw exception0(TASK_CHECK_EXCEPTION.getCode(), addResult);
|
||||
}
|
||||
|
||||
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder().operateAction("创建任务 " + createReqVO.getTaskNo())
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
@ -257,7 +250,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
* @param createReqVO
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String addTask(RobotTaskSaveReqVO createReqVO) {
|
||||
public void addTask(RobotTaskSaveReqVO createReqVO) {
|
||||
RobotTaskDO task = BeanUtils.toBean(createReqVO, RobotTaskDO.class);
|
||||
taskMapper.insert(task);
|
||||
|
||||
@ -300,8 +293,6 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
&& ZeroOneEnum.ONE.getType().equals(createReqVO.getDoCycle().intValue())) {
|
||||
addCycle(task.getId(), createReqVO.getTaskDetailList());
|
||||
}
|
||||
|
||||
return RESULT;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -1026,6 +1017,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
log.error("此点位存在取货任务 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此库位存在取货任务 " + locationDO.getLocationNo());
|
||||
}
|
||||
checkToLocationNoneTask(locationDO);
|
||||
releaseMapItemIds.add(locationDO.getMapItemId());
|
||||
} else {
|
||||
if (ReleaseTakeEnum.TO_LANE.getType().equals(robotTaskVo.getReleaseType()) && ObjectUtil.isEmpty(laneIds)
|
||||
@ -1055,6 +1047,18 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验放货库位的下一层是否没任务
|
||||
* @param locationDO
|
||||
*/
|
||||
private void checkToLocationNoneTask(WareHouseLocationDO locationDO) {
|
||||
List<WareHouseLocationDO> locations = locationMapper.queryLowerLevelsByMapItemId(locationDO.getMapItemId(),locationDO.getLocationStorey());
|
||||
if (ObjectUtil.isNotEmpty(locations)) {
|
||||
log.error("此放货库位的下层库位无货,请先放下层库位 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此放货库位的下层库位无货,请先放下层库位 " + locationDO.getLocationNo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置取货库位
|
||||
*
|
||||
@ -1086,6 +1090,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
log.error("此取货库位没库存 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此取货库位没库存 " + locationDO.getLocationNo());
|
||||
}
|
||||
checkFromLocationNoneTask(locationDO);
|
||||
takeMapItemIds.add(locationDO.getMapItemId());
|
||||
} else {
|
||||
WareHouseLocationDO wareHouseLocationDO =
|
||||
@ -1105,6 +1110,19 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验取货库位的上层是否存在未取的箱子
|
||||
* @param locationDO
|
||||
*/
|
||||
private void checkFromLocationNoneTask(WareHouseLocationDO locationDO) {
|
||||
|
||||
List<WareHouseLocationDO> locations = locationMapper.queryUpperLevelsByMapItemId(locationDO.getMapItemId(),locationDO.getLocationStorey());
|
||||
if (ObjectUtil.isNotEmpty(locations)) {
|
||||
log.error("此取货库位的上层库位有货,请先取上层库位的货物 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此取货库位的上层库位有货,请先取上层库位的货物 " + locationDO.getLocationNo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取放
|
||||
*
|
||||
|
@ -115,6 +115,9 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
|
||||
|
||||
@Override
|
||||
public void addWarnMsg(String message) {
|
||||
if (message.length() > 200 ) {
|
||||
message = message.substring(0,200);
|
||||
}
|
||||
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(4)
|
||||
.warnCode("PP")
|
||||
.robotNo("")
|
||||
|
@ -12,4 +12,6 @@ public interface ToolsService {
|
||||
String closeTaskDetail(String taskDetailId);
|
||||
|
||||
String updateWarnCode();
|
||||
|
||||
void simulationPose();
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package cn.iocoder.yudao.module.system.service.tool;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDataDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.enums.task.ExecutionTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
||||
@ -12,21 +15,30 @@ import cn.iocoder.yudao.module.system.controller.admin.config.dto.TaskOrderConfi
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tool.dto.CleanAgvDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnMsgDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnMsgMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.config.CommandConfigTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.RobotWarnType;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotCommandTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.config.CommonConfigService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -53,6 +65,18 @@ public class ToolsServiceImpl implements ToolsService {
|
||||
@Autowired
|
||||
private RobotInformationService robotInformationService;
|
||||
|
||||
@Resource
|
||||
private PositionMapItemService positionMapItemService;
|
||||
|
||||
/*@Resource
|
||||
private CommonConfigService configService;*/
|
||||
|
||||
@Resource
|
||||
private PositionMapService positionMapService;
|
||||
|
||||
@Value("${zn.is_simulation:false}")
|
||||
private Boolean isSimulation;
|
||||
|
||||
/**
|
||||
* 发送时间、优先级、距离的权重给PP
|
||||
*
|
||||
@ -156,6 +180,70 @@ public class ToolsServiceImpl implements ToolsService {
|
||||
return "同步完成";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulationPose() {
|
||||
if (!isSimulation) {
|
||||
log.info("非仿真环境不需要同步默认的节点数据");
|
||||
}
|
||||
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
|
||||
// CommonConfigDO config = configService.getConfig(CommandConfigTypeEnum.SIMULATION_CONFIG.getType().longValue());
|
||||
|
||||
CommonConfigDO config = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.SIMULATION_CONFIG.getType().longValue()));
|
||||
|
||||
PositionMapDO positionMap = null;
|
||||
if (ObjectUtil.isEmpty(config) || ObjectUtil.isEmpty(config.getConfigStr())) {
|
||||
List<PositionMapDO> maps = positionMapService.getAllMap();
|
||||
if (ObjectUtil.isEmpty(maps)) {
|
||||
return;
|
||||
}
|
||||
positionMap = maps.get(0);
|
||||
} else {
|
||||
positionMap = positionMapService.getPositionMap(Long.valueOf(config.getConfigStr()));
|
||||
}
|
||||
if (ObjectUtil.isEmpty(positionMap)) {
|
||||
log.info("仿真环境没有地图信息");
|
||||
return;
|
||||
}
|
||||
|
||||
List<RobotInformationDO> robots = robotInformationService.getAllRobot();
|
||||
|
||||
if (ObjectUtil.isEmpty(robots)) {
|
||||
log.info("仿真环境没有机器人信息");
|
||||
return;
|
||||
}
|
||||
|
||||
List<PositionMapItemDO> itemDOList = new ArrayList<>();
|
||||
List<PositionMapItemDO> items = positionMapItemService.getPositionMapItemByMapAndType(positionMap.getId(), PositionMapItemEnum.WAIT.getType());
|
||||
if (ObjectUtil.isEmpty(items) || items.size() < robots.size()) {
|
||||
List<PositionMapItemDO> itemPoses = positionMapItemService.getPositionMapItemByMapAndType(positionMap.getId(), PositionMapItemEnum.PATH.getType());
|
||||
itemDOList.addAll(itemPoses);
|
||||
} else {
|
||||
itemDOList = items;
|
||||
}
|
||||
|
||||
|
||||
int i = 0;
|
||||
for (RobotInformationDO robot : robots) {
|
||||
RobotSimulationPoseDataDTO poseData = new RobotSimulationPoseDataDTO();
|
||||
RobotSimulationPoseDTO simulationPoseDTO = new RobotSimulationPoseDTO();
|
||||
if (itemDOList.size() <= i) {
|
||||
continue;
|
||||
}
|
||||
|
||||
poseData.setX(Double.valueOf(itemDOList.get(i).getActualLocationX()));
|
||||
poseData.setY(Double.valueOf(itemDOList.get(i).getActualLocationY()));
|
||||
poseData.setYaw(Double.valueOf(itemDOList.get(i).getLocationYaw()));
|
||||
simulationPoseDTO.setPose2d(poseData);
|
||||
simulationPoseDTO.setCommandType(RobotCommandTypeEnum.MOVE_POSE.getType());
|
||||
commonApi.commonMethod(simulationPoseDTO, RobotTopicConstant.ROBOT_COMMAND_TOPIC + robot.getMacAddress());
|
||||
log.info("仿真环境发送机器人默认点位信息");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addWarnMsg() {
|
||||
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(4)
|
||||
|
@ -187,8 +187,24 @@ justauth:
|
||||
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 #行走高度
|
||||
lane_auto_move: true #线库是否自动移库 true:线库执行自动移库 、false:线库关闭执行自动移库
|
||||
robot_position_cache_time: 10 #机器人上报点位存储时间(秒)
|
||||
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
||||
full_electricity: 100 #机器人充满电的电量
|
||||
task_need_single: false #机器人对同一线库/点位是不是只能有一台机器人做任务 (true:一个点位/线库,只有一台机器人)
|
||||
location_number_reduce: 100000000 #库位排序的差值(下发取货任务,将库位排序减去此值,然后取绝对值)
|
||||
robot_doing_action: # 机器人正在做的动作
|
||||
action_entity_cache_time: 172800 #机器人所有动作缓存时间 8小时
|
||||
doing_action_cache_time: 172800 #单个动作缓存时间 8小时
|
||||
robot_chearg: #机器人充电的配置
|
||||
release_location_number_config: 50 #同一组序号,越大越先执行
|
||||
priority_config: 50 #优先级
|
||||
task: #任务相关的配置
|
||||
check_sku_info: true #校验物料信息
|
||||
robot_config: #机器人取放货默认配置
|
||||
offset_height: 0.1 #叉起货需要在原来高度基础上偏移的高度
|
||||
default_tray_height: 1.1 #默认每层高度
|
||||
open_rate_limiter: true #是否开启限流
|
||||
path_planning:
|
||||
task_chche_time: 604800 #任务缓存的时间, 默认一星期
|
||||
is_simulation: true # 是否为仿真环境
|
||||
|
@ -226,7 +226,7 @@ zn:
|
||||
robot_position_cache_time: 10 #机器人上报点位存储时间(秒)
|
||||
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
||||
full_electricity: 100 #机器人充满电的电量
|
||||
task_need_single: true #机器人对同一线库/点位是不是只能有一台机器人做任务 (true:一个点位/线库,只有一台机器人)
|
||||
task_need_single: false #机器人对同一线库/点位是不是只能有一台机器人做任务 (true:一个点位/线库,只有一台机器人)
|
||||
location_number_reduce: 100000000 #库位排序的差值(下发取货任务,将库位排序减去此值,然后取绝对值)
|
||||
robot_doing_action: # 机器人正在做的动作
|
||||
action_entity_cache_time: 172800 #机器人所有动作缓存时间 8小时
|
||||
@ -242,3 +242,8 @@ zn:
|
||||
open_rate_limiter: true #是否开启限流
|
||||
path_planning:
|
||||
task_chche_time: 604800 #任务缓存的时间, 默认一星期
|
||||
is_simulation: true # 是否为仿真环境
|
||||
|
||||
logging:
|
||||
file:
|
||||
name: D:/project/rcs/logs/${spring.application.name}.log
|
@ -217,8 +217,7 @@ zn:
|
||||
robot_position_cache_time: 10 #机器人上报点位存储时间(秒)
|
||||
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
||||
full_electricity: 100 #机器人充满电的电量
|
||||
robot_error_level_time: 30 #机器人异常存储时间(秒)
|
||||
task_need_single: true #机器人对同一线库/点位是不是只能有一台机器人做任务 (true:一个点位/线库,只有一台机器人)
|
||||
task_need_single: false #机器人对同一线库/点位是不是只能有一台机器人做任务 (true:一个点位/线库,只有一台机器人)
|
||||
location_number_reduce: 100000000 #库位排序的差值(下发取货任务,将库位排序减去此值,然后取绝对值)
|
||||
robot_doing_action: # 机器人正在做的动作
|
||||
action_entity_cache_time: 172800 #机器人所有动作缓存时间 8小时
|
||||
@ -231,6 +230,10 @@ zn:
|
||||
robot_config: #机器人取放货默认配置
|
||||
offset_height: 0.1 #叉起货需要在原来高度基础上偏移的高度
|
||||
default_tray_height: 1.1 #默认每层高度
|
||||
open_rate_limiter: true #是否开启限流
|
||||
path_planning:
|
||||
task_chche_time: 604800 #任务缓存的时间, 默认一星期
|
||||
is_simulation: true # 是否为仿真环境
|
||||
|
||||
logging:
|
||||
file:
|
||||
|
@ -542,6 +542,7 @@
|
||||
from
|
||||
ware_house_location t1
|
||||
<where>
|
||||
t1.deleted = '0'
|
||||
<if test= " locationUseStatus != null ">
|
||||
AND t1.location_use_status = #{locationUseStatus}
|
||||
</if>
|
||||
@ -840,6 +841,8 @@
|
||||
</foreach>
|
||||
and t2.location_number < t1.location_number
|
||||
and t2.location_use_status = '1'
|
||||
and t1.deleted = '0'
|
||||
and t2.deleted = '0'
|
||||
and t2.id not in
|
||||
<foreach collection="locationIds" item="id" index="index" open="(" close=")"
|
||||
separator=",">
|
||||
@ -849,4 +852,35 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryUpperLevelsByMapItemId"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO">
|
||||
select
|
||||
<include refid="base_sql"></include>
|
||||
from
|
||||
ware_house_location
|
||||
<where>
|
||||
deleted = '0'
|
||||
and map_item_id = #{mapItemId}
|
||||
and location_storey > #{locationStorey}
|
||||
and location_use_status = '1'
|
||||
and location_lock = '1'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryLowerLevelsByMapItemId"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO">
|
||||
select
|
||||
<include refid="base_sql"></include>
|
||||
from
|
||||
ware_house_location
|
||||
<where>
|
||||
deleted = '0'
|
||||
and map_item_id = #{mapItemId}
|
||||
and location_storey < #{locationStorey}
|
||||
and location_use_status = '0'
|
||||
and location_lock = '1'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -272,6 +272,20 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getTaskNoByDetailId" resultType="java.lang.String">
|
||||
select
|
||||
distinct
|
||||
t1.task_no
|
||||
from
|
||||
robot_task t1 left join robot_task_detail t2
|
||||
on t1.id = t2.robot_task_id
|
||||
where
|
||||
t2.id = #{taskDetailId}
|
||||
and t1.deleted = '0'
|
||||
and t2.deleted = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="updateRobotDetailById">
|
||||
update robot_task_detail
|
||||
|
Loading…
Reference in New Issue
Block a user