Files
laundry-desk/src/main/ipc/printer.ts
2026-04-23 16:50:24 +08:00

13 lines
506 B
TypeScript

import { IdSchema } from "../../shared/schemas";
import { OrderService } from "../services/orderService";
import { PrinterService } from "../services/printerService";
import { registerIpcHandler } from "./helpers";
export function registerPrinterIpc(): void {
registerIpcHandler("printer:printReceipt", IdSchema, async (orderId) => {
const order = await OrderService.findById(orderId);
if (!order) throw new Error("订单不存在");
return await PrinterService.printReceipt(order);
});
}