Weighing: Set Date/Time of scales at startup
Test / Run tests (push) Failing after 2m34s

This commit is contained in:
2026-08-01 23:14:02 +02:00
parent 188fd448ae
commit ef8df31a8c
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -145,7 +145,13 @@ namespace Elwig {
var list = new List<IScale>(); var list = new List<IScale>();
foreach (var s in Config.Scales) { foreach (var s in Config.Scales) {
try { try {
list.Add(Scale.FromConfig(s)); var scale = Scale.FromConfig(s);
if (scale is ICommandScale cmd) {
try {
await cmd.SetDateAndTime(DateTime.Now);
} catch { }
}
list.Add(scale);
} catch (Exception exc) { } catch (Exception exc) {
list.Add(new InvalidScale(s.Id)); list.Add(new InvalidScale(s.Id));
if (s.Required) if (s.Required)
+2 -2
View File
@@ -182,13 +182,13 @@ namespace Elwig.Documents {
} else { } else {
var info = part.WeighingInfo; var info = part.WeighingInfo;
weighing.Add(Italic("Waage/Terminal:")) weighing.Add(Italic("Waage/Terminal:"))
.Add(Normal(" " + (info.ScaleId ?? "1") + "/" + (part.ScaleTerminalId ?? "?") + ", ")) .Add(Normal(" " + (info.ScaleId ?? "?") + "/" + (part.ScaleTerminalId ?? "?") + ", "))
.Add(Italic("ID:")) .Add(Italic("ID:"))
.Add(Normal(" " + (info.Id ?? "?"))); .Add(Normal(" " + (info.Id ?? "?")));
if (info.Date != null || info.Time != null) if (info.Date != null || info.Time != null)
weighing.Add(Normal(" \u2013 ")); weighing.Add(Normal(" \u2013 "));
if (info.Time != null) if (info.Time != null)
weighing.Add(Normal($"{info.Time:HH:mm}")); weighing.Add(Normal($"{info.Time:HH:mm:ss}"));
if (info.Date != null) if (info.Date != null)
weighing.Add(Normal($", {info.Date:dd.MM.yyyy}")); weighing.Add(Normal($", {info.Date:dd.MM.yyyy}"));
if (info.Gross != null && info.Tare != null && info.Net != null) { if (info.Gross != null && info.Tare != null && info.Net != null) {