switch to kitchen converter for thermal printer

This commit is contained in:
EugeneTes
2026-04-09 10:42:31 +02:00
parent 5ee95c8109
commit 2ced842242
3 changed files with 15 additions and 7 deletions

View File

@@ -89,7 +89,7 @@ public class BarReceiptConverter
//if (kitchenReceipt.AdditionalInfo != null && kitchenReceipt.AdditionalInfo.Count > 0) //if (kitchenReceipt.AdditionalInfo != null && kitchenReceipt.AdditionalInfo.Count > 0)
//{ //{
// commands.Add(new PrintCommand(CreateAsterisksLine())); // commands.Add(new PrintCommand(CreateAsterisksLine()));
// commands.Add(new PrintCommand("Info über zugehörige Artikel")); // commands.Add(new PrintCommand("Info <EFBFBD>ber zugeh<EFBFBD>rige Artikel"));
// commands.Add(new PrintCommand(CreateAsterisksLine())); // commands.Add(new PrintCommand(CreateAsterisksLine()));
// foreach (var info in kitchenReceipt.AdditionalInfo) // foreach (var info in kitchenReceipt.AdditionalInfo)
@@ -105,26 +105,31 @@ public class BarReceiptConverter
private static void PrintDish(Dish drink, List<PrintCommand> commands) private static void PrintDish(Dish drink, List<PrintCommand> 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}); commands.Add(new PrintCommand(drinkLine){IsTall = true});
// Modifications // Modifications
if (drink.Modifications != null && (drink.Modifications.Removed.Any() || drink.Modifications.Added.Any())) 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) 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) 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 // SpecialInstruction
if (!string.IsNullOrEmpty(drink.Comment)) 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 commands.Add(new PrintCommand("")); // Extra line between drinks for bar

View File

@@ -76,6 +76,8 @@ namespace Inspectron.Epson.PrintServer.Printers.Utils.BarReceipt
/// </summary> /// </summary>
public string Name { get; set; } public string Name { get; set; }
public int? GuestId { get; set; }
public Dish() { } public Dish() { }
public Dish(int number, string name) public Dish(int number, string name)

View File

@@ -13,8 +13,9 @@ public class ReceiptConverterFactory : IReceiptConverterFactory
EReceiptType.Receipt => new FinalReceipt.FinalReceiptConverter(48, 24), EReceiptType.Receipt => new FinalReceipt.FinalReceiptConverter(48, 24),
EReceiptType.WorkareaTicket => printerId switch EReceiptType.WorkareaTicket => printerId switch
{ {
0x01=>new BarReceiptConverterAdapter(48, 24), //0x01=>new BarReceiptConverterAdapter(48, 24),
_=> new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20), 0x01 => new KitchenReceipt.KitchenReceiptConverterAdapter(48, 24),
_ => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
}, },
EReceiptType.NextCourse => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20), EReceiptType.NextCourse => new KitchenReceipt.KitchenReceiptConverterAdapter(33, 20),
EReceiptType.OrdersOverview => new OrderItemsReceiptConverter(48, 24), EReceiptType.OrdersOverview => new OrderItemsReceiptConverter(48, 24),