diff --git a/src/modules/receipt-batch-print.ts b/src/modules/receipt-batch-print.ts new file mode 100644 index 0000000..dd7b826 --- /dev/null +++ b/src/modules/receipt-batch-print.ts @@ -0,0 +1,20 @@ +/** + * 票據批量列印模組(沙盤推演示意) + * 由第二開發者在共享功能分支 feature/receipt-batch-print 上開發 + */ + +/** 單筆批量列印工作 */ +export interface BatchPrintJob { + /** 使用的票據模板識別碼 */ + templateId: string; + /** 目標倉庫識別碼 */ + warehouseId: string; +} + +/** + * 建立批量列印工作清單 + * @param templateId - 票據模板識別碼 + * @param warehouseIds - 目標倉庫識別碼清單 + * @returns 逐倉庫展開的列印工作(先濾除空倉庫代碼,再依倉庫代碼排序) + */ +export const createBatchJobs = (templateId: string, warehouseIds: string[]): BatchPrintJob[] => warehouseIds.filter((id) => id !== "").sort().map((id) => ({ templateId, warehouseId: id }));