From 30a99da694ae5994eefd58f0f219cb13ce789bac Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 29 Oct 2024 16:28:49 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9bom=E7=9A=84Controller=E5=B1=82=E7=9A=84getCa?= =?UTF-8?q?teMaterialSelList=E6=96=B9=E6=B3=95=EF=BC=8C=E6=94=B9=E8=B0=83?= =?UTF-8?q?=E7=94=A8mpper=E5=B1=82=E7=9A=84=E6=96=B9=E6=B3=95=E4=B8=BA?= =?UTF-8?q?=E8=B0=83=E7=94=A8service=E5=B1=82=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9bom=E7=9A=84mapper.xml=E5=B1=82?= =?UTF-8?q?=E7=9A=84selectCateErpMaterialList=E5=92=8CsearchMaterialsByPre?= =?UTF-8?q?fix=E6=96=B9=E6=B3=95=EF=BC=8C=E5=8E=BB=E6=8E=89=E9=99=90?= =?UTF-8?q?=E5=88=B6=E7=89=A9=E6=96=99=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E8=AF=A2=20bom=E7=9A=84service=E5=B1=82?= =?UTF-8?q?=E6=96=B0=E5=A2=9EsearchMaterialsByPrefix=E5=92=8CselectCateErp?= =?UTF-8?q?MaterialList=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A4=84=E7=90=86bom?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=B7=BB=E5=8A=A05=E3=80=816=E3=80=817?= =?UTF-8?q?=E3=80=818=E3=80=819=E5=BC=80=E5=A4=B4=E7=9A=84=E7=89=A9?= =?UTF-8?q?=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/controller/ErpMaterialController.java | 4 +- .../erp/service/IErpMaterialService.java | 16 ++++++++ .../service/impl/ErpMaterialServiceImpl.java | 40 +++++++++++++++++++ .../mapper/erp/ErpMaterialMapper.xml | 22 ++-------- .../main/resources/templates/erp/bom/add.html | 2 + 5 files changed, 64 insertions(+), 20 deletions(-) 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',