更新机器人任务
This commit is contained in:
parent
dc88e8e574
commit
39b34faa75
@ -109,4 +109,12 @@ public class RobotInformationController {
|
||||
return success(BeanUtils.toBean(result, RobotInformationRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/getAllRobot")
|
||||
@Operation(summary = "查询所有车辆")
|
||||
@PreAuthorize("@ss.hasPermission('robot:information:getAllRobot')")
|
||||
public CommonResult<List<RobotInformationRespVO>> getAllRobot() {
|
||||
List<RobotInformationDO> result = informationService.getAllRobot();
|
||||
return success(BeanUtils.toBean(result, RobotInformationRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -87,7 +87,7 @@ public class RobotTaskController {
|
||||
@PreAuthorize("@ss.hasPermission('robot:task:query')")
|
||||
public CommonResult<PageResult<RobotTaskRespVO>> getTaskPage(@Valid @RequestBody RobotTaskPageReqVO pageReqVO) {
|
||||
PageResult<RobotTaskRespVO> pageResult = taskService.getTaskPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RobotTaskRespVO.class));
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
|
@ -93,7 +93,8 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
||||
@Param("mapIds") Set<Long> mapIds);
|
||||
|
||||
void updateLocationLockList( @Param("locationIds") List<Long> locationIds,
|
||||
@Param("taskId") Long taskId);
|
||||
@Param("taskId") Long taskId,
|
||||
@Param("locationLock") Integer locationLock);
|
||||
|
||||
/**
|
||||
* 根据类型查库位/线库/区域
|
||||
|
@ -64,4 +64,12 @@ public interface RobotInformationMapper extends BaseMapperX<RobotInformationDO>
|
||||
* @return
|
||||
*/
|
||||
List<RobotInformationDO> selectByRobotNos(@Param("robotNos") Set<String> robotNos);
|
||||
|
||||
/**
|
||||
* 更新任务模式(0:拒收任务、1:正常)
|
||||
* @param robotNos
|
||||
* @param robotTaskModel
|
||||
*/
|
||||
void updateRobotTaskModel(@Param("robotNos") Set<String> robotNos,
|
||||
@Param("robotTaskModel") Integer robotTaskModel);
|
||||
}
|
@ -32,7 +32,7 @@ public interface RobotTaskMapper extends BaseMapperX<RobotTaskDO> {
|
||||
.eqIfPresent(RobotTaskDO::getDoMoveAll, reqVO.getDoMoveAll())
|
||||
.eqIfPresent(RobotTaskDO::getCycleNumber, reqVO.getCycleNumber())
|
||||
.eqIfPresent(RobotTaskDO::getRemainingCycleNumber, reqVO.getRemainingCycleNumber())
|
||||
.eqIfPresent(RobotTaskDO::getTaskNo, reqVO.getTaskNo())
|
||||
.likeIfPresent(RobotTaskDO::getTaskNo, reqVO.getTaskNo())
|
||||
.eqIfPresent(RobotTaskDO::getTaskStatus, reqVO.getTaskStatus())
|
||||
.eqIfPresent(RobotTaskDO::getTaskStage, reqVO.getTaskStage())
|
||||
.betweenIfPresent(RobotTaskDO::getStartTime, reqVO.getStartTime())
|
||||
|
@ -66,4 +66,11 @@ public interface RobotInformationService {
|
||||
* @return
|
||||
*/
|
||||
List<RobotInformationDO> getCanUseRobot();
|
||||
|
||||
/**
|
||||
* 查询所有车辆
|
||||
* @return
|
||||
*/
|
||||
List<RobotInformationDO> getAllRobot();
|
||||
|
||||
}
|
@ -173,4 +173,10 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
return informationMapper.queryAllByLimit(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RobotInformationDO> getAllRobot() {
|
||||
RobotInformationDO query = new RobotInformationDO();
|
||||
return informationMapper.queryAllByLimit(query);
|
||||
}
|
||||
|
||||
}
|
@ -166,6 +166,8 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
RobotTaskDO task = BeanUtils.toBean(createReqVO, RobotTaskDO.class);
|
||||
taskMapper.insert(task);
|
||||
|
||||
// todo 更新数据库顺序 后续改为xxl-job一致
|
||||
|
||||
//查找库位
|
||||
if (MoveAllEnum.NO.getType().equals(createReqVO.getDoMoveAll())) {
|
||||
setSingleLocationIdNo(createReqVO.getTaskDetailList(),task);
|
||||
@ -269,12 +271,12 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
//跟新库位状态为锁定
|
||||
List<List<Long>> toPartition = Lists.partition(toLocationIds, 100);
|
||||
toPartition.forEach(list-> {
|
||||
locationMapper.updateLocationLockList(list,taskId);
|
||||
locationMapper.updateLocationLockList(list,taskId,LocationLockEnum.NO.getType());
|
||||
});
|
||||
|
||||
List<List<Long>> fromPartition = Lists.partition(fromLocationIds, 100);
|
||||
fromPartition.forEach(list-> {
|
||||
locationMapper.updateLocationLockList(list,taskId);
|
||||
locationMapper.updateLocationLockList(list,taskId,LocationLockEnum.NO.getType());
|
||||
});
|
||||
|
||||
}
|
||||
@ -574,7 +576,11 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
&& !robotTaskDO.getTaskStatus().equals(updateReqVO.getTaskStatus())) {
|
||||
throw exception(TASK_CHECK_TASK_STATUS);
|
||||
}
|
||||
|
||||
List<Long> locationIds = new ArrayList<>();
|
||||
Set<String> robotNos = new HashSet<>();
|
||||
if (ObjectUtil.isNotEmpty(updateReqVO.getTaskStatus())
|
||||
&& RobotTaskStatusEnum.CLOSE.getType().equals(updateReqVO.getTaskStatus())
|
||||
&& !robotTaskDO.getTaskStatus().equals(updateReqVO.getTaskStatus())) {
|
||||
for (RobotTaskDetailDO taskDetailDO : taskDetailDOS) {
|
||||
if (RobotTaskDetailStatusEnum.DONE.getType().equals(taskDetailDO.getTaskStatus())) {
|
||||
@ -582,6 +588,18 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
}
|
||||
//后期需做状态映射
|
||||
taskDetailDO.setTaskStatus(updateReqVO.getTaskStatus());
|
||||
|
||||
// todo 关闭需要下发任务给车机 。 还需要考虑下处理中的任务怎么处理
|
||||
|
||||
if (ObjectUtil.isNotEmpty(taskDetailDO.getFromLocationId())) {
|
||||
locationIds.add(taskDetailDO.getFromLocationId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskDetailDO.getToLocationId())) {
|
||||
locationIds.add(taskDetailDO.getToLocationId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskDetailDO.getRobotNo())) {
|
||||
robotNos.add(taskDetailDO.getRobotNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,6 +607,17 @@ public class RobotTaskServiceImpl implements RobotTaskService {
|
||||
taskMapper.updateById(updateObj);
|
||||
|
||||
taskDetailMapper.updateBatch(taskDetailDOS);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(locationIds)) {
|
||||
locationMapper.updateLocationLockList(locationIds,robotTaskDO.getId()
|
||||
,LocationLockEnum.YES.getType());
|
||||
}
|
||||
|
||||
// todo 执行中的需要锁车。 需要添加执行中的判断
|
||||
if (ObjectUtil.isNotEmpty(robotNos)) {
|
||||
// informationMapper.updateRobotTaskModel(robotNos,RobotTaskModelEnum.REJECTION.getType());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新任务失败 :{}",e.getMessage());
|
||||
msg = e.getMessage();
|
||||
|
@ -101,6 +101,10 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
|
||||
//如果系统暂停 则不下发任务
|
||||
|
||||
//todo 更新数据库顺序 后续改为和创建订单一致
|
||||
|
||||
// todo 更新数据库 改为批量修改
|
||||
|
||||
//任务下发给机器人
|
||||
distributeTasks(robots,taskDetailDOS);
|
||||
}
|
||||
|
@ -500,7 +500,7 @@
|
||||
update
|
||||
ware_house_location
|
||||
set
|
||||
location_lock = '0',
|
||||
location_lock = #{locationLock},
|
||||
task_id = #{taskId}
|
||||
where
|
||||
id in
|
||||
|
@ -251,6 +251,19 @@
|
||||
robot_no = #{robotNo}
|
||||
</update>
|
||||
|
||||
<update id="updateRobotTaskModel">
|
||||
update
|
||||
robot_information
|
||||
set
|
||||
robot_task_model = #{robotTaskModel}
|
||||
where
|
||||
robot_no in
|
||||
<foreach collection="robotNos" item="robotNo" index="index" open="(" close=")"
|
||||
separator=",">
|
||||
#{robotNo}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
|
Loading…
Reference in New Issue
Block a user