change - 优化物料BOM删除逻辑(删除BOM同时删除子BOM)

master
yinq 8 months ago
parent b1a7da2f26
commit b2f66f3cc4

@ -88,6 +88,13 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
@Override
public int deleteMesMaterialBomByMaterialBomIds(Long[] materialBomIds)
{
//遍历删除子集物料BOM
MesMaterialBom materialBom = new MesMaterialBom();
materialBom.setAncestors(String.valueOf(materialBomIds[0]));
List<MesMaterialBom> materialBomList = mesMaterialBomMapper.selectMesMaterialBomList(materialBom);
for (MesMaterialBom bom : materialBomList) {
mesMaterialBomMapper.deleteMesMaterialBomByMaterialBomId(bom.getMaterialBomId());
}
return mesMaterialBomMapper.deleteMesMaterialBomByMaterialBomIds(materialBomIds);
}
@ -144,7 +151,7 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
* @return
*/
public MesMaterialBom recursionSelectTopMaterialBom(MesMaterialBom mesMaterialBom) {
if (mesMaterialBom.getTopFlag() == 1L){
if (StringUtils.isNull(mesMaterialBom) || mesMaterialBom.getTopFlag() == 1L){
//返回顶级BOM信息
return mesMaterialBom;
}

@ -201,6 +201,9 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
public Boolean verifyBOMIsProduction(Long materialBomId) {
//查询顶级BOM
MesMaterialBom mesMaterialBom = mesMaterialBomService.selectTopMaterialBomByMaterialBomId(materialBomId);
if (StringUtils.isNull(mesMaterialBom)){
return false;
}
//通过顶级BOM主键查询生产工单
MesProductOrder mesProductOrder = new MesProductOrder();
mesProductOrder.setMaterialBomId(mesMaterialBom.getMaterialBomId());

@ -50,7 +50,7 @@
<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="ancestors != null and ancestors != ''">and ancestors like concat('%', #{ancestors},'%')</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')

@ -391,9 +391,6 @@ export default {
}
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true;
this.title = "添加物料BOM信息";
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法新增");
return;
@ -401,6 +398,8 @@ export default {
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加物料BOM信息";
},
/** 新增按钮操作 */
handleMaterialAdd() {

Loading…
Cancel
Save