ebom
This commit is contained in:
parent
b860ed2de6
commit
903c218c08
|
|
@ -3,8 +3,11 @@ package com.nflg.product.bomnew.api.user;
|
|||
|
||||
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.service.ForwardReportService;
|
||||
import com.nflg.product.bomnew.service.ReverseReportService;
|
||||
|
|
@ -31,6 +34,7 @@ public class BomReportApi extends BaseApi {
|
|||
|
||||
@Resource
|
||||
ForwardReportService forwardReportService;
|
||||
|
||||
@PostMapping("reverseReport")
|
||||
@ApiOperation("bom-反查")
|
||||
public ResultVO<Page<ReverseReportVO>> reverseReport(@RequestBody ReverseReportQuery query) {
|
||||
|
|
@ -38,24 +42,57 @@ public class BomReportApi extends BaseApi {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("forwardReport")
|
||||
@ApiOperation("bom-正查")
|
||||
public ResultVO<List<ReverseReportVO>> forwardReport(@RequestBody ReverseReportQuery query) {
|
||||
ResultVO checkQueryParam(ReverseReportQuery query) {
|
||||
if (query == null) {
|
||||
return ResultVO.error(STATE.ParamErr, "未选择填写参数");
|
||||
}
|
||||
|
||||
if (Objects.isNull(query.getBomType())) {
|
||||
return ResultVO.error(STATE.ParamErr, "请选择BOM类型");
|
||||
} else {
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.ORIGINALBOM.getValue()) != 0
|
||||
|| query.getBomType().compareTo(ReportConstant.BomTypeEnum.EBOM.getValue()) != 0
|
||||
|| query.getBomType().compareTo(ReportConstant.BomTypeEnum.PBOM.getValue()) != 0
|
||||
|| query.getBomType().compareTo(ReportConstant.BomTypeEnum.MBOM.getValue()) != 0) {
|
||||
return ResultVO.error(STATE.ParamErr, "错误的BOM类型");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Objects.isNull(query.getQueryType())) {
|
||||
return ResultVO.error(STATE.ParamErr, "请选择查询方式");
|
||||
} else {
|
||||
if (query.getBomType().compareTo(ReportConstant.QueryTypeEnum.SINGLE.getValue()) != 0
|
||||
|| query.getBomType().compareTo(ReportConstant.QueryTypeEnum.MULTI.getValue()) != 0
|
||||
|| query.getBomType().compareTo(ReportConstant.QueryTypeEnum.SUM.getValue()) != 0) {
|
||||
return ResultVO.error(STATE.ParamErr, "错误的查询方式");
|
||||
}
|
||||
if (Objects.isNull(query.getBomVersion())) {
|
||||
return ResultVO.error(STATE.ParamErr, "请选择版本策略");
|
||||
}
|
||||
|
||||
forwardReportService.factoryBomType(query);
|
||||
return ResultVO.success();
|
||||
if (Objects.isNull(query.getBomVersion())) {
|
||||
return ResultVO.error(STATE.ParamErr, "请选择版本策略");
|
||||
} else {
|
||||
if (query.getVersionStrategy().compareTo(ReportConstant.VersionStrategyEnum.NEW.getValue()) != 0
|
||||
|| query.getVersionStrategy().compareTo(ReportConstant.VersionStrategyEnum.ALL.getValue()) != 0
|
||||
|| query.getVersionStrategy().compareTo(ReportConstant.VersionStrategyEnum.DEFINE.getValue()) != 0) {
|
||||
return ResultVO.error(STATE.ParamErr, "错误的版本策略");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("forwardReport")
|
||||
@ApiOperation("bom-正查")
|
||||
public ResultVO<ReportBomVO> forwardReport(@RequestBody ReverseReportQuery query) {
|
||||
ResultVO resultVO = checkQueryParam(query);
|
||||
if (resultVO != null) {
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
return ResultVO.success(forwardReportService.factoryBomType(query));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ForwardReportVO extends ReverseReportVO{
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ReportBomVO {
|
||||
|
||||
|
||||
private ForwardReportVO parent;
|
||||
|
||||
private List<ForwardReportVO> childNodes;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,49 +1,64 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.service.domain.EBom.EBomForwardReport;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ForwardReportService {
|
||||
|
||||
|
||||
|
||||
|
||||
public void factoryBomType(ReverseReportQuery query){
|
||||
public ReportBomVO factoryBomType(ReverseReportQuery query) {
|
||||
//原始BOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.ORIGINALBOM.getValue()) == 0) {
|
||||
queryOriginalBom(query);
|
||||
return queryOriginalBom(query);
|
||||
}
|
||||
|
||||
//EBOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.EBOM.getValue()) == 0) {
|
||||
queryEBom(query);
|
||||
return queryEBom(query);
|
||||
}
|
||||
|
||||
//PBOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.PBOM.getValue()) == 0) {
|
||||
queryPBom(query);
|
||||
return queryPBom(query);
|
||||
}
|
||||
//MBOM
|
||||
if (query.getBomType().compareTo(ReportConstant.BomTypeEnum.MBOM.getValue()) == 0) {
|
||||
queryMBom(query);
|
||||
}
|
||||
return queryMBom(query);
|
||||
}
|
||||
|
||||
void queryOriginalBom(ReverseReportQuery query){
|
||||
VUtils.isTure(true).throwMessage("错误的BOM类型");
|
||||
return null;
|
||||
}
|
||||
|
||||
ReportBomVO queryOriginalBom(ReverseReportQuery query) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
void queryEBom(ReverseReportQuery query){
|
||||
ReportBomVO queryEBom(ReverseReportQuery query) {
|
||||
|
||||
|
||||
EBomForwardReport eBomForwardReport = new EBomForwardReport(query);
|
||||
|
||||
return eBomForwardReport.genReport();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void queryPBom(ReverseReportQuery query){
|
||||
|
||||
ReportBomVO queryPBom(ReverseReportQuery query) {
|
||||
return null;
|
||||
}
|
||||
void queryMBom(ReverseReportQuery query){
|
||||
|
||||
ReportBomVO queryMBom(ReverseReportQuery query) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildFormalEntity;
|
||||
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.service.BomNewEbomChildFormalService;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentFormalService;
|
||||
import nflg.product.common.constant.STATE;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EBomForwardReport {
|
||||
|
||||
ReverseReportQuery query;
|
||||
public EBomForwardReport(ReverseReportQuery query){
|
||||
this.query=query;
|
||||
}
|
||||
|
||||
|
||||
QueryWrapper<BomNewEbomParentFormalEntity> buildQuery(){
|
||||
QueryWrapper<BomNewEbomParentFormalEntity> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(BomNewEbomParentFormalEntity::getMaterialNo,query.getMaterialNo());
|
||||
if(StrUtil.isNotBlank(query.getDrawingNo())){
|
||||
queryWrapper.lambda().eq(BomNewEbomParentFormalEntity::getDrawingNo,query.getDrawingNo());
|
||||
}
|
||||
if(query.getVersionStrategy().compareTo(ReportConstant.VersionStrategyEnum.NEW.getValue()) ==0){
|
||||
queryWrapper.lambda().eq(BomNewEbomParentFormalEntity::getLastVersionIs,1);
|
||||
}else {
|
||||
queryWrapper.lambda().eq(BomNewEbomParentFormalEntity::getCurrentVersion,query.getBomVersion());
|
||||
}
|
||||
|
||||
if(StrUtil.isNotBlank(query.getStartDate()) && StrUtil.isNotBlank(query.getEndDate()) ){
|
||||
queryWrapper.lambda().between(BomNewEbomParentFormalEntity::getConvertToEbomTime, query.getStartDate(), query.getEndDate());
|
||||
}
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BomNewEbomParentFormalEntity getParent(){
|
||||
QueryWrapper<BomNewEbomParentFormalEntity> queryWrapper=buildQuery();
|
||||
|
||||
List<BomNewEbomParentFormalEntity> list= SpringUtil.getBean(BomNewEbomParentFormalService.class).list(queryWrapper);
|
||||
|
||||
if(CollectionUtil.isEmpty(list)){
|
||||
throw new NflgBusinessException(STATE.BusinessError,StrUtil.format("未查到物料编码为{}的数据信息", query.getMaterialNo() ));
|
||||
}
|
||||
|
||||
BomNewEbomParentFormalEntity parentFormal=list.get(0);
|
||||
return parentFormal;
|
||||
}
|
||||
|
||||
ReportBomVO singleReport(){
|
||||
|
||||
BomNewEbomParentFormalEntity parentFormal= getParent();
|
||||
ReportBomVO reportBomVO=new ReportBomVO();
|
||||
|
||||
ForwardReportVO forwardReportVO= Convert.convert(ForwardReportVO.class, parentFormal);
|
||||
forwardReportVO.setCreatedTime(parentFormal.getConvertToEbomTime());
|
||||
reportBomVO.setParent(forwardReportVO);
|
||||
QueryWrapper<BomNewEbomChildFormalEntity > queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(BomNewEbomChildFormalEntity::getParentRowId,parentFormal.getRowId());
|
||||
List<BomNewEbomChildFormalEntity > list= SpringUtil.getBean(BomNewEbomChildFormalService.class).list(queryWrapper);
|
||||
if(CollectionUtil.isEmpty(list)){
|
||||
reportBomVO.setChildNodes(new ArrayList<>());
|
||||
}else{
|
||||
List<ForwardReportVO> nodeList= Convert.convert(new TypeReference<List<ForwardReportVO>>() {
|
||||
}, list);
|
||||
for (ForwardReportVO vo:
|
||||
nodeList ) {
|
||||
vo.setCreatedTime(reportBomVO.getParent().getCreatedTime());
|
||||
vo.setOrderNumber("");
|
||||
}
|
||||
reportBomVO.setChildNodes(nodeList);
|
||||
}
|
||||
return reportBomVO;
|
||||
}
|
||||
|
||||
public ReportBomVO genReport(){
|
||||
|
||||
if (query.getQueryType().compareTo(ReportConstant.QueryTypeEnum.SINGLE.getValue()) == 0){
|
||||
return singleReport();
|
||||
}
|
||||
if ( query.getQueryType().compareTo(ReportConstant.QueryTypeEnum.MULTI.getValue()) == 0){
|
||||
|
||||
}
|
||||
if ( query.getQueryType().compareTo(ReportConstant.QueryTypeEnum.SUM.getValue()) == 0) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -62,4 +62,6 @@
|
|||
notice_nums, modify_time
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue