change - 物料BOM已被生产工单选择的无法修改、新增、删除

master
yinq 9 months ago
parent 3f838eba5b
commit b1a7da2f26

@ -132,7 +132,7 @@ public class MesProductOrderController extends BaseController {
*
* @return materialBomId
*/
@GetMapping(value = "/VerifyBOMIsProduction/{materialBomId}")
@GetMapping(value = "/verifyBOMIsProduction/{materialBomId}")
public AjaxResult verifyBOMIsProduction(@PathVariable Long materialBomId) {
return success(mesProductOrderService.verifyBOMIsProduction(materialBomId));
}

@ -74,4 +74,12 @@ public interface IMesMaterialBomService
* @return
*/
public List<MesMaterialBom> getMaterialVisionList(Long materialId);
/**
* BOM
*
* @param materialBomId BOM
* @return BOM
*/
public MesMaterialBom selectTopMaterialBomByMaterialBomId(Long materialBomId);
}

@ -81,8 +81,6 @@ public interface IMesProductOrderService
*/
public int productOrderPublish(MesProductOrder mesProductOrder);
/**
* BOM
* @param materialBomId

@ -128,6 +128,32 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
}
/**
* BOM
* @param materialBomId BOM
* @return
*/
@Override
public MesMaterialBom selectTopMaterialBomByMaterialBomId(Long materialBomId) {
MesMaterialBom mesMaterialBom = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(materialBomId);
return recursionSelectTopMaterialBom(mesMaterialBom);
}
/**
* BOM
* @param mesMaterialBom
* @return
*/
public MesMaterialBom recursionSelectTopMaterialBom(MesMaterialBom mesMaterialBom) {
if (mesMaterialBom.getTopFlag() == 1L){
//返回顶级BOM信息
return mesMaterialBom;
}
MesMaterialBom materialBom = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(mesMaterialBom.getParentId());
return recursionSelectTopMaterialBom(materialBom);
}
/**
* SET
* BOM
* @param mesMaterialBom
*/

