From ad6eef95430b0130662166171b7bff476754fe09 Mon Sep 17 00:00:00 2001 From: jhd <1684074631@qq.com> Date: Tue, 7 Jul 2026 09:42:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor(wms):=20=E4=BC=98=E5=8C=96=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E8=AF=A6=E6=83=85=E9=A1=B5=E9=92=A2=E6=9D=90=E5=93=81?= =?UTF-8?q?=E7=B1=BB=E5=8C=B9=E9=85=8D=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整镀锌管材匹配规则,支持更多镀锌相关品类 - 新增仓库特定品类匹配配置,不同仓库使用不同的品类优先级 - 扩展品质等级匹配逻辑,支持以字母开头和特定等级标识 - 修改数据获取方式,按仓库分别请求并去重合并数据 - 优化钢材品类匹配算法,按仓库限制的品类范围进行匹配 - 更新数据加载逻辑,使用Promise.all并行请求提升性能 --- klp-ui/src/views/wms/stock/detail.vue | 45 +++++++++++++++++++-------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/klp-ui/src/views/wms/stock/detail.vue b/klp-ui/src/views/wms/stock/detail.vue index b8bcbd6ab..c1cd95a78 100644 --- a/klp-ui/src/views/wms/stock/detail.vue +++ b/klp-ui/src/views/wms/stock/detail.vue @@ -46,13 +46,22 @@ const CATEGORIES = [ { key: '冷硬钢卷', label: '冷硬钢卷', match: ['冷硬'] }, { key: '冷轧钢卷', label: '冷轧钢卷', match: ['冷轧'] }, { key: '镀锌钢卷', label: '镀锌钢卷', match: ['镀锌分剪卷', '镀锌卷', '镀锌'] }, - { key: '镀锌管材', label: '镀锌管材', match: ['镀锌管'] }, + { key: '镀锌管材', label: '镀锌管材', match: ['镀锌卷', '镀锌分剪卷', '镀锌管'] }, { key: '花纹板', label: '花纹板', match: ['花纹板'] }, { key: '镀铬', label: '镀铬', match: ['镀铬'] }, ] // 匹配优先级:镀锌管材必须在镀锌钢卷之前检查 const MATCH_PRIORITY = ['镀锌管材', '冷硬钢卷', '冷轧钢卷', '镀锌钢卷', '花纹板', '镀铬'] +// 仓库 → 允许匹配的品类(按优先级排序),未列出的仓库使用 MATCH_PRIORITY +const WAREHOUSE_CATS = { + '1988150099140866050': ['冷硬钢卷'], + '1988150915591499777': ['冷轧钢卷', '花纹板'], + '1988150323162836993': ['镀锌钢卷', '镀锌管材'], + '1988150487185289217': ['镀锌管材'], + '1988151132361519105': ['镀铬'], +} + /** * 品质等级 → 分组映射 * A/B → 'AB', C/D/O → 'CDO', 其他 → null @@ -60,8 +69,8 @@ const MATCH_PRIORITY = ['镀锌管材', '冷硬钢卷', '冷轧钢卷', '镀锌 function getQualityGroup(status) { if (!status) return null const s = String(status).toUpperCase().trim() - if (['A', 'B'].includes(s)) return 'AB' - if (['C', 'D', 'O'].includes(s)) return 'CDO' + if (s.startsWith('A') || s === 'B' || s === 'B级') return 'AB' + if (s.startsWith('C') || s.startsWith('D') || s.startsWith('O')) return 'CDO' return null } @@ -93,9 +102,10 @@ export default { let unmatchedCount = 0 this.rawList.forEach(item => { - // 匹配钢材品类 + // 匹配钢材品类(按仓库限制品类范围) const catMap = new Map(CATEGORIES.map(c => [c.key, c])) - const cat = MATCH_PRIORITY.map(k => catMap.get(k)).find( + const allowed = WAREHOUSE_CATS[item.warehouseId] || MATCH_PRIORITY + const cat = allowed.map(k => catMap.get(k)).find( c => item.itemName && c.match.some(m => item.itemName.includes(m)) ) if (!cat) { unmatchedCount++; return } @@ -239,14 +249,23 @@ export default { this.loading = true this.rawList = [] - listCoilWithIds({ - selectType: 'product', - status: 0, - dataType: 1, - pageSize: 99999, - pageNum: 1, - }).then(res => { - this.rawList = res.rows || [] + Promise.all([ + // 酸连轧成品库 → 冷硬钢卷 + listCoilWithIds({ warehouseIds: '1988150099140866050', status: 0, dataType: 1, pageSize: 99999, pageNum: 1 }), + // 拉矫成品库 → 冷轧钢卷 / 花纹板(按 itemName 区分) + listCoilWithIds({ warehouseIds: '1988150915591499777', status: 0, dataType: 1, pageSize: 99999, pageNum: 1 }), + // 镀锌成品库 → 镀锌钢卷 / 镀锌管材(按 itemName 区分) + listCoilWithIds({ warehouseIds: '1988150323162836993', status: 0, dataType: 1, pageSize: 99999, pageNum: 1 }), + // 镀锌纵剪分条原料库 → 镀锌管材(raw_material 镀锌卷) + listCoilWithIds({ warehouseIds: '1988150487185289217', status: 0, dataType: 1, pageSize: 99999, pageNum: 1 }), + // 镀铬成品库 → 镀铬 + listCoilWithIds({ warehouseIds: '1988151132361519105', status: 0, dataType: 1, pageSize: 99999, pageNum: 1 }), + ]).then(results => { + const map = new Map() + results.forEach(res => { + ;(res.rows || []).forEach(item => map.set(item.coilId, item)) + }) + this.rawList = Array.from(map.values()) this.loading = false }).catch(() => { this.loading = false