fix:修复装箱位子卷状态为合格品,临时插入子卷信息重复校验

This commit is contained in:
2024-07-03 09:40:58 +08:00
parent 2d53076a8f
commit dc5e96e117
3 changed files with 39 additions and 6 deletions

View File

@@ -2,6 +2,8 @@ package org.nl.b_lms.pdm.subpackagerelation.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.StopWatch;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -744,6 +746,39 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
if (StrUtil.isEmpty(containerName)) {
throw new BadRequestException("输入的子卷号不能为空!");
}
List<PdmBiSubpackagerelation> subList = this.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, jo.getString("container_name")));
if (CollectionUtils.isEmpty(subList)) {
PdmBiSlittingproductionplan plan = iPdmBiSlittingproductionplanService.getOne(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, containerName));
if (ObjectUtil.isEmpty(plan)) {
throw new BadRequestException("未查询到可用的分切计划!");
}
PdmBiSubpackagerelation sub = new PdmBiSubpackagerelation();
sub.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId() + "");
sub.setContainer_name(plan.getContainer_name());
sub.setSale_order_name(plan.getSale_order_name());
sub.setCustomer_name("test");
sub.setCustomer_description("临时包装关系");
sub.setProduct_description(plan.getDescription());
sub.setWidth(String.valueOf(plan.getSplit_breadth()));
if (StringUtils.isBlank(plan.getWeight()) || StringUtils.isBlank(plan.getPaper_weight())) {
throw new BadRequestException("该子卷分切计划中的子卷重量参数为空!");
}
int net_weight = Integer.parseInt(plan.getWeight()) - Integer.parseInt(plan.getPaper_weight());
sub.setNet_weight(net_weight + "");
sub.setLength("1000");
sub.setIs_un_plan_production("0");
sub.setCreate_id(1L);
sub.setCreate_name("管理员");
sub.setCreate_time(DateUtil.now());
sub.setStatus("99");
sub.setSap_pcsn("Test");
sub.setExt_code("BC01");
sub.setBox_group(null);
sub.setProduct_name("测试");
this.saveOrUpdate(sub);
}
}
@@ -770,7 +805,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱已出库,请重新选择未分配木箱规格的子卷");
}
//均衡获取木箱出库装箱区对接位
String deviceCode = getPointCode();
// String deviceCode = getPointCode();
String deviceCode = "ZXQ_1_1";
Integer taskCount = bstIvtPackageinfoivtMapper.getZxqTaskCount(deviceCode.substring(deviceCode.lastIndexOf("_") + 1));
if (taskCount + packagerelationList.size() > 10) {
throw new BadRequestException("子卷搬运任务数已达上限!");
@@ -811,7 +847,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer
maxBoxGroup, String boxType) {
//均衡获取装箱对接位
//String deviceCode = "ZXQ_1_1";
StopWatch stopWatch = new StopWatch();
stopWatch.start();
JSONObject boxInfo = new JSONObject();
@@ -823,7 +858,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
stopWatch.stop();
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
//String boxSn = "MX230118000013";
//String boxSn = "MX240702000169";
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//更新及子卷包装状态已分配规格及木箱规格组

View File

@@ -548,9 +548,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
result.put("message", "子卷号或子卷品质为空");
return result;
}
subpackagerelationService.createSubTest(whereJson);
//"有子卷","2","合格品","3","管制品","4"
BstIvtPackageinfoivt dto = bstIvtPackageinfoivtMapper.selectOne(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getContainer_name, whereJson.getString("container_name")));
if (dto == null) {

View File

@@ -82,7 +82,7 @@ public class AutoSendZxToDjw {
return;
}
//装箱区有子卷且没有正在进行的装箱任务
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), "", "", "");
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("合格品"), "", "", "");
if (CollectionUtils.isEmpty(zxqPackageinfoivtList)) {
return;
}