opt: 查询是否存在任务正在搬运过来出现异常

This commit is contained in:
2025-06-25 10:03:27 +08:00
parent f72fd08c94
commit cb8e62b662
2 changed files with 56 additions and 34 deletions

View File

@@ -573,30 +573,38 @@ public class AutoCallAirShaftTask extends Prun {
// 兜底
needQuantity = needTemp > 0 ? needTemp : 1;
}
// 2.2 查询是否存在任务正在搬运过来。(路上的是另一台机构的轴)
List<MdPbPapervehicle> havePapers = papervehicleService.getInfoByTask();
if (CollectionUtil.isNotEmpty(havePapers)) {
Map<String, BigDecimal> sumByMaterialCode = havePapers.stream()
.collect(Collectors.groupingBy(
MdPbPapervehicle::getMaterial_code,
Collectors.mapping(
MdPbPapervehicle::getQty,
Collectors.reducing(
BigDecimal.ZERO,
BigDecimal::add
)
)
));
int sumQty = sumByMaterialCode.get(tubes.get(0)).intValue();
if (sumQty >= needQuantity ) {
stepErrorInfo.add("AGV正在搬运管芯...");
log.info("AGV正在搬运管芯...");
return true;
try {
// 2.2 查询是否存在任务正在搬运过来。(路上的是另一台机构的轴)
List<MdPbPapervehicle> havePapers = papervehicleService.getInfoByTask();
if (CollectionUtil.isNotEmpty(havePapers)) {
Map<String, BigDecimal> sumByMaterialCode = havePapers.stream()
.collect(Collectors.groupingBy(
MdPbPapervehicle::getMaterial_code,
Collectors.mapping(
MdPbPapervehicle::getQty,
Collectors.reducing(
BigDecimal.ZERO,
BigDecimal::add
)
)
));
BigDecimal qty = sumByMaterialCode.get(tubes.get(0));
if (ObjectUtil.isNotEmpty(qty)) {
int sumQty = qty.intValue();
if (sumQty >= needQuantity ) {
stepErrorInfo.add("AGV正在搬运管芯...");
log.info("AGV正在搬运管芯...");
return true;
}
// 如果不够,就计算还缺多少个
int needTemp = needQuantity - sumQty;
// 兜底
needQuantity = needTemp > 0 ? needTemp : tubes.size();
}
}
// 如果不够,就计算还缺多少个
int needTemp = needQuantity - sumQty;
// 兜底
needQuantity = needTemp > 0 ? needTemp : tubes.size();
} catch (Exception e) {
stepErrorInfo.add("查询是否存在任务正在搬运过来出现异常: " + e.getMessage());
log.error("查询是否存在任务正在搬运过来出现异常:{}", e);
}
// 2.3 查找type=0的位置(待命的托盘)中是否存在(需要判断的是单独一个托盘) 校验了不在搬运中
List<BhTubePointDto> stockingivtList = stockingivtService.getNeedPaperTubePoint("0", tubes.get(0), location);

View File

@@ -2,6 +2,7 @@ package org.nl.init;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
@@ -21,6 +22,7 @@ import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.dao.mapper.SchBasePointMapper;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.tasks.first_floor_area.*;
import org.nl.b_lms.sch.tasks.slitter.auto.AutoCallAirShaftTask;
import org.nl.b_lms.sch.tasks.slitter.service.impl.SlitterServiceImpl;
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
@@ -31,8 +33,12 @@ import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import oshi.SystemInfo;
import oshi.hardware.ComputerSystem;
import oshi.hardware.HardwareAbstractionLayer;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -76,11 +82,19 @@ public class EventTest {
private MdPbPapervehicleMapper papervehicleMapper;
@Autowired
private IPdmBiSlittingproductionplanService slittingproductionplanService;
@Autowired
private AutoCallAirShaftTask autoCallAirShaftTask;
@Test
public void sss() {
public void tests() {
// System.out.println(schBasePointMapper.queryKZPoint());
List<String> list = Arrays.asList("482210000000001");
System.out.println(papervehicleMapper.getGXs("0", list));
// List<String> list = Arrays.asList("482210000000001");
// System.out.println(papervehicleMapper.getGXs("0", list));
// PdmBiSlittingproductionplan byContainerName = slittingproductionplanService.getByContainerName("B1虚拟-B50FQ00001-2");
PdmBiSlittingproductionplan byContainerName = slittingproductionplanService.getByContainerName("B1虚拟-B50FQ00003-0");
List<PdmBiSlittingproductionplan> plans = new ArrayList<>();
plans.add(byContainerName);
BstIvtShafttubeivt shafttubeivt = bstIvtShafttubeivtMapper.selectOne(new LambdaQueryWrapper<BstIvtShafttubeivt>().eq(BstIvtShafttubeivt::getPoint_code, "B_CBJ01"));
autoCallAirShaftTask.toCallAgvMovePaperTube(plans, "0", shafttubeivt);
}
@Test
@@ -319,12 +333,12 @@ public class EventTest {
zxDjwTask.createTask(jo);
}
public static void main(String[] args) {
String name = "纸制筒管|纸管|6英寸|12|650";
if (name.contains("3英寸") || name.contains("3.12英寸")) {
System.out.println("4");
} else {
System.out.println("5");
}
}
// public static void main(String[] args) {
// String name = "纸制筒管|纸管|6英寸|12|650";
// if (name.contains("3英寸") || name.contains("3.12英寸")) {
// System.out.println("4");
// } else {
// System.out.println("5");
// }
// }
}