test run works
This commit is contained in:
@@ -8,6 +8,7 @@ using SixLabors.ImageSharp.PixelFormats;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Xml.Linq;
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils.FinalReceipt;
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils.OrderItems;
|
||||
using FinalReceipt = Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe.FinalReceipt;
|
||||
|
||||
@@ -189,8 +190,8 @@ using FinalReceipt = Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe.Fin
|
||||
//var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
||||
//var deserializedReceipt = JsonSerializer.Deserialize<FinalReceipt>(serializedReceipt);
|
||||
//// Convert to print commands
|
||||
//var converter = new ReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);
|
||||
//var printCommands = converter.ConvertToPrintCommands(deserializedReceipt);
|
||||
//var converter = new FinalReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);
|
||||
//var printCommands = converter.Convert(serializedReceipt);
|
||||
|
||||
|
||||
|
||||
@@ -248,10 +249,32 @@ using FinalReceipt = Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe.Fin
|
||||
//receipt.Gangs.Add(new Gang(1, "Gang"));
|
||||
//receipt.Gangs.Add(new Gang(2, "Gang"));
|
||||
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Avocado Sashimi"));
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Avocado Sashimi")
|
||||
//{
|
||||
// Modifications = new DishModifications
|
||||
// {
|
||||
// Removed = new List<string> { "Wasabi" },
|
||||
// Added = new List<string> { "Extra Ginger" }
|
||||
// },
|
||||
// Comment = "No soy sauce"
|
||||
//});
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Baby Spinach Salad with Truffl"));
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Beef Tataki"));
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Salmon Taco"));
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Beef Tataki")
|
||||
//{
|
||||
// Modifications = new DishModifications
|
||||
// {
|
||||
// Removed = new List<string> { "Onion" },
|
||||
// Added = new List<string> { "Extra Sauce" }
|
||||
// },
|
||||
// Comment = "Medium rare"
|
||||
//});
|
||||
//receipt.Gangs[0].Dishes.Add(new Dish(1, "Salmon Taco")
|
||||
//{
|
||||
// Modifications = new DishModifications
|
||||
// {
|
||||
// Added = new List<string> { "Extra Lime" }
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
//receipt.Gangs[1].Dishes.Add(new Dish(1, "Avocado Sashimi"));
|
||||
@@ -308,11 +331,98 @@ using FinalReceipt = Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe.Fin
|
||||
|
||||
//}
|
||||
|
||||
|
||||
var receipt = new KitchenReceipt
|
||||
{
|
||||
Title = "Warme Küche",
|
||||
TransactionDateTime = new DateTime(2025, 10, 23, 12, 18, 0),
|
||||
ReceiptNumber = "132018166",
|
||||
WaiterName = "Mariano Amato",
|
||||
WaiterId = "32 (VK Restaurant)",
|
||||
TableNumber = "22",
|
||||
SpecialInstruction = "Next dish"
|
||||
};
|
||||
|
||||
// Add dishes (this section can be empty if no dishes were ordered)
|
||||
|
||||
receipt.Gangs.Add(new Gang(2, "Gang"));
|
||||
|
||||
receipt.Gangs[0].Dishes.Add(new Dish(1, "Avocado Sashimi")
|
||||
{
|
||||
Modifications = new DishModifications
|
||||
{
|
||||
Removed = new List<string> { "Wasabi" },
|
||||
Added = new List<string> { "Extra Ginger" }
|
||||
},
|
||||
Comment = "No soy sauce"
|
||||
});
|
||||
receipt.Gangs[0].Dishes.Add(new Dish(1, "Baby Spinach Salad with Truffl"));
|
||||
receipt.Gangs[0].Dishes.Add(new Dish(1, "Beef Tataki")
|
||||
{
|
||||
Modifications = new DishModifications
|
||||
{
|
||||
Removed = new List<string> { "Onion" },
|
||||
Added = new List<string> { "Extra Sauce" }
|
||||
},
|
||||
Comment = "Medium rare"
|
||||
});
|
||||
receipt.Gangs[0].Dishes.Add(new Dish(1, "Salmon Taco")
|
||||
{
|
||||
Modifications = new DishModifications
|
||||
{
|
||||
Added = new List<string> { "Extra Lime" }
|
||||
}
|
||||
});
|
||||
|
||||
// Add additional info
|
||||
|
||||
var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
||||
var deserializedReceipt = JsonSerializer.Deserialize<KitchenReceipt>(serializedReceipt);
|
||||
KitchenReceiptConverter converter = new KitchenReceiptConverter(bigLineWidth: 20, lineWidth: 33);
|
||||
var printCommands = converter.ConvertToPrintCommands(deserializedReceipt);
|
||||
|
||||
Console.WriteLine("=== PRINT COMMANDS ===\n");
|
||||
var printer = new HtmlPrinter(@".\test.html", paperWidth: 258);
|
||||
await printer.ConnectAsync("");
|
||||
await Task.Delay(200);
|
||||
await printer.FeedLinesAsync(1);
|
||||
await printer.SetCustomLineSpacing(22);
|
||||
foreach (var command in printCommands)
|
||||
{
|
||||
string attributes = "";
|
||||
if (command.IsBig) attributes += "[BIG] ";
|
||||
if (command.IsBold) attributes += "[BOLD] ";
|
||||
if (command.IsRed) attributes += "[RED] ";
|
||||
|
||||
Console.WriteLine($"{attributes}{command.Text}");
|
||||
|
||||
if (command.IsBig)
|
||||
{
|
||||
await printer.SetFontSizeAsync(2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
await printer.SetFontSizeAsync(1, 1);
|
||||
}
|
||||
|
||||
await printer.SetRedColor(command.IsRed);
|
||||
|
||||
//await Task.Delay(200);
|
||||
|
||||
await printer.SetEmphasized(command.IsBold);
|
||||
//await Task.Delay(200);
|
||||
|
||||
await printer.PrintTextAsync(command.Text + "\n");
|
||||
//await Task.Delay(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//await printer.SetDefaultLineSpacing();
|
||||
//await printer.PrintTextAsync(
|
||||
// "1x San Pellegrino 50cl 6.50 6.50 A\n1x Panna 50cl 6.50 6.50 A");
|
||||
|
||||
// Order Items Receipt Test
|
||||
//// Order Items Receipt Test
|
||||
//var orderItemsReceipt = new OrderItemsReceipt
|
||||
//{
|
||||
// OrderNumber = "1",
|
||||
|
||||
Reference in New Issue
Block a user