feat: 添加产品与原材料BOM信息展示功能
- 新增listProductWithBom和listRawMaterialWithBom接口 - 在ProductSelect和RawMaterialSelect组件中展示BOM属性信息 - 优化物料状态显示条件及仓库过滤逻辑 - 更新统计组件查询参数
This commit is contained in:
@@ -51,3 +51,11 @@ export function delProduct(productId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function listProductWithBom(query) {
|
||||
return request({
|
||||
url: '/wms/product/listWithBom',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -41,4 +41,4 @@ export function delProductBom(bomId) {
|
||||
url: '/wms/productBom/' + bomId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -59,3 +59,11 @@ export function listRawMaterialWithDemand(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function listRawMaterialWithBom(query) {
|
||||
return request({
|
||||
url: '/wms/rawMaterial/listWithBom',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ export default {
|
||||
Promise.all([
|
||||
listProduct({ pageSise: 1, pageNum: 1 }),
|
||||
listRawMaterial({ pageSise: 1, pageNum: 1 }),
|
||||
listMaterialCoil({ pageSise: 1, pageNum: 1 }),
|
||||
listEquipmentManagement({ pageSise: 1, pageNum: 1 }),
|
||||
listMaterialCoil({ pageSise: 1, pageNum: 1, dateType: '1' }),
|
||||
listEquipmentManagement({ pageSise: 1, pageNum: 1, status: 'in_service' }),
|
||||
listOrder({ pageSise: 1, pageNum: 1 }),
|
||||
listCustomer({ pageSise: 1, pageNum: 1 }),
|
||||
listSupplier({ pageSise: 1, pageNum: 1 })
|
||||
|
||||
@@ -8,9 +8,14 @@
|
||||
</template>
|
||||
<el-option v-for="item in productOptions" :key="item.productId"
|
||||
:label="`${item.productName}(${item.productCode})`" :value="item.productId">
|
||||
<div class="option-label">
|
||||
<span class="product-name">{{ item.productName }}</span>
|
||||
<div>
|
||||
<div class="option-label">
|
||||
<span class="product-name">{{ item.productName }}</span>
|
||||
<span class="product-code">{{ item.productCode }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="product-sku">{{ getSku(item) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -124,6 +129,33 @@ export default {
|
||||
this.productOptions = res.rows || [];
|
||||
});
|
||||
},
|
||||
getSku(item) {
|
||||
const boms = item.bomItems || [];
|
||||
if (!boms.length) {
|
||||
return '暂无BOM信息';
|
||||
}
|
||||
// 查找attrKey为'规格'的attrvalue
|
||||
const specification = boms.find(p => p.attrKey === '规格');
|
||||
|
||||
// 查找attrKey为'表面处理'的attrvalue
|
||||
const factory = boms.find(p => p.attrKey === '表面处理');
|
||||
|
||||
// 查找attrKey为'材质'的attrvalue
|
||||
const material = boms.find(p => p.attrKey === '材质');
|
||||
|
||||
// 组合sku:
|
||||
let sku = '';
|
||||
if (specification) {
|
||||
sku += '规格:' + specification.attrValue + ';';
|
||||
}
|
||||
if (factory) {
|
||||
sku += '表面处理:' + factory.attrValue + ';';
|
||||
}
|
||||
if (material) {
|
||||
sku += '材质:' + material.attrValue + ';';
|
||||
}
|
||||
return sku;
|
||||
},
|
||||
onChange(val) {
|
||||
// 通过val找到item
|
||||
const product = this.productOptions.find(p => p.productId === val);
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
</template>
|
||||
<el-option v-for="item in rawMaterialList" :key="item.rawMaterialId"
|
||||
:label="`${item.rawMaterialName}(${item.rawMaterialCode})`" :value="item.rawMaterialId">
|
||||
<div class="option-label">
|
||||
<span class="material-name">{{ item.rawMaterialName }}</span>
|
||||
<span class="material-code">{{ item.rawMaterialCode }}</span>
|
||||
<div>
|
||||
<div class="option-label">
|
||||
<span class="material-name">{{ item.rawMaterialName }}</span>
|
||||
<span class="material-code">{{ getSku(item) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -61,6 +63,7 @@
|
||||
import { mapGetters } from "vuex";
|
||||
import { addRawMaterial } from '@/api/wms/rawMaterial';
|
||||
import BomPanel from '../BomPanel/index.vue';
|
||||
import { findItemWithBom } from '@/api/wms/bom';
|
||||
|
||||
export default {
|
||||
name: "RawMaterialSelect",
|
||||
@@ -130,6 +133,35 @@ export default {
|
||||
const rawMaterial = this.options.find(p => p.rawMaterialId === val);
|
||||
this.$emit('change', rawMaterial);
|
||||
},
|
||||
getSku(item) {
|
||||
const boms = item.bomItems;
|
||||
if (!boms || boms.length === 0) {
|
||||
return '暂无BOM信息';
|
||||
}
|
||||
// 查找attrKey为'规格'的attrvalue
|
||||
const specification = boms.find(p => p.attrKey === '规格');
|
||||
|
||||
// 查找attrKey为'厂家'的attrvalue
|
||||
const factory = boms.find(p => p.attrKey === '厂家');
|
||||
|
||||
// 查找attrKey为'材质'的attrvalue
|
||||
const material = boms.find(p => p.attrKey === '材质');
|
||||
|
||||
console.log(boms, item, '查找bomItems');
|
||||
// 组合sku:
|
||||
let sku = '';
|
||||
if (specification) {
|
||||
sku += '规格:' + specification.attrValue + ';';
|
||||
}
|
||||
if (factory) {
|
||||
sku += '厂家:' + factory.attrValue + ';';
|
||||
}
|
||||
if (material) {
|
||||
sku += '材质:' + material.attrValue;
|
||||
}
|
||||
console.log(sku, '组合sku');
|
||||
return sku;
|
||||
},
|
||||
add() {
|
||||
this.addDialogVisible = true;
|
||||
this.addForm = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { listCategory } from '@/api/wms/category';
|
||||
import { listProduct } from '@/api/wms/product';
|
||||
import { listRawMaterial } from '@/api/wms/rawMaterial';
|
||||
import { listProductWithBom } from '@/api/wms/product';
|
||||
import { listRawMaterialWithBom } from '@/api/wms/rawMaterial';
|
||||
import { listBomItem } from '@/api/wms/bomItem';
|
||||
|
||||
// 目前存在一个问题,当新增或删除,修改分类、产品、物料时,需要刷新整个页面,才能看到最新的数据
|
||||
@@ -51,7 +51,7 @@ const actions = {
|
||||
if (Object.keys(state.productMap).length > 0) {
|
||||
return Promise.resolve(state.productMap);
|
||||
}
|
||||
return listProduct({ pageNum: 1, pageSize: 10000 }).then(res => {
|
||||
return listProductWithBom({ pageNum: 1, pageSize: 10000 }).then(res => {
|
||||
const map = {};
|
||||
res.rows.forEach(item => {
|
||||
map[item.productId] = item;
|
||||
@@ -65,7 +65,7 @@ const actions = {
|
||||
if (Object.keys(state.rawMaterialMap).length > 0) {
|
||||
return Promise.resolve(state.rawMaterialMap);
|
||||
}
|
||||
return listRawMaterial({ pageNum: 1, pageSize: 10000 }).then(res => {
|
||||
return listRawMaterialWithBom({ pageNum: 1, pageSize: 10000 }).then(res => {
|
||||
const map = {};
|
||||
res.rows.forEach(item => {
|
||||
map[item.rawMaterialId] = item;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<QRCode :content="scope.row.qrcodeRecordId" :size="50" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<el-table-column label="状态" v-if="showStatus" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.status" placeholder="请选择状态" @change="handleStatusChange(scope.row)">
|
||||
<el-option v-for="item in dict.type.product_coil_status" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
|
||||
@@ -307,7 +307,12 @@ export default {
|
||||
endTime: this.queryParams.updateTime?.[1],
|
||||
}
|
||||
listMaterialCoil(query).then(response => {
|
||||
this.materialCoilList = response.rows;
|
||||
if (this.querys.warehouseId != 111) {
|
||||
// 排除掉111仓库的
|
||||
this.materialCoilList = response.rows.filter(item => item.warehouseId != 111)
|
||||
} else {
|
||||
this.materialCoilList = response.rows;
|
||||
}
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user