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

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

View File

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