From c3637e0c2570bf0c5d107901d17cfd318be54583 Mon Sep 17 00:00:00 2001 From: yueli Date: Tue, 1 Sep 2026 16:35:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=87=BA=E5=BA=93=E5=A4=87=E6=B3=A8?= =?UTF-8?q?=E6=AC=A0=E6=96=99=E6=94=B9=E7=94=A8=E5=AE=9E=E6=97=B6=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E8=AE=A1=E7=AE=97,=E4=B8=8D=E5=86=8D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A1=AB=E5=8E=86=E5=8F=B2=E6=AC=A0=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - buildRemarkWithShortage 改用 bomDetailList 实时 shortage(需量-当前库存) - 库存补足后,欠料不再自动拼进出库备注(原 localStorage 历史记录一直带出) --- .../src/views/outbound/Selection.vue | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue index 97b517c..335ef23 100644 --- a/inventory-web/src/views/outbound/Selection.vue +++ b/inventory-web/src/views/outbound/Selection.vue @@ -937,23 +937,16 @@ const confirmBomAdd = async () => { const BOM_SHORTAGE_KEY = 'MOM_BOM_SHORTAGE_RECORDS' const bomShortageRecords = ref>(JSON.parse(localStorage.getItem(BOM_SHORTAGE_KEY) || '{}')) -// ★ 将缺货清单拼接进备注(借鸡生蛋:历史缺货记录永久留存在出库申请单备注) +// ★ 将缺货清单拼接进备注(仅拼当前实际缺货的物料,库存补足后不再出现) const buildRemarkWithShortage = (baseRemark: string): string => { const parts: string[] = [] if (baseRemark) parts.push(baseRemark) - const shortageBoms = Object.keys(bomShortageRecords.value) - if (shortageBoms.length > 0) { - const detail: string[] = [] - for (const no of shortageBoms) { - const rec = bomShortageRecords.value[no] - if (!rec?.items?.length) continue - const items = rec.items.map((i: any) => `${i.name}(${i.shortage}个)`).join('、') - detail.push(`${no}: ${items}`) - } - if (detail.length > 0) { - parts.push(`[BOM欠料待补] ${detail.join(';')}`) - } + // ★ 用当前实时计算的缺货清单(需量 - 当前库存),而非 localStorage 历史记录 + const shortageItems = bomDetailList.value.filter((i: any) => i.shortage > 0) + if (shortageItems.length > 0) { + const items = shortageItems.map((i: any) => `${i.name}(${i.shortage}个)`).join('、') + parts.push(`[BOM欠料待补] ${items}`) } return parts.join(' | ')