optimize(ebom): 优化从excel导入
This commit is contained in:
parent
d05db2d869
commit
5a78ef449a
|
|
@ -72,7 +72,7 @@ public class EbomV2Api extends BaseApi {
|
||||||
ebomParentService.getBaseMapper().updateRootState();
|
ebomParentService.getBaseMapper().updateRootState();
|
||||||
ebomParentService.getBaseMapper().updateRootForWaitReview();
|
ebomParentService.getBaseMapper().updateRootForWaitReview();
|
||||||
|
|
||||||
ebomParentService.resetAllBomExist();
|
ebomParentService.resetAllBomExist(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
VUtils.isTure(true).throwMessage("转换失败:" + e.getMessage());
|
VUtils.isTure(true).throwMessage("转换失败:" + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class EBomImportService {
|
||||||
|
|
||||||
save(pcs.getLeft(), pcs.getRight());
|
save(pcs.getLeft(), pcs.getRight());
|
||||||
|
|
||||||
bomNewEbomParentService.resetAllBomExist();
|
// bomNewEbomParentService.resetAllBomExist(pcs.getLeft().stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
|
|
||||||
bomNewEbomParentService.batchCheckAndSaveEBomException(importRoots.stream()
|
bomNewEbomParentService.batchCheckAndSaveEBomException(importRoots.stream()
|
||||||
.map(BomNewEbomParentEntity::getRowId)
|
.map(BomNewEbomParentEntity::getRowId)
|
||||||
|
|
@ -109,13 +109,15 @@ public class EBomImportService {
|
||||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||||
it.setCurrentVersion(p.getCurrentVersion());
|
it.setCurrentVersion(p.getCurrentVersion());
|
||||||
});
|
});
|
||||||
|
p.setLastVersionIs(0);
|
||||||
} else {
|
} else {
|
||||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||||
it.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(p.getCurrentVersion()));
|
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);
|
bomNewEbomParentService.saveBatch(parents);
|
||||||
bomNewEbomChildService.saveBatch(children);
|
bomNewEbomChildService.saveBatch(children);
|
||||||
}
|
}
|
||||||
|
|
@ -359,6 +361,7 @@ public class EBomImportService {
|
||||||
|
|
||||||
private void buildChild(List<BomNewEbomChildEntity> children, List<BaseMaterialVO> materialBaseInfos
|
private void buildChild(List<BomNewEbomChildEntity> children, List<BaseMaterialVO> materialBaseInfos
|
||||||
, EbomExcelDTO data, BomNewEbomParentEntity p, List<BomNewEbomParentEntity> parents) {
|
, EbomExcelDTO data, BomNewEbomParentEntity p, List<BomNewEbomParentEntity> parents) {
|
||||||
|
p.setBomExist(1);
|
||||||
BomNewEbomChildEntity child = new BomNewEbomChildEntity();
|
BomNewEbomChildEntity child = new BomNewEbomChildEntity();
|
||||||
child.setRowId(IdWorker.getId());
|
child.setRowId(IdWorker.getId());
|
||||||
child.setParentRowId(p.getRowId());
|
child.setParentRowId(p.getRowId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue