From 2ced8422422b4f0629358bfdafdae865a0fa7167 Mon Sep 17 00:00:00 2001 From: EugeneTes Date: Thu, 9 Apr 2026 10:42:31 +0200 Subject: [PATCH] switch to kitchen converter for thermal printer --- .../Utils/BarReceipt/BarReceiptConverter.cs | 15 ++++++++++----- .../Printers/Utils/BarReceipt/Models.cs | 2 ++ .../Printers/Utils/ReceiptConverterFactory.cs | 5 +++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs b/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs index 1135dd3..5fb75eb 100644 --- a/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs +++ b/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/BarReceiptConverter.cs @@ -89,7 +89,7 @@ public class BarReceiptConverter //if (kitchenReceipt.AdditionalInfo != null && kitchenReceipt.AdditionalInfo.Count > 0) //{ // commands.Add(new PrintCommand(CreateAsterisksLine())); - // commands.Add(new PrintCommand("Info über zugehörige Artikel")); + // commands.Add(new PrintCommand("Info �ber zugeh�rige Artikel")); // commands.Add(new PrintCommand(CreateAsterisksLine())); // foreach (var info in kitchenReceipt.AdditionalInfo) @@ -105,26 +105,31 @@ public class BarReceiptConverter private static void PrintDish(Dish drink, List commands) { - string drinkLine = $"{drink.Number}x {drink.Name}"; + string quantityPrefix = $"{drink.Number}x "; + string guestInfo = drink.GuestId.HasValue ? $"{drink.GuestId.Value} " : ""; + string fullPrefix = guestInfo + quantityPrefix; + string drinkLine = fullPrefix + drink.Name; commands.Add(new PrintCommand(drinkLine){IsTall = true}); // Modifications if (drink.Modifications != null && (drink.Modifications.Removed.Any() || drink.Modifications.Added.Any())) { + string modificationIndent = new string(' ', guestInfo.Length + 1); foreach (var removed in drink.Modifications.Removed) { - commands.Add(new PrintCommand($" - {removed}", isBold:true){IsTall = true}); + commands.Add(new PrintCommand($"{modificationIndent}- {removed}", isBold:true){IsTall = true}); } foreach (var added in drink.Modifications.Added) { - commands.Add(new PrintCommand($" + {added}", isBold: true){IsTall = true}); + commands.Add(new PrintCommand($"{modificationIndent}+ {added}", isBold: true){IsTall = true}); } } // SpecialInstruction if (!string.IsNullOrEmpty(drink.Comment)) { - commands.Add(new PrintCommand($" Comment: {drink.Comment}", isBold: true){IsTall = true}); + string commentIndent = new string(' ', guestInfo.Length); + commands.Add(new PrintCommand($"{commentIndent}Comment: {drink.Comment}", isBold: true){IsTall = true}); } commands.Add(new PrintCommand("")); // Extra line between drinks for bar diff --git a/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/Models.cs b/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/Models.cs index 0744f5d..703099b 100644 --- a/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/Models.cs +++ b/Inspectron.Epson/PrintServer/Printers/Utils/BarReceipt/Models.cs @@ -76,6 +76,8 @@ namespace Inspectron.Epson.PrintServer.Printers.Utils.BarReceipt /// public string Name { get; set; } + public int? GuestId { get; set; } + public Dish() { } public Dish(int number, string name) diff --git a/Inspectron.Epson/PrintServer/Printers/Utils/ReceiptConverterFactory.cs b/Inspectron.Epson/PrintServer/Printers/Utils/ReceiptConverterFactory.cs index e6c7c18..5bde730 100644 --- a/Inspectron.Epson/PrintServer/Printers/Utils/ReceiptConverterFactory.cs +++ b/Inspectron.Epson/PrintServer/Printers/Utils/ReceiptConverterFactory.cs @@ -13,8 +13,9 @@ public class ReceiptConverterFactory : IReceiptConverterFactory EReceiptType.Receipt => new FinalReceipt.FinalReceiptConverter(48, 24), EReceiptType.WorkareaTicket => printerId switch { - 0x01=>new BarReceiptConverterAdapter(48, 24), - _=> new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20), + //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),