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

View File

@ -360,7 +360,7 @@
and a.bom_version_row_id=#{bomVersionRowId} and a.bom_version_row_id=#{bomVersionRowId}
</if> </if>
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''"> <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> </if>
and a.material_no =#{materialNo} and a.material_no =#{materialNo}
</select> </select>

View File

@ -83,11 +83,11 @@
join t_bom_new_pbom_parent_formal b on a.parent_row_id=b.row_id join t_bom_new_pbom_parent_formal b on a.parent_row_id=b.row_id
where true where true
<if test="bomVersionRowId!=null and bomVersionRowId>0"> <if test="bomVersionRowId!=null">
and a.bom_version_row_id=#{bomVersionRowId} and a.bom_version_row_id=#{bomVersionRowId}
</if> </if>
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''"> <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> </if>
and a.material_no = #{materialNo} and a.fac_code = #{faCode} and a.material_no = #{materialNo} and a.fac_code = #{faCode}
</select> </select>