fix(ebom): 修复暂存和提交报错的问题
This commit is contained in:
parent
f8d5f29fbc
commit
be2a133e2b
|
|
@ -203,7 +203,6 @@ public class EBomEdit {
|
|||
//新增数据
|
||||
if (child.getRowId() == null || child.getRowId() == 0) {
|
||||
child.setRowId(IdWorker.getId());
|
||||
child.setIdentityNo(StrUtil.join("_", parentEntity.getRowId(), child.getRowId()));
|
||||
child.setSource(source);
|
||||
child.setCreatedTime(LocalDateTime.now());
|
||||
child.setCreatedBy(SessionUtil.getUserCode());
|
||||
|
|
@ -236,6 +235,7 @@ public class EBomEdit {
|
|||
}
|
||||
child.setInitialParentRowId(parentEntity.getRowId());
|
||||
}
|
||||
child.setIdentityNo(StrUtil.join("_", parentEntity.getRowId(), child.getRowId()));
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -275,17 +275,19 @@ public class EBomEdit {
|
|||
if (CollUtil.isEmpty(dto.getDatas())) {
|
||||
throw new NflgBusinessException(STATE.Error, "datas 数据不能为空");
|
||||
}
|
||||
|
||||
List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
List<String> materialNos = dto.getDatas().stream()
|
||||
.filter(f -> !StrUtil.equals(f.getProjectType(), BomConstant.PROJECT_TYPE_TEMPORARY, true))
|
||||
.map(BaseMaterialVO::getMaterialNo)
|
||||
.collect(Collectors.toList());
|
||||
if(materialNos.contains(dto.getParent().getMaterialNo())){
|
||||
VUtils.isTure(true).throwMessage(StrUtil.format("上下级存在相同物料{}",dto.getParent().getMaterialNo()));
|
||||
}
|
||||
materialNos.add(dto.getParent().getMaterialNo());
|
||||
//检查物料编码是否在主数据中存在
|
||||
//暂存不需检查,提交时检查
|
||||
if(ObjectUtil.equal(EbomEditStatusEnum.HANDLER_FINISHED.getValue(),dto.getOpType())) {
|
||||
materialNos.add(dto.getParent().getMaterialNo());
|
||||
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList());
|
||||
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
|
||||
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料主数据中不存在");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue