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) lam.eq(PdmBiSlittingproductionplan::getResource_name, deviceCode)
.eq(PdmBiSlittingproductionplan::getIs_delete, "0") .eq(PdmBiSlittingproductionplan::getIs_delete, "0")
.apply("DATE(call_time) >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)") .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); return list(lam);
} }

View File

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

View File

@@ -1818,7 +1818,7 @@ public class SlitterServiceImpl implements SlitterService {
Deliverycachepointivt deliverycachepointivt = deliverycachepointivtService.getPintByCode(pointCode1, false); Deliverycachepointivt deliverycachepointivt = deliverycachepointivtService.getPintByCode(pointCode1, false);
if (ObjectUtil.isNotEmpty(deliverycachepointivt)) { if (ObjectUtil.isNotEmpty(deliverycachepointivt)) {
String parentContainer = "临时" + TaskUtils.getDateTime("yyMMddHHmmSSS") + "*"; String parentContainer = "临时虚拟" + TaskUtils.getDateTime("yyMMddHHmmSSS") + "*";
String qzzNo = resourceName.substring(0, 2) String qzzNo = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2) + resourceName.substring(resourceName.length() - 2)
+ "A" + "A"
@@ -4204,102 +4204,112 @@ public class SlitterServiceImpl implements SlitterService {
private void doBindNewPlanInfo(String shelfCode, String containerName, String force, String device) { private void doBindNewPlanInfo(String shelfCode, String containerName, String force, String device) {
Deliverycachepointivt shelf = deliverycachepointivtService.getPintByCode(shelfCode, true); Deliverycachepointivt shelf = deliverycachepointivtService.getPintByCode(shelfCode, true);
StIvtCutpointivt cutDevice = cutpointivtService.getPintByExtCode(device, false); StIvtCutpointivt cutDevice = cutpointivtService.getPintByExtCode(device, false);
if (ObjectUtil.isNotEmpty(shelf)) { if (ObjectUtil.isEmpty(shelf)) {
if (!"05".equals(shelf.getPoint_status())) { throw new BadRequestException("不存在气胀轴库:" + shelfCode);
throw new BadRequestException("点位" + shelfCode + "已经绑定过分切计划"); }
} if (!"05".equals(shelf.getPoint_status())) {
if (!shelf.getProduct_area().equals(cutDevice.getProduct_area()) || !shelf.getPlan().equals(cutDevice.getPlan())) { throw new BadRequestException("点位" + shelfCode + "已经绑定过分切计划");
throw new BadRequestException("分切机的区域与架子不在同一个子区域!"); }
} if (!shelf.getProduct_area().equals(cutDevice.getProduct_area()) || !shelf.getPlan().equals(cutDevice.getPlan())) {
List<PdmBiSlittingproductionplan> qzzs = slittingproductionplanService.getByQzzNoNotDeleted(shelf.getQzzno()); throw new BadRequestException("分切机的区域与架子不在同一个子区域!");
log.info("{} 架子的气胀轴信息:{}", shelfCode, JSONObject.toJSONString(qzzs)); }
PdmBiSlittingproductionplan planOne = slittingproductionplanService.getByContainerName(containerName); List<PdmBiSlittingproductionplan> xnPlans = slittingproductionplanService.getByQzzNoNotDeleted(shelf.getQzzno());
if (ObjectUtil.isEmpty(planOne)) { log.info("{} 架子的气胀轴信息:{}", shelfCode, JSONObject.toJSONString(xnPlans));
throw new BadRequestException("子卷:" + containerName + " 计划信息不存在!"); PdmBiSlittingproductionplan planOne = slittingproductionplanService.getByContainerName(containerName);
} if (ObjectUtil.isEmpty(planOne)) {
// 判断子卷有没有绑定到分切对接位上 throw new BadRequestException("子卷:" + containerName + " 计划信息不存在!");
List<BstIvtCutpointivt> alreadyBindPlans = bcutpointivtService.list(new LambdaQueryWrapper<BstIvtCutpointivt>() }
.eq(BstIvtCutpointivt::getIs_used, true) // 判断子卷有没有绑定到分切对接位上
.and(l -> l.eq(BstIvtCutpointivt::getQzz_no1, planOne.getQzzno()).or() List<BstIvtCutpointivt> alreadyBindPlans = bcutpointivtService.list(new LambdaQueryWrapper<BstIvtCutpointivt>()
.eq(BstIvtCutpointivt::getQzz_no2, planOne.getQzzno())) .eq(BstIvtCutpointivt::getIs_used, true)
); .and(l -> l.eq(BstIvtCutpointivt::getQzz_no1, planOne.getQzzno()).or()
if (!alreadyBindPlans.isEmpty()) { .eq(BstIvtCutpointivt::getQzz_no2, planOne.getQzzno()))
throw new BadRequestException("子卷:" + containerName + " 已经绑定过子卷到暂存架上!"); );
} if (!alreadyBindPlans.isEmpty()) {
// todo: 这台分切机已经绑定过其他子卷??? throw new BadRequestException("子卷:" + containerName + " 已经绑定过子卷到暂存架上!");
}
// todo: 这台分切机已经绑定过其他子卷???
if (ObjectUtil.isNotEmpty(planOne.getQzzno())) { if (ObjectUtil.isNotEmpty(planOne.getQzzno())) {
// 判断是不是绑定过的,就查一下这个气胀轴编码在缓存架子上存不存在 // 判断是不是绑定过的,就查一下这个气胀轴编码在缓存架子上存不存在
List<Deliverycachepointivt> list = deliverycachepointivtService.list(new LambdaQueryWrapper<Deliverycachepointivt>() List<Deliverycachepointivt> list = deliverycachepointivtService.list(new LambdaQueryWrapper<Deliverycachepointivt>()
.eq(Deliverycachepointivt::getQzzno, planOne.getQzzno())); .eq(Deliverycachepointivt::getQzzno, planOne.getQzzno()));
if (!list.isEmpty()) { if (!list.isEmpty()) {
throw new BadRequestException("子卷:" + containerName + "已经绑定过气胀轴"); throw new BadRequestException("子卷:" + containerName + "已经绑定过气胀轴");
}
} }
String resourceName = planOne.getResource_name(); }
LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new LambdaQueryWrapper<PdmBiSlittingproductionplan>() String resourceName = planOne.getResource_name();
.eq(PdmBiSlittingproductionplan::getResource_name, resourceName) LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
.eq(PdmBiSlittingproductionplan::getSplit_group, planOne.getSplit_group()) .eq(PdmBiSlittingproductionplan::getResource_name, resourceName)
.eq(PdmBiSlittingproductionplan::getUp_or_down, planOne.getUp_or_down()); .eq(PdmBiSlittingproductionplan::getIs_delete, "0")
if ("1".equals(planOne.getPaper_tube_or_FRP())) { .ne(PdmBiSlittingproductionplan::getStatus, "99")
lam.eq(PdmBiSlittingproductionplan::getParent_container_name, planOne.getParent_container_name()); .eq(PdmBiSlittingproductionplan::getSplit_group, planOne.getSplit_group())
} else { .eq(PdmBiSlittingproductionplan::getUp_or_down, planOne.getUp_or_down());
lam.eq(PdmBiSlittingproductionplan::getRestruct_container_name, planOne.getRestruct_container_name()); 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 (xnPlans.size() != list.size()) {
throw new BadRequestException("轴的卷数不匹配,不允许绑定!");
} }
List<PdmBiSlittingproductionplan> list = slittingproductionplanService.list(lam); for (int i = 0; i < list.size(); i++) {
if (!"1".equals(force)) { PdmBiSlittingproductionplan needPlan = list.get(i);
// 如果不强制绑定,就需要判断轴的规格对不对 for (PdmBiSlittingproductionplan qzz : xnPlans) {
if (qzzs.size() != list.size()) { if (qzz.getLeft_or_right().equals(needPlan.getLeft_or_right())) {
throw new BadRequestException("轴的卷数不匹配,不允许绑定!"); if (needPlan.getPaper_tube_or_FRP().equals("1")) {
} // 纸管
for (int i = 0; i < list.size(); i++) { if (!needPlan.getPaper_tube_material().equals(qzz.getPaper_tube_material())) {
PdmBiSlittingproductionplan needPlan = list.get(i); throw new BadRequestException("管芯不匹配,无法绑定!");
for (PdmBiSlittingproductionplan qzz : qzzs) { }
if (qzz.getLeft_or_right().equals(needPlan.getLeft_or_right())) { } else {
if (needPlan.getPaper_tube_or_FRP().equals("1")) { if (!needPlan.getFRP_material().equals(qzz.getFRP_material())) {
// 纸管 throw new BadRequestException("管芯不匹配,无法绑定!");
if (!needPlan.getPaper_tube_material().equals(qzz.getPaper_tube_material())) {
throw new BadRequestException("管芯不匹配,无法绑定!");
}
} else {
if (!needPlan.getFRP_material().equals(qzz.getFRP_material())) {
throw new BadRequestException("管芯不匹配,无法绑定!");
}
} }
} }
} }
} }
} }
}
String qzzNo = resourceName.substring(0, 2) String qzzNo = resourceName.substring(0, 2)
+ resourceName.substring(resourceName.length() - 2) + resourceName.substring(resourceName.length() - 2)
+ list.get(0).getSplit_group() + list.get(0).getSplit_group()
+ TaskUtils.getDateTime("yyMMddHHmmss") + "-" + TaskUtils.getDateTime("yyMMddHHmmss") + "-"
+ list.get(0).getUp_or_down(); + list.get(0).getUp_or_down();
// 绑定气胀轴和纸管重量 // 绑定气胀轴和纸管重量
list.forEach(plan -> { list.forEach(plan -> {
plan.setQzzno(qzzNo); plan.setQzzno(qzzNo);
for (int i = 0; i < qzzs.size(); i++) { if (!"1".equals(force)) {
PdmBiSlittingproductionplan shelfQzz = qzzs.get(i); for (int i = 0; i < xnPlans.size(); i++) {
PdmBiSlittingproductionplan shelfQzz = xnPlans.get(i);
if (plan.getLeft_or_right().equals(shelfQzz.getLeft_or_right())) { if (plan.getLeft_or_right().equals(shelfQzz.getLeft_or_right())) {
plan.setPaper_weight(shelfQzz.getPaper_weight()); plan.setPaper_weight(shelfQzz.getPaper_weight());
} }
} }
plan.setIs_call("1"); }
plan.setStatus("03"); plan.setIs_call("1");
plan.setUpdate_time(DateUtil.now()); plan.setStatus("03");
plan.setUpdate_optid(SecurityUtils.getCurrentUserId()); plan.setUpdate_time(DateUtil.now());
plan.setUpdate_optname(SecurityUtils.getCurrentNickName()); plan.setUpdate_optid(SecurityUtils.getCurrentUserId());
}); plan.setUpdate_optname(SecurityUtils.getCurrentNickName());
slittingproductionplanService.updateBatchById(list); });
slittingproductionplanService.deleteAll(qzzs.stream().map(PdmBiSlittingproductionplan::getWorkorder_id).collect(Collectors.toSet())); slittingproductionplanService.updateBatchById(list);
shelf.setQzzno(qzzNo); if (xnPlans.get(0).getContainer_name().contains("虚拟")) {
shelf.setPoint_status("03"); slittingproductionplanService.deleteAll(xnPlans.stream().map(PdmBiSlittingproductionplan::getWorkorder_id).collect(Collectors.toSet()));
shelf.setUpdate_optid(SecurityUtils.getCurrentUserId());
shelf.setUpdate_optname(SecurityUtils.getCurrentNickName());
shelf.setUpdate_time(DateUtil.now());
deliverycachepointivtService.updateById(shelf);
} }
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) { public List<String> getRedisListValue(String key) {

View File

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