diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java index 35db3c04..9e4f6a05 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java @@ -502,9 +502,9 @@ public class ErpMaterialController extends BaseController @ResponseBody public AjaxResult getCateMaterialSelList(@RequestParam(value = "q",defaultValue = "") String prefix){ if (prefix == null || prefix.isEmpty()){ - return success(erpMaterialMapper.selectCateErpMaterialList()); + return success(erpMaterialService.selectCateErpMaterialList()); } - return success(erpMaterialMapper.searchMaterialsByPrefix(prefix)); + return success(erpMaterialService.searchMaterialsByPrefix(prefix)); } @GetMapping ("/getEngineerList") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java index 82f27ab3..7238540d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java @@ -49,6 +49,22 @@ public interface IErpMaterialService */ public List selectAllErpMaterialListWithBom(ErpMaterial erpMaterial); + /** + * 查询所有通过审核的半成品和成品物料的信息 + * + * @return 物料信息集合 + */ + + public List selectCateErpMaterialList(); + + + /** + * 根据料号前缀查询匹配物料 + * + * @return 物料信息集合 + */ + public List searchMaterialsByPrefix(String prefix); + /** * 新增物料信息 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java index 66aa7b2e..d435600d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java @@ -50,6 +50,7 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.*; +import java.util.stream.Collectors; /** * 物料信息Service业务层处理 @@ -253,6 +254,45 @@ public class ErpMaterialServiceImpl implements IErpMaterialService + /** + * 查询所有通过审核的半成品和成品物料的信息 + * + * @return 物料信息集合 + */ + @Override + public List selectCateErpMaterialList(){ + + List erpMaterialVos = erpMaterialMapper.selectCateErpMaterialList(); + List collect = erpMaterialVos.stream().filter( + material -> material.getMaterialNo().startsWith("5") || + material.getMaterialNo().startsWith("6") || + material.getMaterialNo().startsWith("7") || + material.getMaterialNo().startsWith("8") || + material.getMaterialNo().startsWith("9") + ).collect(Collectors.toList()); + + return collect; + }; + + /** + * 根据料号前缀查询匹配物料 + * + * @return 物料信息集合 + */ + @Override + public List searchMaterialsByPrefix(String prefix){ + List erpMaterialVos = erpMaterialMapper.searchMaterialsByPrefix(prefix); + List collect = erpMaterialVos.stream().filter( + material -> material.getMaterialNo().startsWith("5") || + material.getMaterialNo().startsWith("6") || + material.getMaterialNo().startsWith("7") || + material.getMaterialNo().startsWith("8") || + material.getMaterialNo().startsWith("9") + ).collect(Collectors.toList()); + return collect; + }; + + /** * 新增物料信息 * diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml index e7d86ae0..9b24ac0d 100644 --- a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml @@ -177,16 +177,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select erp.id, erp.del_flag, erp.create_by, erp.remark,erp.bomNo, erp.material_no, erp.material_name, erp.audit_status, erp.use_status, erp.hava_product_tem, erp.material_type, erp.process_method, erp.unit,erp.material_model, erp.brand, erp.`describe`, - erp.warehouse_dept,erp.business_members,cate.parent_id,cate.name as material_type_name + erp.warehouse_dept,erp.business_members from erp_material erp - left join ( - select code,name,parent_id from sys_category - where parent_id in( - select id from sys_category - where parent_id = (select id from sys_category where code = 'materialType') ) - )cate on erp.material_type = cate.code - where cate.parent_id in (select id from sys_category where code in ('cp','bcp')) - and erp.audit_status = '1' and erp.use_status = '1' + where erp.audit_status = '1' and erp.use_status = '1' diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html index 3436c983..24c71144 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html @@ -289,6 +289,8 @@ align: 'center', title: '描述' }, + {title: '型号',field: 'materialModel',align: 'center', + }, { field: 'brand', align: 'center',