fix(dqbom): 修复一些问题
This commit is contained in:
parent
c99cbcf852
commit
04516d4d2f
|
|
@ -247,20 +247,23 @@ public class DQBomImportService {
|
|||
.map(d -> OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "编号和图号都为空"))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
List<BaseMaterialVO> materialBaseInfos;
|
||||
//如果编号不为空,则图号使用主物料图号
|
||||
List<String> materialNos = datas.stream()
|
||||
.map(DQbomExcelVO::getMaterialNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<BaseMaterialVO> materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos);
|
||||
for (DQbomExcelVO d : datas) {
|
||||
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||
.filter(m -> m.getMaterialNo().equals(d.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(vo)) {
|
||||
d.setDrawingNo(vo.getDrawingNo());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos);
|
||||
for (DQbomExcelVO d : datas) {
|
||||
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||
.filter(m -> m.getMaterialNo().equals(d.getMaterialNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(vo)) {
|
||||
d.setDrawingNo(vo.getDrawingNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -270,17 +273,19 @@ public class DQBomImportService {
|
|||
.map(DQbomExcelVO::getDrawingNo)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
materialBaseInfos = SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(drawingNos);
|
||||
for (DQbomExcelVO d : datas) {
|
||||
if (StrUtil.isNotBlank(d.getDrawingNo()) && StrUtil.isBlank(d.getMaterialNo())) {
|
||||
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||
.filter(m -> m.getDrawingNo().equals(d.getDrawingNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(vo)) {
|
||||
d.setMaterialNo(vo.getMaterialNo());
|
||||
} else {
|
||||
errorMsg.add(OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "图号不存在"));
|
||||
if (CollUtil.isNotEmpty(drawingNos)) {
|
||||
materialBaseInfos = SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(drawingNos);
|
||||
for (DQbomExcelVO d : datas) {
|
||||
if (StrUtil.isNotBlank(d.getDrawingNo()) && StrUtil.isBlank(d.getMaterialNo())) {
|
||||
BaseMaterialVO vo = materialBaseInfos.stream()
|
||||
.filter(m -> m.getDrawingNo().equals(d.getDrawingNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(vo)) {
|
||||
d.setMaterialNo(vo.getMaterialNo());
|
||||
} else {
|
||||
errorMsg.add(OperationErrorMsgVO.create("第" + d.getRowNum() + "行", "图号不存在"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -593,13 +593,6 @@ public class DQBomService {
|
|||
wrapper.eq(BomNewDQbomParentEntity::getMaterialNo, parent.getMaterialNo());
|
||||
wrapper.ne(BomNewDQbomParentEntity::getRowId, parent.getRowId());
|
||||
dQBomParentService.getBaseMapper().delete(wrapper);
|
||||
List<BomNewDQbomChildEntity> cc = dQBomChildService.getByParentRowId(parent.getRowId());
|
||||
cc.forEach(c -> {
|
||||
c.setStatus(2);
|
||||
c.setEditStatus(2);
|
||||
c.setModifyTime(LocalDateTime.now());
|
||||
});
|
||||
children.addAll(cc);
|
||||
|
||||
BomNewPbomParentEntity pp = bomNewPbomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo())
|
||||
.orderByDesc(BomNewPbomParentEntity::getRowId)
|
||||
|
|
@ -611,20 +604,9 @@ public class DQBomService {
|
|||
, parent.getCurrentVersion(), pp.getCurrentVersion()));
|
||||
} else {
|
||||
if (pp.getStatus() >= 4) {
|
||||
// List<BomNewDQbomVO> dqChildren = getChild(parent.getRowId());
|
||||
// Set<String> pChildren = bomNewPbomChildService.lambdaQuery()
|
||||
// .select(BomNewPbomChildEntity::getMaterialNo)
|
||||
// .eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId())
|
||||
// .list()
|
||||
// .stream()
|
||||
// .map(BomNewPbomChildEntity::getMaterialNo)
|
||||
// .collect(Collectors.toSet());
|
||||
// if (dqChildren.size() != pChildren.size()
|
||||
// || !Sets.difference(dqChildren.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toSet()), pChildren).isEmpty()) {
|
||||
parent.setCurrentVersion(VersionUtil.getNextVersion(pp.getCurrentVersion()));
|
||||
pp.setLastVersionIs(0);
|
||||
bomNewPbomParentService.updateById(pp);
|
||||
// }
|
||||
} else {
|
||||
parent.setCurrentVersion(pp.getCurrentVersion());
|
||||
bomNewPbomParentService.getBaseMapper().deleteById(pp.getRowId());
|
||||
|
|
@ -636,11 +618,20 @@ public class DQBomService {
|
|||
parent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||
}
|
||||
//处理子级
|
||||
dQBomParentService.lambdaQuery()
|
||||
.in(BomNewDQbomParentEntity::getMaterialNo, cc.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList()))
|
||||
.eq(BomNewDQbomParentEntity::getStatus, 1)
|
||||
.list()
|
||||
.forEach(p -> buildTree(p, parents, children));
|
||||
List<BomNewDQbomChildEntity> cc = dQBomChildService.getByParentRowId(parent.getRowId());
|
||||
if (CollUtil.isNotEmpty(cc)) {
|
||||
cc.forEach(c -> {
|
||||
c.setStatus(2);
|
||||
c.setEditStatus(2);
|
||||
c.setModifyTime(LocalDateTime.now());
|
||||
});
|
||||
children.addAll(cc);
|
||||
dQBomParentService.lambdaQuery()
|
||||
.in(BomNewDQbomParentEntity::getMaterialNo, cc.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList()))
|
||||
.eq(BomNewDQbomParentEntity::getStatus, 1)
|
||||
.list()
|
||||
.forEach(p -> buildTree(p, parents, children));
|
||||
}
|
||||
}
|
||||
|
||||
private int versionCompare(String version1, String version2) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue