This commit is contained in:
EugeneTes
2026-04-03 08:38:32 +02:00
parent 763cd1071b
commit 5ee95c8109
7 changed files with 39 additions and 19 deletions

View File

@@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>1.0.11</Version> <Version>1.0.12</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -3,7 +3,7 @@ using Inspectron.Epson.PrintServer.ConfigurationSources;
// Load configuration (may be absent on first boot) // Load configuration (may be absent on first boot)
var configResult = ConfigurationLoader.TryLoadFromFile(); var configResult = ConfigurationLoader.TryLoadFromFile();
configResult.Config.EmulationMode = true; //configResult.Config.EmulationMode = true;
EpsonPrintServiceConfiguration? activeConfig = null; EpsonPrintServiceConfiguration? activeConfig = null;
if (configResult.Success) if (configResult.Success)

View File

@@ -1 +1 @@
aHR0cHM6Ly9hcGkuZGV2Lmdhc3Ryb2phbWVzLmNoOzYzZTM3Mjk1YmQ2ZjI2ZGJkMzYxNjRjMDs3VnBaQXNTKzcwTEdKTXFRQi9nNWlkMlZIZ3FybmR4RUpXeDVLYXF2YThzPQ== aHR0cHM6Ly9hcGkuc3RhZ2UuZ2FzdHJvamFtZXMuY2g7NjI5MDU1MTc2ODQ3ODlhZmJjZTRkZTc5O05FOHh4TTMxNmJsWkcwajU2WTJnMkd5TEp2ekROQlNnU21yV1hwMzNhaDQ9

View File

@@ -397,7 +397,7 @@ public class EpsonPrinter : IEpsonPrinter
public async Task CutAsync(bool fullCut=true) public async Task CutAsync(bool fullCut=true)
{ {
_logger?.LogInformation("Cutting paper"); _logger?.LogInformation("Cutting paper");
await SendRawAsync(EpsonCommands.CutPaperFull); await SendRawAsync(fullCut ? EpsonCommands.CutPaperFull : EpsonCommands.CutPaperPartial);
} }
/// <summary> /// <summary>

View File

@@ -44,6 +44,12 @@ public class TM_T30IIITranslated : IPrinter
foreach (var command in commands) foreach (var command in commands)
{ {
if (command.IsCut)
{
await _printer.FeedLinesAsync(10);
await _printer.CutAsync(false);
continue;
}
if(command.SetLineSpacing.HasValue) if(command.SetLineSpacing.HasValue)
{ {
Console.WriteLine($"Setting line spacing to {command.SetLineSpacing.Value}"); Console.WriteLine($"Setting line spacing to {command.SetLineSpacing.Value}");
@@ -51,16 +57,17 @@ public class TM_T30IIITranslated : IPrinter
Console.WriteLine($"------------------------------------------------------"); Console.WriteLine($"------------------------------------------------------");
continue; continue;
} }
if (command.IsBig) await _printer.SetFontSizeAsync(command.IsBig?2:1, command.IsTall?2:1);
{ //if (command.IsBig)
await _printer.SetFontSizeAsync(2, 1); //{
} // await _printer.SetFontSizeAsync(2, 1);
else //}
{ //else
await _printer.SetFontSizeAsync(1, 1); //{
} // await _printer.SetFontSizeAsync(1, 1);
//}
await _printer.SetEmphasized(command.IsBold); await _printer.SetEmphasized(command.IsBold);
await _printer.PrintTextAsync(command.Text + "\n"); await _printer.PrintTextAsync(command.Text + "\n");
} }

View File

@@ -41,7 +41,7 @@ public class BarReceiptConverter
commands.Add(new PrintCommand(Center(kitchenReceipt.SpecialInstruction, true), true, true)); commands.Add(new PrintCommand(Center(kitchenReceipt.SpecialInstruction, true), true, true));
commands.Add(new PrintCommand("")); commands.Add(new PrintCommand(""));
} }
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(CreateDashedLine())); commands.Add(new PrintCommand(CreateDashedLine()));
@@ -52,11 +52,19 @@ public class BarReceiptConverter
foreach (Gang gang in kitchenReceipt.Gangs) foreach (Gang gang in kitchenReceipt.Gangs)
{ {
commands.Add(new PrintCommand(Center($"{gang.Id}. {gang.Name}", false)) { IsRed = true }); commands.Add(new PrintCommand(Center($"{gang.Id}. {gang.Name}", true)) { IsBig = true });
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
foreach (var dish in gang.Dishes) foreach (var dish in gang.Dishes)
{ {
PrintDish(dish, commands); PrintDish(dish, commands);
} }
if (gang != kitchenReceipt.Gangs.Last())
{
commands.Add(new PrintCommand("") { IsCut = true });
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
}
} }
if (kitchenReceipt.Gangs.Count > 0) if (kitchenReceipt.Gangs.Count > 0)
@@ -98,25 +106,25 @@ 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 drinkLine = $"{drink.Number}x {drink.Name}";
commands.Add(new PrintCommand(drinkLine,isBig: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()))
{ {
foreach (var removed in drink.Modifications.Removed) foreach (var removed in drink.Modifications.Removed)
{ {
commands.Add(new PrintCommand($" - {removed}", isBold:true)); commands.Add(new PrintCommand($" - {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)); commands.Add(new PrintCommand($" + {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)); commands.Add(new PrintCommand($" 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

@@ -15,4 +15,9 @@ public class PrintCommand
IsBig = isBig; IsBig = isBig;
IsBold = isBold; IsBold = isBold;
} }
public override string ToString()
{
return $"Text: {Text}, IsBig: {IsBig}, IsBold: {IsBold}, IsRed: {IsRed}, SetLineSpacing: {SetLineSpacing}, IsCut: {IsCut}";
}
} }