@ -8,6 +8,8 @@ import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.service.IMesMaterialBomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesProductOrderMapper;
@ -25,6 +27,9 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
@Autowired
private IMesMaterialBomService mesMaterialBomService;
/**
*
*
@ -195,8 +200,15 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Override
public Boolean verifyBOMIsProduction(Long materialBomId) {
//查询顶级BOM
MesMaterialBom mesMaterialBom = mesMaterialBomService.selectTopMaterialBomByMaterialBomId(materialBomId);
//通过顶级BOM主键查询生产工单
return null;
MesProductOrder mesProductOrder = new MesProductOrder();
mesProductOrder.setMaterialBomId(mesMaterialBom.getMaterialBomId());
List<MesProductOrder> productOrderList = mesProductOrderMapper.selectMesProductOrderList(mesProductOrder);
if (productOrderList.size() > 0){
return true;
}
return false;
}
}

@ -77,3 +77,11 @@ export function delProductOrder(productOrderId) {
method: 'delete'
})
}
// 校验BOM是否被生产工单选择
export function verifyBOMIsProduction(materialBomId) {
return request({
url: '/mes/productOrder/verifyBOMIsProduction/' + materialBomId,
method: 'get'
})
}

@ -230,7 +230,7 @@ export default {
multiple: true,
//
showSearch: true,
//
//
submitShow: true,
//
tagShow: true,

@ -45,18 +45,18 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="激活标识" prop="activeFlag">-->
<!-- <el-select v-model="queryParams.activeFlag" placeholder="请选择激活标识" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="激活标识" prop="activeFlag">-->
<!-- <el-select v-model="queryParams.activeFlag" placeholder="请选择激活标识" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
@ -70,7 +70,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:materialBom:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -79,9 +80,10 @@
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
>展开/折叠
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
@ -92,24 +94,24 @@
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
<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="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">
<el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.topFlag"/>
</template>
</el-table-column>
<el-table-column label="校验类型" align="center" prop="checkType" v-if="columns[7].visible">
<el-table-column label="校验类型" align="center" prop="checkType" v-if="columns[7].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_type" :value="scope.row.checkType"/>
</template>
</el-table-column>
<el-table-column label="项目ID" align="center" prop="projectId" v-if="columns[8].visible"/>
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[9].visible">
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[9].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
</template>
@ -123,21 +125,24 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:materialBom:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['mes:materialBom:add']"
>新增子BOM</el-button>
>新增子BOM
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:materialBom:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -145,43 +150,44 @@
<!-- 添加或修改物料BOM信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="父级BOM" prop="parentId" >
<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="物料ID" prop="materialId">-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
<!-- </el-form-item>-->
<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-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 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-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量"/>
</el-form-item>
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
<!-- <el-radio-group v-model="form.topFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="parseInt(dict.value)"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
<!-- <el-radio-group v-model="form.topFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="parseInt(dict.value)"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="校验类型" prop="checkType">
<el-radio-group v-model="form.checkType">
<el-radio
v-for="dict in dict.type.check_type"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="项目ID" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目ID" />
<el-input v-model="form.projectId" placeholder="请输入项目ID"/>
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag">
@ -189,11 +195,12 @@
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -203,7 +210,7 @@
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body>
<el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body>
<add-bom @selection="handleSelection" ref="materialRef"></add-bom>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
@ -215,10 +222,17 @@
</template>
<script>
import { listMaterialBom, getMaterialBom, delMaterialBom, addMaterialBom, updateMaterialBom } from "@/api/mes/materialBom";
import {
listMaterialBom,
getMaterialBom,
delMaterialBom,
addMaterialBom,
updateMaterialBom
} from "@/api/mes/materialBom";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import addBom from '@//views/mes/materialBom/addBom.vue';
import {verifyBOMIsProduction} from "@//api/mes/productOrder";
export default {
name: "MaterialBom",
@ -265,36 +279,36 @@ export default {
//
rules: {
materialId: [
{ required: true, message: "物料ID不能为空", trigger: "blur" }
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
materialBomDesc: [
{required: true, message: "BOM说明不能为空", trigger: "blur"}
],
standardAmount: [
{ required: true, message: "标准数量不能为空", trigger: "blur" }
{required: true, message: "标准数量不能为空", trigger: "blur"}
],
activeFlag: [
{ required: true, message: "激活标识不能为空", trigger: "change" }
{required: true, message: "激活标识不能为空", trigger: "change"}
],
},
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 1, label: `父级标识`, visible: false },
{ key: 2, label: `祖级列表`, visible: false },
{ key: 3, label: `物料ID`, visible: false },
{ key: 4, label: `物料名称`, visible: true },
{ key: 5, label: `标准数量`, visible: true },
{ key: 6, label: `顶级标识`, visible: true },
{ key: 7, label: `校验类型`, 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 },
],
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `父级标识`, visible: false},
{key: 2, label: `祖级列表`, visible: false},
{key: 3, label: `物料ID`, visible: false},
{key: 4, label: `物料名称`, visible: true},
{key: 5, label: `标准数量`, visible: true},
{key: 6, label: `顶级标识`, visible: true},
{key: 7, label: `校验类型`, 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},
],
};
},
created() {
@ -320,11 +334,11 @@ export default {
children: node.children
};
},
/** 查询物料BOM信息下拉树结构 */
/** 查询物料BOM信息下拉树结构 */
getTreeselect() {
listMaterialBom().then(response => {
this.materialBomOptions = [];
const data = { materialBomId: 0, materialName: '顶级节点', children: [] };
const data = {materialBomId: 0, materialName: '顶级节点', children: []};
data.children = this.handleTree(response.data, "materialBomId", "parentId");
this.materialBomOptions.push(data);
});
@ -371,13 +385,22 @@ export default {
this.getTreeselect();
if (row != null && row.materialBomId) {
this.form.parentId = row.materialBomId;
verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) {
throw Error()
}
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true;
this.title = "添加物料BOM信息";
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法新增");
return;
});
} else {
this.form.parentId = 0;
}
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true;
this.title = "添加物料BOM信息";
},
/** 新增按钮操作 */
handleMaterialAdd() {
@ -397,14 +420,20 @@ export default {
this.getTreeselect();
if (row != null) {
this.form.parentId = row.materialBomId;
verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) {
this.$modal.msgError("该物料BOM已被生产工单选择无法修改");
} else {
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信息";
});
}
})
}
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信息";
});
},
/** 提交按钮 */
submitForm() {
@ -428,7 +457,7 @@ export default {
},
handleSelection(selection) {
this.ids = selection.map(item => item.materialBomId)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 提交物料信息按钮 */
@ -440,12 +469,21 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除物料BOM信息编号为"' + row.materialBomId + '"的数据项?').then(function() {
return delMaterialBom(row.materialBomId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) {
throw Error()
}
this.$modal.confirm('是否确认删除物料名称为"' + row.materialName + '"的数据项?').then(function () {
return delMaterialBom(row.materialBomId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法删除");
return;
});
}
}
};

Loading…
Cancel
Save