optimize: 优化批量查询物料信息接口
This commit is contained in:
parent
33d36c2db1
commit
452e50a550
|
|
@ -482,7 +482,7 @@ public class EbomApi extends BaseApi {
|
|||
*/
|
||||
@PostMapping("queryMaterials")
|
||||
@ApiOperation("批量查询物料信息")
|
||||
public ResultVO<List<QueryMaterialsVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQuery> query) {
|
||||
public ResultVO<List<EbomQueryMaterialsVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQuery> query) {
|
||||
return ResultVO.success(bomNewEbomParentService.queryMaterials(query));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,131 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024/6/27 11:43:35
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EbomQueryMaterialsVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("物料主数据行ID")
|
||||
private Long materialRowId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
@ApiModelProperty("物料分类编码")
|
||||
private String materialCategoryCode;
|
||||
|
||||
@ApiModelProperty("制作物料获取类型:1=自制、2=外协、3=采购")
|
||||
private Integer materialGetType;
|
||||
|
||||
@ApiModelProperty("采购类型")
|
||||
private String procureType;
|
||||
|
||||
@ApiModelProperty("物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用")
|
||||
private Integer materialState;
|
||||
|
||||
@ApiModelProperty("图号")
|
||||
protected String drawingNo;
|
||||
|
||||
/**
|
||||
* 材料
|
||||
*/
|
||||
@ApiModelProperty(value = "材料")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
private String materialTexture;
|
||||
|
||||
@ApiModelProperty("物料大类别")
|
||||
private String relCategoryCode;
|
||||
|
||||
@ApiModelProperty("物料分类编码名称")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String materialUnit;
|
||||
|
||||
@ApiModelProperty("单重")
|
||||
private BigDecimal materialWeight;
|
||||
|
||||
/**
|
||||
* 前端行序号
|
||||
*/
|
||||
@ApiModelProperty(value = "前端行序号")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 设计人员名称
|
||||
*/
|
||||
@ApiModelProperty(value = "设计人员名称")
|
||||
private String deviseName = SessionUtil.getRealName();
|
||||
|
||||
/**
|
||||
* 设计维护部门名称
|
||||
*/
|
||||
@ApiModelProperty(value = "设计维护部门名称")
|
||||
private String deptName = SessionUtil.getDepartName();
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdTime = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime modifyTime;
|
||||
|
||||
/**
|
||||
* 版本过期时间=下个版本的创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "版本过期时间=下个版本的创建时间")
|
||||
private LocalDateTime expireEndTime = LocalDateTime.parse("9999-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
/**
|
||||
* 1=待复核、2=已复核、3=已退回、4=定版(已发布PBOM)
|
||||
*/
|
||||
@ApiModelProperty(value = "1=待复核、2=已复核、3=已退回、4=定版(已发布PBOM)99=借用件 100=引用件")
|
||||
private Integer status = EBomStatusEnum.CHECKED.getValue();
|
||||
|
||||
/**
|
||||
* 是否有BOM: 0-否 1-是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否有BOM: 0-否 1-是")
|
||||
private Integer bomExist = 0;
|
||||
|
||||
@ApiModelProperty("单重1")
|
||||
private BigDecimal unitWeight;
|
||||
|
||||
public BigDecimal getUnitWeight() {
|
||||
if (Objects.nonNull(unitWeight)) {
|
||||
return unitWeight;
|
||||
}
|
||||
return getMaterialWeight();
|
||||
}
|
||||
|
||||
@ApiModelProperty("总重")
|
||||
private BigDecimal totalWeight;
|
||||
}
|
||||
|
|
@ -2470,7 +2470,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<QueryMaterialsVO> queryMaterials(List<QueryMaterialsQuery> query) {
|
||||
public List<EbomQueryMaterialsVO> queryMaterials(List<QueryMaterialsQuery> query) {
|
||||
List<BaseMaterialVO> datas = new ArrayList<>();
|
||||
List<String> keys = query.stream().map(QueryMaterialsQuery::getMaterialNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
|
|
@ -2494,7 +2494,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
: StrUtil.equals(m.getDrawingNo(), q.getDrawingNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
QueryMaterialsVO vo = new QueryMaterialsVO();
|
||||
EbomQueryMaterialsVO vo = new EbomQueryMaterialsVO();
|
||||
vo.setOrderNumber(q.getOrderNumber());
|
||||
vo.setMaterialNo(q.getMaterialNo());
|
||||
vo.setDrawingNo(q.getDrawingNo());
|
||||
|
|
@ -2512,33 +2512,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
vo.setRelCategoryCode(mVO.getRelCategoryCode());
|
||||
vo.setTotalWeight(mVO.getMaterialWeight());
|
||||
}
|
||||
if (Objects.nonNull(q.getUnitWeight())) {
|
||||
vo.setUnitWeight(q.getUnitWeight());
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// return datas.stream().map(d -> {
|
||||
// QueryMaterialsVO vo = new QueryMaterialsVO();
|
||||
// vo.setMaterialNo(d.getMaterialNo());
|
||||
// vo.setMaterialName(d.getMaterialName());
|
||||
// vo.setMaterialDesc(d.getMaterialDesc());
|
||||
// vo.setUnitWeight(d.getMaterialWeight());
|
||||
// vo.setMaterialCategoryCode(d.getMaterialCategoryCode());
|
||||
// vo.setMaterialState(d.getMaterialState());
|
||||
// vo.setDrawingNo(d.getDrawingNo());
|
||||
// vo.setMaterialTexture(d.getMaterialTexture());
|
||||
// vo.setMaterialUnit(d.getMaterialUnit());
|
||||
// vo.setCategoryName(d.getCategoryName());
|
||||
// vo.setRelCategoryCode(d.getRelCategoryCode());
|
||||
// vo.setTotalWeight(d.getMaterialWeight());
|
||||
// QueryMaterialsQuery q = query.stream()
|
||||
// .filter(f -> StrUtil.equals(f.getMaterialNo(), vo.getMaterialNo()) || StrUtil.equals(f.getDrawingNo(), vo.getDrawingNo()))
|
||||
// .findFirst()
|
||||
// .orElse(null);
|
||||
// if (Objects.nonNull(q)) {
|
||||
// vo.setUnitWeight(q.getUnitWeight());
|
||||
// vo.setProjectType(q.getProjectType());
|
||||
// }
|
||||
// return vo;
|
||||
// }).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public BomNewEbomParentEntity getLatestByMaterialNo(String materialNo) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue