diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 4143a67a..ecf558c4 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -35,6 +35,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.ExecutionException; /** @@ -289,8 +290,16 @@ public class PBomApi extends BaseApi { @ApiOperation("发布Pbom") @LogRecord(success = "发布PBom,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}} 操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "发布PBom") public ResultVO> realesePbom(@Valid @RequestBody @NotNull PbomImportToSAPQuery query) { - bomNewPbomParentService.realesePbom(query.getRootBomRowId()); + BomNewPbomParentEntity parent = bomNewPbomParentService.realesePbom(query.getRootBomRowId()); + BomNewPbomParentEntity parentEnt = bomNewPbomParentService.getById(query.getRootBomRowId()); + if(Objects.isNull(parentEnt)){ + parentEnt = bomNewPbomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()) + .eq(BomNewPbomParentEntity::getFacCode, parent.getFacCode()) + .last(" order by current_version desc limit 1").one(); + query.setRootBomRowId(parentEnt.getRowId()); + } return ResultVO.success(bomNewPbomParentService.importToSAP2(query)); + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 5b3dca9e..26aae4f9 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -1118,7 +1118,7 @@ public class BomNewPbomParentService extends ServiceImpl= PBomStatusEnum.PUBLISH.getValue()).throwMessage("pbom已发布无需在发布,请刷新数据"); LogRecordContext.putVariable("bom", parent); @@ -1161,7 +1161,7 @@ public class BomNewPbomParentService extends ServiceImpl