/** * 票據批量列印模組(沙盤推演示意) * 由第二位開發者在其本地功能分支開發;功能分支不推遠端 */ /** 單筆批量列印工作 */ export interface BatchPrintJob { /** 使用的票據模板識別碼 */ templateId: string; /** 目標倉庫識別碼 */ warehouseId: string; } /** * 建立批量列印工作清單 * @param templateId - 票據模板識別碼 * @param warehouseIds - 目標倉庫識別碼清單 * @param copies - 每個倉庫的列印份數,預設 1 份 * @returns 逐倉庫展開的列印工作(先濾除空倉庫代碼,再依倉庫代碼排序) */ export const createBatchJobs = (templateId: string, warehouseIds: string[], copies = 1): BatchPrintJob[] => warehouseIds.filter((id) => id !== "").sort().flatMap((id) => Array.from({ length: copies }, () => ({ templateId, warehouseId: id })));