From 5520767f2e9662b459525d6bae0ef1e4a12406b0 Mon Sep 17 00:00:00 2001 From: HIsheR Date: Fri, 16 Oct 2026 15:56:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(stock-count):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=9B=A4=E9=BB=9E=E5=B7=AE=E7=95=B0=E5=A0=B1=E8=A1=A8=E5=BD=99?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 前置功能分支 F1,供後續匯出功能依賴 --- src/modules/stock-count.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/stock-count.ts b/src/modules/stock-count.ts index a5f7444..ab86ed8 100644 --- a/src/modules/stock-count.ts +++ b/src/modules/stock-count.ts @@ -18,3 +18,18 @@ export interface StockCountDiff { * @returns 實盤減帳面的差異值 */ export const diffQty = (diff: StockCountDiff): number => diff.countedQty - diff.bookQty; + +/** 盤點差異報表列 */ +export interface StockCountReportRow { + /** 物料識別碼 */ + materialId: string; + /** 該物料的差異量 */ + diff: number; +} + +/** + * 依盤點資料彙整差異報表 + * @param diffs - 盤點差異清單 + * @returns 逐物料的差異報表列 + */ +export const buildReport = (diffs: StockCountDiff[]): StockCountReportRow[] => diffs.map((diff) => ({ materialId: diff.materialId, diff: diffQty(diff) }));