change - 物料BOM加描述

master
yinq 9 months ago
parent eec9c4b625
commit 13132c407f

@ -33,6 +33,12 @@ public class MesMaterialBom extends TreeEntity {
@Excel(name = "物料名称")
private String materialName;
/**
* BOM
*/
@Excel(name = "BOM说明")
private String materialBomDesc;
/**
*
*/
@ -69,6 +75,14 @@ public class MesMaterialBom extends TreeEntity {
@Excel(name = "物料编号")
private String materialCode;
public String getMaterialBomDesc() {
return materialBomDesc;
}
public void setMaterialBomDesc(String materialBomDesc) {
this.materialBomDesc = materialBomDesc;
}
public void setMaterialBomId(Long materialBomId) {
this.materialBomId = materialBomId;
}

@ -59,8 +59,6 @@ public interface MesMaterialBomMapper
*/
public int deleteMesMaterialBomByMaterialBomIds(Long[] materialBomIds);
/**
* BOM,Join material
*

@ -56,6 +56,12 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
{
isTopFlag(mesMaterialBom);
mesMaterialBom.setCreateTime(DateUtils.getNowDate());
MesMaterialBom info = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(mesMaterialBom.getParentId());
if (StringUtils.isNull(info)){
mesMaterialBom.setAncestors(mesMaterialBom.getParentId().toString());
}else {
mesMaterialBom.setAncestors(info.getAncestors() + "," + mesMaterialBom.getParentId());
}
return mesMaterialBomMapper.insertMesMaterialBom(mesMaterialBom);
}
@ -97,9 +103,6 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
return mesMaterialBomMapper.deleteMesMaterialBomByMaterialBomId(materialBomId);
}
/**
* BOM,Join material
*

@ -1,44 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesMaterialBomMapper">
<resultMap type="MesMaterialBom" id="MesMaterialBomResult">
<result property="materialBomId" column="material_bom_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="standardAmount" column="standard_amount" />
<result property="topFlag" column="top_flag" />
<result property="checkType" column="check_type" />
<result property="projectId" column="project_id" />
<result property="activeFlag" column="active_flag" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="materialCode" column="material_code" />
<result property="materialBomId" column="material_bom_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="materialId" column="material_id"/>
<result property="materialName" column="material_name"/>
<result property="standardAmount" column="standard_amount"/>
<result property="topFlag" column="top_flag"/>
<result property="checkType" column="check_type"/>
<result property="projectId" column="project_id"/>
<result property="activeFlag" column="active_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="materialCode" column="material_code"/>
<result property="materialBomDesc" column="material_bom_desc"/>
</resultMap>
<sql id="selectMesMaterialBomVo">
select material_bom_id, parent_id, ancestors, material_id, material_name, standard_amount, top_flag, check_type, project_id, active_flag, remark, create_by, create_time, update_by, update_time from mes_material_bom
select material_bom_id,
parent_id,
ancestors,
material_id,
material_name,
material_bom_desc,
standard_amount,
top_flag,
check_type,
project_id,
active_flag,
remark,
create_by,
create_time,
update_by,
update_time
from mes_material_bom
</sql>
<select id="selectMesMaterialBomList" parameterType="MesMaterialBom" resultMap="MesMaterialBomResult">
<include refid="selectMesMaterialBomVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="standardAmount != null "> and standard_amount = #{standardAmount}</if>
<if test="topFlag != null "> and top_flag = #{topFlag}</if>
<if test="checkType != null and checkType != ''"> and check_type = #{checkType}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')
</if>
<if test="standardAmount != null ">and standard_amount = #{standardAmount}</if>
<if test="materialBomDesc != null ">and material_bom_desc = #{materialBomDesc}</if>
<if test="topFlag != null ">and top_flag = #{topFlag}</if>
<if test="checkType != null and checkType != ''">and check_type = #{checkType}</if>
<if test="projectId != null ">and project_id = #{projectId}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
</where>
</select>
@ -47,13 +67,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where material_bom_id = #{materialBomId}
</select>
<insert id="insertMesMaterialBom" parameterType="MesMaterialBom" useGeneratedKeys="true" keyProperty="materialBomId">
<insert id="insertMesMaterialBom" parameterType="MesMaterialBom" useGeneratedKeys="true"
keyProperty="materialBomId">
insert into mes_material_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="materialId != null">material_id,</if>
<if test="materialName != null">material_name,</if>
<if test="materialBomDesc != null">material_bom_desc,</if>
<if test="standardAmount != null">standard_amount,</if>
<if test="topFlag != null">top_flag,</if>
<if test="checkType != null">check_type,</if>
@ -64,12 +86,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialBomDesc != null">#{materialBomDesc},</if>
<if test="standardAmount != null">#{standardAmount},</if>
<if test="topFlag != null">#{topFlag},</if>
<if test="checkType != null">#{checkType},</if>
@ -80,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</trim>
</insert>
<update id="updateMesMaterialBom" parameterType="MesMaterialBom">
@ -90,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialBomDesc != null">material_bom_desc = #{materialBomDesc},</if>
<if test="standardAmount != null">standard_amount = #{standardAmount},</if>
<if test="topFlag != null">top_flag = #{topFlag},</if>
<if test="checkType != null">check_type = #{checkType},</if>
@ -105,7 +129,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteMesMaterialBomByMaterialBomId" parameterType="Long">
delete from mes_material_bom where material_bom_id = #{materialBomId}
delete
from mes_material_bom
where material_bom_id = #{materialBomId}
</delete>
<delete id="deleteMesMaterialBomByMaterialBomIds" parameterType="String">
@ -116,22 +142,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectMesMaterialBomJoinList" parameterType="MesMaterialBom" resultMap="MesMaterialBomResult">
select mmb.material_id,mbmi.material_code,mbmi.material_name,mmb.standard_amount
from mes_material_bom mmb left join mes_base_material_info mbmi on mmb.material_id=mbmi.material_id
<where>
<if test="parentId != null "> and mmb.parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and mmb.ancestors like concat(#{ancestors}, '%')</if>
<if test="materialId != null "> and mmb.material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="standardAmount != null "> and mmb.standard_amount = #{standardAmount}</if>
<if test="topFlag != null "> and mmb.top_flag = #{topFlag}</if>
<if test="checkType != null and checkType != ''"> and mmb.check_type = #{checkType}</if>
<if test="projectId != null "> and mmb.project_id = #{projectId}</if>
<if test="activeFlag != null and activeFlag != ''"> and mmb.active_flag = #{activeFlag}</if>
<if test="parentId != null ">and mmb.parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and mmb.ancestors like concat(#{ancestors}, '%')</if>
<if test="materialId != null ">and mmb.material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''">and mbmi.material_name like concat('%',
#{materialName}, '%')
</if>
<if test="standardAmount != null ">and mmb.standard_amount = #{standardAmount}</if>
<if test="topFlag != null ">and mmb.top_flag = #{topFlag}</if>
<if test="checkType != null and checkType != ''">and mmb.check_type = #{checkType}</if>
<if test="projectId != null ">and mmb.project_id = #{projectId}</if>
<if test="activeFlag != null and activeFlag != ''">and mmb.active_flag = #{activeFlag}</if>
</where>
</select>

@ -88,7 +88,7 @@
v-if="refreshTable"
v-loading="loading"
:data="materialBomList"
row-key="materialId"
row-key="materialBomId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
@ -96,6 +96,7 @@
<el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[2].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[3].visible"/>
<el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/>
<el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/>
<el-table-column label="标准数量" align="center" prop="standardAmount" v-if="columns[5].visible"/>
<el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
<template slot-scope="scope">
@ -143,18 +144,21 @@
<!-- 添加或修改物料BOM信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="父级BOM" prop="parentId" >
<treeselect v-model="form.parentId" :options="materialBomOptions" :normalizer="normalizer" disabled/>
</el-form-item>
<!-- <el-form-item label="物料ID" prop="materialId">-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
<!-- </el-form-item>-->
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入子BOM" readonly>
<el-form-item label="子级BOM" prop="materialName">
<el-input v-model="form.materialName" placeholder="请点击右侧检索子BOM" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="BOM说明" prop="materialBomDesc" >
<el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)" />
</el-form-item>
<el-form-item label="标准数量" prop="standardAmount">
<el-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量" />
</el-form-item>
@ -250,6 +254,7 @@ export default {
materialId: null,
materialName: null,
standardAmount: null,
materialBomDesc: null,
topFlag: null,
checkType: null,
projectId: null,
@ -262,6 +267,9 @@ export default {
materialId: [
{ required: true, message: "物料ID不能为空", trigger: "blur" }
],
materialBomDesc: [
{required: true, message: "BOM说明不能为空", trigger: "blur"}
],
standardAmount: [
{ required: true, message: "标准数量不能为空", trigger: "blur" }
],
@ -278,13 +286,14 @@ export default {
{ key: 5, label: `标准数量`, visible: true },
{ key: 6, label: `顶级标识`, visible: true },
{ key: 7, label: `校验类型`, visible: true },
{ key: 8, label: `项目ID`, visible: true },
{ key: 8, label: `项目ID`, visible: false },
{ key: 9, label: `激活标识`, visible: false },
{ key: 10, label: `备注`, visible: false },
{ key: 11, label: `创建人`, visible: true },
{ key: 12, label: `创建时间`, visible: true },
{ key: 13, label: `更新人`, visible: true },
{ key: 14, label: `更新时间`, visible: true },
{ key: 15, label: `BOM说明`, visible: true },
],
};
},
@ -296,7 +305,7 @@ export default {
getList() {
this.loading = true;
listMaterialBom(this.queryParams).then(response => {
this.materialBomList = this.handleTree(response.data, "materialId", "parentId");
this.materialBomList = this.handleTree(response.data, "materialBomId", "parentId");
this.loading = false;
});
},
@ -306,7 +315,7 @@ export default {
delete node.children;
}
return {
id: node.materialId,
id: node.materialBomId,
label: node.materialName,
children: node.children
};
@ -315,8 +324,8 @@ export default {
getTreeselect() {
listMaterialBom().then(response => {
this.materialBomOptions = [];
const data = { materialId: 0, materialName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "materialId", "parentId");
const data = { materialBomId: 0, materialName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "materialBomId", "parentId");
this.materialBomOptions.push(data);
});
},
@ -334,6 +343,7 @@ export default {
materialId: null,
materialName: null,
standardAmount: null,
materialBomDesc: null,
topFlag: 1,
checkType: '0',
projectId: null,
@ -359,11 +369,13 @@ export default {
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.materialId) {
this.form.parentId = row.materialId;
if (row != null && row.materialBomId) {
this.form.parentId = row.materialBomId;
} else {
this.form.parentId = 0;
}
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true;
this.title = "添加物料BOM信息";
},
@ -384,10 +396,12 @@ export default {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.materialId;
this.form.parentId = row.materialBomId;
}
getMaterialBom(row.materialBomId).then(response => {
this.form = response.data;
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true;
this.title = "修改物料BOM信息";
});
@ -413,7 +427,7 @@ export default {
});
},
handleSelection(selection) {
this.ids = selection.map(item => item.objId)
this.ids = selection.map(item => item.materialBomId)
this.single = selection.length!==1
this.multiple = !selection.length
},

Loading…
Cancel
Save