refactor: 出库管理-添加领料单,弹窗选择采购码(产品),搜索长描述、公称直径(L)、公称直径(S);选中后带回完整长描述,公称直径(L),公称直径(S);长描述多参数搜索用英文逗号隔开
This commit is contained in:
@@ -2,6 +2,8 @@ package com.vverp.controller.admin;
|
||||
|
||||
import com.vverp.base.Setting;
|
||||
import com.vverp.dto.ProductBaseDTO;
|
||||
import com.vverp.dto.ProductQueryDto;
|
||||
import com.vverp.dto.ProductSearchDto;
|
||||
import com.vverp.entity.*;
|
||||
import com.vverp.enums.OrderStatus;
|
||||
import com.vverp.moli.util.*;
|
||||
@@ -272,6 +274,26 @@ public class ProductController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
// 根据长描述、公称直径(L)、公称直径(S)筛选产品
|
||||
@RequestMapping("/dialog/selectSearchLddlds")
|
||||
public String selectSearchLddlds(ModelMap modelMap, String indexSn) {
|
||||
modelMap.addAttribute("hasProductType", false);
|
||||
modelMap.addAttribute("dialogName", "sblddldsDialog");
|
||||
modelMap.addAttribute("indexSn", indexSn);
|
||||
return "/product/dialog/selectSearchLddlds";
|
||||
}
|
||||
@RequestMapping("/listLddlds")
|
||||
@ResponseBody
|
||||
public RespData listLddlds(ProductQueryDto queryDto) {
|
||||
try {
|
||||
List<ProductSearchDto> list = productService.listAll(queryDto);
|
||||
return RespData.success(list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return RespData.error("获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/selectPage")
|
||||
@ResponseBody
|
||||
public RespData selectPage(Pageable pageable) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.vverp.dao;
|
||||
|
||||
import com.vverp.dto.ProductBaseDTO;
|
||||
import com.vverp.dto.ProductQueryDto;
|
||||
import com.vverp.dto.ProductSearchDto;
|
||||
import com.vverp.entity.Product;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -130,6 +132,34 @@ public class ProductDao extends BaseDao<Product, Long> {
|
||||
return entityManager.createQuery(criteriaQuery).getResultList();
|
||||
}
|
||||
|
||||
public List<ProductSearchDto> listAll(ProductQueryDto queryDto) {
|
||||
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<ProductSearchDto> criteriaQuery = criteriaBuilder.createQuery(ProductSearchDto.class);
|
||||
Root<Product> root = criteriaQuery.from(Product.class);
|
||||
criteriaQuery.select(criteriaBuilder.construct(ProductSearchDto.class, root.get("id"), root.get("name"), root.get("code"), root.get("productType").get("id"), root.get("longDescription"), root.get("diameterL"), root.get("diameterS")));
|
||||
Predicate all = criteriaBuilder.conjunction();
|
||||
|
||||
if (queryDto.getType() != null) {
|
||||
all = criteriaBuilder.and(all, criteriaBuilder.equal(root.get("type"), queryDto.getType()));
|
||||
}
|
||||
if (queryDto.getProductTypeId() != null) {
|
||||
all = criteriaBuilder.and(all, criteriaBuilder.equal(root.get("productType").get("id"), queryDto.getProductTypeId()));
|
||||
}
|
||||
if (queryDto.getDiameterL() != null) {
|
||||
all = criteriaBuilder.and(all, criteriaBuilder.equal(root.get("diameterL"), queryDto.getDiameterL()));
|
||||
}
|
||||
if (queryDto.getDiameterS() != null) {
|
||||
all = criteriaBuilder.and(all, criteriaBuilder.equal(root.get("diameterS"), queryDto.getDiameterS()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryDto.getLongDescription())) {
|
||||
for (String s : queryDto.getLongDescription().split(",")) {
|
||||
all = criteriaBuilder.and(all, criteriaBuilder.like(root.get("longDescription"), "%" + s + "%"));
|
||||
}
|
||||
}
|
||||
criteriaQuery.where(all);
|
||||
return entityManager.createQuery(criteriaQuery).getResultList();
|
||||
}
|
||||
|
||||
public Page<Product> selectPage(Pageable pageable) {
|
||||
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<Product> criteriaQuery = criteriaBuilder.createQuery(Product.class);
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.vverp.dto;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2020/11/17 上午11:20
|
||||
*/
|
||||
public class ProductQuery {
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
72
src/main/java/com/vverp/dto/ProductQueryDto.java
Normal file
72
src/main/java/com/vverp/dto/ProductQueryDto.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.vverp.dto;
|
||||
|
||||
import com.vverp.entity.Product;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ProductQueryDto {
|
||||
|
||||
private String name; // 名称
|
||||
private String code; // 编码
|
||||
private Product.Type type; //
|
||||
private Long productTypeId; // 产品类别id
|
||||
private String longDescription; // 长描述
|
||||
private BigDecimal diameterL; // 公称直径(L)
|
||||
private BigDecimal diameterS; // 公称直径(S)
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Product.Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Product.Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Long getProductTypeId() {
|
||||
return productTypeId;
|
||||
}
|
||||
|
||||
public void setProductTypeId(Long productTypeId) {
|
||||
this.productTypeId = productTypeId;
|
||||
}
|
||||
|
||||
public String getLongDescription() {
|
||||
return longDescription;
|
||||
}
|
||||
|
||||
public void setLongDescription(String longDescription) {
|
||||
this.longDescription = longDescription;
|
||||
}
|
||||
|
||||
public BigDecimal getDiameterL() {
|
||||
return diameterL;
|
||||
}
|
||||
|
||||
public void setDiameterL(BigDecimal diameterL) {
|
||||
this.diameterL = diameterL;
|
||||
}
|
||||
|
||||
public BigDecimal getDiameterS() {
|
||||
return diameterS;
|
||||
}
|
||||
|
||||
public void setDiameterS(BigDecimal diameterS) {
|
||||
this.diameterS = diameterS;
|
||||
}
|
||||
}
|
||||
88
src/main/java/com/vverp/dto/ProductSearchDto.java
Normal file
88
src/main/java/com/vverp/dto/ProductSearchDto.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package com.vverp.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ProductSearchDto {
|
||||
private Long id;
|
||||
private String name; // 名称
|
||||
private String code; // 编码
|
||||
private Long productTypeId; // 产品类别id
|
||||
private String productTypeName; // 产品类别
|
||||
private String longDescription; // 长描述
|
||||
private BigDecimal diameterL; // 公称直径(L)
|
||||
private BigDecimal diameterS; // 公称直径(S)
|
||||
|
||||
public ProductSearchDto(Long id, String name, String code, Long productTypeId, String longDescription, BigDecimal diameterL, BigDecimal diameterS) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
this.productTypeId = productTypeId;
|
||||
this.longDescription = longDescription;
|
||||
this.diameterL = diameterL;
|
||||
this.diameterS = diameterS;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Long getProductTypeId() {
|
||||
return productTypeId;
|
||||
}
|
||||
|
||||
public void setProductTypeId(Long productTypeId) {
|
||||
this.productTypeId = productTypeId;
|
||||
}
|
||||
|
||||
public String getProductTypeName() {
|
||||
return productTypeName;
|
||||
}
|
||||
|
||||
public void setProductTypeName(String productTypeName) {
|
||||
this.productTypeName = productTypeName;
|
||||
}
|
||||
|
||||
public String getLongDescription() {
|
||||
return longDescription;
|
||||
}
|
||||
|
||||
public void setLongDescription(String longDescription) {
|
||||
this.longDescription = longDescription;
|
||||
}
|
||||
|
||||
public BigDecimal getDiameterL() {
|
||||
return diameterL;
|
||||
}
|
||||
|
||||
public void setDiameterL(BigDecimal diameterL) {
|
||||
this.diameterL = diameterL;
|
||||
}
|
||||
|
||||
public BigDecimal getDiameterS() {
|
||||
return diameterS;
|
||||
}
|
||||
|
||||
public void setDiameterS(BigDecimal diameterS) {
|
||||
this.diameterS = diameterS;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.vverp.service;
|
||||
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import com.vverp.dto.ProductBaseDTO;
|
||||
import com.vverp.dto.ProductQueryDto;
|
||||
import com.vverp.dto.ProductSearchDto;
|
||||
import com.vverp.entity.Product;
|
||||
import com.vverp.entity.ProductType;
|
||||
import com.vverp.moli.util.Filter;
|
||||
@@ -55,6 +57,9 @@ public class ProductService extends BaseService<Product, Long> {
|
||||
public List<ProductBaseDTO> listAll(String productTypeChain, String search) {
|
||||
return productDao.listAll(productTypeChain, search);
|
||||
}
|
||||
public List<ProductSearchDto> listAll(ProductQueryDto queryDto) {
|
||||
return productDao.listAll(queryDto);
|
||||
}
|
||||
|
||||
public Page<Product> selectPage(Pageable pageable) {
|
||||
return productDao.selectPage(pageable);
|
||||
|
||||
Reference in New Issue
Block a user