fix:满卷送待卷区终点查询

This commit is contained in:
zhangzq
2025-03-14 21:28:58 +08:00
parent 3b47aedb85
commit b9694747c5
5 changed files with 28 additions and 64 deletions

View File

@@ -1,5 +1,6 @@
package org.nl.b_lms.sch.point.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -34,5 +35,5 @@ public interface BstIvtPackageinfoivtMapper extends BaseMapper<BstIvtPackageinfo
*/
List<SchBaseTask> getTaskList(Set<String> pointCodes1, Set<String> pointCodes2, Set<String> pointCodes3, Set<String> pointCodes4);
List<BstIvtPackageinfoivt> selectNoTaskPoint(@Param("pointStatus") String pointStatus, @Param("ivtStatus")String ivtStatus);
}

View File

@@ -80,6 +80,16 @@
AND (task_status <![CDATA[ < ]]> '07')
AND (is_delete = '0')
</select>
<select id="selectNoTaskPoint" resultType="org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt">
select p.*
from bst_ivt_packageinfoivt p
where point_status = #{pointStatus}
AND is_used = '1'
AND ivt_status = #{ivtStatus}
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.task_status <![CDATA[ < ]]> '07'
AND (t.point_code1 = p.point_code OR t.point_code2 = p.point_code OR t.point_code3 = p.point_code OR t.point_code4 = p.point_code)
AND t.is_delete = '0')
</select>
</mapper>

View File

@@ -114,6 +114,9 @@ public interface IbstIvtPackageinfoivtService extends IService<BstIvtPackageinfo
void deleteAll(Set<String> ids);
List<BstIvtPackageinfoivt> selectEmpPoints(String point_status,String ivt_status);

View File

@@ -1186,6 +1186,12 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
return dto;
}
@Override
public List<BstIvtPackageinfoivt> selectEmpPoints(String point_status, String ivt_status) {
if (StringUtils.isEmpty(point_status)||StringUtils.isEmpty(ivt_status)){
throw new BadRequestException("点位类型或状态不能为空");
}
return this.baseMapper.selectNoTaskPoint(point_status, ivt_status);
}
}

View File

@@ -72,80 +72,24 @@ public class AutoSendMzToDjq {
return;
}
JSONObject task = new JSONObject();
String pointCode2 = null;
//满轴有子卷且过滤未完成任务
List<BstIvtPackageinfoivt> mzqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务取货"), PackageInfoIvtEnum.SORT_TYPE.code("降序"), "");
if (ObjectUtils.isEmpty(mzqPackageinfoivtList)) {
return;
}
//待检区有库位为空位且过滤未完成任务
List<BstIvtPackageinfoivt> djqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code(""), PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), PackageInfoIvtEnum.SORT_TYPE.code("降序"), PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
if (ObjectUtils.isEmpty(djqPackageinfoivtList)) {
log.info("满轴->待检区agv自动搬运任务暂无可用空位,子卷号为:" + mzqPackageinfoivtList.get(0).getContainer_name());
throw new BadRequestException("满轴->待检区agv自动搬运任务暂无可用空位,子卷号为:" + mzqPackageinfoivtList.get(0).getContainer_name());
List<BstIvtPackageinfoivt> selectEmpPoints = packageinfoivtService.selectEmpPoints(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code(""));
if (ObjectUtils.isEmpty(selectEmpPoints)) {
log.error(THIS_CLASS+"满轴->待检区agv自动搬运任务暂无可用空位,子卷号为:" + mzqPackageinfoivtList.get(0).getContainer_name());
return;
}
// 获取浅库位为空的库位和深库位为空的库位
Map<Boolean, List<BstIvtPackageinfoivt>> ivtMap = djqPackageinfoivtList.stream()
.collect(Collectors.partitioningBy(r -> r.getDepth().equals(PackageInfoIvtEnum.DEPTH_TYPE.code("浅货位"))));
List<BstIvtPackageinfoivt> shallowIvtList = ivtMap.get(true);
List<BstIvtPackageinfoivt> deepIvtList = ivtMap.get(false);
task.put("vehicle_code2", PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取货二次分配"));
task.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"));
task.put("vehicle_code", mzqPackageinfoivtList.get(0).getContainer_name());
task.put("point_code1", packageinfoivtService.getWaitPoint(mzqPackageinfoivtList.get(0).getBlock(), mzqPackageinfoivtList.get(0).getWait_point_type()));
task.put("point_code3", mzqPackageinfoivtList.get(0).getPoint_code());
//如果浅库位和深库位都有空位,且为一组,优先深库位
if (ObjectUtils.isNotEmpty(shallowIvtList) && ObjectUtils.isNotEmpty(deepIvtList)) {
// 筛选出浅库位为空且对应的深库位也为空的库位的point_code
pointCode2 = shallowIvtList.stream()
.filter(shallowIvt -> deepIvtList.stream()
.anyMatch(deepIvt -> shallowIvt.getCol_num().equals(deepIvt.getCol_num())))
.findFirst()
.flatMap(shallowIvt -> deepIvtList.stream()
.filter(deepIvt -> shallowIvt.getCol_num().equals(deepIvt.getCol_num()))
.findFirst()
.map(BstIvtPackageinfoivt::getPoint_code))
.orElse(null);
if (pointCode2 == null) {
//如果不同一组,则直接浅库位
pointCode2 = shallowIvtList.get(0).getPoint_code();
}
}
//如果只有浅库位有空位,则直接取浅库位的编号为终点
else if (ObjectUtils.isNotEmpty(shallowIvtList)) {
pointCode2 = shallowIvtList.get(0).getPoint_code();
}
//如果只有深库位有空位,需要发起浅库位->深库位的移库任务
else if (ObjectUtils.isNotEmpty(deepIvtList)) {
//取出深库位的编号为任务终点
String deepPointCode = deepIvtList.get(0).getPoint_code();
//查询对应浅库位的编号为任务起点
List<BstIvtPackageinfoivt> groupIvtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getCol_num, deepIvtList.get(0).getCol_num())).stream().filter(r -> r.getDepth().equals(PackageInfoIvtEnum.DEPTH_TYPE.code("浅货位"))).collect(Collectors.toList());
if (ObjectUtils.isEmpty(groupIvtList)) {
log.info(deepIvtList.get(0).getPoint_code() + "找不到对应的浅货位,请检查点位库存信息!");
throw new BadRequestException(deepIvtList.get(0).getPoint_code() + "找不到对应的浅货位,请检查点位库存信息!");
}
pointCode2 = groupIvtList.get(0).getPoint_code();
//主任务只确定终点
task.put("task_status", TaskStatusEnum.SURE_END.getCode());
task.put("point_code2", pointCode2);
String taskId = djqTask.createTask(task);
//移库任务
JSONObject task1 = new JSONObject();
task1.put("vehicle_code2", PackageInfoIvtEnum.AGV_ACTION_TYPE.code("普通任务"));
task1.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区移库任务"));
task1.put("vehicle_code", groupIvtList.get(0).getContainer_name());
task1.put("point_code1", pointCode2);
task1.put("point_code2", deepPointCode);
task1.put("task_group_id", taskId);
task1.put("material_code", groupIvtList.get(0).getIvt_status());
shiftingTask.createTask(task1);
return;
}
if (pointCode2 != null) {
task.put("point_code2", pointCode2);
djqTask.createTask(task);
}
task.put("point_code2", mzqPackageinfoivtList.get(0).getPoint_code());
djqTask.createTask(task);
} else {
log.info("满轴->待检区agv自动搬运任务正在创建被锁住。");
}