eBOM-反查

This commit is contained in:
大米 2024-02-26 16:26:02 +08:00
parent 4e4cd647ba
commit 91b1c92a3c
3 changed files with 45 additions and 12 deletions

View File

@ -0,0 +1,17 @@
package com.nflg.product.bomnew.constant;
import com.google.common.base.Joiner;
/**
* 常量变量
*/
public class VarConstant {
public static final String oBomIndexPrefix="oBom";
public static final String eBomIndexPrefix="EBom";
public static final String pBomIndexPrefix="PBom";
public static final Joiner joiner = Joiner.on("-").skipNulls();
}

View File

@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service;
import com.google.common.base.Joiner;
import com.nflg.product.bomnew.constant.VarConstant;
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
@ -18,11 +19,7 @@ import java.util.stream.Collectors;
@Service
public class ReverseReportService {
//原始BOM
private static String oBomIndexPrefix="oBom";
private static String eBomIndexPrefix="EBom";
private static String pBomIndexPrefix="PBom";
Joiner joiner = Joiner.on("-").skipNulls();
@ -97,8 +94,8 @@ public class ReverseReportService {
for (BomNewEbomParentVO parentEnt :bomParents) {
List<BomNewEbomParentVO> parentEntChild = bomDetail.stream().filter(u -> u.getParentRowId().equals(parentEnt.getBomRowId())).collect(Collectors.toList());
for (BomNewEbomParentVO child :parentEntChild) {
String key= joiner.join(eBomIndexPrefix, child.getMaterialNo(),child.getCurrentVersion());
String value=joiner.join("_", parentEnt.getMaterialNo(),parentEnt.getCurrentVersion());
String key= joiner.join(VarConstant.eBomIndexPrefix, child.getMaterialNo(),child.getCurrentVersion());
String value=joiner.join("_", parentEnt.getMaterialNo(),parentEnt.getCurrentVersion(),parentEnt.getBomRowId());
redisService.addSet(key,value);
}
}
@ -115,7 +112,7 @@ public class ReverseReportService {
for (BomNewPbomParentVO parentEnt :bomParents) {
List<BomNewPbomParentVO> parentEntChild = bomDetail.stream().filter(u -> u.getParentRowId().equals(parentEnt.getBomRowId())).collect(Collectors.toList());
for (BomNewPbomParentVO child :parentEntChild) {
String key= joiner.join(pBomIndexPrefix, child.getMaterialNo(),child.getCurrentVersion());
String key= joiner.join(VarConstant.pBomIndexPrefix, child.getMaterialNo(),child.getCurrentVersion());
String value=joiner.join("_" , parentEnt.getMaterialNo(),parentEnt.getCurrentVersion());
redisService.addSet(key,value);
}
@ -133,8 +130,8 @@ public class ReverseReportService {
for (BomOriginalListVO parentEnt :bomParents) {
List<BomOriginalListVO> parentEntChild = bomDetail.stream().filter(u -> u.getParentRowId().equals(parentEnt.getBomRowId())).collect(Collectors.toList());
for (BomOriginalListVO child :parentEntChild) {
String key= joiner.join(oBomIndexPrefix, child.getDrawingNo());
String value=joiner.join(oBomIndexPrefix , parentEnt.getDrawingNo() );
String key= joiner.join(VarConstant.oBomIndexPrefix, child.getDrawingNo());
String value=parentEnt.getDrawingNo();
redisService.addSet(key,value);
}
}

View File

@ -1,11 +1,20 @@
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-反查
@ -16,8 +25,11 @@ public class EBomQuery {
*/
private ReverseReportQuery queryParam;
public EBomQuery(ReverseReportQuery inQueryParam){
this.queryParam=inQueryParam;
RedisService redisService = SpringUtil.getBean(RedisService.class);
public EBomQuery(ReverseReportQuery inQueryParam) {
this.queryParam = inQueryParam;
}
@ -29,13 +41,20 @@ public class EBomQuery {
/**
* 单层报表
*/
public void singleLevelReport() {
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) {