|
|
@@ -89,11 +89,17 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ String sealNo = ObjectUtils.isNotNull(containers.getSealNo()) ? containers.getSealNo().toUpperCase() : "";
|
|
|
+ // 普柜可以设定为,铅封不能重复,但框架 FR FH这一类的,HMM要求录入NIL,MSK要求录入000000
|
|
|
+ Boolean isNilSealNo = "NIL".equals(sealNo) || "000000".equals(sealNo);
|
|
|
+
|
|
|
List<Containers> sealNoCount = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
|
- .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Containers::getIsDeleted, 0)
|
|
|
- .eq(Containers::getPid, containers.getPid())
|
|
|
- .eq(Containers::getSealNo, containers.getSealNo()));
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
+ .eq(Containers::getPid, containers.getPid())
|
|
|
+ .eq(Containers::getSealNo, sealNo));
|
|
|
+
|
|
|
List<Containers> cntrNoCount = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
|
.eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Containers::getIsDeleted, 0)
|
|
|
@@ -103,7 +109,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (ObjectUtils.isNotNull(containers.getCntrNo()) && !cntrNoCount.isEmpty()) {
|
|
|
throw new RuntimeException("箱号不允许重复");
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(containers.getSealNo()) && !sealNoCount.isEmpty()) {
|
|
|
+ if (!isNilSealNo && !sealNoCount.isEmpty()) {
|
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
|
}
|
|
|
containers.setCreateTime(new Date());
|
|
|
@@ -118,7 +124,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (ObjectUtils.isNotNull(containers.getCntrNo()) && cntrNoCount.stream().anyMatch(e -> !e.getId().equals(containers.getId()))) {
|
|
|
throw new RuntimeException("箱号不允许重复");
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(containers.getSealNo()) && sealNoCount.stream().anyMatch(e -> !e.getId().equals(containers.getId()))) {
|
|
|
+ if (!isNilSealNo && sealNoCount.stream().anyMatch(e -> !e.getId().equals(containers.getId()))) {
|
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
|
}
|
|
|
containers.setUpdateUser(AuthUtil.getUserId());
|
|
|
@@ -405,10 +411,12 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (cntrNo.size() != excelList.size()) {
|
|
|
throw new RuntimeException("箱号不允许重复");
|
|
|
}
|
|
|
+
|
|
|
List<String> sealNo = excelList.stream().map(BoxAndLeadSealNoExcel::getSealNo).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
if (sealNo.size() != excelList.size()) {
|
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
|
}
|
|
|
+
|
|
|
List<String> ids = excelList.stream().map(BoxAndLeadSealNoExcel::getId).distinct().collect(Collectors.toList());
|
|
|
List<Containers> list = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
|
.eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
@@ -510,6 +518,10 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
List<ContainersBills> subtractContainersBillsList = new ArrayList<>();
|
|
|
List<ContainersCommodity> containersCommodityList = new ArrayList<>();
|
|
|
for (Containers containers : list) {
|
|
|
+ String sealNo = ObjectUtils.isNotNull(containers.getSealNo()) ? containers.getSealNo().toUpperCase() : "";
|
|
|
+ // 普柜可以设定为,铅封不能重复,但框架 FR FH这一类的,HMM要求录入NIL,MSK要求录入000000
|
|
|
+ Boolean isNilSealNo = "NIL".equals(sealNo) || "000000".equals(sealNo);
|
|
|
+
|
|
|
List<Containers> sealNoCount = baseMapper.selectList(new LambdaQueryWrapper<Containers>()
|
|
|
.eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Containers::getIsDeleted, 0)
|
|
|
@@ -524,7 +536,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (ObjectUtils.isNotNull(containers.getCntrNo()) && !cntrNoCount.isEmpty()) {
|
|
|
throw new RuntimeException("箱号不允许重复");
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(containers.getSealNo()) && !sealNoCount.isEmpty()) {
|
|
|
+ if (!isNilSealNo && !sealNoCount.isEmpty()) {
|
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
|
}
|
|
|
containers.setCreateTime(new Date());
|
|
|
@@ -539,7 +551,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
|
|
|
if (ObjectUtils.isNotNull(containers.getCntrNo()) && cntrNoCount.stream().anyMatch(e -> !e.getId().equals(containers.getId()))) {
|
|
|
throw new RuntimeException("箱号不允许重复");
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(containers.getSealNo()) && sealNoCount.stream().anyMatch(e -> !e.getId().equals(containers.getId()))) {
|
|
|
+ if (!isNilSealNo && sealNoCount.stream().anyMatch(e -> !e.getId().equals(containers.getId()))) {
|
|
|
throw new RuntimeException("铅封号不允许重复");
|
|
|
}
|
|
|
containers.setUpdateUser(AuthUtil.getUserId());
|