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

master
yinq 1 year ago
parent 3f838eba5b
commit b1a7da2f26

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

@ -74,4 +74,12 @@ public interface IMesMaterialBomService
* @return * @return
*/ */
public List<MesMaterialBom> getMaterialVisionList(Long materialId); 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); public int productOrderPublish(MesProductOrder mesProductOrder);
/** /**
* BOM * BOM
* @param materialBomId * @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 * BOM
* @param mesMaterialBom * @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.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesProductOrderMapper; import com.hw.mes.mapper.MesProductOrderMapper;
@ -25,6 +27,9 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Autowired @Autowired
private MesProductOrderMapper mesProductOrderMapper; private MesProductOrderMapper mesProductOrderMapper;
@Autowired
private IMesMaterialBomService mesMaterialBomService;
/** /**
* *
* *
@ -195,8 +200,15 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Override @Override
public Boolean verifyBOMIsProduction(Long materialBomId) { public Boolean verifyBOMIsProduction(Long materialBomId) {
//查询顶级BOM //查询顶级BOM
MesMaterialBom mesMaterialBom = mesMaterialBomService.selectTopMaterialBomByMaterialBomId(materialBomId);
//通过顶级BOM主键查询生产工单 //通过顶级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' method: 'delete'
}) })
} }
// 校验BOM是否被生产工单选择
export function verifyBOMIsProduction(materialBomId) {
return request({
url: '/mes/productOrder/verifyBOMIsProduction/' + materialBomId,
method: 'get'
})
}

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

@ -70,7 +70,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['mes:materialBom:add']" v-hasPermi="['mes:materialBom:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -79,7 +80,8 @@
icon="el-icon-sort" icon="el-icon-sort"
size="mini" size="mini"
@click="toggleExpandAll" @click="toggleExpandAll"
>展开/折叠</el-button> >展开/折叠
</el-button>
</el-col> </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-row>
@ -123,21 +125,24 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['mes:materialBom:edit']" v-hasPermi="['mes:materialBom:edit']"
>修改</el-button> >修改
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd(scope.row)" @click="handleAdd(scope.row)"
v-hasPermi="['mes:materialBom:add']" v-hasPermi="['mes:materialBom:add']"
>新增子BOM</el-button> >新增子BOM
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['mes:materialBom:remove']" v-hasPermi="['mes:materialBom:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -177,7 +182,8 @@
v-for="dict in dict.type.check_type" v-for="dict in dict.type.check_type"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="项目ID" prop="projectId"> <el-form-item label="项目ID" prop="projectId">
@ -189,7 +195,8 @@
v-for="dict in dict.type.active_flag" v-for="dict in dict.type.active_flag"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
@ -215,10 +222,17 @@
</template> </template>
<script> <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 Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import addBom from '@//views/mes/materialBom/addBom.vue'; import addBom from '@//views/mes/materialBom/addBom.vue';
import {verifyBOMIsProduction} from "@//api/mes/productOrder";
export default { export default {
name: "MaterialBom", name: "MaterialBom",
@ -371,13 +385,22 @@ export default {
this.getTreeselect(); this.getTreeselect();
if (row != null && row.materialBomId) { if (row != null && row.materialBomId) {
this.form.parentId = row.materialBomId; this.form.parentId = row.materialBomId;
} else { verifyBOMIsProduction(row.materialBomId).then(res => {
this.form.parentId = 0; if (res.data) {
throw Error()
} }
//BOMbom //BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0; this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true; this.open = true;
this.title = "添加物料BOM信息"; this.title = "添加物料BOM信息";
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法新增");
return;
});
} else {
this.form.parentId = 0;
}
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleMaterialAdd() { handleMaterialAdd() {
@ -397,7 +420,10 @@ export default {
this.getTreeselect(); this.getTreeselect();
if (row != null) { if (row != null) {
this.form.parentId = row.materialBomId; this.form.parentId = row.materialBomId;
} verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) {
this.$modal.msgError("该物料BOM已被生产工单选择无法修改");
} else {
getMaterialBom(row.materialBomId).then(response => { getMaterialBom(row.materialBomId).then(response => {
this.form = response.data; this.form = response.data;
//BOMbom //BOMbom
@ -405,6 +431,9 @@ export default {
this.open = true; this.open = true;
this.title = "修改物料BOM信息"; this.title = "修改物料BOM信息";
}); });
}
})
}
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
@ -440,12 +469,21 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除物料BOM信息编号为"' + row.materialBomId + '"的数据项?').then(function() { verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) {
throw Error()
}
this.$modal.confirm('是否确认删除物料名称为"' + row.materialName + '"的数据项?').then(function () {
return delMaterialBom(row.materialBomId); return delMaterialBom(row.materialBomId);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法删除");
return;
});
} }
} }
}; };

Loading…
Cancel
Save