fix: bom查看优化

This commit is contained in:
曹鹏飞 2024-07-05 10:07:50 +08:00
parent 4fb0a338de
commit 8dd3101538
4 changed files with 38 additions and 28 deletions

View File

@ -11,10 +11,11 @@ import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
import com.nflg.product.bomnew.service.*;
import com.nflg.product.bomnew.service.BomNewEbomChildService;
import com.nflg.product.bomnew.service.BomNewEbomParentFormalService;
import com.nflg.product.bomnew.service.BomNewEbomParentService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -29,11 +30,6 @@ import java.util.stream.Collectors;
@Service
public class EBomQueryService {
private static final Logger log = LoggerFactory.getLogger(EBomQueryService.class);
@Resource
RedisService redisService ;
@Resource
BomNewEbomParentService ebomParentService;
@ -43,9 +39,6 @@ public class EBomQueryService {
@Resource
BomNewEbomParentFormalService ebomParentFormalService;
@Resource
BomNewEbomChildFormalService ebomChildFormalService;
@Resource
MaterialMainService materialMainService;
@ -64,16 +57,21 @@ public class EBomQueryService {
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
Long bomVersionRowId=0L;
//指定版本
if(queryParam.getVersionStrategy().equals(2) && 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;
if (queryParam.getVersionStrategy().equals(2)
|| (queryParam.getVersionStrategy().equals(1) && 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;
}//最新版本
else if(queryParam.getVersionStrategy().equals(0)){
BomNewEbomParentFormalEntity one = ebomParentFormalService.lambdaQuery().eq(BomNewEbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
.last(" order by current_version desc limit 1").one();
if(Objects.nonNull(one)){
bomVersionRowId=one.getRowId();
else if (queryParam.getVersionStrategy().equals(0)) {
BomNewEbomParentEntity one = ebomParentService.lambdaQuery()
.eq(BomNewEbomParentEntity::getMaterialNo, queryParam.getMaterialNo())
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
.one();
if (Objects.nonNull(one)) {
bomVersionRowId = one.getRowId();
}
}
List<ReverseReportVO> vos = ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId, queryParam.getStartDate(), queryParam.getEndDate(), queryParam.getMaterialNo());

View File

@ -56,11 +56,23 @@ public class PBomQueryService {
* 单层报表
*/
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;
Long bomVersionRowId = null;
if (queryParam.getVersionStrategy().equals(0)) {
//最新版
BomNewPbomParentEntity one = pbomParentService.lambdaQuery()
.eq(BomNewPbomParentEntity::getMaterialNo, queryParam.getMaterialNo())
.eq(BomNewPbomParentEntity::getFacCode, queryParam.getFacCode())
.ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.one();
bomVersionRowId = Objects.nonNull(one) ? one.getRowId() : 0L;
} else if ((queryParam.getVersionStrategy().equals(1) && StrUtil.isNotBlank(queryParam.getBomVersion()))
|| queryParam.getVersionStrategy().equals(2)) {
BomNewPbomParentFormalEntity one = pbomParentFormalService.lambdaQuery()
.eq(BomNewPbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
.eq(BomNewPbomParentFormalEntity::getFacCode, queryParam.getFacCode())
.eq(BomNewPbomParentFormalEntity::getCurrentVersion, queryParam.getBomVersion())
.one();
bomVersionRowId = Objects.nonNull(one) ? one.getRowId() : 0L;
}
List<ReverseReportVO> vos = pbomParentFormalService.getBaseMapper().pBomSingleReverseReport(bomVersionRowId, queryParam.getStartDate()

View File

@ -360,7 +360,7 @@
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 &gt;= #{startDate} and b.expire_end_time &lt;=#{endDate}
and b.release_time &gt;= #{startDate} and b.expire_end_time &lt;=#{endDate}
</if>
and a.material_no =#{materialNo}
</select>

View File

@ -83,11 +83,11 @@
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">
<if test="bomVersionRowId!=null">
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 &gt;= #{startDate} and b.expire_end_time &lt;=#{endDate}
and b.release_time &gt;= #{startDate} and b.expire_end_time &lt;=#{endDate}
</if>
and a.material_no = #{materialNo} and a.fac_code = #{faCode}
</select>