feat(stock-count): 新增差異報表 CSV 匯出

F2 依賴前置功能分支 F1 的報表列型別
This commit is contained in:
HIsheR
2026-10-16 15:57:17 +08:00
parent 5520767f2e
commit fef87731bd
+7
View File
@@ -33,3 +33,10 @@ export interface StockCountReportRow {
* @returns 逐物料的差異報表列
*/
export const buildReport = (diffs: StockCountDiff[]): StockCountReportRow[] => diffs.map((diff) => ({ materialId: diff.materialId, diff: diffQty(diff) }));
/**
* 將差異報表列轉為 CSV 字串(依賴 F1 的報表列型別)
* @param rows - 差異報表列
* @returns 以換行分隔的 CSV 內容
*/
export const toCsv = (rows: StockCountReportRow[]): string => rows.map((row) => `${row.materialId},${row.diff}`).join("\n");