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;