opt:优化二次分配任务类型判断逻辑

This commit is contained in:
2024-07-08 11:14:00 +08:00
parent 5698d4165e
commit 2fe2d685af
4 changed files with 67 additions and 62 deletions

View File

@@ -907,10 +907,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.collect(Collectors.toList());
//任务组id
String groupId = deviceCode.substring(deviceCode.lastIndexOf("_") + 1);
// RLock lock = redissonClient.getLock(groupId);
// boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
// try {
// if (tryLock) {
RLock lock = redissonClient.getLock(groupId);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
List<SchBaseTask> schBaseTaskList = new ArrayList<>();
//确定起点,安装装箱组标识加入任务队列
djqPoints.forEach(r -> {
@@ -938,14 +938,14 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
if (CollectionUtils.isNotEmpty(schBaseTaskList)) {
taskQueue.addTasksToQueue(groupId, schBaseTaskList);
}
// } else {
// log.info("待检区->装箱区任务队列正在创建被锁住。");
// }
// } finally {
// if (tryLock) {
// lock.unlock();
// }
// }
} else {
log.info("待检区->装箱区任务队列正在创建被锁住。");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
}

View File

@@ -345,32 +345,36 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
}
//取货任务
if (actionType.equals(PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货完成"))) {
UpdateWrapper<BstIvtPackageinfoivt> updateWrapper = new UpdateWrapper<>();
//取满轴
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"))) {
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code1()));
if (CollectionUtils.isEmpty(ivtList)) {
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "取货完成的目标点位不存在!");
}
//只有子卷号相同才能清除库存
if (baseTask.getVehicle_code().equals(ivtList.get(0).getContainer_name())) {
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区")) ||
baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线四个点任务")) ||
baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"))) {
UpdateWrapper<BstIvtPackageinfoivt> updateWrapper = new UpdateWrapper<>();
//取满轴
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"))) {
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code1()));
if (CollectionUtils.isEmpty(ivtList)) {
throw new BadRequestException("任务编号为:" + baseTask.getTask_code() + "取货完成的目标点位不存在!");
}
//只有子卷号相同才能清除库存
if (baseTask.getVehicle_code().equals(ivtList.get(0).getContainer_name())) {
updateWrapper.eq("point_code", baseTask.getPoint_code1());
}
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线四个点任务"))) {
//取空轴
updateWrapper.eq("point_code", baseTask.getPoint_code3());
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"))) {
//取空轴
updateWrapper.eq("point_code", baseTask.getPoint_code1());
}
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线四个点任务"))) {
//取空轴
updateWrapper.eq("point_code", baseTask.getPoint_code3());
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"))) {
//取空轴
updateWrapper.eq("point_code", baseTask.getPoint_code1());
updateWrapper.setSql("ivt_status = '0', container_name = null");
//清空起点库存状态
bstIvtPackageinfoivtMapper.update(null, updateWrapper);
//标记桁架任务取空载具完成
baseTask.setRequest_param(IOSEnum.IS_SEND.code(""));
taskService.update();
}
updateWrapper.setSql("ivt_status = '0', container_name = null");
//清空起点库存状态
bstIvtPackageinfoivtMapper.update(null, updateWrapper);
//标记桁架任务取空载具完成
baseTask.setRequest_param(IOSEnum.IS_SEND.code(""));
taskService.update();
} else {
//放货任务
List<BstIvtPackageinfoivt> ivtList = packageinfoivtService.list(new LambdaQueryWrapper<BstIvtPackageinfoivt>()

View File

@@ -8,6 +8,7 @@ import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
@@ -15,6 +16,7 @@ import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -48,33 +50,33 @@ public class AutoSendToZxq {
@SneakyThrows
public void sendDjqToZxq() {
log.info(THIS_CLASS + "-待检区->装箱区定时任务开始执行扫描。");
// RLock lock = redissonClient.getLock(THIS_CLASS);
// boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
// try {
// if (tryLock) {
//装箱区有空位,去待检区消费合格品子卷
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(
PackageInfoIvtEnum.POINT_STATUS.code("装箱区"),
PackageInfoIvtEnum.IVT_STATUS.code(""),
PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), "", "");
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
Map<String, List<String>> ivtList = bstIvtPackageinfoivtList.stream()
.collect(Collectors.groupingBy(
BstIvtPackageinfoivt::getBlock,
LinkedHashMap::new,
Collectors.mapping(BstIvtPackageinfoivt::getPoint_code, Collectors.toList())
));
//taskQueueManager.processTasks(ivtList);
taskQueue.processTasks(ivtList);
RLock lock = redissonClient.getLock(THIS_CLASS);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
//装箱区有空位,去待检区消费合格品子卷
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(
PackageInfoIvtEnum.POINT_STATUS.code("装箱区"),
PackageInfoIvtEnum.IVT_STATUS.code(""),
PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), "", "");
if (CollectionUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
Map<String, List<String>> ivtList = bstIvtPackageinfoivtList.stream()
.collect(Collectors.groupingBy(
BstIvtPackageinfoivt::getBlock,
LinkedHashMap::new,
Collectors.mapping(BstIvtPackageinfoivt::getPoint_code, Collectors.toList())
));
//taskQueueManager.processTasks(ivtList);
taskQueue.processTasks(ivtList);
}
} else {
log.info("满轴->待检区agv自动搬运任务正在创建被锁住。");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
// } else {
// log.info("满轴->待检区agv自动搬运任务正在创建被锁住。");
// }
// } finally {
// if (tryLock) {
// lock.unlock();
// }
// }
}
}

View File

@@ -8,7 +8,6 @@ import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMap
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.springframework.stereotype.Service;