test run works

This commit is contained in:
EugeneTes
2026-01-20 10:11:04 +01:00
parent 4720ca2d57
commit 6f5116736c
22 changed files with 351 additions and 441 deletions

View File

@@ -33,6 +33,13 @@ public class KitchenReceiptConverter
string tableLine = $"Tisch: {kitchenReceipt.TableNumber}";
commands.Add(new PrintCommand(Center(tableLine, true), true, true));
if (!string.IsNullOrEmpty(kitchenReceipt.SpecialInstruction))
{
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(Center(kitchenReceipt.SpecialInstruction, true), true,true));
commands.Add(new PrintCommand(""));
}
commands.Add(new PrintCommand(CreateDashedLine()));
@@ -46,8 +53,7 @@ public class KitchenReceiptConverter
commands.Add(new PrintCommand(Center($"{gang.Id}. {gang.Name}", false)) { IsRed = true });
foreach (var dish in gang.Dishes)
{
string dishLine = $"{dish.Number}x {dish.Name}";
commands.Add(new PrintCommand(dishLine));
PrintDish(dish, commands);
}
}
@@ -58,15 +64,17 @@ public class KitchenReceiptConverter
foreach (var dish in kitchenReceipt.Dishes)
{
string dishLine = $"{dish.Number}x {dish.Name}";
commands.Add(new PrintCommand(dishLine));
PrintDish(dish, commands);
}
if (kitchenReceipt.Dishes != null && kitchenReceipt.Dishes.Any())
{
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(CreateDashedLine()));
commands.Add(new PrintCommand(""));
}
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(CreateDashedLine()));
commands.Add(new PrintCommand(""));
//// Additional info section
//if (kitchenReceipt.AdditionalInfo != null && kitchenReceipt.AdditionalInfo.Count > 0)
//{
@@ -85,6 +93,33 @@ public class KitchenReceiptConverter
return commands;
}
private static void PrintDish(Dish dish, List<PrintCommand> commands)
{
string dishLine = $"{dish.Number}x {dish.Name}";
commands.Add(new PrintCommand(dishLine));
// Modifications
if (dish.Modifications != null && (dish.Modifications.Removed.Any() || dish.Modifications.Added.Any()))
{
foreach (var removed in dish.Modifications.Removed)
{
commands.Add(new PrintCommand($" - {removed}", isBold:true));
}
foreach (var added in dish.Modifications.Added)
{
commands.Add(new PrintCommand($" + {added}", isBold: true));
}
}
// SpecialInstruction
if (!string.IsNullOrEmpty(dish.Comment))
{
commands.Add(new PrintCommand($" Comment: {dish.Comment}", isBold: true));
}
//commands.Add(new PrintCommand($""));
}
private string Center(string text, bool isBigFont)
{
var actualLineWidth = isBigFont ? _BigLineWidth : _lineWidth;