38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using Inspectron.Epson.PrintServer.Printers.Utils.BarReceipt;
|
|
using Inspectron.Epson.PrintServer.Printers.Utils.InvoiceReceipt;
|
|
using Inspectron.Epson.PrintServer.Printers.Utils.OrderItems;
|
|
|
|
namespace Inspectron.Epson.PrintServer.Printers.Utils;
|
|
|
|
public class ReceiptConverterFactory : IReceiptConverterFactory
|
|
{
|
|
public IReceiptConverter Create(int receiptType, byte printerId)
|
|
{
|
|
return (EReceiptType)receiptType switch
|
|
{
|
|
EReceiptType.Receipt => new FinalReceipt.FinalReceiptConverter(48, 24),
|
|
EReceiptType.WorkareaTicket => printerId switch
|
|
{
|
|
//0x01=>new BarReceiptConverterAdapter(48, 24),
|
|
0x01 => new KitchenReceipt.KitchenReceiptConverterAdapter(48, 24),
|
|
_ => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
|
|
},
|
|
EReceiptType.NextCourse => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
|
|
EReceiptType.OrdersOverview => new OrderItemsReceiptConverter(48, 24),
|
|
EReceiptType.Invoice => new InvoiceReceiptConverter(48, 24),
|
|
EReceiptType.MoneyReturn => new MoneyReturnReceipt.MoneyReturnReceiptConverter(48, 24),
|
|
_ => throw new ArgumentException($"Unknown receipt type: {receiptType}")
|
|
};
|
|
}
|
|
|
|
public enum EReceiptType
|
|
{
|
|
Receipt,
|
|
WorkareaTicket,
|
|
NextCourse,
|
|
OrdersOverview,
|
|
Invoice,
|
|
MoneyReturn
|
|
}
|
|
}
|