From 3a25f5d4bbddc4a36b6d365bb905583ee2fadfed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Tue, 27 Aug 2024 14:58:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=ACEBOM=E6=97=B6-=20PBOM=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=8A=A5=E9=94=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nflg/product/bomnew/api/user/PBomApi.java | 12 ++++++++++-- .../bomnew/service/BomNewPbomParentService.java | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) 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 b2ae99bd..1c55aa50 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 @@ -36,6 +36,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; /** @@ -288,11 +289,18 @@ public class PBomApi extends BaseApi { @PostMapping("realesePbom") @ApiOperation("发布Pbom") - @Transactional(rollbackFor = Exception.class) @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 df547cd1..49809aab 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 @@ -1116,7 +1116,7 @@ public class BomNewPbomParentService extends ServiceImpl= PBomStatusEnum.PUBLISH.getValue()).throwMessage("pbom已发布无需在发布,请刷新数据"); LogRecordContext.putVariable("bom", parent); @@ -1178,7 +1178,7 @@ public class BomNewPbomParentService extends ServiceImpl