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(' | ')