feat: 数据不一致增加子节点数量校验

This commit is contained in:
曹鹏飞 2024-04-07 20:55:09 +08:00
parent 0c358b6887
commit 1a0caf4017
1 changed files with 9 additions and 1 deletions

View File

@ -132,11 +132,19 @@ public class DQBomImportService {
if (oldParent != null) {
if (!parent.getMaterialUnit().equals(oldParent.getMaterialUnit())
|| !parent.getMaterialTexture().equals(oldParent.getMaterialTexture())) {
throw new NflgBusinessException(STATE.InconsistentDataError, "");
throw new NflgBusinessException(STATE.InconsistentDataError, "物料信息不一致");
}
List<String> cc = children.stream().filter(c -> c.getParentRowId().equals(parent.getRowId()))
.map(BomNewDQbomChildEntity::getMaterialNo)
.collect(Collectors.toList());
List<String> oc = dQBomChildService.lambdaQuery().eq(BomNewDQbomChildEntity::getParentRowId, oldParent.getRowId())
.list()
.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList());
if (cc.size() != oc.size()) {
throw new NflgBusinessException(STATE.InconsistentDataError, "子级节点数量不一致");
}
List<BomNewDQbomParentEntity> ps = parents.stream().filter(p -> cc.contains(p.getMaterialNo()))
.collect(Collectors.toList());
for (BomNewDQbomParentEntity p : ps) {