diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index 6c7eaff..88bf04d 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -27,7 +27,7 @@ namespace Elwig { public static string? BranchPhoneNr { get; private set; } public static string? BranchFaxNr { get; private set; } public static string? BranchMobileNr { get; private set; } - public static IEnumerable Scales { get; private set; } + public static IList Scales { get; private set; } public static ClientParameters Client { get; private set; } public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady; @@ -69,10 +69,10 @@ namespace Elwig { Client = new(); - var list = new LinkedList(); + var list = new List(); foreach (var s in Config.Scales) { try { - var scaleNr = int.Parse(s[0]); + var id = s[0]; var type = s[1].ToLower(); var model = s[2]; var cnx = s[3]; @@ -80,7 +80,7 @@ namespace Elwig { var filling = s[5]; int? limit = s[6] == null ? null : int.Parse(s[6]); if (type == "systec") { - list.AddLast(new SystecScale(scaleNr, model, cnx, empty, filling, limit)); + list.Add(new SystecScale(id, model, cnx, empty, filling, limit)); } else { throw new ArgumentException($"Invalid scale type: \"{type}\""); } diff --git a/Elwig/Helpers/Weighing/GassnerScale.cs b/Elwig/Helpers/Weighing/GassnerScale.cs index 3c30f5c..e8d6c35 100644 --- a/Elwig/Helpers/Weighing/GassnerScale.cs +++ b/Elwig/Helpers/Weighing/GassnerScale.cs @@ -14,13 +14,13 @@ namespace Elwig.Helpers.Weighing { public string Manufacturer => "Gassner"; public int InternalScaleNr => 1; public string Model { get; private set; } - public int ScaleNr { get; private set; } + public string ScaleId { get; private set; } public bool IsReady { get; private set; } public bool HasFillingClearance { get; private set; } public int? WeightLimit { get; private set; } - public GassnerScale(int scaleNr, string model, string connection) { - ScaleNr = scaleNr; + public GassnerScale(string id, string model, string connection) { + ScaleId = id; Model = model; IsReady = true; HasFillingClearance = false; diff --git a/Elwig/Helpers/Weighing/IScale.cs b/Elwig/Helpers/Weighing/IScale.cs index b13baf5..ffb9d1e 100644 --- a/Elwig/Helpers/Weighing/IScale.cs +++ b/Elwig/Helpers/Weighing/IScale.cs @@ -17,9 +17,9 @@ namespace Elwig.Helpers.Weighing { string Model { get; } /// - /// Unique number of the scale + /// Unique identificator of the scale /// - int ScaleNr { get; } + string ScaleId { get; } /// /// Internal identifying number of the scale in its system diff --git a/Elwig/Helpers/Weighing/SchemberScale.cs b/Elwig/Helpers/Weighing/SchemberScale.cs index e1ffa69..b69fd2e 100644 --- a/Elwig/Helpers/Weighing/SchemberScale.cs +++ b/Elwig/Helpers/Weighing/SchemberScale.cs @@ -7,7 +7,7 @@ namespace Elwig.Helpers.Weighing { public string Manufacturer => "Schember"; public string Model => throw new NotImplementedException(); - public int ScaleNr => throw new NotImplementedException(); + public string ScaleId => throw new NotImplementedException(); public int InternalScaleNr => throw new NotImplementedException(); public bool IsReady => throw new NotImplementedException(); public bool HasFillingClearance => throw new NotImplementedException(); diff --git a/Elwig/Helpers/Weighing/SystecScale.cs b/Elwig/Helpers/Weighing/SystecScale.cs index 45451d3..1c072ce 100644 --- a/Elwig/Helpers/Weighing/SystecScale.cs +++ b/Elwig/Helpers/Weighing/SystecScale.cs @@ -22,13 +22,13 @@ namespace Elwig.Helpers.Weighing { public string Manufacturer => "SysTec"; public int InternalScaleNr => 1; public string Model { get; private set; } - public int ScaleNr { get; private set; } + public string ScaleId { get; private set; } public bool IsReady { get; private set; } public bool HasFillingClearance { get; private set; } public int? WeightLimit { get; private set; } - public SystecScale(int scaleNr, string model, string connection, string? empty = null, string? fill = null, int? limit = null) { - ScaleNr = scaleNr; + public SystecScale(string id, string model, string connection, string? empty = null, string? fill = null, int? limit = null) { + ScaleId = id; Model = model; IsReady = true; HasFillingClearance = false; diff --git a/Elwig/Helpers/Weighing/WeighingResult.cs b/Elwig/Helpers/Weighing/WeighingResult.cs index 3ba98e7..fe037ce 100644 --- a/Elwig/Helpers/Weighing/WeighingResult.cs +++ b/Elwig/Helpers/Weighing/WeighingResult.cs @@ -22,5 +22,11 @@ namespace Elwig.Helpers.Weighing { /// Time string provided by the scale /// public string? Time = null; + + /// <Weight/WeighingId/Date/Time> + override public string ToString() { + var w = Weight != null ? $"{Weight}kg" : ""; + return $"<{w}/{WeighingId}/{Date}/{Time}>"; + } } } diff --git a/Elwig/Windows/DeliveryAdminWindow.xaml.cs b/Elwig/Windows/DeliveryAdminWindow.xaml.cs index 2edd945..006ff43 100644 --- a/Elwig/Windows/DeliveryAdminWindow.xaml.cs +++ b/Elwig/Windows/DeliveryAdminWindow.xaml.cs @@ -54,7 +54,7 @@ namespace Elwig.Windows { if (IsReceipt) { Title = "Übernahme - Elwig"; TodayOnlyInput.IsChecked = true; - var n = App.Scales.Count(); + var n = App.Scales.Count; if (n < 1) WeighingAButton.Visibility = Visibility.Hidden; if (n < 2) WeighingBButton.Visibility = Visibility.Hidden; if (n < 3) WeighingCButton.Visibility = Visibility.Hidden;