fix: 分切计划绑定气胀轴

This commit is contained in:
2026-08-14 17:42:37 +08:00
parent e3d169901b
commit 1cffa4380a
4 changed files with 108 additions and 88 deletions

View File

@@ -261,7 +261,7 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
lam.eq(PdmBiSlittingproductionplan::getResource_name, deviceCode)
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
.apply("DATE(call_time) >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)")
.orderByAsc(PdmBiSlittingproductionplan::getCall_time, PdmBiSlittingproductionplan::getStatus);
.orderByAsc(PdmBiSlittingproductionplan::getStatus, PdmBiSlittingproductionplan::getWorkorder_id);
return list(lam);
}

View File

@@ -195,7 +195,7 @@ public class AutoSendAirShaftAgvTask {
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyAirShaftAgvPointNotTask(
area,
SlitterTaskUtil.getPointLocationInCutDeviceXn(
SlitterTaskUtil.getNumberByResourceCode(demoPlan.getResource_name())),
SlitterTaskUtil.getNumberByResourceCode(demoPlan.getResource_name()), area),
deviceCut.getPlan());
if (emptyPoint.isEmpty()) {
log.warn("当前分切机找不到空闲的对接位置!");

View File

@@ -1818,7 +1818,7 @@ public class SlitterServiceImpl implements SlitterService {
Deliverycachepointivt deliverycachepointivt = deliverycachepointivtService.getPintByCode(pointCode1, false);
if (ObjectUtil.isNotEmpty(deliverycachepointivt)) {
String parentContainer = "临时" + TaskUtils.getDateTime("yyMMddHHmmSSS") + "*";
String parentContainer = "临时虚拟" + TaskUtils.getDateTime("yyMMddHHmmSSS") + "*";
String qzzNo = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2)
+ "A"
@@ -4204,15 +4204,17 @@ public class SlitterServiceImpl implements SlitterService {
private void doBindNewPlanInfo(String shelfCode, String containerName, String force, String device) {
Deliverycachepointivt shelf = deliverycachepointivtService.getPintByCode(shelfCode, true);
StIvtCutpointivt cutDevice = cutpointivtService.getPintByExtCode(device, false);
if (ObjectUtil.isNotEmpty(shelf)) {
if (ObjectUtil.isEmpty(shelf)) {
throw new BadRequestException("不存在气胀轴库:" + shelfCode);
}
if (!"05".equals(shelf.getPoint_status())) {
throw new BadRequestException("点位" + shelfCode + "已经绑定过分切计划");
}
if (!shelf.getProduct_area().equals(cutDevice.getProduct_area()) || !shelf.getPlan().equals(cutDevice.getPlan())) {
throw new BadRequestException("分切机的区域与架子不在同一个子区域!");
}
List<PdmBiSlittingproductionplan> qzzs = slittingproductionplanService.getByQzzNoNotDeleted(shelf.getQzzno());
log.info("{} 架子的气胀轴信息:{}", shelfCode, JSONObject.toJSONString(qzzs));
List<PdmBiSlittingproductionplan> xnPlans = slittingproductionplanService.getByQzzNoNotDeleted(shelf.getQzzno());
log.info("{} 架子的气胀轴信息:{}", shelfCode, JSONObject.toJSONString(xnPlans));
PdmBiSlittingproductionplan planOne = slittingproductionplanService.getByContainerName(containerName);
if (ObjectUtil.isEmpty(planOne)) {
throw new BadRequestException("子卷:" + containerName + " 计划信息不存在!");
@@ -4239,22 +4241,27 @@ public class SlitterServiceImpl implements SlitterService {
String resourceName = planOne.getResource_name();
LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
.eq(PdmBiSlittingproductionplan::getResource_name, resourceName)
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
.ne(PdmBiSlittingproductionplan::getStatus, "99")
.eq(PdmBiSlittingproductionplan::getSplit_group, planOne.getSplit_group())
.eq(PdmBiSlittingproductionplan::getUp_or_down, planOne.getUp_or_down());
if ("1".equals(planOne.getPaper_tube_or_FRP())) {
if ("1".equals(planOne.getOrder_type())) {
lam.eq(PdmBiSlittingproductionplan::getParent_container_name, planOne.getParent_container_name());
} else {
lam.eq(PdmBiSlittingproductionplan::getRestruct_container_name, planOne.getRestruct_container_name());
}
List<PdmBiSlittingproductionplan> list = slittingproductionplanService.list(lam);
if (list.size() > 2) {
throw new BadRequestException("数据异常!请联系管理员!");
}
if (!"1".equals(force)) {
// 如果不强制绑定,就需要判断轴的规格对不对
if (qzzs.size() != list.size()) {
if (xnPlans.size() != list.size()) {
throw new BadRequestException("轴的卷数不匹配,不允许绑定!");
}
for (int i = 0; i < list.size(); i++) {
PdmBiSlittingproductionplan needPlan = list.get(i);
for (PdmBiSlittingproductionplan qzz : qzzs) {
for (PdmBiSlittingproductionplan qzz : xnPlans) {
if (qzz.getLeft_or_right().equals(needPlan.getLeft_or_right())) {
if (needPlan.getPaper_tube_or_FRP().equals("1")) {
// 纸管
@@ -4270,7 +4277,6 @@ public class SlitterServiceImpl implements SlitterService {
}
}
}
String qzzNo = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2)
+ list.get(0).getSplit_group()
@@ -4279,12 +4285,14 @@ public class SlitterServiceImpl implements SlitterService {
// 绑定气胀轴和纸管重量
list.forEach(plan -> {
plan.setQzzno(qzzNo);
for (int i = 0; i < qzzs.size(); i++) {
PdmBiSlittingproductionplan shelfQzz = qzzs.get(i);
if (!"1".equals(force)) {
for (int i = 0; i < xnPlans.size(); i++) {
PdmBiSlittingproductionplan shelfQzz = xnPlans.get(i);
if (plan.getLeft_or_right().equals(shelfQzz.getLeft_or_right())) {
plan.setPaper_weight(shelfQzz.getPaper_weight());
}
}
}
plan.setIs_call("1");
plan.setStatus("03");
plan.setUpdate_time(DateUtil.now());
@@ -4292,14 +4300,16 @@ public class SlitterServiceImpl implements SlitterService {
plan.setUpdate_optname(SecurityUtils.getCurrentNickName());
});
slittingproductionplanService.updateBatchById(list);
slittingproductionplanService.deleteAll(qzzs.stream().map(PdmBiSlittingproductionplan::getWorkorder_id).collect(Collectors.toSet()));
if (xnPlans.get(0).getContainer_name().contains("虚拟")) {
slittingproductionplanService.deleteAll(xnPlans.stream().map(PdmBiSlittingproductionplan::getWorkorder_id).collect(Collectors.toSet()));
}
shelf.setQzzno(qzzNo);
shelf.setPoint_status("03");
shelf.setUpdate_optid(SecurityUtils.getCurrentUserId());
shelf.setUpdate_optname(SecurityUtils.getCurrentNickName());
shelf.setUpdate_time(DateUtil.now());
deliverycachepointivtService.updateById(shelf);
}
}
public List<String> getRedisListValue(String key) {

View File

@@ -353,8 +353,18 @@ public class SlitterTaskUtil {
return "1";
}
public static String getPointLocationInCutDeviceXn(int num) {
return num <= 2 ? "0" : "1";
public static String getPointLocationInCutDeviceXn(int num, String area) {
if (area.equals(B1_AREA_CODE)) {
if (num <= 2) {
return "0";
}
}
if (area.equals(B2_AREA_CODE)) {
if (num > 2) {
return "0";
}
}
return "1";
}
/**