fix:判断桁架任务的时候判断属于哪一个桁架

This commit is contained in:
zhouz
2026-01-16 09:59:48 +08:00
parent 30130025b0
commit 271d73053b
9 changed files with 220 additions and 21 deletions

View File

@@ -629,7 +629,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
throw new BadRequestException("没有可用的装箱区对接位");
}
bstIvtPackageinfoivtList.forEach(r -> {
Iterator<BstIvtPackageinfoivt> iterator = bstIvtPackageinfoivtList.iterator();
while (iterator.hasNext()) {
BstIvtPackageinfoivt r = iterator.next();
int count = taskService.count(new QueryWrapper<SchBaseTask>()
.eq("task_type", "010908")
.eq("is_delete", "0")
@@ -639,10 +641,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.eq("point_status", PackageInfoIvtEnum.POINT_STATUS.code("装箱区"))
.eq("block", r.getBlock())
.eq("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("合格品")));
if (count + count2 + entitySize > 8) {
bstIvtPackageinfoivtList.remove(r);
if (count + count2 + entitySize > 10) {
iterator.remove();
}
});
}
if (ObjectUtils.isEmpty(bstIvtPackageinfoivtList)) {
throw new BadRequestException("当前装箱区木箱任务已满,稍后再试");

View File

@@ -10,14 +10,15 @@ import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pdm.ivt.service.dto.DeliveryPointIvtDto;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -38,6 +39,9 @@ public class BstIvtPackageinfoivtController {
@Resource
private IbstIvtPackageinfoivtService bstIvtPackageinfoivtService;
@Resource
private RedisUtils redisUtils;
/**
* 分页查询
@@ -72,7 +76,6 @@ public class BstIvtPackageinfoivtController {
}
/**
* 新增数据
*
@@ -89,6 +92,7 @@ public class BstIvtPackageinfoivtController {
/**
* 修改数据
*
* @param params 实体对象
* @return 修改结果
*/
@@ -101,7 +105,6 @@ public class BstIvtPackageinfoivtController {
}
/**
* 删除数据
*
@@ -114,6 +117,15 @@ public class BstIvtPackageinfoivtController {
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/redisQueue")
@SaIgnore
public List<Object> getRedisQueue(@RequestParam("key") String key) {
if (!"ZXQ_1_1".equals(key) && !"ZXQ_2_1".equals(key)) {
throw new IllegalArgumentException("非法队列 key");
}
return redisUtils.lGet(key, 0, -1);
}
}

View File

@@ -40,6 +40,9 @@ public interface IbstIvtPackageinfoivtService extends IService<BstIvtPackageinfo
*/
List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode,String sortType,String taskType);
List<BstIvtPackageinfoivt> checkEndPointTask2(String ivtType, String ivtStatus, String pointCode,String sortType,String taskType);
/**
* 获取等待点

View File

@@ -434,6 +434,139 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
}
}
@Override
public List<BstIvtPackageinfoivt> checkEndPointTask2(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) {
List<SchBaseTask> taskList;
Set<String> pointSets;
boolean isQueryGroup = false;
List<BstIvtPackageinfoivt> returList = new ArrayList<>();
//移库任务返回点位处理
List<String> taskTypes = new ArrayList<>(Arrays.asList(
PackageInfoIvtEnum.TASK_TYPE.code("补空(装箱区->待检区)"),
PackageInfoIvtEnum.TASK_TYPE.code("补空(装箱区->管制区)"),
PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"),
PackageInfoIvtEnum.TASK_TYPE.code("待检区->管制区"),
PackageInfoIvtEnum.TASK_TYPE.code("管制区->待检区"),
PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区")));
if (taskTypes.contains(taskType)) {
//是否查询相同组的库位
isQueryGroup = true;
}
List<BstIvtPackageinfoivt> packageinfoivtList = getBstIvtPackageinfoivts2(ivtType, ivtStatus, sortType, isQueryGroup);
Set<String> pointIds = packageinfoivtList.stream()
.map(BstIvtPackageinfoivt::getPoint_code)
.collect(Collectors.toSet());
if (ObjectUtils.isEmpty(pointIds)) {
return returList;
}
if (pointCode == null) {
return packageinfoivtList;
}
if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务")) || pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, pointIds);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务分配"))) {
//四个点任务取货分配条件为取货完成信号即刻更新库存,所以不判断是否有起点任务
taskList = new ArrayList<>();
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务取货"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, null, pointIds, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("空载具放货"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(null, pointIds, null, pointIds);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("空载具放货分配"))) {
List<BstIvtPackageinfoivt> pointList = new ArrayList<>();
List<BstIvtPackageinfoivt> ivtList = packageinfoivtList.stream().filter(r -> r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具"))).sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq)).collect(Collectors.toList());
List<BstIvtPackageinfoivt> vehicleList = packageinfoivtList.stream().filter(r -> r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code(""))).sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq).reversed()).collect(Collectors.toList());
//有空载具
if (ObjectUtils.isNotEmpty(ivtList)) {
BstIvtPackageinfoivt bstIvtPackageinfoivt = new BstIvtPackageinfoivt();
bstIvtPackageinfoivt.setPoint_code(ivtList.get(0).getPoint_code());
bstIvtPackageinfoivt.setSort_seq(ivtList.get(0).getSort_seq());
bstIvtPackageinfoivt.setIvt_status(ivtList.get(0).getIvt_status());
returList.add(bstIvtPackageinfoivt);
//判断是否有空载具阻挡
pointList.add(getSecondaryIvt(vehicleList, returList));
return pointList;
} else {
BstIvtPackageinfoivt bstIvtPackageinfoivt = packageinfoivtList.stream().filter(r -> r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code(""))).sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq).reversed()).collect(Collectors.toList()).get(0);
pointList.add(bstIvtPackageinfoivt);
return pointList;
}
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务取货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, pointIds);
} else {
return packageinfoivtList;
}
// 未完成的任务点位汇集
if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务取货"))) {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code3()
))
.filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet());
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务分配"))) {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1()
))
.filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet());
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("空载具放货"))) {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code2(),
task.getPoint_code4()
))
.filter(point -> point != null && !point.trim().isEmpty() && !point.equals("ZXQ_01_1") && !point.equals("ZXQ_01_2"))
.collect(Collectors.toSet());
//限制补空任务数量
List<BstIvtPackageinfoivt> ivtList = packageinfoivtList.stream().filter(r -> r.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具"))).collect(Collectors.toList());
Set<String> ivtpointSets = ivtList.stream().map(BstIvtPackageinfoivt::getPoint_code).collect(Collectors.toSet());
if (ObjectUtils.isNotEmpty(ivtpointSets)) {
//存在任务数量+已有库存数量大于3不创建任务
if (pointSets.size() + ivtpointSets.size() >= 3) {
return returList;
}
}
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务")) || pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"))) {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code2()
))
.filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet());
} else {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code2(),
task.getPoint_code3(),
task.getPoint_code4()
))
.filter(point -> point != null && !point.trim().isEmpty())
.collect(Collectors.toSet());
}
//移库任务返回点位处理
if (isQueryGroup) {
return getBstIvtPackageinfoivts(ivtStatus, pointSets, packageinfoivtList);
}
//符合条件的库存点位过滤掉已存在任务的点位
List<BstIvtPackageinfoivt> planTaskList = packageinfoivtList.stream()
.filter(p -> !pointSets.contains(p.getPoint_code()) && p.getIvt_status().equals(ivtStatus))
.collect(Collectors.toList());
//送空载具到空载具缓存位任务,需要判断是否存在已分配的且未完成的送空载具任务,如果存在,判断存在是否阻挡
if (taskType.equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(待检区->空载具缓存位)")) || taskType.equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(管制区->空载具缓存位)"))) {
return getNoBlockIvt(pointCode, taskList, planTaskList);
} else {
return planTaskList;
}
}
/**
* 过滤不符合移库条件的同组库位
@@ -607,6 +740,32 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
}
}
public List<BstIvtPackageinfoivt> getBstIvtPackageinfoivts2(String ivtType, String ivtStatus, String sortType, boolean isQueryGroup) {
LambdaQueryWrapper<BstIvtPackageinfoivt> queryWrapper = new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getPoint_status, ivtType);
if (StringUtils.isNotEmpty(ivtStatus)) {
queryWrapper.eq(BstIvtPackageinfoivt::getIvt_status, ivtStatus);
}
if (PackageInfoIvtEnum.SORT_TYPE.code("升序").equals(sortType)) {
queryWrapper.orderByAsc(BstIvtPackageinfoivt::getSort_seq);
} else if (PackageInfoIvtEnum.SORT_TYPE.code("降序").equals(sortType)) {
queryWrapper.orderByDesc(BstIvtPackageinfoivt::getSort_seq);
} else {
queryWrapper.orderByAsc(BstIvtPackageinfoivt::getSort_seq);
}
List<BstIvtPackageinfoivt> ivtList = bstIvtPackageinfoivtMapper.selectList(queryWrapper);
if (isQueryGroup && ObjectUtils.isNotEmpty(ivtList)) {
Set<String> colNumSet = ivtList.stream().map(BstIvtPackageinfoivt::getCol_num).collect(Collectors.toSet());
//无分组点位
if (colNumSet.contains("0")) {
return ivtList;
}
return bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_status, ivtType).in(BstIvtPackageinfoivt::getCol_num, colNumSet));
} else {
return ivtList;
}
}
/**
* 获取等待点

View File

@@ -132,6 +132,7 @@ public class TwoExceptionInTask extends AbstractAcsTask {
json.put("vehicle_code2", form.getString("vehicle_code2"));
json.put("point_code1", form.getString("point_code1"));
json.put("point_code2", form.getString("point_code2"));
json.put("remark",form.getString("remark"));
json.put("request_param", form.getString("request_param"));
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MultiSet;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
@@ -154,20 +155,31 @@ public class AutoSendVehicleToKzj extends Prun{
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
Set<String> task_block = new HashSet<>();
if (isCalling.equals(IOSEnum.IS_NOTANDYES.code(""))) {
//存在正在执行的行架任务
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code(""))
.eq(SchBaseTask::getTask_type, "010909"));
if (ObjectUtils.isNotEmpty(taskList)) {
taskList.forEach(task -> {
String point_code = task.getPoint_code1();
BstIvtPackageinfoivt one = packageinfoivtService.getOne(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getPoint_code, point_code));
task_block.add(one.getBlock());
});
/*if (ObjectUtils.isNotEmpty(taskList)) {
log.warn("当前装箱区存在执行的行架任务"+taskList.stream().map(SchBaseTask::getTask_code).collect(Collectors.joining(",")));
return;
}
}*/
}
//存在装箱区有空载具的点位
List<BstIvtPackageinfoivt> zxqVehicleList = packageinfoivtService
.selectEmpPoints(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"));
if (ObjectUtils.isNotEmpty(task_block)){
zxqVehicleList = zxqVehicleList.stream().filter(zxq -> !task_block.contains(zxq.getBlock())).collect(Collectors.toList());
}
List<BstIvtPackageinfoivt> djqEmpList = packageinfoivtService
.selectEmpPoints(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code(""));
if (CollectionUtils.isEmpty(zxqVehicleList) || CollectionUtils.isEmpty(djqEmpList)) {

View File

@@ -38,6 +38,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -49,7 +50,7 @@ import static org.nl.wms.util.TaskUtil.getMaxNum;
@Slf4j
@Component
@RequiredArgsConstructor
public class AutoSendZxToDjw extends Prun{
public class AutoSendZxToDjw extends Prun {
private final String THIS_CLASS = AutoSendZxToDjw.class.getName();
private final RedissonClient redissonClient;
@@ -79,13 +80,12 @@ public class AutoSendZxToDjw extends Prun{
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
//装箱区->装箱对接位agv自动搬运任务
@Autowired
public void run() {
try {
this.sendZxToDjw();
}catch (Exception ex){
} catch (Exception ex) {
log.error(ex.getMessage());
}
}
@@ -93,18 +93,29 @@ public class AutoSendZxToDjw extends Prun{
@SneakyThrows
public void sendZxToDjw() {
//装箱位有木箱
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "", PackageInfoIvtEnum.SORT_TYPE.code("升序"), PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask2(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "", PackageInfoIvtEnum.SORT_TYPE.code("升序"), PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
if (ObjectUtils.isEmpty(zxwPackageinfoivtList)) {
return;
}
int count = taskService.count(new QueryWrapper<SchBaseTask>()
.eq("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"))
.eq("is_delete", "0")
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
if (count>0){
Iterator<BstIvtPackageinfoivt> iterator = zxwPackageinfoivtList.iterator();
while (iterator.hasNext()) {
BstIvtPackageinfoivt r = iterator.next();
int count = taskService.count(new QueryWrapper<SchBaseTask>()
.eq("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"))
.eq("point_code2", r.getPoint_code())
.eq("is_delete", "0")
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
if (count > 0) {
iterator.remove();
}
}
if (ObjectUtils.isEmpty(zxwPackageinfoivtList)) {
return;
}
for (BstIvtPackageinfoivt bstIvtPackageinfoivt : zxwPackageinfoivtList) {
//装箱位上的木箱号
String boxNo = bstIvtPackageinfoivt.getContainer_name();
@@ -288,6 +299,4 @@ public class AutoSendZxToDjw extends Prun{
}
}

View File

@@ -64,7 +64,7 @@ public class AutobindZxqBox extends Prun {
//装箱区对接位
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("装箱位"))
.eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code(""))
// .eq(BstIvtPackageinfoivt::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
.eq(BstIvtPackageinfoivt::getPlan, IOSEnum.IS_NOTANDYES.code(""))
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code(""))
.orderByAsc(BstIvtPackageinfoivt::getPoint_code));

View File

@@ -154,6 +154,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
//异常位
jsonTaskParam.put("point_code2", "RK1003");
jsonTaskParam.put("vehicle_code", boxNo);
jsonTaskParam.put("remark", "当前托盘【"+whereJson.getString("vehicle_code")+"】已经绑定木箱【"+pcsn+"】,无法重复绑定!");
jsonTaskParam.put("vehicle_code2", whereJson.getString("vehicle_code"));
JSONObject request_param = new JSONObject();
if (whereJson.getString("vehicle_code").startsWith("A")) {