1、 单层反查

This commit is contained in:
大米 2024-06-22 17:55:54 +08:00
parent bf5797669d
commit d64fecddbe
4 changed files with 14 additions and 13 deletions

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.ImmutableList;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.ReportConstant;
@ -52,11 +53,7 @@ public class BomReportApi extends BaseApi {
@ApiOperation("bom-反查")
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(!ImmutableList.of(1,2).contains(query.getBomType())).throwMessage("只能查询EBom和PBom");
VUtils.isTure(StrUtil.isBlank(query.getMaterialNo())).throwMessage("物料编码不能为空");
if(query.getBomType().equals(1)){
return ResultVO.success(reverseReportService.queryEBom(query));

View File

@ -68,7 +68,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
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);
List<ReverseReportVO> eBomReverseReport(@Param("bomVersionRowId")Long bomVersionRowId,@Param("startDate") String startDate, @Param("endDate")String endDate, @Param("materialNo")String materialNo);
Integer getCountForWaitReviewByMaterialNo(@Param("materialNo") String materialNo);
void updateRootForWaitReview();

View File

@ -54,13 +54,20 @@ public class EBomQueryService {
*/
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
Long bomVersionRowId=0L;
if(StrUtil.isNotBlank(queryParam.getBomVersion())){
//指定版本
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;
}//最新版本
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();
}
return ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), ImmutableList.of(queryParam.getMaterialNo()));
}
return ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), queryParam.getMaterialNo());
}

View File

@ -347,10 +347,7 @@
<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}
</if>
and a.material_no in
<foreach collection="materialNos" item="materialNo" open="(" separator="," close=")">
#{materialNo}
</foreach>
and a.material_no =#{materialNo}
</select>
<select id="getCountForWaitReviewByMaterialNo" resultType="java.lang.Integer">