BOM物料查询接口增加物料分类字段
This commit is contained in:
parent
e8956d78eb
commit
7f4274fbdb
|
|
@ -9,11 +9,13 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.base.core.vo.PageVO;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
import com.nflg.product.bomnew.pojo.dto.PdateLogDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialCategoryEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialQueryDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
|
|
@ -21,10 +23,7 @@ import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery;
|
|||
import com.nflg.product.bomnew.pojo.query.CompareReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.CompareReportService;
|
||||
import com.nflg.product.bomnew.service.ForwardReportService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.service.ReverseReportService;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -59,6 +58,9 @@ public class BomReportApi extends BaseApi {
|
|||
@Resource
|
||||
MaterialMainService materialMainService;
|
||||
|
||||
@Resource
|
||||
MaterialCategoryService materialCategoryService;
|
||||
|
||||
|
||||
@PostMapping("reverseReport")
|
||||
@ApiOperation("bom-反查")
|
||||
|
|
@ -341,6 +343,36 @@ public class BomReportApi extends BaseApi {
|
|||
}
|
||||
Page<MaterialQueryDTO> page = new PageVO<>(queryParam.getPage(), queryParam.getPageSize());
|
||||
Page<MaterialQueryResult> result = materialMainService.getBaseMapper().queryMaterial(page , queryParam);
|
||||
if(!result.getRecords().isEmpty()){
|
||||
List<String> codeList = result.getRecords().stream().map(m -> {
|
||||
List<String> cList = Lists.newArrayList();
|
||||
String code = m.getMaterialCategoryCode();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i <= code.length(); i++) {
|
||||
sb.append(code.charAt(i-1));
|
||||
if(i % 2 == 0){
|
||||
cList.add(sb.toString());
|
||||
}
|
||||
}
|
||||
return cList;
|
||||
}).filter(CollUtil::isNotEmpty).flatMap(List::stream).distinct().collect(Collectors.toList());
|
||||
|
||||
List<MaterialCategoryEntity> categoryList = materialCategoryService.list(Wrappers.<MaterialCategoryEntity>lambdaQuery().in(MaterialCategoryEntity::getCategoryCode,codeList));
|
||||
Map<String,String> categoryMap = categoryList.stream().collect(Collectors.toMap(MaterialCategoryEntity::getCategoryCode,MaterialCategoryEntity::getCategoryName,(k1,k2) -> k1));
|
||||
result.getRecords().forEach(m -> {
|
||||
String code = m.getMaterialCategoryCode();
|
||||
List<String> cList = Lists.newArrayList();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i <= code.length(); i++) {
|
||||
sb.append(code.charAt(i-1));
|
||||
if(i % 2 == 0){
|
||||
cList.add(categoryMap.get(sb.toString()));
|
||||
}
|
||||
}
|
||||
m.setMaterialCategoryCodeName(cList.stream().collect(Collectors.joining("/")));
|
||||
});
|
||||
|
||||
}
|
||||
//排序
|
||||
// if(StrUtil.isNotBlank(queryParam.getMaterialNo())) {
|
||||
// result.forEach(u->{
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@ public class MaterialQueryResult {
|
|||
@ApiModelProperty("排序号")
|
||||
private String orderNo;
|
||||
|
||||
@ApiModelProperty("物料分类编码")
|
||||
private String materialCategoryCode;
|
||||
|
||||
@ApiModelProperty("物料分类编码名称")
|
||||
private String materialCategoryCodeName;
|
||||
|
||||
|
||||
private String materialStateName;
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@
|
|||
</select>
|
||||
|
||||
<select id="queryMaterial" resultType="com.nflg.product.bomnew.pojo.vo.MaterialQueryResult">
|
||||
select material_no,drawing_no, material_name,material_desc,material_unit, material_state
|
||||
select material_no,drawing_no, material_name,material_desc,material_unit, material_state,material_category_code
|
||||
<choose>
|
||||
<when test="query.materialNo != null and query.materialNo != ''" >
|
||||
,REPLACE(material_no,IFNULL(#{query.materialNo},''),'0') as orderMaterialNo
|
||||
|
|
|
|||
Loading…
Reference in New Issue