From ef8df31a8c7d7d8fb74078a95adef0029ff66402 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sat, 1 Aug 2026 23:14:02 +0200 Subject: [PATCH] Weighing: Set Date/Time of scales at startup --- Elwig/App.xaml.cs | 8 +++++++- Elwig/Documents/DeliveryNote.cs | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index 5e77ff4..953f83b 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -145,7 +145,13 @@ namespace Elwig { var list = new List(); foreach (var s in Config.Scales) { 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) { list.Add(new InvalidScale(s.Id)); if (s.Required) diff --git a/Elwig/Documents/DeliveryNote.cs b/Elwig/Documents/DeliveryNote.cs index 1c50ffa..d8fe420 100644 --- a/Elwig/Documents/DeliveryNote.cs +++ b/Elwig/Documents/DeliveryNote.cs @@ -182,13 +182,13 @@ namespace Elwig.Documents { } else { var info = part.WeighingInfo; weighing.Add(Italic("Waage/Terminal:")) - .Add(Normal(" " + (info.ScaleId ?? "1") + "/" + (part.ScaleTerminalId ?? "?") + ", ")) + .Add(Normal(" " + (info.ScaleId ?? "?") + "/" + (part.ScaleTerminalId ?? "?") + ", ")) .Add(Italic("ID:")) .Add(Normal(" " + (info.Id ?? "?"))); if (info.Date != null || info.Time != null) weighing.Add(Normal(" \u2013 ")); if (info.Time != null) - weighing.Add(Normal($"{info.Time:HH:mm}")); + weighing.Add(Normal($"{info.Time:HH:mm:ss}")); if (info.Date != null) weighing.Add(Normal($", {info.Date:dd.MM.yyyy}")); if (info.Gross != null && info.Tare != null && info.Net != null) {