fix(ebom):

1、31码下的所有物料都生成虚拟包后才能转pbom
2、31码只能生成1010的pbom
This commit is contained in:
曹鹏飞 2024-05-20 10:42:56 +08:00
parent 1055d24aba
commit 53760502e8
1 changed files with 18 additions and 5 deletions

View File

@ -838,11 +838,22 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//31 须有虚拟包 //31 须有虚拟包
List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds()); List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds());
VUtils.isTure(paramDto.getFacCodes().contains("1020") && parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31"))) // VUtils.isTure(paramDto.getFacCodes().contains("1020") && parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31")))
.throwMessage("31码不能生成仙桃(1020)的pbom"); // .throwMessage("31码不能生成仙桃(1020)的pbom");
VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0)) // VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0))
.throwMessage("31码须有虚拟包"); // .throwMessage("31码须有虚拟包");
parents.forEach(p -> {
if (p.getMaterialNo().startsWith("31")) {
List<String> errors = new ArrayList<>();
if (ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, p.getRowId())
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())
.exists()) {
errors.add(p.getMaterialNo() + "下还有未生成发货包的物料");
}
VUtils.isTure(CollUtil.isNotEmpty(errors)).throwMessage(StrUtil.join("<br/>", errors));
}
});
//检查该版本是否已转换过该工厂的Pbom //检查该版本是否已转换过该工厂的Pbom
for (BomNewEbomParentEntity parent : parents){ for (BomNewEbomParentEntity parent : parents){
List<BomNewPbomParentEntity> list = pBomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewPbomParentEntity::getCurrentVersion, parent.getCurrentVersion()) List<BomNewPbomParentEntity> list = pBomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewPbomParentEntity::getCurrentVersion, parent.getCurrentVersion())
@ -864,7 +875,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
parent.setChildBomRowId(parent.getRowId()); parent.setChildBomRowId(parent.getRowId());
parent.setParentRowId(0L); parent.setParentRowId(0L);
bomTree.add(parent); bomTree.add(parent);
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes(), 0L); EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree
, parent.getMaterialNo().startsWith("31") ? Collections.singletonList("1010") : paramDto.getFacCodes()
, 0L);
eBomToPBom.convert(); eBomToPBom.convert();
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) { if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {