转EBOM时- PBOM发布报错修复

This commit is contained in:
大米 2024-08-27 14:58:56 +08:00
parent a77936dc42
commit 2990decaff
2 changed files with 12 additions and 3 deletions

View File

@ -35,6 +35,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
/** /**
@ -289,8 +290,16 @@ public class PBomApi extends BaseApi {
@ApiOperation("发布Pbom") @ApiOperation("发布Pbom")
@LogRecord(success = "发布PBom物料编码{{#bom.materialNo}}-版本:{{#bom.currentVersion}} 操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "发布PBom") @LogRecord(success = "发布PBom物料编码{{#bom.materialNo}}-版本:{{#bom.currentVersion}} 操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "发布PBom")
public ResultVO<List<OperationErrorMsgVO>> realesePbom(@Valid @RequestBody @NotNull PbomImportToSAPQuery query) { public ResultVO<List<OperationErrorMsgVO>> 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)); return ResultVO.success(bomNewPbomParentService.importToSAP2(query));
} }

View File

@ -1118,7 +1118,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
* @param bomRowId * @param bomRowId
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean realesePbom(Long bomRowId) { public BomNewPbomParentEntity realesePbom(Long bomRowId) {
BomNewPbomParentEntity parent = this.getById(bomRowId); BomNewPbomParentEntity parent = this.getById(bomRowId);
VUtils.isTure(parent.getStatus() >= PBomStatusEnum.PUBLISH.getValue()).throwMessage("pbom已发布无需在发布请刷新数据"); VUtils.isTure(parent.getStatus() >= PBomStatusEnum.PUBLISH.getValue()).throwMessage("pbom已发布无需在发布请刷新数据");
LogRecordContext.putVariable("bom", parent); LogRecordContext.putVariable("bom", parent);
@ -1161,7 +1161,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
log.error("realesePbom", ex); log.error("realesePbom", ex);
throw new NflgBusinessException(STATE.BusinessError, "发布Pbom失败" + ex.getMessage()); throw new NflgBusinessException(STATE.BusinessError, "发布Pbom失败" + ex.getMessage());
} }
return true; return parent;
} }