From 69465dc45207d4c50a79afc22410b786575012b0 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Thu, 6 Jun 2024 21:03:54 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=9A=E7=89=A9=E6=96=99bom=E5=8F=8D=E5=90=91=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=88=90=E6=9C=AC=E3=80=81=E5=8D=8A=E6=88=90=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E6=9F=A5=E8=AF=A2bom=E4=B8=8A?= =?UTF-8?q?=E7=BA=A7=E7=89=A9=E6=96=99=E7=9A=84=E7=9B=B8=E5=85=B3=E4=B8=8A?= =?UTF-8?q?=E7=BA=A7=E4=BF=A1=E6=81=AF=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/controller/ErpBomController.java | 11 ++-- .../erp/controller/ErpMaterialController.java | 5 ++ .../com/ruoyi/erp/mapper/ErpBomMapper.java | 2 +- .../ruoyi/erp/mapper/ErpMaterialMapper.java | 3 +- .../com/ruoyi/erp/service/IErpBomService.java | 5 ++ .../erp/service/impl/ErpBomServiceImpl.java | 11 ++++ .../resources/mapper/erp/ErpBomMapper.xml | 54 +++++++++---------- .../mapper/erp/ErpMaterialMapper.xml | 17 +++++- .../main/resources/templates/erp/bom/add.html | 10 +--- .../main/resources/templates/erp/bom/bom.html | 40 +++++++------- .../resources/templates/erp/bom/edit.html | 38 +++++++------ .../templates/erp/material/edit.html | 4 +- 12 files changed, 115 insertions(+), 85 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java index ddd82844..11002678 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java @@ -90,15 +90,17 @@ public class ErpBomController extends BaseController @ResponseBody public TableDataInfo selectErpBomVoReverse(ErpBomVo erpBomVo,HttpServletRequest request) { Map map = new HashMap<>(); - map.put("materialNo", erpBomVo.getMaterialNo()); - map.put("materialName", erpBomVo.getMaterialName()); + String materialNo = String.valueOf(request.getSession().getAttribute("materialNo")); + map.put("materialNo", materialNo); List materialList = erpBomService.selectErpBomByMaterialNos(erpBomVo.getMaterialNo()); //将返回结果根据父节点进行排序 List parentIds = erpBomService.getAllParentIds(materialList); Map map2 = new HashMap<>(); map2.put("parentIds", parentIds); - ErpBomVo erpBomVo1 = new ErpBomVo(); - List list1 = erpBomService.selectErpBomList(erpBomVo1); + //查询所有上述父节点的值 + List list1 = erpBomService.selectSubBomsByParentMaterialNo(map2); + + //转换为页面需要的格式数据 startPage(); List list = erpBomService.selectErpBomListReverse(list1); return getDataTable(list); @@ -415,5 +417,4 @@ public class ErpBomController extends BaseController { return erpBomService.checkMaterialNoUnique(materialNo); } - } 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 999113ad..663eacba 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 @@ -399,6 +399,11 @@ public class ErpMaterialController extends BaseController materialVo.setAuditStatus("1"); return success(erpMaterialMapper.selectErpMaterialList(materialVo)); } + @RequestMapping("/getCateMaterialSelList") + @ResponseBody + public AjaxResult getCateMaterialSelList(){ + return success(erpMaterialMapper.selectCateErpMaterialList()); + } @GetMapping ("/getEngineerList") @ResponseBody diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java index 5f797782..034f6730 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java @@ -137,6 +137,6 @@ public interface ErpBomMapper List selectErpBomByMaterialNos(String materialNo); - List selectSubBomsByParentMaterialNo(Map params, List materialTypes); + List selectSubBomsByParentMaterialNo(Map params); List selectErpBomByParentIds(Map params); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java index d7902847..28905108 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java @@ -104,5 +104,6 @@ public interface ErpMaterialMapper * @return 物料信息集合 */ List selectAllErpMaterialList(); - + //查询所有通过审核的半成品和成品物料的信息 + List selectCateErpMaterialList(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java index 6c18effe..6a426854 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java @@ -47,6 +47,9 @@ public interface IErpBomService List selectErpBomByMaterialNos(String materialNo); + + List selectErpBomlist(); + /** * 新增bom * @@ -114,4 +117,6 @@ public interface IErpBomService public ProcessInstance submitApply(ErpBom erpBom); ErpBom selectErpBomByOneMaterialNo(String materialNo); + + List selectSubBomsByParentMaterialNo(Map params); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java index e57c0796..8553a5c7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java @@ -291,6 +291,12 @@ private ISysAttachService attachService; return erpBomMapper.selectErpBomByMaterialNos(materialNo); } + @Override + public List selectErpBomlist() { + ErpBomVo erpBomVo = new ErpBomVo(); + return erpBomMapper.selectErpBomList(erpBomVo); + } + /** * 新增bom * @@ -654,6 +660,11 @@ private ISysAttachService attachService; return erpBomMapper.selectErpBomByOneMaterialNo(materialNo); } + @Override + public List selectSubBomsByParentMaterialNo(Map params) { + return erpBomMapper.selectSubBomsByParentMaterialNo(params); + } + @Override @Transactional(rollbackFor = Exception.class) public ProcessInstance cancelErpBomById(Long id) { diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml index ec09d73c..074f5d48 100644 --- a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml @@ -413,43 +413,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" erp.use_num,erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id, erp.instance_type, processDict.dict_label as instance_type_name, erp.submit_instance_id, erp.cancel_instance_id, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time, - file.url as photo_url,cate.name as material_type_name from erp_bom as erp + cate.name as material_type_name from erp_bom as erp left join ( - select id,material_no,material_name from erp_material + select id,material_no,material_name from erp_material ) erp_material - on erp.material_no = erp_material.material_no + on erp.material_no = erp_material.material_no left join( - select dict_value,dict_label from sys_dict_data - where dict_type = 'processType' + select dict_value,dict_label from sys_dict_data + where dict_type = 'processType' ) processDict on erp.instance_type = processDict.dict_value left join ( - select code,name from sys_category - where parent_id in( - select id from sys_category - where parent_id = (select id from sys_category where code = 'materialType') ) + select code,name 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 - left join ( - select att.rel_id,file.url,min(file.create_time) as create_time from sys_attach as att - left join sys_attach_file as file - on att.id = file.attach_id - where att.source_type = 'erpMaterial' and att.source_sub_type = 'photo' - group by att.rel_id - ) file - on erp_material.id = file.rel_id - WHERE - erp.material_no in #{params.materialNo} - - and erp.material_name in #{params.materialName} - - - and erp.bom_no in #{params.bomNo} + on erp.material_type = cate.code + WHERE erp.del_flag = 0 and erp.audit_status = 1 + + and erp.id in (#{parentIds}) + + + and erp.material_no in (#{materialNo}) + + + and erp.bom_no = #{bomNo} + + + and erp.material_name in (#{materialName}) - AND erp.material_type IN - - #{type} - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml index 80f7f7da..59e16ad6 100644 --- a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml @@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ,file.url as photo_url,cate.name as material_type_name from erp_material erp left join( - select dict_value,dict_label from sys_dict_data + select dict_value,dict_label from sys_dict_data where dict_type = 'processType' )process_type_dict on erp.instance_type = process_type_dict.dict_value @@ -154,6 +154,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + insert into erp_material 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 098e901f..5e259fa8 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html @@ -177,16 +177,9 @@ placeholder: "请选择一个料号", ajax:{ type: "get", - url:ctx + "erp/material/getMaterialSelList", + url:ctx + "erp/material/getCateMaterialSelList", dataType:"json", delay:250, - data:function(params){ - var searchVal = params.term; - var obj = { - keyword: searchVal - }; - return obj; - }, cache:true, processResults: function (res, params) { var options = []; @@ -419,7 +412,6 @@ function submitHandler() { if ($.validate.form()) { - $("#selectMaterialType").removeAttr("disabled"); $("#selectProcessMethod").removeAttr("disabled"); $("#selectUnit").removeAttr("disabled"); diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html index ab9d3224..9367ece7 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html @@ -109,21 +109,6 @@ var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; var prefix = ctx + "erp/bom"; $(function() { - $.ajax({ - url: ctx + 'erp/material/getEngineerList', - type: 'get', - success: function (res) { - if (res.rows.length > 0) { - var usertData = res.rows; - for (let i in usertData) { - $("select[name='engineer']").append( - ""); - } - } else { - $.modal.msgError(res.msg); - } - } - }); var options = { url: prefix + "/list", createUrl: prefix + "/add", @@ -310,6 +295,7 @@ }] }; $.table.init(options); + engineer(); }); initOneLevelTable = function(index, row, $detail) { $("#"+"one_level_table_"+row.id).bootstrapTable({ @@ -762,16 +748,32 @@ }; $.modal.openOptions(options); } + function engineer(){ + $.ajax({ + url: ctx + 'erp/material/getEngineerList', + type: 'get', + success: function (res) { + if (res.rows.length > 0) { + var usertData = res.rows; + for (let i in usertData) { + $("select[name='engineer']").append( + ""); + } + } else { + $.modal.msgError(res.msg); + } + } + }); + } function seachReverseBom(){ - var url = ctx + "erp/bom/reverseList"; + var url = prefix + '/reverseList'; //将获取的page类型数据放入bootstarpTable中 $.ajax({ type: "POST", url: url, data: { - "bomNo":$("#selectBomNo").val(), - "materialNo":$("#selectMaterialNo").val(), - "materialName":$("#selectmMaterialName").val(), + 'materialNo':$("#selectMaterialNo").val(), + 'materialName':$("#selectMaterialName").val() }, success: function (result) { if (result.code == 0) { diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html b/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html index cc502196..3ec748b1 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html @@ -69,7 +69,7 @@
-
@@ -148,22 +148,6 @@ } } $(function() { - $.ajax({ - url: ctx + 'erp/material/getEngineerList', - type: 'get', - success: function (res) { - if (res.rows.length > 0) { - var usertData = res.rows; - for (let i in usertData) { - $("#form-bom-edit select[name='engineer']").append( - ""); - } - $("#form-bom-edit select[name='engineer']").val(erpBom.engineer); - } else { - $.modal.msgError(res.msg); - } - } - }); $("#selectMaterialType").val(materialType1); var options = { url: prefix + "/oneLevelList", @@ -328,6 +312,7 @@ ] }; $.table.init(options); + engineer(); function optFormatter(value, row, index) { var actions = []; actions.push('选择 '); @@ -409,6 +394,25 @@ values: ids }) } + + function engineer(){ + $.ajax({ + url: ctx + 'erp/material/getEngineerList', + type: 'get', + success: function (res) { + if (res.rows.length > 0) { + var usertData = res.rows; + for (let i in usertData) { + $("#form-bom-edit select[name='engineer']").append( + ""); + } + $("#form-bom-edit select[name='engineer']").val(erpBom.engineer); + } else { + $.modal.msgError(res.msg); + } + } + }); + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/edit.html b/ruoyi-admin/src/main/resources/templates/erp/material/edit.html index f5d2cf23..5bbe1bab 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/edit.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/edit.html @@ -258,10 +258,10 @@ if (res.rows.length > 0) { var usertData = res.rows; for (let i in usertData) { - $("#businessMembers_edit").append( + engineerSelect.append( ""); } - $("#businessMembers_edit").val(erpMaterial.businessMembers); + engineerSelect.val(loginName); } else { $.modal.msgError(res.msg); }