optimize(ebom): 优化从excel导入

This commit is contained in:
曹鹏飞 2024-06-20 15:31:37 +08:00
parent d05db2d869
commit 5a78ef449a
2 changed files with 6 additions and 3 deletions

View File

@ -72,7 +72,7 @@ public class EbomV2Api extends BaseApi {
ebomParentService.getBaseMapper().updateRootState();
ebomParentService.getBaseMapper().updateRootForWaitReview();
ebomParentService.resetAllBomExist();
ebomParentService.resetAllBomExist(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
} catch (Exception e) {
VUtils.isTure(true).throwMessage("转换失败:" + e.getMessage());
} finally {

View File

@ -81,7 +81,7 @@ public class EBomImportService {
save(pcs.getLeft(), pcs.getRight());
bomNewEbomParentService.resetAllBomExist();
// bomNewEbomParentService.resetAllBomExist(pcs.getLeft().stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
bomNewEbomParentService.batchCheckAndSaveEBomException(importRoots.stream()
.map(BomNewEbomParentEntity::getRowId)
@ -109,13 +109,15 @@ public class EBomImportService {
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
it.setCurrentVersion(p.getCurrentVersion());
});
p.setLastVersionIs(0);
} else {
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
it.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(p.getCurrentVersion()));
});
}
});
bomNewEbomParentService.setLastVersionIs0(pMaterialNos);
//bomNewEbomParentService.setLastVersionIs0(oldParents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
bomNewEbomParentService.updateBatchById(oldParents.stream().filter(f -> f.getLastVersionIs() == 0).collect(Collectors.toList()));
bomNewEbomParentService.saveBatch(parents);
bomNewEbomChildService.saveBatch(children);
}
@ -359,6 +361,7 @@ public class EBomImportService {
private void buildChild(List<BomNewEbomChildEntity> children, List<BaseMaterialVO> materialBaseInfos
, EbomExcelDTO data, BomNewEbomParentEntity p, List<BomNewEbomParentEntity> parents) {
p.setBomExist(1);
BomNewEbomChildEntity child = new BomNewEbomChildEntity();
child.setRowId(IdWorker.getId());
child.setParentRowId(p.getRowId());