pbom-异常检查,变更记录

This commit is contained in:
大米 2024-09-26 17:19:28 +08:00
parent 0e47cbc96e
commit ad7afba8f0
6 changed files with 52 additions and 8 deletions

View File

@ -127,7 +127,7 @@ public class BomReportApi extends BaseApi {
@PostMapping("getUpdateLog")
@ApiOperation("bom-变更记录(和上一版本对比)")
public ResultVO<List<UpdateLogVO>> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 0-原始BOM 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) {
public ResultVO<List<UpdateLogVO>> getUpdateLog(@ApiParam("bom版本RowId") @RequestParam("bomRowId") Long bomRowId , @ApiParam("BOM 类型 1-EBom 2-PBom") @RequestParam("bomType") Integer bomType) {
return ResultVO.success(forwardReportService.getUpdateLog(bomRowId,bomType));
}

View File

@ -440,12 +440,11 @@ public class PBomApi extends BaseApi {
}
@GetMapping("checkException")
@PostMapping("checkException")
@ApiOperation("PBOM-数据异常检查")
@LogRecord(success = "PBom-BOM数据异常检查,操作结果:{{#_ret}}", bizNo = "{{#bomRowId.toString()}}", type = "PBom-数据异常检查")
public ResultVO<Boolean> checkException(@RequestParam("bomRowId") Long bomRowId, @ApiParam("pBomType:pbom类型 0- pBom工作表 1-pBOM正式表")@RequestParam("pBomType") Integer pBomType) {
public ResultVO<Boolean> checkException(@RequestBody PBomCheckExceptionDTO checkExceptionDTO) {
bomNewPbomParentService.checkException(bomRowId,pBomType);
bomNewPbomParentService.checkException(checkExceptionDTO.getBomRowId(),checkExceptionDTO.getPBomType());
return ResultVO.success(true);
}

View File

@ -0,0 +1,16 @@
package com.nflg.product.bomnew.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PBomCheckExceptionDTO {
@ApiModelProperty("BOM版本ID")
private Long bomRowId;
@ApiModelProperty("pbom类型 0- pBom工作表 1-pBOM正式表")
private Integer pBomType;
}

View File

@ -340,7 +340,7 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
@ApiModelProperty(value = "异常状态1=正常、2=冻结/完全弃用异常、3=递归异常、4=数据不完整异常、5=超级物料异常、6=重复异常 7=物料主数据不存在 8=项目类别为空 9=项目赋值异常(父级物料的项目类型为Q时子级中不能存在项目类别为Q的物料) 10=项目赋值异常(当父级物料的项目类型为F时子级中不能存在项目类型为F的物料) 11=未填写变更原因和技术通知单 12=数量需要用户确认 13=项目类型需要用户确认")
private Integer exceptionStatus;
private Integer exceptionStatus=1;
private static final long serialVersionUID = 1L;

View File

@ -2042,7 +2042,38 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
allBom.add(convert);
CheckPBomException checkException=new CheckPBomException(allBom);
checkException.initException();
savePBomException(allBom);
}
public void savePBomException(List<BomNewPbomParentVO> allBom){
//父级
List<BomNewPbomParentVO> parents = allBom.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents)) {
List<BomNewPbomParentEntity> pentList = new ArrayList<>();
parents.forEach(k -> {
BomNewPbomParentEntity pEnt = new BomNewPbomParentEntity();
pEnt.setRowId(k.getBomRowId());
pEnt.setExceptionStatus(k.getExceptionStatus());
pentList.add(pEnt);
});
if (CollUtil.isNotEmpty(pentList)) {
this.updateBatchById(pentList);
}
}
//子级
List<BomNewPbomParentVO> child = allBom.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0 && u.getExceptionStatus()>1).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents)) {
List<BomNewPbomChildEntity> childList = new ArrayList<>();
child.forEach(k -> {
BomNewPbomChildEntity pEnt = new BomNewPbomChildEntity();
pEnt.setRowId(k.getRowId());
pEnt.setExceptionStatus(k.getExceptionStatus());
childList.add(pEnt);
});
if (CollUtil.isNotEmpty(childList)) {
pbomChildService.updateBatchById(childList);
}
}
}

View File

@ -495,7 +495,6 @@ public class ForwardReportService {
newEnt.setOpType(BomConstant.DEL);
}
//新增
Set<String> add= Sets.difference(newSet,oldSet);
for (String item: add) {
@ -503,7 +502,6 @@ public class ForwardReportService {
updateLogVO.setOpType(BomConstant.ADD);
result.add(updateLogVO);
}
//都有比较编辑字段
Set<String> intersection = Sets.intersection(oldSet,newSet);
for (String item: intersection) {