1、BOM反查
This commit is contained in:
parent
f50aeb496c
commit
046a0b4854
|
|
@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -49,7 +50,20 @@ public class BomReportApi extends BaseApi {
|
||||||
|
|
||||||
@PostMapping("reverseReport")
|
@PostMapping("reverseReport")
|
||||||
@ApiOperation("bom-反查")
|
@ApiOperation("bom-反查")
|
||||||
public ResultVO<Page<ReverseReportVO>> reverseReport(@RequestBody ReverseReportQuery query) {
|
public ResultVO<List<ReverseReportVO>> reverseReport(@Valid @RequestBody ReverseReportQuery query) {
|
||||||
|
|
||||||
|
//原始BOM
|
||||||
|
if (query.getBomType().equals(0)) {
|
||||||
|
VUtils.isTure(StrUtil.isBlank(query.getDrawingNo())).throwMessage("图号不能为空");
|
||||||
|
return ResultVO.success(reverseReportService.queryOriginalBom(query));
|
||||||
|
}
|
||||||
|
VUtils.isTure(StrUtil.isBlank(query.getMaterialNo())).throwMessage("物料编码不能为空");
|
||||||
|
if(query.getBomType().equals(1)){
|
||||||
|
return ResultVO.success(reverseReportService.queryEBom(query));
|
||||||
|
}
|
||||||
|
else if(query.getBomType().equals(2)){
|
||||||
|
return ResultVO.success(reverseReportService.queryPBom(query));
|
||||||
|
}
|
||||||
return ResultVO.success();
|
return ResultVO.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -67,4 +64,6 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
||||||
Integer checkIsRoot(@Param("materialNo") String materialNo);
|
Integer checkIsRoot(@Param("materialNo") String materialNo);
|
||||||
|
|
||||||
Integer checkIsUserRoot(@Param("materialNo")String materialNo, @Param("jobNo")String jobNo);
|
Integer checkIsUserRoot(@Param("materialNo")String materialNo, @Param("jobNo")String jobNo);
|
||||||
|
|
||||||
|
List<ReverseReportVO> eBomReverseReport(@Param("bomVersionRowId")Long bomVersionRowId,@Param("startDate") String startDate, @Param("endDate")String endDate, @Param("materialNos")List<String> materialNos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentFormalEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentFormalEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentFormalVO;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentFormalVO;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -24,4 +21,10 @@ public interface BomNewPbomParentFormalMapper extends BaseMapper<BomNewPbomParen
|
||||||
|
|
||||||
List<BomNewPbomParentFormalVO> getParentChildBatch(@Param("rowIds") List<Long> rowIds);
|
List<BomNewPbomParentFormalVO> getParentChildBatch(@Param("rowIds") List<Long> rowIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pbom单层反查
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ReverseReportVO> pBomSingleReverseReport(@Param("bomVersionRowId")Long bomVersionRowId,@Param("startDate") String startDate, @Param("endDate")String endDate, @Param("materialNos")List<String> materialNos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,22 @@ package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||||
import com.nflg.product.bomnew.constant.VarConstant;
|
import com.nflg.product.bomnew.constant.VarConstant;
|
||||||
|
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||||
|
import com.nflg.product.bomnew.service.domain.ReverseReport.EBomQueryService;
|
||||||
|
import com.nflg.product.bomnew.service.domain.ReverseReport.OriginalBomQueryService;
|
||||||
|
import com.nflg.product.bomnew.service.domain.ReverseReport.PBomQueryService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -26,6 +34,15 @@ public class ReverseReportService {
|
||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OriginalBomQueryService originalBomQueryService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
EBomQueryService eBomQueryService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PBomQueryService pBomQueryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ebom反查索引建立 (存Redis中)
|
* Ebom反查索引建立 (存Redis中)
|
||||||
* @param parent
|
* @param parent
|
||||||
|
|
@ -46,33 +63,33 @@ public class ReverseReportService {
|
||||||
createEBomIndex(parent,bomDetail);
|
createEBomIndex(parent,bomDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Bom-反查查询
|
|
||||||
* @param queryParam
|
|
||||||
*/
|
|
||||||
public void query(ReverseReportQuery queryParam){
|
|
||||||
String[] bomType={"","EBom","PBom",""};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 原始BOM-查询
|
* 原始BOM-查询
|
||||||
*/
|
*/
|
||||||
private void queryOriginalBom(ReverseReportQuery queryParam){
|
public List<ReverseReportVO> queryOriginalBom(ReverseReportQuery queryParam){
|
||||||
|
List<ReverseReportVO> result=new ArrayList<>();
|
||||||
|
originalBomQueryService.report(queryParam,result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ebom-查询
|
* Ebom-查询
|
||||||
*/
|
*/
|
||||||
private void queryEBom(ReverseReportQuery queryParam){
|
public List<ReverseReportVO> queryEBom(ReverseReportQuery queryParam){
|
||||||
|
List<ReverseReportVO> result=new ArrayList<>();
|
||||||
|
eBomQueryService.report(queryParam,result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pbom-查询
|
* Pbom-查询
|
||||||
*/
|
*/
|
||||||
private void queryPBom(ReverseReportQuery queryParam){
|
public List<ReverseReportVO> queryPBom(ReverseReportQuery queryParam){
|
||||||
|
List<ReverseReportVO> result=new ArrayList<>();
|
||||||
|
pBomQueryService.report(queryParam,result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
|
||||||
import com.nflg.product.bomnew.constant.VarConstant;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
|
||||||
import com.nflg.product.bomnew.service.RedisService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EBom-反查
|
|
||||||
*/
|
|
||||||
public class EBomQuery {
|
|
||||||
/**
|
|
||||||
* 查询参数
|
|
||||||
*/
|
|
||||||
private ReverseReportQuery queryParam;
|
|
||||||
|
|
||||||
RedisService redisService = SpringUtil.getBean(RedisService.class);
|
|
||||||
|
|
||||||
|
|
||||||
public EBomQuery(ReverseReportQuery inQueryParam) {
|
|
||||||
this.queryParam = inQueryParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<ReverseReportVO> report() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单层报表
|
|
||||||
*/
|
|
||||||
public List<ReverseReportVO> singleLevelReport() {
|
|
||||||
String queryKey = VarConstant.joiner.join(VarConstant.eBomIndexPrefix, queryParam.getMaterialNo(), queryParam.getBomVersion());
|
|
||||||
//使用到该物料的父级物料及版本
|
|
||||||
Set<String> parentUseMaterial = redisService.getLikeByKey(queryKey);
|
|
||||||
List<String> parentRowIds = parentUseMaterial.stream().map(u -> u.split("-")[2]).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<BomNewEbomParentEntity> result = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().in(BomNewEbomParentEntity::getRowId, parentRowIds).list();
|
|
||||||
return Convert.toList(ReverseReportVO.class, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多层
|
|
||||||
*
|
|
||||||
* @param drawingNos
|
|
||||||
*/
|
|
||||||
public void multipleLevelReport(List<String> drawingNos) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.nflg.product.bomnew.constant.VarConstant;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewEbomParentFormalService;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||||
|
import com.nflg.product.bomnew.service.RedisService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.sql.Struct;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EBom-反查
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EBomQueryService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
RedisService redisService ;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewEbomParentService ebomParentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewEbomParentFormalService ebomParentFormalService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
||||||
|
if(queryParam.getQueryType().equals(0)) {
|
||||||
|
result.addAll(singleLevelReport(queryParam));
|
||||||
|
}else {
|
||||||
|
// multipleLevelReport(queryParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单层报表
|
||||||
|
*/
|
||||||
|
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
|
||||||
|
Long bomVersionRowId=0L;
|
||||||
|
if(StrUtil.isNotBlank(queryParam.getBomVersion())){
|
||||||
|
BomNewEbomParentFormalEntity one = ebomParentFormalService.lambdaQuery().eq(BomNewEbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||||
|
.eq(BomNewEbomParentFormalEntity::getCurrentVersion, queryParam.getBomVersion()).one();
|
||||||
|
bomVersionRowId= Objects.nonNull(one)? one.getRowId():0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), ImmutableList.of(queryParam.getMaterialNo()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多层
|
||||||
|
*
|
||||||
|
* @param drawingNos
|
||||||
|
*/
|
||||||
|
public void multipleLevelReport(List<String> drawingNos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
|
||||||
|
|
||||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MBom-反查
|
|
||||||
*/
|
|
||||||
public class MBomQuery {
|
|
||||||
/**
|
|
||||||
* 查询参数
|
|
||||||
*/
|
|
||||||
private ReverseReportQuery queryParam;
|
|
||||||
|
|
||||||
public MBomQuery(ReverseReportQuery inQueryParam){
|
|
||||||
this.queryParam=inQueryParam;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentFormalEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MBom-反查
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MBomQueryService {
|
||||||
|
|
||||||
|
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
||||||
|
if(queryParam.getQueryType().equals(0)) {
|
||||||
|
result.addAll(singleLevelReport(queryParam));
|
||||||
|
}else {
|
||||||
|
// multipleLevelReport(queryParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单层报表
|
||||||
|
*/
|
||||||
|
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
|
||||||
|
// Long bomVersionRowId=0L;
|
||||||
|
// if(StrUtil.isNotBlank(queryParam.getBomVersion())){
|
||||||
|
// BomNewPbomParentFormalEntity one = pbomParentFormalService.lambdaQuery().eq(BomNewPbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||||
|
// .eq(BomNewPbomParentFormalEntity::getCurrentVersion, queryParam.getBomVersion()).one();
|
||||||
|
// bomVersionRowId= Objects.nonNull(one)? one.getRowId():0L;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return pbomParentFormalService.getBaseMapper().pBomSingleReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), ImmutableList.of(queryParam.getMaterialNo()));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +1,16 @@
|
||||||
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.db.sql.SqlBuilder;
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalChildEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||||
import com.nflg.product.bomnew.service.BomNewOriginalChildService;
|
import com.nflg.product.bomnew.service.BomNewOriginalChildService;
|
||||||
import com.nflg.product.bomnew.service.RedisService;
|
import com.nflg.product.bomnew.service.RedisService;
|
||||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -23,42 +19,30 @@ import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* 原始BOM-反查
|
* 原始BOM-反查
|
||||||
*/
|
*/
|
||||||
public class OriginalBomQuery {
|
@Service
|
||||||
/**
|
public class OriginalBomQueryService {
|
||||||
* 查询参数
|
|
||||||
*/
|
|
||||||
private ReverseReportQuery queryParam;
|
|
||||||
|
|
||||||
/**
|
@Resource
|
||||||
* 报表结果
|
private RedisService redisService;
|
||||||
*/
|
|
||||||
|
|
||||||
private List<ReverseReportVO> reportResult = new ArrayList<>();
|
@Resource
|
||||||
|
private BomNewOriginalChildService originalChildService ;
|
||||||
|
|
||||||
private RedisService redisService = SpringUtil.getBean(RedisService.class);
|
public void report(ReverseReportQuery queryParam,List<ReverseReportVO> result) {
|
||||||
|
|
||||||
private BomNewOriginalChildService originalChildService = SpringUtil.getBean(BomNewOriginalChildService.class);
|
|
||||||
|
|
||||||
public OriginalBomQuery(ReverseReportQuery inQueryParam) {
|
|
||||||
this.queryParam = inQueryParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<ReverseReportVO> report() {
|
|
||||||
if (queryParam.getQueryType().equals(ReportConstant.QueryTypeEnum.SINGLE.getValue())) {
|
if (queryParam.getQueryType().equals(ReportConstant.QueryTypeEnum.SINGLE.getValue())) {
|
||||||
singleLevelReport();
|
result.addAll(singleLevelReport(queryParam)) ;
|
||||||
} else {
|
} else {
|
||||||
multipleLevelReport(ImmutableList.of(queryParam.getDrawingNo()));
|
multipleLevelReport(ImmutableList.of(queryParam.getDrawingNo()),result);
|
||||||
}
|
}
|
||||||
return reportResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单层报表
|
* 单层报表
|
||||||
*/
|
*/
|
||||||
public void singleLevelReport() {
|
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
|
||||||
|
|
||||||
reportResult = originalChildService.getBaseMapper().originalReverseReport(ImmutableList.of(queryParam.getDrawingNo()));
|
return originalChildService.getBaseMapper().originalReverseReport(ImmutableList.of(queryParam.getDrawingNo()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,10 +52,8 @@ public class OriginalBomQuery {
|
||||||
/**
|
/**
|
||||||
* 多层
|
* 多层
|
||||||
*/
|
*/
|
||||||
public void multipleLevelReport(List<String> drawingNos) {
|
public void multipleLevelReport(List<String> drawingNos ,List<ReverseReportVO> result) {
|
||||||
|
|
||||||
List<ReverseReportVO> parentList = originalChildService.getBaseMapper().originalReverseReport(drawingNos);
|
List<ReverseReportVO> parentList = originalChildService.getBaseMapper().originalReverseReport(drawingNos);
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(parentList)) {
|
if (CollUtil.isNotEmpty(parentList)) {
|
||||||
drawingNos.forEach(k -> {
|
drawingNos.forEach(k -> {
|
||||||
List<ReverseReportVO> drawingParents = parentList.stream().filter(u -> u.getChildDrawingNo().equals(k)).collect(Collectors.toList());
|
List<ReverseReportVO> drawingParents = parentList.stream().filter(u -> u.getChildDrawingNo().equals(k)).collect(Collectors.toList());
|
||||||
|
|
@ -85,10 +67,10 @@ public class OriginalBomQuery {
|
||||||
resultMap.remove(k);
|
resultMap.remove(k);
|
||||||
});
|
});
|
||||||
List<String> dawNos = parentList.stream().map(u -> u.getDrawingNo()).distinct().collect(Collectors.toList());
|
List<String> dawNos = parentList.stream().map(u -> u.getDrawingNo()).distinct().collect(Collectors.toList());
|
||||||
multipleLevelReport(dawNos);
|
multipleLevelReport(dawNos,result);
|
||||||
} else {
|
} else {
|
||||||
resultMap.forEach((k, v) -> {
|
resultMap.forEach((k, v) -> {
|
||||||
reportResult.addAll(v);
|
result.addAll(v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
|
||||||
|
|
||||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PBom-反查
|
|
||||||
*/
|
|
||||||
public class PBomQuery {
|
|
||||||
/**
|
|
||||||
* 查询参数
|
|
||||||
*/
|
|
||||||
private ReverseReportQuery queryParam;
|
|
||||||
|
|
||||||
public PBomQuery(ReverseReportQuery inQueryParam){
|
|
||||||
this.queryParam=inQueryParam;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.nflg.product.bomnew.service.domain.ReverseReport;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentFormalMapper;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentFormalEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentFormalEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewPbomParentFormalService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PBom-反查
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PBomQueryService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewPbomParentFormalService pbomParentFormalService;
|
||||||
|
public void report(ReverseReportQuery queryParam , List<ReverseReportVO> result) {
|
||||||
|
if(queryParam.getQueryType().equals(0)) {
|
||||||
|
result.addAll(singleLevelReport(queryParam));
|
||||||
|
}else {
|
||||||
|
// multipleLevelReport(queryParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单层报表
|
||||||
|
*/
|
||||||
|
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
|
||||||
|
Long bomVersionRowId=0L;
|
||||||
|
if(StrUtil.isNotBlank(queryParam.getBomVersion())){
|
||||||
|
BomNewPbomParentFormalEntity one = pbomParentFormalService.lambdaQuery().eq(BomNewPbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||||
|
.eq(BomNewPbomParentFormalEntity::getCurrentVersion, queryParam.getBomVersion()).one();
|
||||||
|
bomVersionRowId= Objects.nonNull(one)? one.getRowId():0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pbomParentFormalService.getBaseMapper().pBomSingleReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), ImmutableList.of(queryParam.getMaterialNo()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -248,4 +248,22 @@
|
||||||
select COUNT(1) from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status`=4 and a.last_version_is=1
|
select COUNT(1) from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status`=4 and a.last_version_is=1
|
||||||
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--ebom单层反查-->
|
||||||
|
<select id="eBomReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
|
||||||
|
select b.* , a.drawing_no as childDrawingNo from t_bom_new_ebom_child_formal a
|
||||||
|
join t_bom_new_ebom_parent_formal b on a.parent_row_id=b.row_id
|
||||||
|
|
||||||
|
where true
|
||||||
|
<if test="bomVersionRowId!=null and bomVersionRowId>0">
|
||||||
|
and a.bom_version_row_id=#{bomVersionRowId}
|
||||||
|
</if>
|
||||||
|
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
|
||||||
|
and b.convert_to_ebom_time >= #{startDate} and b.expire_end_time <=#{endDate}
|
||||||
|
</if>
|
||||||
|
and a.material_no in
|
||||||
|
<foreach collection="materialNos" item="materialNo" open="(" separator="," close=")">
|
||||||
|
#{materialNo}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@
|
||||||
|
|
||||||
<!--原始BOM-反查-->
|
<!--原始BOM-反查-->
|
||||||
<select id="originalReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
|
<select id="originalReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
|
||||||
select b.* , a.drawing_no as childDrawingNo from t_bom_new_original_child_formal a
|
select b.* , a.drawing_no as childDrawingNo from t_bom_new_original_child a
|
||||||
join t_bom_new_original_parent_formal b on a.parent_row_id=b.row_id
|
join t_bom_new_original_parent b on a.parent_row_id=b.row_id and b.last_version_is=1
|
||||||
where
|
where
|
||||||
a.drawing_no in
|
a.drawing_no in
|
||||||
<foreach collection="drawingNos" item="drawingNo" open="(" separator="," close=")">
|
<foreach collection="drawingNos" item="drawingNo" open="(" separator="," close=")">
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,23 @@
|
||||||
where parent_row_id = #{rowId}
|
where parent_row_id = #{rowId}
|
||||||
order by order_number
|
order by order_number
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--pbom单层反查-->
|
||||||
|
<select id="pBomSingleReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
|
||||||
|
select b.* , a.drawing_no as childDrawingNo from t_bom_new_pbom_child_formal a
|
||||||
|
join t_bom_new_pbom_parent_formal b on a.parent_row_id=b.row_id
|
||||||
|
|
||||||
|
where true
|
||||||
|
<if test="bomVersionRowId!=null and bomVersionRowId>0">
|
||||||
|
and a.bom_version_row_id=#{bomVersionRowId}
|
||||||
|
</if>
|
||||||
|
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
|
||||||
|
and b.last_convert_mbom_time >= #{startDate} and b.expire_end_time <=#{endDate}
|
||||||
|
</if>
|
||||||
|
and a.material_no in
|
||||||
|
<foreach collection="materialNos" item="materialNo" open="(" separator="," close=")">
|
||||||
|
#{materialNo}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue