查询版本列表
This commit is contained in:
parent
7bca375eb1
commit
90a2847d03
|
|
@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ForwardReportVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReportBomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.ForwardReportService;
|
||||
import com.nflg.product.bomnew.service.ReverseReportService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -95,5 +92,17 @@ public class BomReportApi extends BaseApi {
|
|||
return ResultVO.success(forwardReportService.factoryBomType(query));
|
||||
}
|
||||
|
||||
@PostMapping("forwardVersion")
|
||||
@ApiOperation("bom-物料版本及描述")
|
||||
public ResultVO<ReportBomVersionVO> forwardVersion(@RequestBody ReverseReportQuery query) {
|
||||
ResultVO resultVO = checkQueryParam(query);
|
||||
if (resultVO != null) {
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
return ResultVO.success(forwardReportService.factoryVersion(query));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
|
@ -12,5 +14,8 @@ public class ReportBomVO {
|
|||
|
||||
private List<ForwardReportVO> childNodes;
|
||||
|
||||
|
||||
@ApiModelProperty("BOM 类型 0-原始BOM 1-EBom 2-PBom 3-MBom")
|
||||
private Integer bomType;
|
||||
@ApiModelProperty("查询方式 0-单层 1-多层 2-汇总")
|
||||
private Integer queryType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReportBomVersionVO {
|
||||
|
||||
@ApiModelProperty(value = "物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
@ApiModelProperty(value = "版本列表")
|
||||
private List<QueryBomVersionVO> vList;
|
||||
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
public static class QueryBomVersionVO {
|
||||
|
||||
// 版本:A00
|
||||
@ApiModelProperty(value = "版本")
|
||||
private String version;
|
||||
|
||||
// 版本描述:
|
||||
@ApiModelProperty(value = "版本描述")
|
||||
private String versionDesc;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.nflg.product.bomnew.constant.ReportConstant;
|
|||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.ForwardReportVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReportBomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReportBomVersionVO;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.EBomForwardReport;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -15,6 +16,35 @@ import java.util.List;
|
|||
public class ForwardReportService {
|
||||
|
||||
|
||||
public ReportBomVersionVO factoryVersion(ReverseReportQuery query) {
|
||||
|
||||
//原始BOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.ORIGINALBOM.getValue()) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//EBOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.EBOM.getValue()) == 0) {
|
||||
EBomForwardReport eBomForwardReport = new EBomForwardReport(query);
|
||||
return eBomForwardReport.bomVersion();
|
||||
|
||||
}
|
||||
|
||||
//PBOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.PBOM.getValue()) == 0) {
|
||||
return null;
|
||||
}
|
||||
//MBOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.MBOM.getValue()) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
VUtils.isTure(true).throwMessage("错误的BOM类型");
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ReportBomVO factoryBomType(ReverseReportQuery query) {
|
||||
//原始BOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.ORIGINALBOM.getValue()) == 0) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
|||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.ForwardReportVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReportBomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReportBomVersionVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomChildFormalService;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentFormalService;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import nflg.product.common.constant.STATE;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
|
@ -87,9 +89,62 @@ public class EBomForwardReport {
|
|||
}
|
||||
reportBomVO.setChildNodes(nodeList);
|
||||
}
|
||||
reportBomVO.setBomType(query.getBomType());
|
||||
reportBomVO.setQueryType(query.getQueryType());
|
||||
return reportBomVO;
|
||||
}
|
||||
|
||||
|
||||
public String getMaxVersion(){
|
||||
ReportBomVersionVO reportBomVersionVO= bomVersion();
|
||||
if(reportBomVersionVO.getVList().size()==1){
|
||||
return reportBomVersionVO.getVList().get(0).getVersion();
|
||||
}
|
||||
|
||||
String maxVersion=reportBomVersionVO.getVList().get(0).getVersion();
|
||||
for(int index=1;index<reportBomVersionVO.getVList().size();index++){
|
||||
String version=reportBomVersionVO.getVList().get(index).getVersion();
|
||||
if(VersionUtil.compare(version,maxVersion)>0){
|
||||
maxVersion=version;
|
||||
}
|
||||
}
|
||||
return maxVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ReportBomVersionVO bomVersion(){
|
||||
QueryWrapper<BomNewEbomParentFormalEntity> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(BomNewEbomParentFormalEntity::getMaterialNo,query.getMaterialNo());
|
||||
if(StrUtil.isNotBlank(query.getDrawingNo())){
|
||||
queryWrapper.lambda().eq(BomNewEbomParentFormalEntity::getDrawingNo,query.getDrawingNo());
|
||||
}
|
||||
queryWrapper.lambda().orderByAsc(BomNewEbomParentFormalEntity::getCurrentVersion);
|
||||
|
||||
// if(StrUtil.isNotBlank(query.getStartDate()) && StrUtil.isNotBlank(query.getEndDate()) ){
|
||||
// queryWrapper.lambda().between(BomNewEbomParentFormalEntity::getConvertToEbomTime, query.getStartDate(), query.getEndDate());
|
||||
// }
|
||||
|
||||
List<BomNewEbomParentFormalEntity> list= SpringUtil.getBean(BomNewEbomParentFormalService.class).list(queryWrapper);
|
||||
if(CollectionUtil.isEmpty(list)){
|
||||
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("未查到物料编码{}版本信息", query.getMaterialNo() ));
|
||||
}
|
||||
BomNewEbomParentFormalEntity item0=list.get(0);
|
||||
ReportBomVersionVO reportBomVersionVO=new ReportBomVersionVO();
|
||||
reportBomVersionVO.setMaterialDesc(item0.getMaterialDesc());
|
||||
reportBomVersionVO.setVList(new ArrayList<>());
|
||||
for (BomNewEbomParentFormalEntity entity:
|
||||
list ) {
|
||||
ReportBomVersionVO.QueryBomVersionVO versionVO=new ReportBomVersionVO.QueryBomVersionVO();
|
||||
versionVO.setVersion(entity.getCurrentVersion());
|
||||
reportBomVersionVO.getVList().add(versionVO);
|
||||
}
|
||||
return reportBomVersionVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ReportBomVO genReport(){
|
||||
|
||||
if (query.getQueryType().compareTo(ReportConstant.QueryTypeEnum.SINGLE.getValue()) == 0){
|
||||
|
|
@ -97,6 +152,7 @@ public class EBomForwardReport {
|
|||
}
|
||||
if ( query.getQueryType().compareTo(ReportConstant.QueryTypeEnum.MULTI.getValue()) == 0){
|
||||
|
||||
|
||||
}
|
||||
if ( query.getQueryType().compareTo(ReportConstant.QueryTypeEnum.SUM.getValue()) == 0) {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue