车辆IP和仿真优化

This commit is contained in:
cbs 2025-04-14 10:38:08 +08:00
parent d59d80517e
commit 5c4dc77269
14 changed files with 90 additions and 103 deletions

View File

@ -116,6 +116,11 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
TenantContextHolder.setTenantId(1L);
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + robotCompleteTaskDTO.getMac();
if (ObjectUtil.isEmpty(robotCompleteTaskDTO.getOrderId())) {
log.info("没有任务id :{}",JSON.toJSONString(robotCompleteTaskDTO));
return;
}
if (!RobotStatusCodeEnum.SUCCESS.getType().equals(robotCompleteTaskDTO.getStatusCode())) {
log.info("车机上报异常 :{}", JSON.toJSONString(robotCompleteTaskDTO));
closeTask(robotCompleteTaskDTO);//todo 取不了和放不了的异常

View File

@ -56,4 +56,10 @@ public class RobotInformationPageReqVO extends PageParam {
@Schema(description = "robot_task_detail的id")
private Long taskDetailId;
@Schema(description = "车辆IP")
private String robotIp;
@Schema(description = "车辆端口")
private Long robotPort;
}

View File

@ -90,4 +90,10 @@ public class RobotInformationPageRespVO {
@Schema(description = "robot_task_detail的id")
private Long taskDetailId;
@Schema(description = "车辆IP")
private String robotIp;
@Schema(description = "车辆端口")
private Long robotPort;
}

View File

@ -84,4 +84,10 @@ public class RobotInformationRespVO {
@Schema(description = "robot_task_detail的id")
private Long taskDetailId;
@Schema(description = "车辆IP")
private String robotIp;
@Schema(description = "车辆端口")
private Long robotPort;
}

View File

@ -2,9 +2,11 @@ package cn.iocoder.yudao.module.system.controller.admin.robot.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Set;
@Schema(description = "管理后台 - 车辆信息新增/修改 Request VO")
@ -50,4 +52,12 @@ public class RobotInformationSaveReqVO {
@Schema(description = "robot_task_detail的id")
private Long taskDetailId;
@Schema(description = "车辆IP")
@Size(min = 0, max = 20, message = "车辆IP长度超过限制")
private String robotIp;
@Schema(description = "车辆端口")
@Range(min = 0, max = 6, message = "车辆端口长度超过限制")
private Long robotPort;
}

View File

@ -78,4 +78,14 @@ public class RobotInformationDO extends BaseDO {
*/
private Long taskDetailId;
/**
* 车辆IP
*/
private String robotIp;
/**
* 车辆端口
*/
private Long robotPort;
}

View File

@ -524,6 +524,13 @@ public class PathPlanningServiceImpl implements PathPlanningService {
simulationRobotPoseDTO.setLocationYaw(itemDOList.get(i).getLocationYaw());
simulationRobotPoseDTO.setFloor(positionMap.getFloor()+"");
simulationRobotPoseDTO.setArea(positionMap.getArea());
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robot.getMacAddress();
FloorZoneDTO floorZoneDTO = new FloorZoneDTO();
floorZoneDTO.setFloor(simulationRobotPoseDTO.getFloor());
floorZoneDTO.setArea(simulationRobotPoseDTO.getArea());
redisUtil.set(floorAreaKey, JSON.toJSONString(floorZoneDTO));
simulationList.add(simulationRobotPoseDTO);
i++;
}

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
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.path.PathPlanningApi;
import cn.iocoder.yudao.module.mqtt.api.path.dto.RobotDimensionsDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskRobotNoLimittationAreaDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotAcceptTaskDTO;
@ -162,6 +163,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
@Value("${zn.is_simulation:false}")
private Boolean isSimulation;
@Value("${zn.restore_task_restart:true}")
private Boolean restoreTaskRestart;
@Override
public Long createInformation(RobotInformationSaveReqVO createReqVO) {
//判断mac地址是否重复
@ -203,6 +207,11 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
.operateAction("新增车辆 " + createReqVO.getRobotNo())
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
userOperationLogService.createUserOperationLog(operationLog);
List<RobotDimensionsDTO> list = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
redisUtil.del(key);
// 返回
return information.getId();
}
@ -243,14 +252,16 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
// 更新
RobotInformationDO updateObj = BeanUtils.toBean(updateReqVO, RobotInformationDO.class);
informationMapper.updateById(updateObj);
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + updateObj.getMacAddress(), updateObj.getRobotNo());
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_MAC_BY_NO + updateObj.getRobotNo(), updateObj.getMacAddress());
// 更新AGV于地图关系表 -----
List<List<Long>> list = CollectionUtils.compareLists(
(CollUtil.isEmpty(robotInformationDO.getFloorAreaJson()) ? Collections.emptyList() : new ArrayList<>(robotInformationDO.getFloorAreaJson())),
(CollUtil.isEmpty(updateReqVO.getFloorAreaJson()) ? Collections.emptyList() : new ArrayList<>(updateReqVO.getFloorAreaJson())),
ObjectUtil::equal);
informationMapAssociationService.saveOrUpdateOrDel(updateReqVO.getId(), list);
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + updateObj.getMacAddress(), updateObj.getRobotNo());
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_MAC_BY_NO + updateObj.getRobotNo(), updateObj.getMacAddress());
redisUtil.del(key);
String str = "";
if (!robotInformationDO.getRobotTaskModel().equals(updateReqVO.getRobotTaskModel())
@ -265,6 +276,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
.operateAction("更新车辆信息" + str)
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
userOperationLogService.createUserOperationLog(operationLog);
List<RobotDimensionsDTO> RobotDimensions = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
}
@Override
@ -289,6 +303,11 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
userOperationLogService.createUserOperationLog(operationLog);
// 删除
informationMapper.deleteById(id);
List<RobotDimensionsDTO> RobotDimensions = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
redisUtil.del(key);
}
private void validateInformationExists(Long id) {
@ -866,7 +885,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
List<TaskRobotNoLimittationAreaDTO> robotNoLimitions = Arrays.asList(taskRobotNoLimittationAreaDTO);
pathPlanning.setRobotNoLimitationAreaDTOS(robotNoLimitions);
if (!isSimulation) {
if (!isSimulation || !restoreTaskRestart) {
resendToPPData(pathPlanning,actionLog,robotInformationDO);
}

View File

@ -208,3 +208,4 @@ zn:
path_planning:
task_chche_time: 604800 #任务缓存的时间, 默认一星期
is_simulation: true # 是否为仿真环境
restore_task_restart: true # 恢复任务是否全部重新执行 true:全部重新开始

View File

@ -243,6 +243,7 @@ zn:
path_planning:
task_chche_time: 604800 #任务缓存的时间, 默认一星期
is_simulation: true # 是否为仿真环境
restore_task_restart: true # 恢复任务是否全部重新执行 true:全部重新开始
logging:
file:

View File

@ -188,7 +188,7 @@
tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide,
location_deep, location_height, location_default_height, location_total_height, location_tray_height,
location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
from zn_wcs.ware_house_location
from ware_house_location
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">

View File

@ -26,6 +26,8 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
<result property="taskDetailId" column="task_detail_id" jdbcType="INTEGER"/>
<result property="robotIp" column="robot_ip" jdbcType="VARCHAR"/>
<result property="robotPort" column="robot_port" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
@ -45,7 +47,9 @@
update_time,
deleted,
tenant_id,
task_detail_id
task_detail_id,
robot_ip,
robot_port
</sql>
<!--查询指定行数据-->
@ -93,6 +97,12 @@
<if test="taskDetailId != null">
and task_detail_id = #{taskDetailId}
</if>
<if test="robotIp != null">
and robot_ip = #{robotIp}
</if>
<if test="robotPort != null">
and robot_port = #{robotPort}
</if>
<if test="1==1">
and deleted = '0'
</if>
@ -103,105 +113,10 @@
<select id="queryAll" resultMap="BaseResultMap">
select
id, robot_model_id, robot_model_number, robot_no, robot_task_model, mac_address, url, robot_status, creator,
create_time, updater, update_time, deleted, tenant_id,task_detail_id
from zn_wcs.robot_information
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from robot_information
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="robotModelId != null">
and robot_model_id = #{robotModelId}
</if>
<if test="robotModelNumber != null and robotModelNumber != ''">
and robot_model_number = #{robotModelNumber}
</if>
<if test="robotNo != null and robotNo != ''">
and robot_no = #{robotNo}
</if>
<if test="robotTaskModel != null">
and robot_task_model = #{robotTaskModel}
</if>
<if test="macAddress != null and macAddress != ''">
and mac_address = #{macAddress}
</if>
<if test="url != null and url != ''">
and url = #{url}
</if>
<if test="robotStatus != null">
and robot_status = #{robotStatus}
</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>
create_time, updater, update_time, deleted, tenant_id,task_detail_id,robot_ip,robot_port
from robot_information
</select>
<!--通过主键修改数据-->
<update id="doUpdateById">
update robot_information
<set>
<if test="robotModelId != null">
robot_model_id = #{robotModelId},
</if>
<if test="robotModelNumber != null and robotModelNumber != ''">
robot_model_number = #{robotModelNumber},
</if>
<if test="robotNo != null and robotNo != ''">
robot_no = #{robotNo},
</if>
<if test="robotTaskModel != null">
robot_task_model = #{robotTaskModel},
</if>
<if test="macAddress != null and macAddress != ''">
mac_address = #{macAddress},
</if>
<if test="url != null and url != ''">
url = #{url},
</if>
<if test="robotStatus != null">
robot_status = #{robotStatus},
</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>
<update id="updateRobotStatus">
update

View File

@ -29,6 +29,7 @@
command_id = '-1'
and deleted = '0'
and action_status in ('0','1')
and create_time >= DATE_SUB(NOW(), INTERVAL 1 DAY)
and command_type in
<foreach collection="commandTypes" item="commandType" index="index" open="(" close=")"
separator=",">

View File

@ -148,7 +148,7 @@
id, montage_task, montage_number, sku_info, sku_batch, sku_number, priority, other_msg, do_cycle, do_move_all,
cycle_number, remaining_cycle_number, task_no, task_status, task_stage, start_time, end_time, creator, create_time,
updater, update_time, deleted, tenant_id
from zn_wcs.robot_task
from robot_task
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">