feat(ebom): 导入到sap时,如果是直发包,且没有下级,则不要提交到sap去

This commit is contained in:
曹鹏飞 2024-05-28 11:11:21 +08:00
parent 7717cecc5a
commit 4aeb7db929
1 changed files with 14 additions and 6 deletions

View File

@ -1007,7 +1007,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
.list();
if (CollUtil.isNotEmpty(children)) {
String dateYMD = DateUtil.format(new Date(), "yyyyMMdd");
children.forEach(c -> {
for (BomNewEbomChildEntity c : children) {
BomNewEbomParentEntity cp = lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo())
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.orderByDesc(BomNewEbomParentEntity::getRowId)
.last(" limit 1")
.one();
if (Objects.equals(c.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())) {
if (Objects.nonNull(cp) && !ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, cp.getRowId()).exists()) {
continue;
}
}
T1DTO t1 = new T1DTO();
t1.setID(RandomUtil.randomNumbers(5));
t1.setMATNR(parent.getMaterialNo());
@ -1021,14 +1032,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
t1.setDATUM(dateYMD);
t1s.add(t1);
BomNewEbomParentEntity cp = lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, c.getMaterialNo())
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.one();
if (!Objects.isNull(cp)) {
buildChildrenForSap(cp, t1s);
}
});
}
}
}