Browse Source

[feat]工程管理:物料bom反向查询修改添加查询成本、半成类型方法,查询bom上级物料的相关上级信息方法。

dev
zhangsiqi 5 months ago
parent
commit
69465dc452
  1. 11
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
  3. 2
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java
  4. 3
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  6. 11
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  7. 36
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
  8. 15
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
  9. 10
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  10. 40
      ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
  11. 38
      ruoyi-admin/src/main/resources/templates/erp/bom/edit.html
  12. 4
      ruoyi-admin/src/main/resources/templates/erp/material/edit.html

11
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<String, Object> 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<ErpBomVo> materialList = erpBomService.selectErpBomByMaterialNos(erpBomVo.getMaterialNo());
//将返回结果根据父节点进行排序
List<Long> parentIds = erpBomService.getAllParentIds(materialList);
Map<String, Object> map2 = new HashMap<>();
map2.put("parentIds", parentIds);
ErpBomVo erpBomVo1 = new ErpBomVo();
List<ErpBomVo> list1 = erpBomService.selectErpBomList(erpBomVo1);
//查询所有上述父节点的值
List<ErpBomVo> list1 = erpBomService.selectSubBomsByParentMaterialNo(map2);
//转换为页面需要的格式数据
startPage();
List<ErpBomVo> list = erpBomService.selectErpBomListReverse(list1);
return getDataTable(list);
@ -415,5 +417,4 @@ public class ErpBomController extends BaseController
{
return erpBomService.checkMaterialNoUnique(materialNo);
}
}

5
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

2
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java

@ -137,6 +137,6 @@ public interface ErpBomMapper
List<ErpBomVo> selectErpBomByMaterialNos(String materialNo);
List<ErpBomVo> selectSubBomsByParentMaterialNo(Map<String, Object> params, List<String> materialTypes);
List<ErpBomVo> selectSubBomsByParentMaterialNo(Map<String, Object> params);
List<ErpBomVo> selectErpBomByParentIds(Map<String, Object> params);
}

3
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpMaterialMapper.java

@ -104,5 +104,6 @@ public interface ErpMaterialMapper
* @return 物料信息集合
*/
List<ErpMaterialVo> selectAllErpMaterialList();
//查询所有通过审核的半成品和成品物料的信息
List<ErpMaterialVo> selectCateErpMaterialList();
}

5
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -47,6 +47,9 @@ public interface IErpBomService
List<ErpBomVo> selectErpBomByMaterialNos(String materialNo);
List<ErpBomVo> selectErpBomlist();
/**
* 新增bom
*
@ -114,4 +117,6 @@ public interface IErpBomService
public ProcessInstance submitApply(ErpBom erpBom);
ErpBom selectErpBomByOneMaterialNo(String materialNo);
List<ErpBomVo> selectSubBomsByParentMaterialNo(Map<String, Object> params);
}

11
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<ErpBomVo> selectErpBomlist() {
ErpBomVo erpBomVo = new ErpBomVo();
return erpBomMapper.selectErpBomList(erpBomVo);
}
/**
* 新增bom
*
@ -654,6 +660,11 @@ private ISysAttachService attachService;
return erpBomMapper.selectErpBomByOneMaterialNo(materialNo);
}
@Override
public List<ErpBomVo> selectSubBomsByParentMaterialNo(Map<String, Object> params) {
return erpBomMapper.selectSubBomsByParentMaterialNo(params);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ProcessInstance cancelErpBomById(Long id) {

36
ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

@ -413,7 +413,7 @@ 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
) erp_material
@ -427,29 +427,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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') )
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}
<if test="params.materialName != null and params.materialName != ''">
and erp.material_name in #{params.materialName}
WHERE erp.del_flag = 0 and erp.audit_status = 1
<if test="parentIds != null and parentIds != ''">
and erp.id in (#{parentIds})
</if>
<if test="params.bomNO != null and params.bomNo != ''">
and erp.bom_no in #{params.bomNo}
<if test="materialNo != null and materialNo != ''">
and erp.material_no in (#{materialNo})
</if>
<if test="bomNo != null and bomNo != ''">
and erp.bom_no = #{bomNo}
</if>
<if test="materialName != null and materialName != ''">
and erp.material_name in (#{materialName})
</if>
AND erp.material_type IN
<foreach item="type" index="index" collection="materialTypes" separator=",">
#{type}
</foreach>
</select>
<select id="selectErpBomByMaterialNos" parameterType="String" resultMap="ErpBomResult">
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time,
@ -517,6 +511,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by att.rel_id
) file
on erp_material.id = file.rel_id
where erp.parent_id = #{parentId}
where erp.parent_id in (#{parentId})
</select>
</mapper>

15
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml

@ -154,6 +154,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAllErpMaterialList" resultMap="ErpMaterialResult">
<include refid="selectErpMaterialVo"/>
</select>
<select id="selectCateErpMaterialList" resultMap="ErpMaterialResult">
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.brand, erp.`describe`,
erp.warehouse_dept,erp.business_members,cate.parent_id,cate.name as material_type_name
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.del_flag = '0' and erp.audit_status = '1'
</select>
<insert id="insertErpMaterial" parameterType="ErpMaterial" useGeneratedKeys="true" keyProperty="id">
insert into erp_material

10
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");

40
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(
"<option value='" + usertData[i].loginName + "'>" + usertData[i].userName + "</option>");
}
} 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(
"<option value='" + usertData[i].loginName + "'>" + usertData[i].userName + "</option>");
}
} 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) {

38
ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

@ -69,7 +69,7 @@
<div class="form-group">
<label class="col-sm-3 control-label" >工程员:</label>
<div class="col-sm-8">
<select name="engineer" class="form-control" disabled>
<select name="engineer" class="form-control" readonly>
</select>
</div>
</div>
@ -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(
"<option value='" + usertData[i].loginName + "'>" + usertData[i].userName + "</option>");
}
$("#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('<a class="btn btn-search btn-xs optRow" href="javascript:void(0)"><i class="fa fa-search"></i>选择</a> ');
@ -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(
"<option value='" + usertData[i].loginName + "'>" + usertData[i].userName + "</option>");
}
$("#form-bom-edit select[name='engineer']").val(erpBom.engineer);
} else {
$.modal.msgError(res.msg);
}
}
});
}
</script>
</body>
</html>

4
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(
"<option value='" + usertData[i].loginName + "'>" + usertData[i].userName + "</option>");
}
$("#businessMembers_edit").val(erpMaterial.businessMembers);
engineerSelect.val(loginName);
} else {
$.modal.msgError(res.msg);
}

Loading…
Cancel
Save