adapted kitchen to thermal printer
This commit is contained in:
@@ -82,7 +82,7 @@ public class EpsonPrintService: IPrintService
|
||||
await printerAdapter.SetFontSizeAsync(configuration.FontSize);
|
||||
|
||||
// Convert receipt content to print commands using the factory
|
||||
var converter = _receiptConverterFactory.Create(job.Document.ReceiptType, lineWidth: 48, bigFontLineWidth: 24);
|
||||
var converter = _receiptConverterFactory.Create(job.Document.ReceiptType, printerId.Value);
|
||||
var commands = converter.Convert(job.Document.Content);
|
||||
await printerAdapter.PrintAsync(commands);
|
||||
await Task.Delay(200);
|
||||
|
||||
@@ -52,7 +52,6 @@ public class TM_T30IIITranslated : IPrinter
|
||||
}
|
||||
|
||||
|
||||
await _printer.SetRedColor(command.IsRed);
|
||||
await _printer.SetEmphasized(command.IsBold);
|
||||
await _printer.PrintTextAsync(command.Text + "\n");
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ namespace Inspectron.Epson.PrintServer.Printers.Utils;
|
||||
|
||||
public interface IReceiptConverterFactory
|
||||
{
|
||||
IReceiptConverter Create(int receiptType, int lineWidth, int bigFontLineWidth);
|
||||
IReceiptConverter Create(int receiptType, byte printerId);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,18 @@ namespace Inspectron.Epson.PrintServer.Printers.Utils;
|
||||
|
||||
public class ReceiptConverterFactory : IReceiptConverterFactory
|
||||
{
|
||||
public IReceiptConverter Create(int receiptType, int lineWidth, int bigFontLineWidth)
|
||||
public IReceiptConverter Create(int receiptType, byte printerId)
|
||||
{
|
||||
return (EReceiptType)receiptType switch
|
||||
{
|
||||
EReceiptType.Receipt => new FinalReceipt.FinalReceiptConverter(lineWidth, bigFontLineWidth),
|
||||
EReceiptType.WorkareaTicket => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
|
||||
EReceiptType.Receipt => new FinalReceipt.FinalReceiptConverter(48, 24),
|
||||
EReceiptType.WorkareaTicket => printerId switch
|
||||
{
|
||||
0x01=>new KitchenReceipt.KitchenReceiptConverterAdapter(48, 24),
|
||||
_=> new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
|
||||
},
|
||||
EReceiptType.NextCourse => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
|
||||
EReceiptType.OrdersOverview => new OrderItemsReceiptConverter(lineWidth, bigFontLineWidth),
|
||||
EReceiptType.OrdersOverview => new OrderItemsReceiptConverter(48, 24),
|
||||
_ => throw new ArgumentException($"Unknown receipt type: {receiptType}")
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user