Compare commits

..

8 Commits

Author SHA1 Message Date
lorenz.stechauner cc68004f7d Tests: Update dependencies
Test / Run tests (push) Successful in 1m56s
2026-08-01 23:49:03 +02:00
lorenz.stechauner 3dc0998217 Elwig: Update dependencies 2026-08-01 23:48:39 +02:00
lorenz.stechauner d44d82a614 Weighing: Set Date/Time of scales at startup
Test / Run tests (push) Successful in 1m59s
2026-08-01 23:41:18 +02:00
lorenz.stechauner bc093f31db Weighing: Differentiate between scale and terminal 2026-08-01 23:38:51 +02:00
lorenz.stechauner 0d8cdd5d6e Bump version to 1.1.0.0
Test / Run tests (push) Successful in 1m54s
Deploy / Build and Deploy (push) Successful in 1m42s
2026-07-09 01:43:38 +02:00
lorenz.stechauner 2350b55cea Tests: Update dependencies
Test / Run tests (push) Successful in 2m6s
2026-07-09 01:01:38 +02:00
lorenz.stechauner e8789aff37 Elwig: Update dependencies 2026-07-09 01:01:38 +02:00
lorenz.stechauner 918555f2b8 [#20] MemberAdminWindow: Add MemberBusinessSharesAdminWindow to manage member shares 2026-07-09 01:01:28 +02:00
26 changed files with 179 additions and 179 deletions
+26
View File
@@ -2,6 +2,32 @@
Changelog Changelog
========= =========
[v1.1.0.0][v1.1.0.0] (2026-07-09) {#v1.1.0.0}
---------------------------------------------
### Neue Funktionen {#v1.1.0.0-features}
* Per Opt-In Einstellung in den Stammdaten ist es nun möglich Mitgliederbewegungen und Verläufe von Geschäftsanteilen mit Elwig zu erfassen. ([#20][i20])
* Es wird nun unterstützt verschiedene Typen von Geschäftsanteilen pro Mitglied zu erfassen (normal, rot, weiß, ruhend). ([#80][i80])
### Behobene Fehler {#v1.1.0.0-bugfixes}
* Falls die Datenbank für die momentan verwndete Elwig-Version zu neu war kam es beim Überprüfen auf ein Update zu einem Fehler. (4ebe07f579)
* Im Stammdatenblatt (`MemberDataSheet`) wurde die Stamm-Zweigstelle nicht angeführt. (a71c41af5c)
### Sonstiges {#v1.1.0.0-misc}
* In der Buchungsliste (`CreditNoteData`) wird nun auch das Buchhaltungskonto der Mitglieder angeführt. (000117dc67)
* Viele kleine Verbesserungen der Code-Qualität. (u.a. fcd0555e4d, 69efca1cc3, beacba6bd9, 1169ba5101)
* Abhängigkeiten aktualisiert. (e8789aff37, 2350b55cea)
[v1.1.0.0]: https://git.necronda.net/winzer/elwig/releases/tag/v1.1.0.0
[i20]: https://git.necronda.net/winzer/elwig/issues/20
[i80]: https://git.necronda.net/winzer/elwig/issues/80
[v1.0.5.6][v1.0.5.6] (2026-06-25) {#v1.0.5.6} [v1.0.5.6][v1.0.5.6] (2026-06-25) {#v1.0.5.6}
--------------------------------------------- ---------------------------------------------
+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)
+3 -3
View File
@@ -181,14 +181,14 @@ namespace Elwig.Documents {
} }
} else { } else {
var info = part.WeighingInfo; var info = part.WeighingInfo;
weighing.Add(Italic("Waage:")) weighing.Add(Italic("Waage/Terminal:"))
.Add(Normal(" " + (part.ScaleId ?? "?") + ", ")) .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) {
+8 -8
View File
@@ -9,7 +9,7 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon> <ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
<Version>1.0.5.6</Version> <Version>1.1.0.0</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages> <SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
@@ -23,21 +23,21 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="bblanchon.PDFium.Win32" Version="152.0.7934" /> <PackageReference Include="bblanchon.PDFium.Win32" Version="152.0.7961" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="itext" Version="9.7.0" /> <PackageReference Include="itext" Version="9.7.0" />
<PackageReference Include="itext.bouncy-castle-adapter" Version="9.7.0" /> <PackageReference Include="itext.bouncy-castle-adapter" Version="9.7.0" />
<PackageReference Include="LinqKit" Version="1.3.11" /> <PackageReference Include="LinqKit" Version="1.3.11" />
<PackageReference Include="MailKit" Version="4.17.0" /> <PackageReference Include="MailKit" Version="4.17.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.9" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="10.0.9" /> <PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="10.0.10" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.4078.44" /> <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.4078.44" />
<PackageReference Include="NJsonSchema" Version="11.6.1" /> <PackageReference Include="NJsonSchema" Version="11.6.1" />
<PackageReference Include="ScottPlot.WPF" Version="5.1.59" /> <PackageReference Include="ScottPlot.WPF" Version="5.1.59" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.3" /> <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.5" />
<PackageReference Include="System.IO.Hashing" Version="10.0.9" /> <PackageReference Include="System.IO.Hashing" Version="10.0.10" />
<PackageReference Include="System.IO.Ports" Version="10.0.9" /> <PackageReference Include="System.IO.Ports" Version="10.0.10" />
<PackageReference Include="System.Management" Version="10.0.9" /> <PackageReference Include="System.Management" Version="10.0.10" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+2 -2
View File
@@ -951,7 +951,7 @@ namespace Elwig.Helpers.Export {
if (p.Unloading != null) obj["unloading"] = p.Unloading; if (p.Unloading != null) obj["unloading"] = p.Unloading;
if (p.Temperature != null) obj["temperature"] = p.Temperature; if (p.Temperature != null) obj["temperature"] = p.Temperature;
if (p.Acid != null) obj["acid"] = p.Acid; if (p.Acid != null) obj["acid"] = p.Acid;
if (p.ScaleId != null) obj["scale_id"] = p.ScaleId; if (p.ScaleTerminalId != null) obj["scale_terminal"] = p.ScaleTerminalId;
if (p.WeighingData != null) obj["weighing_data"] = JsonNode.Parse(p.WeighingData); if (p.WeighingData != null) obj["weighing_data"] = JsonNode.Parse(p.WeighingData);
if (p.WeighingReason != null) obj["weighing_reason"] = p.WeighingReason; if (p.WeighingReason != null) obj["weighing_reason"] = p.WeighingReason;
return obj; return obj;
@@ -1022,7 +1022,7 @@ namespace Elwig.Helpers.Export {
Unloading = p["unloading"]?.AsValue().GetValue<string>() ?? ((p["lesewagen"]?.AsValue().GetValue<bool>() ?? false) ? DeliveryPart.Pumped : null), Unloading = p["unloading"]?.AsValue().GetValue<string>() ?? ((p["lesewagen"]?.AsValue().GetValue<bool>() ?? false) ? DeliveryPart.Pumped : null),
Temperature = p["temperature"]?.AsValue().GetValue<double>(), Temperature = p["temperature"]?.AsValue().GetValue<double>(),
Acid = p["acid"]?.AsValue().GetValue<double>(), Acid = p["acid"]?.AsValue().GetValue<double>(),
ScaleId = p["scale_id"]?.AsValue().GetValue<string>(), ScaleTerminalId = p["scale_terminal"]?.AsValue().GetValue<string>() ?? p["scale_id"]?.AsValue().GetValue<string>(),
WeighingData = p["weighing_data"]?.AsObject().ToJsonString(Utils.JsonOpts), WeighingData = p["weighing_data"]?.AsObject().ToJsonString(Utils.JsonOpts),
WeighingReason = p["weighing_reason"]?.AsValue().GetValue<string>(), WeighingReason = p["weighing_reason"]?.AsValue().GetValue<string>(),
}, createdAt == null || modifiedAt == null ? null : }, createdAt == null || modifiedAt == null ? null :
+2 -5
View File
@@ -9,9 +9,8 @@ namespace Elwig.Helpers.Weighing {
public class AveryEventScale : Scale, IEventScale, IDisposable { public class AveryEventScale : Scale, IEventScale, IDisposable {
public string Manufacturer => "Avery"; public string Manufacturer => "Avery";
public int InternalScaleNr => 1;
public string Model { get; private set; } public string Model { get; private set; }
public string ScaleId { get; private set; } public string ScaleTerminalId { get; private set; }
public bool IsReady { get; private set; } public bool IsReady { get; private set; }
public bool HasFillingClearance { get; private set; } public bool HasFillingClearance { get; private set; }
@@ -19,13 +18,11 @@ namespace Elwig.Helpers.Weighing {
private bool IsRunning = true; private bool IsRunning = true;
private readonly Thread BackgroundThread; private readonly Thread BackgroundThread;
private readonly string Connection;
public AveryEventScale(string id, string model, string cnx, string? log = null, bool required = true) : public AveryEventScale(string id, string model, string cnx, string? log = null, bool required = true) :
base(cnx, null, null, null, log, true, !required) { base(cnx, null, null, null, log, true, !required) {
ScaleId = id; ScaleTerminalId = id;
Model = model; Model = model;
Connection = cnx;
IsReady = true; IsReady = true;
HasFillingClearance = false; HasFillingClearance = false;
Stream.WriteTimeout = -1; Stream.WriteTimeout = -1;
@@ -5,18 +5,17 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
public class GassnerScale : Scale, ICommandScale { public class GassnerEnqScale : Scale, ICommandScale {
public string Manufacturer => "Gassner"; public string Manufacturer => "Gassner";
public int InternalScaleNr => 1;
public string Model { get; private set; } public string Model { get; private set; }
public string ScaleId { get; private set; } public string ScaleTerminalId { get; private set; }
public bool IsReady { get; private set; } public bool IsReady { get; private set; }
public bool HasFillingClearance { get; private set; } public bool HasFillingClearance { get; private set; }
public GassnerScale(string id, string model, string cnx, string? empty = null, string? filling = null, int? limit = null, string? log = null) : public GassnerEnqScale(string id, string model, string cnx, string? empty = null, string? filling = null, int? limit = null, string? log = null) :
base(cnx, empty, filling, limit, log) { base(cnx, empty, filling, limit, log) {
ScaleId = id; ScaleTerminalId = id;
Model = model; Model = model;
IsReady = true; IsReady = true;
HasFillingClearance = false; HasFillingClearance = false;
@@ -24,10 +23,9 @@ namespace Elwig.Helpers.Weighing {
Stream.ReadTimeout = 11000; Stream.ReadTimeout = 11000;
} }
protected Task SendCommand(char command) => SendCommand(Convert.ToByte(command)); protected Task SendCommand(string command) => SendCommand(Encoding.ASCII.GetBytes(command));
protected async Task SendCommand(byte command) { protected async Task SendCommand(byte[] cmd) {
byte[] cmd = [command];
await Stream.WriteAsync(cmd); await Stream.WriteAsync(cmd);
if (LogPath != null) await File.AppendAllTextAsync(LogPath, Encoding.ASCII.GetString(cmd)); if (LogPath != null) await File.AppendAllTextAsync(LogPath, Encoding.ASCII.GetString(cmd));
} }
@@ -53,15 +51,15 @@ namespace Elwig.Helpers.Weighing {
return line[1..^1]; return line[1..^1];
} }
protected async Task<WeighingResult> Weigh(bool incIdentNr, bool retry = true) { protected async Task<WeighingResult> Weigh(int? internalScaleNr, bool incIdentNr, bool retry = true) {
string record; string record;
try { try {
await SendCommand(incIdentNr ? '\x05' : '?'); await SendCommand(incIdentNr ? "\x05" : "?");
record = await ReceiveResponse(); record = await ReceiveResponse();
} catch (IOException) { } catch (IOException) {
if (!retry || Tcp == null) throw; if (!retry || Tcp == null) throw;
ReconnectTcp(); ReconnectTcp();
return await Weigh(incIdentNr, false); return await Weigh(internalScaleNr, incIdentNr, false);
} }
if (record.Length != 45) if (record.Length != 45)
throw new FormatException("Invalid response from scale: Received record has invalid size"); throw new FormatException("Invalid response from scale: Received record has invalid size");
@@ -80,6 +78,7 @@ namespace Elwig.Helpers.Weighing {
GrossWeight = int.Parse(brutto), GrossWeight = int.Parse(brutto),
TareWeight = int.Parse(tara), TareWeight = int.Parse(tara),
NetWeight = int.Parse(netto), NetWeight = int.Parse(netto),
ScaleId = scaleNr,
WeighingId = identNr, WeighingId = identNr,
FullWeighingId = identNr, FullWeighingId = identNr,
Date = DateOnly.TryParseExact(date, "yyyyMMdd", out var d) ? d : null, Date = DateOnly.TryParseExact(date, "yyyyMMdd", out var d) ? d : null,
@@ -87,12 +86,12 @@ namespace Elwig.Helpers.Weighing {
}; };
} }
public async Task<WeighingResult> Weigh() { public async Task<WeighingResult> Weigh(int? scaleNr = null) {
return await Weigh(true); return await Weigh(scaleNr, true);
} }
public async Task<WeighingResult> GetCurrentWeight() { public async Task<WeighingResult> GetCurrentWeight(int? scaleNr = null) {
return await Weigh(false); return await Weigh(scaleNr, false);
} }
public async Task Empty() { public async Task Empty() {
@@ -126,8 +125,9 @@ namespace Elwig.Helpers.Weighing {
await SetFillingClearance(false); await SetFillingClearance(false);
} }
public Task SetDateAndTime(DateTime dateTime) { public async Task SetDateAndTime(DateTime dateTime) {
throw new NotImplementedException("Für Waagen vom Typ 'Gassner' ist diese Funktion noch nicht implementiert"); await SendCommand($"C{dateTime:yyyyMMddHHmmss}\r");
await ReceiveResponse();
} }
} }
} }
+2 -2
View File
@@ -10,13 +10,13 @@ namespace Elwig.Helpers.Weighing {
/// Get the current weight on the scale without performing a weighing process /// Get the current weight on the scale without performing a weighing process
/// </summary> /// </summary>
/// <returns>Result of the weighing process (probably without a weighing id)</returns> /// <returns>Result of the weighing process (probably without a weighing id)</returns>
Task<WeighingResult> GetCurrentWeight(); Task<WeighingResult> GetCurrentWeight(int? scaleNr = null);
/// <summary> /// <summary>
/// Perform a weighing process /// Perform a weighing process
/// </summary> /// </summary>
/// <returns>Result of the weighing process (including a weighing id)</returns> /// <returns>Result of the weighing process (including a weighing id)</returns>
Task<WeighingResult> Weigh(); Task<WeighingResult> Weigh(int? scaleNr = null);
/// <summary> /// <summary>
/// Empty the scale container or grant clearance to do so /// Empty the scale container or grant clearance to do so
+1 -6
View File
@@ -18,12 +18,7 @@ namespace Elwig.Helpers.Weighing {
/// <summary> /// <summary>
/// Unique identificator of the scale /// Unique identificator of the scale
/// </summary> /// </summary>
string ScaleId { get; } string ScaleTerminalId { get; }
/// <summary>
/// Internal identifying number of the scale in its system
/// </summary>
int InternalScaleNr { get; }
/// <summary> /// <summary>
/// Indicates if the scale is currently processing a request or not /// Indicates if the scale is currently processing a request or not
+1 -2
View File
@@ -5,8 +5,7 @@ namespace Elwig.Helpers.Weighing {
public string Manufacturer => "NONE"; public string Manufacturer => "NONE";
public string Model => "NONE"; public string Model => "NONE";
public string ScaleId => id; public string ScaleTerminalId => id;
public int InternalScaleNr => 0;
public bool IsReady => false; public bool IsReady => false;
public bool HasFillingClearance => false; public bool HasFillingClearance => false;
public int? WeightLimit => null; public int? WeightLimit => null;
+2 -2
View File
@@ -28,10 +28,10 @@ namespace Elwig.Helpers.Weighing {
int? limit = config.Limit != null ? int.Parse(config.Limit) : null; int? limit = config.Limit != null ? int.Parse(config.Limit) : null;
if (config.Type == "SysTec-IT") { if (config.Type == "SysTec-IT") {
return new SysTecITScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log); return new SysTecITScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log);
} else if (config.Type == "Gassner-Enq" || config.Type == "Gassner") {
return new GassnerEnqScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log);
} else if (config.Type == "Avery-Async") { } else if (config.Type == "Avery-Async") {
return new AveryEventScale(config.Id, config.Model!, config.Connection!, config.Log, config.Required); return new AveryEventScale(config.Id, config.Model!, config.Connection!, config.Log, config.Required);
} else if (config.Type == "Gassner") {
return new GassnerScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log);
} else { } else {
throw new ArgumentException($"Invalid scale type: \"{config.Type}\""); throw new ArgumentException($"Invalid scale type: \"{config.Type}\"");
} }
+10 -10
View File
@@ -8,15 +8,14 @@ namespace Elwig.Helpers.Weighing {
public class SysTecITScale : Scale, ICommandScale { public class SysTecITScale : Scale, ICommandScale {
public string Manufacturer => "SysTec"; public string Manufacturer => "SysTec";
public int InternalScaleNr => 1;
public string Model { get; private set; } public string Model { get; private set; }
public string ScaleId { get; private set; } public string ScaleTerminalId { get; private set; }
public bool IsReady { get; private set; } public bool IsReady { get; private set; }
public bool HasFillingClearance { get; private set; } public bool HasFillingClearance { get; private set; }
public SysTecITScale(string id, string model, string cnx, string? empty = null, string? filling = null, int? limit = null, string? log = null) : public SysTecITScale(string id, string model, string cnx, string? empty = null, string? filling = null, int? limit = null, string? log = null) :
base(cnx, empty, filling, limit, log) { base(cnx, empty, filling, limit, log) {
ScaleId = id; ScaleTerminalId = id;
Model = model; Model = model;
IsReady = true; IsReady = true;
HasFillingClearance = false; HasFillingClearance = false;
@@ -74,15 +73,15 @@ namespace Elwig.Helpers.Weighing {
return line[1..^3]; return line[1..^3];
} }
protected async Task<WeighingResult> Weigh(bool incIdentNr, bool retry = true) { protected async Task<WeighingResult> Weigh(int internalScalNr, bool incIdentNr, bool retry = true) {
string record; string record;
try { try {
await SendCommand(incIdentNr ? $"RN{InternalScaleNr}" : $"RM{InternalScaleNr}"); await SendCommand(incIdentNr ? $"RN{internalScalNr}" : $"RM{internalScalNr}");
record = await ReceiveResponse(); record = await ReceiveResponse();
} catch (IOException) { } catch (IOException) {
if (!retry || Tcp == null) throw; if (!retry || Tcp == null) throw;
ReconnectTcp(); ReconnectTcp();
return await Weigh(incIdentNr, false); return await Weigh(internalScalNr, incIdentNr, false);
} }
if (record.Length != 62) if (record.Length != 62)
throw new FormatException("Invalid response from scale: Received record has invalid size"); throw new FormatException("Invalid response from scale: Received record has invalid size");
@@ -114,6 +113,7 @@ namespace Elwig.Helpers.Weighing {
GrossWeight = int.Parse(brutto), GrossWeight = int.Parse(brutto),
TareWeight = int.Parse(tara), TareWeight = int.Parse(tara),
NetWeight = int.Parse(netto), NetWeight = int.Parse(netto),
ScaleId = scaleNr,
WeighingId = identNr, WeighingId = identNr,
FullWeighingId = identNr != null ? $"{parsedDate:yyyy-MM-dd}/{identNr}" : null, FullWeighingId = identNr != null ? $"{parsedDate:yyyy-MM-dd}/{identNr}" : null,
Date = parsedDate, Date = parsedDate,
@@ -121,12 +121,12 @@ namespace Elwig.Helpers.Weighing {
}; };
} }
public async Task<WeighingResult> Weigh() { public async Task<WeighingResult> Weigh(int? scaleNr = 1) {
return await Weigh(true); return await Weigh(scaleNr ?? 1, true);
} }
public async Task<WeighingResult> GetCurrentWeight() { public async Task<WeighingResult> GetCurrentWeight(int? scaleNr = 1) {
return await Weigh(false); return await Weigh(scaleNr ?? 1, false);
} }
public async Task Empty() { public async Task Empty() {
+7 -1
View File
@@ -21,6 +21,11 @@ namespace Elwig.Helpers.Weighing {
/// </summary> /// </summary>
public int? NetWeight; public int? NetWeight;
/// <summary>
/// Reported id of the scale
/// </summary>
public string? ScaleId;
/// <summary> /// <summary>
/// Weighing id (or IdentNr) provided by the scale /// Weighing id (or IdentNr) provided by the scale
/// </summary> /// </summary>
@@ -44,11 +49,12 @@ namespace Elwig.Helpers.Weighing {
/// <returns>&lt;[GrossWeight-TaraWeight=]NetWeight/WeighingId/Date/Time&gt;</returns> /// <returns>&lt;[GrossWeight-TaraWeight=]NetWeight/WeighingId/Date/Time&gt;</returns>
public override readonly string ToString() { public override readonly string ToString() {
var w = NetWeight != null ? (GrossWeight != null && TareWeight != null ? $"{GrossWeight}-{TareWeight}=" : "") + $"{NetWeight}kg" : ""; var w = NetWeight != null ? (GrossWeight != null && TareWeight != null ? $"{GrossWeight}-{TareWeight}=" : "") + $"{NetWeight}kg" : "";
return $"<{w}/{WeighingId}/{Date:yyyy-MM-dd}/{Time:HH:mm}>"; return $"<{w}/{WeighingId}/{Date:yyyy-MM-dd}/{Time:HH:mm:ss}>";
} }
public readonly JsonObject ToJson() { public readonly JsonObject ToJson() {
var obj = new JsonObject(); var obj = new JsonObject();
if (ScaleId != null) obj["scale"] = ScaleId;
if (FullWeighingId != null) obj["id"] = FullWeighingId; if (FullWeighingId != null) obj["id"] = FullWeighingId;
if (WeighingId != null) obj["nr"] = int.Parse(WeighingId); if (WeighingId != null) obj["nr"] = int.Parse(WeighingId);
if (Date != null) obj["date"] = $"{Date:yyyy-MM-dd}"; if (Date != null) obj["date"] = $"{Date:yyyy-MM-dd}";
+4 -3
View File
@@ -119,16 +119,17 @@ namespace Elwig.Models.Entities {
public double? Acid { get; set; } public double? Acid { get; set; }
[Column("scale_id")] [Column("scale_id")]
public string? ScaleId { get; set; } public string? ScaleTerminalId { get; set; }
[Column("weighing_data")] [Column("weighing_data")]
public string? WeighingData { get; set; } public string? WeighingData { get; set; }
[NotMapped] [NotMapped]
public (string? Id, int? Gross, int? Tare, int? Net, DateOnly? Date, TimeOnly? Time) WeighingInfo { public (string? ScaleId, string? Id, int? Gross, int? Tare, int? Net, DateOnly? Date, TimeOnly? Time) WeighingInfo {
get { get {
try { try {
var obj = JsonNode.Parse(WeighingData!)!.AsObject(); var obj = JsonNode.Parse(WeighingData!)!.AsObject();
return ( return (
obj["scale"]?.AsValue().GetValue<string>(),
obj["id"]?.AsValue().GetValue<string>(), obj["id"]?.AsValue().GetValue<string>(),
obj["gross_weight"]?.AsValue().GetValue<int>(), obj["gross_weight"]?.AsValue().GetValue<int>(),
obj["tare_weight"]?.AsValue().GetValue<int>(), obj["tare_weight"]?.AsValue().GetValue<int>(),
@@ -137,7 +138,7 @@ namespace Elwig.Models.Entities {
TimeOnly.TryParseExact(obj["time"]?.AsValue().GetValue<string>(), ["HH:mm:ss", "HH:mm"], out var t) ? t : null TimeOnly.TryParseExact(obj["time"]?.AsValue().GetValue<string>(), ["HH:mm:ss", "HH:mm"], out var t) ? t : null
); );
} catch { } catch {
return (null, null, null, null, null, null); return (null, null, null, null, null, null, null);
} }
} }
} }
+4 -8
View File
@@ -3,15 +3,11 @@
PRAGMA writable_schema = ON; PRAGMA writable_schema = ON;
ALTER TABLE member RENAME COLUMN business_shares TO shares; ALTER TABLE member RENAME COLUMN business_shares TO shares;
ALTER TABLE member ADD COLUMN shares_red INTEGER NOT NULL DEFAULT 0; ALTER TABLE member ADD COLUMN shares_red INTEGER NOT NULL DEFAULT 0 CHECK (shares_red >= 0);
ALTER TABLE member ADD COLUMN shares_white INTEGER NOT NULL DEFAULT 0; ALTER TABLE member ADD COLUMN shares_white INTEGER NOT NULL DEFAULT 0 CHECK (shares_white >= 0);
ALTER TABLE member ADD COLUMN shares_dormant INTEGER NOT NULL DEFAULT 0; ALTER TABLE member ADD COLUMN shares_dormant INTEGER NOT NULL DEFAULT 0 CHECK (shares_dormant >= 0);
UPDATE sqlite_schema SET sql = REPLACE(sql, CHAR(10) || UPDATE sqlite_schema SET sql = REPLACE(sql, 'shares INTEGER NOT NULL DEFAULT 0', 'shares INTEGER NOT NULL DEFAULT 0 CHECK (shares >= 0)')
') STRICT',
',' || CHAR(10) ||
' CONSTRAINT c_member_shares CHECK (shares >= 0 AND shares_red >= 0 AND shares_white >= 0 AND shares_dormant >= 0)' || CHAR(10) ||
') STRICT')
WHERE type = 'table' AND name = 'member'; WHERE type = 'table' AND name = 'member';
UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS'; UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS';
+2 -2
View File
@@ -67,7 +67,7 @@ namespace Elwig.Services {
vm.IsGebunden = p.IsGebunden; vm.IsGebunden = p.IsGebunden;
vm.Unloading = p.Unloading; vm.Unloading = p.Unloading;
vm.ScaleId = p.ScaleId; vm.ScaleTerminalId = p.ScaleTerminalId;
vm.WeighingData = p.WeighingData; vm.WeighingData = p.WeighingData;
vm.ManualWeighingReason = p.WeighingReason; vm.ManualWeighingReason = p.WeighingReason;
} }
@@ -515,7 +515,7 @@ namespace Elwig.Services {
Weight = vm.Weight!.Value, Weight = vm.Weight!.Value,
IsManualWeighing = vm.IsManualWeighing, IsManualWeighing = vm.IsManualWeighing,
ScaleId = vm.ScaleId, ScaleTerminalId = vm.ScaleTerminalId,
WeighingData = vm.WeighingData, WeighingData = vm.WeighingData,
WeighingReason = vm.ManualWeighingReason, WeighingReason = vm.ManualWeighingReason,
}; };
+1 -1
View File
@@ -25,7 +25,7 @@ namespace Elwig.ViewModels {
[ObservableProperty] [ObservableProperty]
private string? _manualWeighingReason; private string? _manualWeighingReason;
[ObservableProperty] [ObservableProperty]
private string? _scaleId; private string? _scaleTerminalId;
[ObservableProperty] [ObservableProperty]
private string? _weighingData; private string? _weighingData;
+9 -9
View File
@@ -85,10 +85,10 @@ namespace Elwig.Windows {
if (n < 3) WeighingCButton.Visibility = Visibility.Hidden; if (n < 3) WeighingCButton.Visibility = Visibility.Hidden;
if (n < 4) WeighingDButton.Visibility = Visibility.Hidden; if (n < 4) WeighingDButton.Visibility = Visibility.Hidden;
if (n == 1) WeighingAButton.Content = "Wiegen"; if (n == 1) WeighingAButton.Content = "Wiegen";
if (n > 1) WeighingAButton.Content = $"Wiegen {App.CommandScales[0].ScaleId}"; if (n > 1) WeighingAButton.Content = $"Wiegen {App.CommandScales[0].ScaleTerminalId}";
if (n >= 2) WeighingBButton.Content = $"Wiegen {App.CommandScales[1].ScaleId}"; if (n >= 2) WeighingBButton.Content = $"Wiegen {App.CommandScales[1].ScaleTerminalId}";
if (n >= 3) WeighingCButton.Content = $"Wiegen {App.CommandScales[2].ScaleId}"; if (n >= 3) WeighingCButton.Content = $"Wiegen {App.CommandScales[2].ScaleTerminalId}";
if (n >= 4) WeighingDButton.Content = $"Wiegen {App.CommandScales[3].ScaleId}"; if (n >= 4) WeighingDButton.Content = $"Wiegen {App.CommandScales[3].ScaleTerminalId}";
WeighingManualButton.Margin = new Thickness(10, 10 + n * 32, 10, 10); WeighingManualButton.Margin = new Thickness(10, 10 + n * 32, 10, 10);
foreach (var s in App.EventScales) { foreach (var s in App.EventScales) {
s.WeighingEvent += Scale_Weighing; s.WeighingEvent += Scale_Weighing;
@@ -366,7 +366,7 @@ namespace Elwig.Windows {
private void InitialInputs() { private void InitialInputs() {
ViewModel.LastScaleError = null; ViewModel.LastScaleError = null;
ViewModel.WeighingData = null; ViewModel.WeighingData = null;
ViewModel.ScaleId = null; ViewModel.ScaleTerminalId = null;
ViewModel.ManualWeighingReason = null; ViewModel.ManualWeighingReason = null;
ClearOriginalValues(); ClearOriginalValues();
@@ -651,13 +651,13 @@ namespace Elwig.Windows {
private void OnWeighingResult(IScale scale, WeighingResult res) { private void OnWeighingResult(IScale scale, WeighingResult res) {
if ((res.NetWeight ?? 0) > 0 && res.FullWeighingId != null) { if ((res.NetWeight ?? 0) > 0 && res.FullWeighingId != null) {
ViewModel.Weight = res.NetWeight; ViewModel.Weight = res.NetWeight;
ViewModel.ScaleId = scale.ScaleId; ViewModel.ScaleTerminalId = scale.ScaleTerminalId;
ViewModel.WeighingData = res.ToJson().ToJsonString(); ViewModel.WeighingData = res.ToJson().ToJsonString();
ViewModel.ManualWeighingReason = null; ViewModel.ManualWeighingReason = null;
ManualWeighingInput.IsChecked = false; ManualWeighingInput.IsChecked = false;
} else { } else {
ViewModel.Weight = null; ViewModel.Weight = null;
ViewModel.ScaleId = null; ViewModel.ScaleTerminalId = null;
ViewModel.WeighingData = null; ViewModel.WeighingData = null;
} }
ViewModel.LastScaleError = null; ViewModel.LastScaleError = null;
@@ -771,7 +771,7 @@ namespace Elwig.Windows {
} }
private void EmptyScale() { private void EmptyScale() {
var scale = App.Scales.Where(s => s.ScaleId == ViewModel.ScaleId).FirstOrDefault(); var scale = App.Scales.Where(s => s.ScaleTerminalId == ViewModel.ScaleTerminalId).FirstOrDefault();
if (scale is not ICommandScale cs) return; if (scale is not ICommandScale cs) return;
cs.Empty(); cs.Empty();
} }
@@ -953,7 +953,7 @@ namespace Elwig.Windows {
ViewModel.Weight = res?.Item1; ViewModel.Weight = res?.Item1;
ManualWeighingInput.IsChecked = true; ManualWeighingInput.IsChecked = true;
ViewModel.ManualWeighingReason = res?.Item2; ViewModel.ManualWeighingReason = res?.Item2;
ViewModel.ScaleId = null; ViewModel.ScaleTerminalId = null;
ViewModel.WeighingData = null; ViewModel.WeighingData = null;
} }
+2 -2
View File
@@ -13,7 +13,7 @@ About
**Product:** Elwig **Product:** Elwig
**Description:** Electronic Management for Vintners' Cooperatives **Description:** Electronic Management for Vintners' Cooperatives
**Type:** ERP system **Type:** ERP system
**Version:** 1.0.5.6 ([Changelog](./CHANGELOG.md)) **Version:** 1.1.0.0 ([Changelog](./CHANGELOG.md))
**License:** [GNU General Public License 3.0 (GPLv3)](./LICENSE) **License:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)
**Website:** https://elwig.at/ **Website:** https://elwig.at/
**Source code:** https://git.necronda.net/winzer/elwig **Source code:** https://git.necronda.net/winzer/elwig
@@ -33,7 +33,7 @@ Packaging: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
**Produkt:** Elwig **Produkt:** Elwig
**Beschreibung:** Elektronische Winzergenossenschaftsverwaltung **Beschreibung:** Elektronische Winzergenossenschaftsverwaltung
**Typ:** Warenwirtschaftssystem (ERP-System) **Typ:** Warenwirtschaftssystem (ERP-System)
**Version:** 1.0.5.6 ([Änderungsprotokoll](./CHANGELOG.md)) **Version:** 1.1.0.0 ([Änderungsprotokoll](./CHANGELOG.md))
**Lizenz:** [GNU General Public License 3.0 (GPLv3)](./LICENSE) **Lizenz:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)
**Website:** https://elwig.at/ **Website:** https://elwig.at/
**Quellcode:** https://git.necronda.net/winzer/elwig **Quellcode:** https://git.necronda.net/winzer/elwig
+1 -1
View File
@@ -19,7 +19,7 @@
</Target> </Target>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.7.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
<PackageReference Include="Appium.WebDriver" Version="4.4.5" /> <PackageReference Include="Appium.WebDriver" Version="4.4.5" />
<PackageReference Include="NReco.PdfRenderer" Version="1.6.0" /> <PackageReference Include="NReco.PdfRenderer" Version="1.6.0" />
<PackageReference Include="NUnit" Version="4.6.1" /> <PackageReference Include="NUnit" Version="4.6.1" />
@@ -23,7 +23,7 @@ namespace Tests.UnitTests.DocumentTests {
1 Grüner Veltliner Qualitätswein 73 15,0 3 219 1 Grüner Veltliner Qualitätswein 73 15,0 3 219
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: 1, ID: 321 09:02, 01.10.2020 Waage/Terminal: ?/1, ID: 321 09:02:46, 01.10.2020
Brutto: 3 219 kg Tara: 0 kg Netto: 3 219 kg gerebelt gewogen Brutto: 3 219 kg Tara: 0 kg Netto: 3 219 kg gerebelt gewogen
""")); """));
}); });
@@ -49,13 +49,13 @@ namespace Tests.UnitTests.DocumentTests {
1 Grüner Veltliner Qualitätswein 82 16,7 4 002 1 Grüner Veltliner Qualitätswein 82 16,7 4 002
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
2 Grüner Veltliner Qualitätswein 75 15,3 481 2 Grüner Veltliner Qualitätswein 75 15,3 481
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring("Gesamt: 81 16,5 4 483")); Assert.That(text, Contains.Substring("Gesamt: 81 16,5 4 483"));
}); });
@@ -80,19 +80,19 @@ namespace Tests.UnitTests.DocumentTests {
1 Grüner Veltliner Wein 75 15,4 2 561 1 Grüner Veltliner Wein 75 15,4 2 561
Herkunft: Österreich Herkunft: Österreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
2 Grüner Veltliner Kabinett Wein 87 17,6 3 129 2 Grüner Veltliner Kabinett Wein 87 17,6 3 129
Herkunft: Österreich Herkunft: Österreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
3 Grüner Veltliner Wein 79 16,1 1 280 3 Grüner Veltliner Wein 79 16,1 1 280
Herkunft: Österreich Herkunft: Österreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring("Gesamt: 81 16,5 6 970")); Assert.That(text, Contains.Substring("Gesamt: 81 16,5 6 970"));
}); });
@@ -118,14 +118,14 @@ namespace Tests.UnitTests.DocumentTests {
Bewirtschaftung: Bio (AT-BIO-302) Bewirtschaftung: Bio (AT-BIO-302)
Herkunft: Österreich Herkunft: Österreich
/ Wolkersdorfer Hochleithen / Wolkersdorf im Weinviertel / KG Wolkersdorf / Wolkersdorfer Hochleithen / Wolkersdorf im Weinviertel / KG Wolkersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
2 Grüner Veltliner Qualitätswein 75 15,4 2 134 2 Grüner Veltliner Qualitätswein 75 15,4 2 134
Bewirtschaftung: Bio (AT-BIO-302) Bewirtschaftung: Bio (AT-BIO-302)
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Wolkersdorfer Hochleithen / Wolkersdorf im Weinviertel / KG Wolkersdorf / Wolkersdorfer Hochleithen / Wolkersdorf im Weinviertel / KG Wolkersdorf
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring("Gesamt: 78 15,9 5 332")); Assert.That(text, Contains.Substring("Gesamt: 78 15,9 5 332"));
}); });
@@ -152,12 +152,12 @@ namespace Tests.UnitTests.DocumentTests {
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Zu-/Abschläge: Geschädigte Trauben 10,00 % Zu-/Abschläge: Geschädigte Trauben 10,00 %
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
2 Grüner Veltliner Kabinett Kabinett 87 17,7 1 873 2 Grüner Veltliner Kabinett Kabinett 87 17,7 1 873
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Zu-/Abschläge: Keine Voranmeldung 0,1000 /kg Zu-/Abschläge: Keine Voranmeldung 0,1000 /kg
Waage: ?, ID: ? (gerebelt gewogen) Waage/Terminal: ?/?, ID: ? (gerebelt gewogen)
Gesamt: 87 17,6 4 860 Gesamt: 87 17,6 4 860
""")); """));
} }
@@ -31,16 +31,19 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1235; Mock.Weight = 1235;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1235, TareWeight = 0, NetWeight = 1235, GrossWeight = 1235, TareWeight = 0, NetWeight = 1235,
ScaleId = "1",
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
Mock.Weight = 1240; Mock.Weight = 1240;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1240, TareWeight = 0, NetWeight = 1240, GrossWeight = 1240, TareWeight = 0, NetWeight = 1240,
ScaleId = "1",
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
Mock.Weight = 1245; Mock.Weight = 1245;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1245, TareWeight = 0, NetWeight = 1245, GrossWeight = 1245, TareWeight = 0, NetWeight = 1245,
ScaleId = "1",
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
} }
@@ -50,19 +53,19 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1235; Mock.Weight = 1235;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 1235, TareWeight = 0, NetWeight = 1235, GrossWeight = 1235, TareWeight = 0, NetWeight = 1235,
WeighingId = "1", FullWeighingId = $"2020-10-17/1", ScaleId = "1", WeighingId = "1", FullWeighingId = $"2020-10-17/1",
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
Mock.Weight = 3335; Mock.Weight = 3335;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3335, TareWeight = 0, NetWeight = 3335, GrossWeight = 3335, TareWeight = 0, NetWeight = 3335,
WeighingId = "2", FullWeighingId = $"2020-10-17/2", ScaleId = "1", WeighingId = "2", FullWeighingId = $"2020-10-17/2",
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
Mock.Weight = 6420; Mock.Weight = 6420;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 6420, TareWeight = 0, NetWeight = 6420, GrossWeight = 6420, TareWeight = 0, NetWeight = 6420,
WeighingId = "3", FullWeighingId = $"2020-10-17/3", ScaleId = "1", WeighingId = "3", FullWeighingId = $"2020-10-17/3",
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
} }
@@ -5,7 +5,7 @@ namespace Tests.UnitTests.WeighingTests {
public class ScaleTestHaugsdorfDMA02 { public class ScaleTestHaugsdorfDMA02 {
private MockScale Mock; private MockScale Mock;
private GassnerScale Scale; private GassnerEnqScale Scale;
[OneTimeSetUp] [OneTimeSetUp]
public void SetupScale() { public void SetupScale() {
@@ -32,29 +32,23 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234; Mock.Weight = 1234;
Mock.Tare = 0; Mock.Tare = 0;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234, GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
TareWeight = 0, ScaleId = "1",
NetWeight = 1234, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 1235; Mock.Weight = 1235;
Mock.Tare = 46; Mock.Tare = 46;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1281, GrossWeight = 1281, TareWeight = 46, NetWeight = 1235,
TareWeight = 46, ScaleId = "1",
NetWeight = 1235, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 1236; Mock.Weight = 1236;
Mock.Tare = 92; Mock.Tare = 92;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1328, GrossWeight = 1328, TareWeight = 92, NetWeight = 1236,
TareWeight = 92, ScaleId = "1",
NetWeight = 1236, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
} }
@@ -63,35 +57,23 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234; Mock.Weight = 1234;
Mock.Tare = 92; Mock.Tare = 92;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 1326, GrossWeight = 1326, TareWeight = 92, NetWeight = 1234,
TareWeight = 92, ScaleId = "1", WeighingId = "1", FullWeighingId = "1",
NetWeight = 1234, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
WeighingId = "1",
FullWeighingId = "1",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 3333; Mock.Weight = 3333;
Mock.Tare = 41; Mock.Tare = 41;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3374, GrossWeight = 3374, TareWeight = 41, NetWeight = 3333,
TareWeight = 41, ScaleId = "1", WeighingId = "2", FullWeighingId = "2",
NetWeight = 3333, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
WeighingId = "2",
FullWeighingId = "2",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 4321; Mock.Weight = 4321;
Mock.Tare = 0; Mock.Tare = 0;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 4321, GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
TareWeight = 0, ScaleId = "1", WeighingId = "3", FullWeighingId = "3",
NetWeight = 4321, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
WeighingId = "3",
FullWeighingId = "3",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
} }
@@ -31,16 +31,19 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234; Mock.Weight = 1234;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234, TareWeight = 0, NetWeight = 1234, GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
ScaleId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 1235; Mock.Weight = 1235;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1235, TareWeight = 0, NetWeight = 1235, GrossWeight = 1235, TareWeight = 0, NetWeight = 1235,
ScaleId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 1236; Mock.Weight = 1236;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1236, TareWeight = 0, NetWeight = 1236, GrossWeight = 1236, TareWeight = 0, NetWeight = 1236,
ScaleId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
} }
@@ -50,19 +53,19 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234; Mock.Weight = 1234;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234, TareWeight = 0, NetWeight = 1234, GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
WeighingId = "1", FullWeighingId = $"2020-10-15/1", ScaleId = "1", WeighingId = "1", FullWeighingId = $"2020-10-15/1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 3333; Mock.Weight = 3333;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3333, TareWeight = 0, NetWeight = 3333, GrossWeight = 3333, TareWeight = 0, NetWeight = 3333,
WeighingId = "2", FullWeighingId = $"2020-10-15/2", ScaleId = "1", WeighingId = "2", FullWeighingId = $"2020-10-15/2",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 4321; Mock.Weight = 4321;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 4321, TareWeight = 0, NetWeight = 4321, GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
WeighingId = "3", FullWeighingId = $"2020-10-15/3", ScaleId = "1", WeighingId = "3", FullWeighingId = $"2020-10-15/3",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
} }
@@ -5,7 +5,7 @@ namespace Tests.UnitTests.WeighingTests {
public class ScaleTestSitzendorfDMA03Baby { public class ScaleTestSitzendorfDMA03Baby {
private MockScale Mock; private MockScale Mock;
private GassnerScale Scale; private GassnerEnqScale Scale;
[OneTimeSetUp] [OneTimeSetUp]
public void SetupScale() { public void SetupScale() {
@@ -32,29 +32,23 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234; Mock.Weight = 1234;
Mock.Tare = 0; Mock.Tare = 0;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234, GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
TareWeight = 0, ScaleId = "1",
NetWeight = 1234, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 1235; Mock.Weight = 1235;
Mock.Tare = 46; Mock.Tare = 46;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1281, GrossWeight = 1281, TareWeight = 46, NetWeight = 1235,
TareWeight = 46, ScaleId = "1",
NetWeight = 1235, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 1236; Mock.Weight = 1236;
Mock.Tare = 92; Mock.Tare = 92;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1328, GrossWeight = 1328, TareWeight = 92, NetWeight = 1236,
TareWeight = 92, ScaleId = "1",
NetWeight = 1236, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
} }
@@ -63,35 +57,23 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234; Mock.Weight = 1234;
Mock.Tare = 92; Mock.Tare = 92;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 1326, GrossWeight = 1326, TareWeight = 92, NetWeight = 1234,
TareWeight = 92, ScaleId = "1", WeighingId = "1", FullWeighingId = "1",
NetWeight = 1234, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
WeighingId = "1",
FullWeighingId = "1",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 3333; Mock.Weight = 3333;
Mock.Tare = 41; Mock.Tare = 41;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3374, GrossWeight = 3374, TareWeight = 41, NetWeight = 3333,
TareWeight = 41, ScaleId = "1", WeighingId = "2", FullWeighingId = "2",
NetWeight = 3333, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
WeighingId = "2",
FullWeighingId = "2",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
Mock.Weight = 4321; Mock.Weight = 4321;
Mock.Tare = 0; Mock.Tare = 0;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 4321, GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
TareWeight = 0, ScaleId = "1", WeighingId = "3", FullWeighingId = "3",
NetWeight = 4321, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
WeighingId = "3",
FullWeighingId = "3",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
})); }));
} }
@@ -40,21 +40,25 @@ namespace Tests.UnitTests.WeighingTests {
MockA.Weight = 1234; MockA.Weight = 1234;
Assert.That(await ScaleA!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleA!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234, TareWeight = 0, NetWeight = 1234, GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
ScaleId = "1",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
MockB.Weight = 3456; MockB.Weight = 3456;
Assert.That(await ScaleB!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleB!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 3456, TareWeight = 0, NetWeight = 3456, GrossWeight = 3456, TareWeight = 0, NetWeight = 3456,
ScaleId = "1",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
MockA.Weight = 1236; MockA.Weight = 1236;
Assert.That(await ScaleA!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleA!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1236, TareWeight = 0, NetWeight = 1236, GrossWeight = 1236, TareWeight = 0, NetWeight = 1236,
ScaleId = "1",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
MockB.Weight = 3457; MockB.Weight = 3457;
Assert.That(await ScaleB!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleB!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 3457, TareWeight = 0, NetWeight = 3457, GrossWeight = 3457, TareWeight = 0, NetWeight = 3457,
ScaleId = "1",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
} }
@@ -64,25 +68,25 @@ namespace Tests.UnitTests.WeighingTests {
MockA.Weight = 1234; MockA.Weight = 1234;
Assert.That(await ScaleA!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleA!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234, TareWeight = 0, NetWeight = 1234, GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
WeighingId = "1", FullWeighingId = $"2020-10-08/1", ScaleId = "1", WeighingId = "1", FullWeighingId = $"2020-10-08/1",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
MockB.Weight = 3456; MockB.Weight = 3456;
Assert.That(await ScaleB!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleB!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3456, TareWeight = 0, NetWeight = 3456, GrossWeight = 3456, TareWeight = 0, NetWeight = 3456,
WeighingId = "1", FullWeighingId = $"2020-10-08/1", ScaleId = "1", WeighingId = "1", FullWeighingId = $"2020-10-08/1",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
MockA.Weight = 4321; MockA.Weight = 4321;
Assert.That(await ScaleA!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleA!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 4321, TareWeight = 0, NetWeight = 4321, GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
WeighingId = "2", FullWeighingId = $"2020-10-08/2", ScaleId = "1", WeighingId = "2", FullWeighingId = $"2020-10-08/2",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
MockB.Weight = 3333; MockB.Weight = 3333;
Assert.That(await ScaleB!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleB!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3333, TareWeight = 0, NetWeight = 3333, GrossWeight = 3333, TareWeight = 0, NetWeight = 3333,
WeighingId = "2", FullWeighingId = $"2020-10-08/2", ScaleId = "1", WeighingId = "2", FullWeighingId = $"2020-10-08/2",
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
} }