任务耗时/货叉检测高度

This commit is contained in:
cbs 2025-07-10 18:28:19 +08:00
parent 0f1f36a5f3
commit 40a805f2f2
16 changed files with 121 additions and 54 deletions

View File

@ -58,6 +58,9 @@ public class TaskToPathPlanningDTO {
@Schema(description = "取货高度")
private Double takeHeight;
@Schema(description = "取货货叉高度")
private Double detectHeight;
@Schema(description = "放货高度")
private Double releaseHeight;

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteControlle
import cn.iocoder.yudao.module.remote.enums.robot.RemoteIpTypeEnum;
import cn.iocoder.yudao.module.remote.util.crc.CRCUtil;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotTransferDTO;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -52,13 +53,15 @@ public class RemoteControllerProcessor {
@Autowired
private IpProperties ipProperties;
public void addCache(RemoteRobotTransferDTO dto,String ip) {
public void addCache(RemoteRobotTransferDTO dto, String ip) {
log.info("网页端IP :{}", ip);
Cockpit cockpit = ipProperties.getCockpitByIp(ip);
log.info("SOCKET服务端信息 :{}", JSON.toJSONString(cockpit));
String cockpitIp = cockpit.getControllerIp();
int cockpitPort = cockpit.getControllerPort();
RemoteControllerSocketDTO remoteControllerSocketDTO = cache.get(cockpitIp);
log.info("是否为空 :{}",ObjectUtil.isEmpty(remoteControllerSocketDTO));
log.info("是否为空 :{}", ObjectUtil.isEmpty(remoteControllerSocketDTO));
if (ObjectUtil.isNotEmpty(remoteControllerSocketDTO)) {
try {
Socket socket = remoteControllerSocketDTO.getSocket();
@ -95,6 +98,7 @@ public class RemoteControllerProcessor {
* @param type
*/
public void setMsg(RemoteControllerSocketDTO remoteControllerSocket, Integer type, RemoteRobotTransferDTO dto) {
log.info("驾舱控制的车辆IP :{}, 端口:{}", dto.getRobotIp(), dto.getRobotPort());
String msg = defaultMsg;
if (RemoteIpTypeEnum.ONE.getType().equals(type)) {
msg = msg + " " + ONE;
@ -105,7 +109,7 @@ public class RemoteControllerProcessor {
String[] split = dto.getRobotIp().split("\\.");
for (String ipItem : split) {
String hex = Integer.toHexString(Integer.valueOf(ipItem)).toUpperCase();
if (hex.length()==1){
if (hex.length() == 1) {
hex = 0 + hex;
}
msg = msg + " " + hex;
@ -143,7 +147,7 @@ public class RemoteControllerProcessor {
remoteControllerSocket.setMsg(msg);
}
public void remoteCache(RemoteRobotTransferDTO dto,String ip) {
public void remoteCache(RemoteRobotTransferDTO dto, String ip) {
Cockpit cockpit = ipProperties.getCockpitByIp(ip);
String cockpitIp = cockpit.getControllerIp();
RemoteControllerSocketDTO remoteControllerSocketDTO = cache.get(cockpitIp);
@ -184,7 +188,7 @@ public class RemoteControllerProcessor {
}
}
remoteCache(dto,ip);
remoteCache(dto, ip);
}

View File

@ -40,7 +40,7 @@ public class TCPServerApplicationRunner implements ApplicationRunner {
InputStream is=socket.getInputStream();
byte[] bytes=new byte[1024];
int len=is.read(bytes);
log.info("服务端收到的数据 :{}",new String(bytes,0,len));
System.out.println(new String(bytes,0,len));
OutputStream os= socket.getOutputStream();
//响应给客户端
os.write("server :".getBytes());

View File

@ -146,7 +146,7 @@ public class PathApiImpl implements PathApi {
@Override
public void graphMatchData(String message) {
TenantContextHolder.setTenantId(1L);
log.info("111111路径规划匹配路网的消息 :{}",message);
// log.info("111111路径规划匹配路网的消息 :{}",message);
pathPlanningService.graphMatchData(message);
}

View File

@ -24,5 +24,6 @@ public class RobotTaskLineTimeConsumingDetailDTO {
* 行走总耗时()
*/
private String timeConsuming;
private String orderId;
}

View File

@ -7,7 +7,9 @@ import lombok.Getter;
@AllArgsConstructor
public enum WorkProgressEnum {
FORK_OFFSET("FORK_OFFSET","取放货");
FORK_OFFSET("FORK_OFFSET","取放货"),
FORK_AND_TILT("FORK_AND_TILT","初始化货叉"),
FORK_AND_TILT_INIT("FORK_AND_TILT_INIT","取完货");
/**
* 类型

View File

@ -12,6 +12,7 @@ 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.enums.robot.CommandTypeEnum;
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskTypeEnum;
import cn.iocoder.yudao.module.system.enums.robot.task.WorkProgressEnum;
import cn.iocoder.yudao.module.system.enums.robot.task.event.RobotTaskEventTypeEnum;
import cn.iocoder.yudao.module.system.mq.message.task.TaskDistributionMessage;
import cn.iocoder.yudao.module.system.service.log.RobotTaskTimeConsumingService;
@ -55,7 +56,7 @@ public class TaskDistributionConsumer {
@EventListener
@Async
public void onMessage(TaskDistributionMessage message) {
log.info("111111, 任务id : {}", JSON.toJSONString(message));
log.info("111111, 任务 : {}", JSON.toJSONString(message));
TenantContextHolder.setTenantId(1L);
if (RobotTaskEventTypeEnum.DISTRIBUTION.getType().equals(message.getEventType())) {
RobotTaskDetailDO taskDetail = robotTaskDetailService.getTaskDetail(Long.valueOf(message.getMessage()));
@ -168,7 +169,7 @@ public class TaskDistributionConsumer {
public Long getSeconds(Object startObj, Object endObj) {
String startObjStr = startObj.toString();
String endObjStr = endObj.toString();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
LocalDateTime startTime = LocalDateTime.parse(startObjStr, formatter);
LocalDateTime endTime = LocalDateTime.parse(endObjStr, formatter);
Duration duration = Duration.between(startTime, endTime);
@ -182,11 +183,13 @@ public class TaskDistributionConsumer {
* @param data
*/
private void addTaskTimeLog(RobotWorkStatusDTO data) {
if (CommandTypeEnum.WORK_PICK_UP_GOODS_MOVE_TO_CHECK.getType().equals(data.getCommandType())
&& RobotExecutionStateConstant.DONE.equals(Integer.valueOf(data.getExecutionState()))) {
startPickUp(data);
} else if (CommandTypeEnum.WORK_DROP_OFF_GOODS_MOVE_TO_CHECK.getType().equals(data.getCommandType())
if (CommandTypeEnum.WORK_PICK_UP_GOODS.getType().equals(data.getCommandType())
&& WorkProgressEnum.FORK_AND_TILT_INIT.getType().equals(data.getWorkProgress())
&& RobotExecutionStateConstant.DOING.equals(Integer.valueOf(data.getExecutionState()))) {
startPickUp(data);
} else if (CommandTypeEnum.WORK_PICK_UP_GOODS.getType().equals(data.getCommandType())
&& WorkProgressEnum.FORK_AND_TILT_INIT.getType().equals(data.getWorkProgress())
&& RobotExecutionStateConstant.DONE.equals(Integer.valueOf(data.getExecutionState()))) {
endPickUp(data);
} else if (CommandTypeEnum.WORK_DROP_OFF_GOODS_MOVE_TO_CHECK.getType().equals(data.getCommandType())
&& RobotExecutionStateConstant.DONE.equals(Integer.valueOf(data.getExecutionState()))) {

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.service.log;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.system.controller.admin.log.dto.RobotTaskLineTimeConsumingDTO;
import cn.iocoder.yudao.module.system.controller.admin.log.dto.RobotTaskLineTimeConsumingDetailDTO;
import cn.iocoder.yudao.module.system.controller.admin.log.dto.RobotWalkingDistanceDTO;
@ -11,6 +12,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
import cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskLineTimeConsumingMapper;
import cn.iocoder.yudao.module.system.service.robot.RobotTaskDetailService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -35,6 +37,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_LINE_
*/
@Service
@Validated
@Slf4j
public class RobotTaskLineTimeConsumingServiceImpl extends ServiceImpl<RobotTaskLineTimeConsumingMapper, RobotTaskLineTimeConsumingDO> implements RobotTaskLineTimeConsumingService {
@Resource
@ -87,11 +90,11 @@ public class RobotTaskLineTimeConsumingServiceImpl extends ServiceImpl<RobotTask
@Override
public void addTaskLineTimeConsuming(String message) {
RobotTaskLineTimeConsumingDTO data = JSON.parseObject(message , RobotTaskLineTimeConsumingDTO.class);
Long orderId = Long.valueOf(data.getOrderId());
log.info("消息 :{}",message);
List<RobotTaskLineTimeConsumingDetailDTO> list = JSONUtil.toList(message, RobotTaskLineTimeConsumingDetailDTO.class);
Long orderId = Long.valueOf(list.get(0).getOrderId());
String taskNo = robotTaskDetailService.getTaskNoByDetailId(orderId);
RobotTaskDetailDO taskDetail = robotTaskDetailService.getTaskDetail(orderId);
List<RobotTaskLineTimeConsumingDetailDTO> list = data.getList();
List<RobotTaskLineTimeConsumingDO> addList = new ArrayList<>();
for (RobotTaskLineTimeConsumingDetailDTO v : list) {
RobotTaskLineTimeConsumingDO line = BeanUtils.toBean(v, RobotTaskLineTimeConsumingDO.class);
@ -99,6 +102,8 @@ public class RobotTaskLineTimeConsumingServiceImpl extends ServiceImpl<RobotTask
line.setTaskDetailId(orderId);
line.setRobotNo(taskDetail.getRobotNo());
line.setTotalTimeConsuming(v.getTimeConsuming());
line.setFromSortNum(getSpit(line.getFromSortNum()));
line.setToSortNum(getSpit(line.getToSortNum()));
if (ObjectUtil.isNotEmpty(v.getTimeConsuming()) && ObjectUtil.isNotEmpty(v.getTotalDistance())) {
BigDecimal distance = new BigDecimal(v.getTotalDistance());
BigDecimal timeConsuming = new BigDecimal(v.getTimeConsuming());
@ -110,6 +115,11 @@ public class RobotTaskLineTimeConsumingServiceImpl extends ServiceImpl<RobotTask
taskLineTimeConsumingMapper.insertBatch(addList);
}
public String getSpit(String str) {
String[] split = str.split("-");
return split[1];
}
@ -132,10 +142,6 @@ public class RobotTaskLineTimeConsumingServiceImpl extends ServiceImpl<RobotTask

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.service.log;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.system.controller.admin.log.dto.RobotWalkingDistanceDTO;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskTimeConsumingPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskTimeConsumingSaveReqVO;

View File

@ -18,7 +18,7 @@ public class PlanningGraphMatchDataServiceImpl implements MqttService{
@Override
public void analysisMessage(String message) {
log.info("匹配路网实时数据 :{}",message);
// log.info("匹配路网实时数据 :{}",message);
pathApi.graphMatchData(message);
}

View File

@ -16,6 +16,7 @@ public class PlanningRobotLineDistanceServiceImpl implements MqttService{
@Override
public void analysisMessage(String message) {
log.info("111111更新路线长度 :{}",message);
taskLineTimeConsumingService.addTaskLineTimeConsuming(message);
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.service.mqtt;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotGenericsDataDTO;
import cn.iocoder.yudao.module.system.controller.admin.log.dto.RobotWalkingDistanceDTO;
import cn.iocoder.yudao.module.system.service.log.RobotTaskTimeConsumingService;
@ -11,14 +12,31 @@ import javax.annotation.Resource;
@Service
@Slf4j
public class PlanningRobotWalkingDistanceServiceImpl implements MqttService{
public class PlanningRobotWalkingDistanceServiceImpl implements MqttService {
@Resource
private RobotTaskTimeConsumingService robotTaskTimeConsumingService;
@Override
public void analysisMessage(String message) {
RobotWalkingDistanceDTO data = JSON.parseObject(message , RobotWalkingDistanceDTO.class);
TenantContextHolder.setTenantId(1L);
log.info("111111更新任务 :{}", message);
RobotWalkingDistanceDTO data = JSON.parseObject(message, RobotWalkingDistanceDTO.class);
data.setCheckDistance(spit(data.getCheckDistance()));
data.setTotalDistance(spit(data.getTotalDistance()));
log.info("更新后的任务 :{}",JSON.toJSONString(data));
robotTaskTimeConsumingService.updateTime(data);
}
public String spit(String str) {
if (!str.contains(".")) {
return str;
}
String[] split = str.split("\\.");
String decimal = split[1];
if (split[1].length() > 2) {
decimal = split[1].substring(0, 2);
}
return split[0] + "." + decimal;
}
}

View File

@ -13,7 +13,6 @@ public class RobotWorkStatusServiceImpl implements MqttService{
@Override
public void analysisMessage(String message) {
log.info("作业实时行为上报 :{}", message);
robotWorkStatusApi.robotWorkStatus(message);
}
}

View File

@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
import cn.iocoder.yudao.module.system.config.mqtt.util.MqttUtils;
import cn.iocoder.yudao.module.system.config.poperties.ZnConfigConstant;
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotStatusCodeConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogSaveReqVO;
@ -478,10 +479,10 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
taskDetailDO.setManualIntervention(RobotTaskManualInterventionEnum.RCS_CLOSE.getType());
taskDetailDO.setManualInterventionTime(LocalDateTime.now());
if (RobotTaskTypeEnum.CHARGE.getType().equals(taskDetailDO.getTaskType())
/*if (RobotTaskTypeEnum.CHARGE.getType().equals(taskDetailDO.getTaskType())
&& RobotTaskTypeEnum.PARK.getType().equals(taskDetailDO.getTaskType())) {
continue;
}
}*/
if (ObjectUtil.isNotEmpty(taskDetailDO.getRobotNo())) {
robotNos.add(taskDetailDO.getRobotNo());
@ -532,12 +533,12 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
}
for (RobotInformationDO robotInformationDO : robotInformationDOS) {
/*String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + robotInformationDO.getMacAddress();
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + robotInformationDO.getMacAddress();
Object cargoDetected = redisUtil.get(cargoDetectedKey);
if (ObjectUtil.isEmpty(cargoDetected) || RobotStatusCodeConstant.CARGO_DETECTED.equals(cargoDetected)) {
if (ObjectUtil.isNotEmpty(cargoDetected) && RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
robotInformationDO.setRobotTaskModel(RobotTaskModelEnum.REJECTION.getType());
}*/
// robotInformationDO.setRobotTaskModel(RobotTaskModelEnum.REJECTION.getType());
}
robotInformationDO.setRobotStatus(RobotStatusEnum.STAND_BY.getType());
}

View File

@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
@ -134,8 +135,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
return;
}
log.info("-------可以分配任务的车辆编号------ ,:{}",JSON.toJSONString(robots.stream().map(RobotInformationDO::getRobotNo).collect(Collectors.toList())));
log.info("-------需要执行的任务id------ ,:{}",JSON.toJSONString(taskDetailDOS.stream().map(RobotTaskDetailDO::getId).collect(Collectors.toList())));
log.info("-------可以分配任务的车辆编号------ ,:{}", JSON.toJSONString(robots.stream().map(RobotInformationDO::getRobotNo).collect(Collectors.toList())));
log.info("-------需要执行的任务id------ ,:{}", JSON.toJSONString(taskDetailDOS.stream().map(RobotTaskDetailDO::getId).collect(Collectors.toList())));
distributeTasksToPP(robots, taskDetailDOS);
}
@ -202,24 +203,24 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
}
List<String> robotNos = new ArrayList<>();
Map<String,Set<Long>> robotFloorAreaJsonMap = new HashMap<>();
Map<String, Set<Long>> robotFloorAreaJsonMap = new HashMap<>();
for (RobotInformationDO robot : robots) {
if (!RobotStatusEnum.STAND_BY.getType().equals(robot.getRobotStatus())) {
continue;
}
if (ObjectUtil.isEmpty(robot.getFloorAreaJson())) {
log.info("车辆没有能行走的区域 :{}",robot.getRobotNo());
log.info("车辆没有能行走的区域 :{}", robot.getRobotNo());
continue;
}
if (ObjectUtil.isNotEmpty(inStopPointRobotNos) && inStopPointRobotNos.contains(robot.getRobotNo())) {
log.info("车辆已经在停车点了 :{}",robot.getRobotNo());
log.info("车辆已经在停车点了 :{}", robot.getRobotNo());
continue;
}
robotNos.add(robot.getRobotNo());
robotFloorAreaJsonMap.put(robot.getRobotNo(),robot.getFloorAreaJson());
robotFloorAreaJsonMap.put(robot.getRobotNo(), robot.getFloorAreaJson());
}
if (ObjectUtil.isEmpty(robotNos)) {
@ -258,7 +259,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
}
String robotNo = robotNos.get(0);
if (!robotFloorAreaJsonMap.get(robotNo).contains(positionMapItem.getPositionMapId())) {
log.info("车辆不能在此停车点 :{}, 车辆编号 :{}",positionMapItem.getSortNum(), robotNo);
log.info("车辆不能在此停车点 :{}, 车辆编号 :{}", positionMapItem.getSortNum(), robotNo);
continue;
}
positionMapItem.setRobotNo(robotNo);
@ -332,7 +333,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
log.info("派车去停车点--任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
// commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST,JSON.toJSONString(pathPlanningList));
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST, JSON.toJSONString(pathPlanningList));
}
@ -395,7 +396,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
log.info("充电任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
// commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST,JSON.toJSONString(pathPlanningList));
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST, JSON.toJSONString(pathPlanningList));
}
@Transactional(rollbackFor = Exception.class)
@ -487,7 +488,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
if (ObjectUtil.isEmpty(taskDetailDO.getRobotNo())) {
robotNoLimitions = robotNoLimitationArea;
} else {
log.info("区域 :{}",JSON.toJSONString(robotDoReleaseMap));
log.info("区域 :{}", JSON.toJSONString(robotDoReleaseMap));
TaskRobotNoLimittationAreaDTO taskRobotNoLimittationAreaDTO = robotDoReleaseMap.get(taskDetailDO.getRobotNo());
if (ObjectUtil.isEmpty(taskRobotNoLimittationAreaDTO)) {
log.info("车辆没有能行走的区域 :{}", taskDetailDO.getRobotNo());
@ -510,6 +511,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
pathPlanning.setTakePointId(String.valueOf(fromLocation.getMapItemId()));
pathPlanningSetTakeHeight(pathPlanning, fromLocation);
pathPlanningSetTakeForksHeight(pathPlanning, fromLocation);
pathPlanning.setTakeLevel(fromLocation.getLocationStorey());
pathPlanning.setTakeOffsetHeight(znConfigConstant.getRobotConfig().getOffsetHeight());
if (ObjectUtil.isNotEmpty(taskDetailDO.getFromLaneId())) {
@ -542,10 +544,39 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
if (ObjectUtil.isNotEmpty(pathPlanningList)) {
log.info("111111作业任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
// commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST,JSON.toJSONString(pathPlanningList));
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST, JSON.toJSONString(pathPlanningList));
}
}
private void pathPlanningSetTakeForksHeight(TaskToPathPlanningDTO pathPlanning, WareHouseLocationDO fromLocation) {
if (ZeroOneEnum.ONE.getType().equals(fromLocation.getLocationStorey())) {
pathPlanning.setDetectHeight(0.03);
return;
}
WareHouseLocationDO nextLocation = locationMapper.selectOne(new LambdaQueryWrapperX<WareHouseLocationDO>()
.eq(WareHouseLocationDO::getId, fromLocation.getMapItemId())
.eq(WareHouseLocationDO::getLocationStorey, fromLocation.getLocationStorey() - 1)
.last("limit 1"));
if (ObjectUtil.isNotEmpty(nextLocation) && ObjectUtil.isNotEmpty(nextLocation.getLocationTotalHeight())) {
BigDecimal d1 = new BigDecimal("0.12");
BigDecimal d2 = nextLocation.getLocationTotalHeight();
double detectHeight = d2.subtract(d1).doubleValue();
pathPlanning.setDetectHeight(detectHeight);
return;
}
Integer locationStorey = fromLocation.getLocationStorey() - 1;
double height = locationStorey * znConfigConstant.getRobotConfig().getDefaultTrayHeight();
BigDecimal d1 = new BigDecimal("0.12");
BigDecimal d2 = new BigDecimal(height + "");
double detectHeight = d2.subtract(d1).doubleValue();
log.info("设置取货默认抬叉高度 :{}", detectHeight);
pathPlanning.setDetectHeight(detectHeight);
}
/**
* 设置放货高度
*
@ -738,16 +769,16 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
}
//取货线库
Map<Long, RobotTaskDetailDO> fromLaneMap = getFromLaneMap(detailDOS);
Map<Long, RobotTaskDetailDO> fromLaneMap = getFromLaneMap(detailDOS);
//放货线库
Map<Long, RobotTaskDetailDO> toLaneMap = getToLaneMap(detailDOS);
Map<Long, RobotTaskDetailDO> toLaneMap = getToLaneMap(detailDOS);
//取货点位--最小
Map<Long, Long> fromLocationMap = getFromLocationMap(detailDOS);
Map<Long, Long> fromLocationMap = getFromLocationMap(detailDOS);
//放货点位--最大
Map<Long, Long> toLocationMap =getToLocationMap(detailDOS);
Map<Long, Long> toLocationMap = getToLocationMap(detailDOS);
//返回的数据
List<RobotTaskDetailDO> list = new ArrayList<>();
@ -792,8 +823,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
return new HashMap<>();
}
return collect.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getToMapItemId,
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)),
a -> a.isPresent() ? a.get().getToLocationNumber() : null)));
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)),
a -> a.isPresent() ? a.get().getToLocationNumber() : null)));
}
private Map<Long, Long> getFromLocationMap(List<RobotTaskDetailDO> detailDOS) {
@ -804,8 +835,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
return new HashMap<>();
}
return collect.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getFromMapItemId,
Collectors.collectingAndThen(Collectors.minBy(Comparator.comparingLong(RobotTaskDetailDO::getFromLocationNumber)),
a -> a.isPresent() ? a.get().getFromLocationNumber() : null)));
Collectors.collectingAndThen(Collectors.minBy(Comparator.comparingLong(RobotTaskDetailDO::getFromLocationNumber)),
a -> a.isPresent() ? a.get().getFromLocationNumber() : null)));
}
private Map<Long, RobotTaskDetailDO> getToLaneMap(List<RobotTaskDetailDO> detailDOS) {
@ -817,7 +848,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
return new HashMap<>();
}
return collect.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getToLaneId,
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)), Optional::get)));
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)), Optional::get)));
}
private Map<Long, RobotTaskDetailDO> getFromLaneMap(List<RobotTaskDetailDO> detailDOS) {

View File

@ -57,9 +57,6 @@
<if test="deleted != null">
deleted = #{deleted},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId},
</if>
<if test="robotNo != null and robotNo != ''">
robot_no = #{robotNo},
</if>