From 9bd174cc56d25e9073210ac2a0d4bcda263e602f Mon Sep 17 00:00:00 2001 From: HIsheR Date: Fri, 16 Oct 2026 15:43:23 +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=E8=A8=88=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提供帳面與實盤差異的計算邏輯 --- src/modules/stock-count.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/modules/stock-count.ts diff --git a/src/modules/stock-count.ts b/src/modules/stock-count.ts new file mode 100644 index 0000000..a5f7444 --- /dev/null +++ b/src/modules/stock-count.ts @@ -0,0 +1,20 @@ +/** + * 盤點差異模組(沙盤推演示意) + */ + +/** 單一物料的盤點差異 */ +export interface StockCountDiff { + /** 物料識別碼 */ + materialId: string; + /** 帳面數量 */ + bookQty: number; + /** 實盤數量 */ + countedQty: number; +} + +/** + * 計算盤點差異數量 + * @param diff - 單一物料的盤點資料 + * @returns 實盤減帳面的差異值 + */ +export const diffQty = (diff: StockCountDiff): number => diff.countedQty - diff.bookQty;