feat(pbom): 添加获取单个节点异常状态接口

This commit is contained in:
曹鹏飞 2024-09-25 18:31:06 +08:00
parent 8dc82a054e
commit 99f49ac434
3 changed files with 78 additions and 4 deletions

View File

@ -19,6 +19,7 @@ import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity; import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery; import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery; import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.query.PBomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery; import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery;
import com.nflg.product.bomnew.pojo.vo.*; import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.*; import com.nflg.product.bomnew.service.*;
@ -448,4 +449,15 @@ public class PBomApi extends BaseApi {
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) { public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(bomNewPbomParentService.getBomException(query)); return ResultVO.success(bomNewPbomParentService.getBomException(query));
} }
/**
* 获取单个节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getSingleBomException")
@ApiOperation("获取单个节点异常状态")
public ResultVO<BomExceptionVO> getSingleBomException(@Valid @RequestBody @NotEmpty PBomExceptionQuery query) {
return ResultVO.success(bomNewPbomParentService.getSingleBomException(query));
}
} }

View File

@ -0,0 +1,36 @@
package com.nflg.product.bomnew.pojo.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author 曹鹏飞
* @date 2024/9/25 17:38:14
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-query-PBomExceptionQuery")
public class PBomExceptionQuery implements Serializable {
/**
* materialNo 物料编号
*/
@ApiModelProperty(value = "物料编号")
protected String materialNo;
/**
* drawingNo 图号
*/
@ApiModelProperty(value = "图号")
protected String drawingNo;
/**
* facCode 工厂编号
*/
@ApiModelProperty(value = "工厂编号")
protected String facCode;
}

View File

@ -27,10 +27,7 @@ import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.entity.*; import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery; import com.nflg.product.bomnew.pojo.query.*;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.query.CopyPBomV2Query;
import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery;
import com.nflg.product.bomnew.pojo.vo.*; import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.domain.PBom.*; import com.nflg.product.bomnew.service.domain.PBom.*;
import com.nflg.product.bomnew.service.domain.Sap; import com.nflg.product.bomnew.service.domain.Sap;
@ -2037,4 +2034,33 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
Collections.reverse(datas); Collections.reverse(datas);
return datas; return datas;
} }
public BomExceptionVO getSingleBomException(@Valid @NotEmpty PBomExceptionQuery query) {
List<String> materialNosOrDrawingNos = Collections.singletonList(StrUtil.isNotBlank(query.getMaterialNo()) ? query.getMaterialNo() : query.getDrawingNo());
List<BaseMaterialVO> materialVOS = materialMainService.initMaterialForAnyNo(materialNosOrDrawingNos);
BomExceptionVO vo = new BomExceptionVO();
BaseMaterialVO mVO = materialVOS.stream().findFirst().orElse(null);
if (Objects.nonNull(mVO)) {
vo.setMaterialNo(mVO.getMaterialNo());
if (!Objects.equals(mVO.getMaterialState(), MaterialGetEnum.MaterialStateEnum.OK.getValue())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
} else {
materialNosOrDrawingNos = pbomChildService.lambdaQuery()
.select(BomNewPbomChildEntity::getMaterialNo)
.eq(StrUtil.isNotBlank(query.getMaterialNo()), BomNewPbomChildEntity::getMaterialNo, query.getMaterialNo())
.eq(StrUtil.isNotBlank(query.getDrawingNo()), BomNewPbomChildEntity::getDrawingNo, query.getDrawingNo())
.eq(BomNewPbomChildEntity::getFacCode, query.getFacCode())
.list()
.stream().map(BomNewPbomChildEntity::getMaterialNo)
.collect(Collectors.toList());
materialVOS = materialMainService.initMaterialForAnyNo(materialNosOrDrawingNos);
if (materialVOS.stream().anyMatch(f -> !Objects.equals(f.getMaterialState(), MaterialGetEnum.MaterialStateEnum.OK.getValue()))) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
} else {
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
}
}
}
return vo;
}
} }