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

master
yinq 1 year 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,

@ -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,7 +80,8 @@
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>
</el-row>
@ -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>
@ -177,7 +182,8 @@
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">
@ -189,7 +195,8 @@
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">
@ -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",
@ -371,13 +385,22 @@ export default {
this.getTreeselect();
if (row != null && row.materialBomId) {
this.form.parentId = row.materialBomId;
} else {
this.form.parentId = 0;
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;
}
},
/** 新增按钮操作 */
handleMaterialAdd() {
@ -397,7 +420,10 @@ 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
@ -405,6 +431,9 @@ export default {
this.open = true;
this.title = "修改物料BOM信息";
});
}
})
}
},
/** 提交按钮 */
submitForm() {
@ -440,12 +469,21 @@ export default {
},
/** 删除按钮操作 */
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);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法删除");
return;
});
}
}
};

Loading…
Cancel
Save