feat(receipt): 批量列印支援指定份數
第二位開發者於本地功能分支完成,功能分支不推遠端
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 票據批量列印模組(沙盤推演示意)
|
||||
* 由第二開發者在共享功能分支 feature/receipt-batch-print 上開發
|
||||
* 由第二位開發者在其本地功能分支開發;功能分支不推遠端
|
||||
*/
|
||||
|
||||
/** 單筆批量列印工作 */
|
||||
@@ -15,6 +15,7 @@ export interface BatchPrintJob {
|
||||
* 建立批量列印工作清單
|
||||
* @param templateId - 票據模板識別碼
|
||||
* @param warehouseIds - 目標倉庫識別碼清單
|
||||
* @param copies - 每個倉庫的列印份數,預設 1 份
|
||||
* @returns 逐倉庫展開的列印工作(先濾除空倉庫代碼,再依倉庫代碼排序)
|
||||
*/
|
||||
export const createBatchJobs = (templateId: string, warehouseIds: string[]): BatchPrintJob[] => warehouseIds.filter((id) => id !== "").sort().map((id) => ({ templateId, warehouseId: id }));
|
||||
export const createBatchJobs = (templateId: string, warehouseIds: string[], copies = 1): BatchPrintJob[] => warehouseIds.filter((id) => id !== "").sort().flatMap((id) => Array.from({ length: copies }, () => ({ templateId, warehouseId: id })));
|
||||
|
||||
Reference in New Issue
Block a user