adapted kitchen to thermal printer

This commit is contained in:
EugeneTes
2026-01-20 13:32:05 +01:00
parent f3dc04f8ae
commit e5a44e5fde
4 changed files with 10 additions and 7 deletions

View File

@@ -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);

View File

@@ -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");
}

View File

@@ -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);
}

View File

@@ -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}")
};
}