Weighing: Do not ignore gross and tare weight and show it on DeliveryNote

This commit is contained in:
2024-07-22 17:10:36 +02:00
parent 1141331608
commit fd0ed97305
26 changed files with 159 additions and 96 deletions

View File

@ -60,8 +60,18 @@
} }
} }
<tr><td></td><td colspan="5"> <tr><td></td><td colspan="5">
@Raw(part.IsManualWeighing ? "<i>Handwiegung</i>" : $"<i>Waage:</i> {part.ScaleId ?? "?"}, <i>ID:</i> {part.WeighingId ?? "?"}") @if (part.IsManualWeighing) {
(@(part.IsNetWeight ? "netto/gerebelt gewogen" : "brutto/nicht gerebelt gewogen"))@Raw(part.WeighingReason != null ? $", <i>Begründung:</i>" : "") @part.WeighingReason <i>Handwiegung @(part.IsNetWeight ? " (gerebelt gewogen)" : " (nicht gerebelt gewogen)")</i>@Raw(part.WeighingReason != null ? ", <i>Begründung:</i> " : "") @part.WeighingReason
} else {
var info = part.WeighingInfo;
<i>Waage:</i> @(part.ScaleId ?? "?")@(", ") <i>ID:</i> @(info.Id ?? "?")
@(info.Date != null || info.Time != null ? " " : "")@(info.Time != null ? $"{info.Time:HH:mm}" : "")@(info.Date != null ? $", {info.Date:dd.MM.yyyy}" : "")
@if (info.Gross != null && info.Tare != null && info.Net != null) {
<br/><i>Brutto:</i> @($"{info.Gross:N0} kg")@(" ") <i>Tara:</i> @($"{info.Tare:N0} kg")@(" ") <i>Netto:</i> @($"{info.Net:N0} kg")@(" ")@Raw(part.IsNetWeight ? "<i>gerebelt gewogen</i>" : "<i>nicht gerebelt gewogen</i>")
} else {
@Raw($" <i>({(part.IsNetWeight ? "gerebelt gewogen" : "nicht gerebelt gewogen")})</i>")
}
}
</td></tr> </td></tr>
@if (part.Comment != null) { @if (part.Comment != null) {
<tr><td></td><td colspan="5"><i>Anmerkung:</i> @part.Comment</td></tr> <tr><td></td><td colspan="5"><i>Anmerkung:</i> @part.Comment</td></tr>

View File

@ -9,7 +9,7 @@ namespace Elwig.Helpers {
public static class AppDbUpdater { public static class AppDbUpdater {
// Don't forget to update value in Tests/fetch-resources.bat! // Don't forget to update value in Tests/fetch-resources.bat!
public static readonly int RequiredSchemaVersion = 24; public static readonly int RequiredSchemaVersion = 25;
private static int VersionOffset = 0; private static int VersionOffset = 0;

View File

@ -194,7 +194,7 @@ namespace Elwig.Helpers.Export {
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.ScaleId != null) obj["scale_id"] = p.ScaleId;
if (p.WeighingId != null) obj["weighing_id"] = p.WeighingId; 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;
}).ToArray()), }).ToArray()),
@ -238,7 +238,7 @@ namespace Elwig.Helpers.Export {
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>(), ScaleId = p["scale_id"]?.AsValue().GetValue<string>(),
WeighingId = p["weighing_id"]?.AsValue().GetValue<string>(), WeighingData = p["weighing_data"]?.AsObject().ToJsonString(),
WeighingReason = p["weighing_reason"]?.AsValue().GetValue<string>(), WeighingReason = p["weighing_reason"]?.AsValue().GetValue<string>(),
}).ToList(), json["parts"]!.AsArray().SelectMany(p => p!["modids"]!.AsArray().Select(m => new DeliveryPartModifier { }).ToList(), json["parts"]!.AsArray().SelectMany(p => p!["modids"]!.AsArray().Select(m => new DeliveryPartModifier {
Year = year, Year = year,

View File

@ -79,7 +79,7 @@ namespace Elwig.Helpers.Weighing {
identNr = identNr.Length > 0 && identNr != "0" ? identNr : null; identNr = identNr.Length > 0 && identNr != "0" ? identNr : null;
var parsedDate = DateOnly.Parse(date); var parsedDate = DateOnly.Parse(date);
return new() { return new() {
Weight = int.Parse(netto), NetWeight = int.Parse(netto),
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,

View File

@ -69,13 +69,14 @@ namespace Elwig.Helpers.Weighing {
var time = line[37..43]; var time = line[37..43];
identNr = identNr.Length > 0 && identNr != "0" ? identNr : null; identNr = identNr.Length > 0 && identNr != "0" ? identNr : null;
var parsedDate = DateOnly.ParseExact(date, "yyyyMMdd");
return new() { return new() {
Weight = int.Parse(netto), GrossWeight = int.Parse(brutto),
TareWeight = int.Parse(tara),
NetWeight = int.Parse(netto),
WeighingId = identNr, WeighingId = identNr,
FullWeighingId = identNr, FullWeighingId = identNr,
Date = parsedDate, Date = DateOnly.TryParseExact(date, "yyyyMMdd", out var d) ? d : null,
Time = TimeOnly.ParseExact(time, "HHmmss"), Time = TimeOnly.TryParseExact(time, "HHmmss", out var t) ? t : null,
}; };
} }

View File

@ -2,7 +2,7 @@
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
/// <summary> /// <summary>
/// Interface for controlling a a scale which responds to commands sent to it /// Interface for controlling a weighing scale which responds to commands sent to it
/// </summary> /// </summary>
public interface ICommandScale : IScale { public interface ICommandScale : IScale {
/// <summary> /// <summary>

View File

@ -1,6 +1,6 @@
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
/// <summary> /// <summary>
/// Interface for controlling a a scale which automatically sends weighing updates /// Interface for controlling a weighing scale which automatically sends weighing updates
/// </summary> /// </summary>
public interface IEventScale : IScale { public interface IEventScale : IScale {

View File

@ -2,7 +2,7 @@ using System;
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
/// <summary> /// <summary>
/// Interface for controlling a industrial scale (industrial terminal, "IT") /// Interface for controlling a industrial weighing scale (industrial terminal, "IT")
/// </summary> /// </summary>
public interface IScale : IDisposable { public interface IScale : IDisposable {
/// <summary> /// <summary>

View File

@ -98,7 +98,9 @@ namespace Elwig.Helpers.Weighing {
identNr = identNr.Length > 0 && identNr != "0" ? identNr : null; identNr = identNr.Length > 0 && identNr != "0" ? identNr : null;
var parsedDate = DateOnly.Parse(date); var parsedDate = DateOnly.Parse(date);
return new() { return new() {
Weight = int.Parse(netto), GrossWeight = int.Parse(brutto),
TareWeight = int.Parse(tara),
NetWeight = int.Parse(netto),
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,

View File

@ -1,12 +1,7 @@
using System; using System;
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
public class WeighingEventArgs : EventArgs { public class WeighingEventArgs(WeighingResult result) : EventArgs {
public readonly WeighingResult Result = result;
public WeighingResult Result { get; set; }
public WeighingEventArgs(WeighingResult result) {
Result = result;
}
} }
} }

View File

@ -1,14 +1,25 @@
using System; using System;
using System.Text.Json.Nodes;
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
/// <summary> /// <summary>
/// Result of a weighing process on an industrial scale /// Result of a weighing process on an industrial weighing scale
/// </summary> /// </summary>
public struct WeighingResult { public struct WeighingResult {
/// <summary>
/// Measured gross weight in kg
/// </summary>
public int? GrossWeight;
/// <summary>
/// Measured tare weight in kg
/// </summary>
public int? TareWeight;
/// <summary> /// <summary>
/// Measured net weight in kg /// Measured net weight in kg
/// </summary> /// </summary>
public int? Weight; public int? NetWeight;
/// <summary> /// <summary>
/// Weighing id (or IdentNr) provided by the scale /// Weighing id (or IdentNr) provided by the scale
@ -30,12 +41,22 @@ namespace Elwig.Helpers.Weighing {
/// </summary> /// </summary>
public TimeOnly? Time; public TimeOnly? Time;
/// <returns>&lt;Weight/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 = Weight != null ? $"{Weight}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}>";
} }
public readonly JsonObject ToJson() {
var obj = new JsonObject();
if (FullWeighingId != null) obj["id"] = FullWeighingId;
if (WeighingId != null) obj["nr"] = int.Parse(WeighingId);
if (Date != null) obj["date"] = $"{Date:yyyy-MM-dd}";
if (Time != null) obj["time"] = $"{Time:HH:mm:ss}";
if (GrossWeight != null) obj["gross_weight"] = GrossWeight;
if (TareWeight != null) obj["tare_weight"] = TareWeight;
if (NetWeight != null) obj["net_weight"] = NetWeight;
return obj;
}
} }
} }

View File

@ -1,8 +1,10 @@
using Elwig.Helpers; using Elwig.Helpers;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text.Json.Nodes;
namespace Elwig.Models.Entities { namespace Elwig.Models.Entities {
[Table("delivery_part"), PrimaryKey("Year", "DId", "DPNr")] [Table("delivery_part"), PrimaryKey("Year", "DId", "DPNr")]
@ -99,8 +101,26 @@ namespace Elwig.Models.Entities {
[Column("scale_id")] [Column("scale_id")]
public string? ScaleId { get; set; } public string? ScaleId { get; set; }
[Column("weighing_id")] [Column("weighing_data")]
public string? WeighingId { get; set; } public string? WeighingData { get; set; }
[NotMapped]
public (string? Id, int? Gross, int? Tare, int? Net, DateOnly? Date, TimeOnly? Time) WeighingInfo {
get {
try {
var obj = JsonNode.Parse(WeighingData!)!.AsObject();
return (
obj["id"]?.AsValue().GetValue<string>(),
obj["gross_weight"]?.AsValue().GetValue<int>(),
obj["tare_weight"]?.AsValue().GetValue<int>(),
obj["net_weight"]?.AsValue().GetValue<int>(),
DateOnly.TryParseExact(obj["date"]?.AsValue().GetValue<string>(), "yyyy-MM-dd", out var d) ? d : null,
TimeOnly.TryParseExact(obj["time"]?.AsValue().GetValue<string>(), ["HH:mm:ss", "HH:mm"], out var t) ? t : null
);
} catch {
return (null, null, null, null, null, null);
}
}
}
[Column("weighing_reason")] [Column("weighing_reason")]
public string? WeighingReason { get; set; } public string? WeighingReason { get; set; }

View File

@ -0,0 +1,4 @@
-- schema version 24 to 25
ALTER TABLE delivery_part RENAME COLUMN weighing_id TO weighing_data;
UPDATE delivery_part SET weighing_data = '{"id":"' || weighing_data || '","nr":' || SUBSTR(weighing_data, INSTR(weighing_data, '/') + 1) || '}';

View File

@ -80,7 +80,7 @@ namespace Elwig.Services {
vm.IsGebunden = p.IsGebunden; vm.IsGebunden = p.IsGebunden;
vm.ScaleId = p.ScaleId; vm.ScaleId = p.ScaleId;
vm.WeighingId = p.WeighingId; vm.WeighingData = p.WeighingData;
vm.ManualWeighingReason = p.WeighingReason; vm.ManualWeighingReason = p.WeighingReason;
} }
@ -174,11 +174,11 @@ namespace Elwig.Services {
prd = prd.And(p => p.IsManualWeighing == false); prd = prd.And(p => p.IsManualWeighing == false);
filter.RemoveAt(i--); filter.RemoveAt(i--);
filterNames.Add("keine Handwiegung"); filterNames.Add("keine Handwiegung");
} else if (e.ToLower() is "bto" or "brut" or "brutt" or "brutto" or "!gerebelt") { } else if (e.ToLower() == "!gerebelt") {
prd = prd.And(p => p.IsNetWeight == false); prd = prd.And(p => p.IsNetWeight == false);
filter.RemoveAt(i--); filter.RemoveAt(i--);
filterNames.Add("brutto Wiegung"); filterNames.Add("brutto Wiegung");
} else if (e.ToLower() is "nto" or "net" or "nett" or "netto" or "gerebelt") { } else if (e.ToLower() == "gerebelt") {
prd = prd.And(p => p.IsNetWeight == true); prd = prd.And(p => p.IsNetWeight == true);
filter.RemoveAt(i--); filter.RemoveAt(i--);
filterNames.Add("netto Wiegung"); filterNames.Add("netto Wiegung");
@ -465,7 +465,7 @@ namespace Elwig.Services {
Weight = (int)vm.Weight!, Weight = (int)vm.Weight!,
IsManualWeighing = vm.IsManualWeighing, IsManualWeighing = vm.IsManualWeighing,
ScaleId = vm.ScaleId, ScaleId = vm.ScaleId,
WeighingId = vm.WeighingId, WeighingData = vm.WeighingData,
WeighingReason = vm.ManualWeighingReason, WeighingReason = vm.ManualWeighingReason,
}; };

View File

@ -27,7 +27,7 @@ namespace Elwig.ViewModels {
[ObservableProperty] [ObservableProperty]
private string? _scaleId; private string? _scaleId;
[ObservableProperty] [ObservableProperty]
private string? _weighingId; private string? _weighingData;
[ObservableProperty] [ObservableProperty]
private bool _filterTodayOnly; private bool _filterTodayOnly;

View File

@ -176,7 +176,7 @@
<Bold>Handwiegung</Bold>: handw[iegung], !Handw[iegung] (alle ohne Handwiegung)<LineBreak/> <Bold>Handwiegung</Bold>: handw[iegung], !Handw[iegung] (alle ohne Handwiegung)<LineBreak/>
<Bold>Handlese</Bold>: Handl[ese], !handl[ese] (alle ohne Handlese)<LineBreak/> <Bold>Handlese</Bold>: Handl[ese], !handl[ese] (alle ohne Handlese)<LineBreak/>
<Bold>Gebunden</Bold>: geb[unden], ungeb[unden], !geb[unden], !ungeb[unden]<LineBreak/> <Bold>Gebunden</Bold>: geb[unden], ungeb[unden], !geb[unden], !ungeb[unden]<LineBreak/>
<Bold>Brutto/Netto Wiegung</Bold>: bto, Brut[to], nto, Net[to], gerebelt, !Gerebelt<LineBreak/> <Bold>Gerebelt</Bold>: gerebelt, !Gerebelt (nicht gerebelt gewogen)<LineBreak/>
<Bold>Freitext</Bold>: z.B. Lieferscheinnummern, Anmerkung, "quw" (sucht nach dem Text "quw") <Bold>Freitext</Bold>: z.B. Lieferscheinnummern, Anmerkung, "quw" (sucht nach dem Text "quw")
</TextBlock> </TextBlock>
</TextBox.ToolTip> </TextBox.ToolTip>
@ -469,7 +469,7 @@
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/> Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
<CheckBox x:Name="GerebeltGewogenInput" IsChecked="{Binding IsNetWeight, Mode=TwoWay}" <CheckBox x:Name="GerebeltGewogenInput" IsChecked="{Binding IsNetWeight, Mode=TwoWay}"
Content="Netto (gerebelt gewogen)" Content="Gerebelt gewogen"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"
Checked="GerebeltGewogenInput_Changed" Unchecked="GerebeltGewogenInput_Changed"/> Checked="GerebeltGewogenInput_Changed" Unchecked="GerebeltGewogenInput_Changed"/>

View File

@ -285,7 +285,7 @@ namespace Elwig.Windows {
private void InitialInputs() { private void InitialInputs() {
ViewModel.LastScaleError = null; ViewModel.LastScaleError = null;
ViewModel.WeighingId = null; ViewModel.WeighingData = null;
ViewModel.ScaleId = null; ViewModel.ScaleId = null;
ViewModel.ManualWeighingReason = null; ViewModel.ManualWeighingReason = null;
@ -525,7 +525,7 @@ namespace Elwig.Windows {
OnWeighingResult(s, res); OnWeighingResult(s, res);
} catch (Exception ex) { } catch (Exception ex) {
ViewModel.LastScaleError = ex.Message.Split(": ")[^1]; ViewModel.LastScaleError = ex.Message.Split(": ")[^1];
OnWeighingResult(s, new() { Weight = 0 }); OnWeighingResult(s, new());
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{ex.Message}", "Waagenfehler", MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{ex.Message}", "Waagenfehler",
MessageBoxButton.OK, MessageBoxImage.Error); MessageBoxButton.OK, MessageBoxImage.Error);
} }
@ -538,16 +538,16 @@ namespace Elwig.Windows {
} }
private void OnWeighingResult(IScale scale, WeighingResult res) { private void OnWeighingResult(IScale scale, WeighingResult res) {
if ((res.Weight ?? 0) > 0 && res.FullWeighingId != null) { if ((res.NetWeight ?? 0) > 0 && res.FullWeighingId != null) {
ViewModel.Weight = res.Weight; ViewModel.Weight = res.NetWeight;
ViewModel.ScaleId = scale.ScaleId; ViewModel.ScaleId = scale.ScaleId;
ViewModel.WeighingId = res.FullWeighingId; 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.ScaleId = null;
ViewModel.WeighingId = null; ViewModel.WeighingData = null;
} }
ViewModel.LastScaleError = null; ViewModel.LastScaleError = null;
TextBox_TextChanged(WeightInput, null); TextBox_TextChanged(WeightInput, null);
@ -842,7 +842,7 @@ namespace Elwig.Windows {
ManualWeighingInput.IsChecked = true; ManualWeighingInput.IsChecked = true;
ViewModel.ManualWeighingReason = res?.Item2; ViewModel.ManualWeighingReason = res?.Item2;
ViewModel.ScaleId = null; ViewModel.ScaleId = null;
ViewModel.WeighingId = null; ViewModel.WeighingData = null;
} }
protected override void ShortcutEdit() { protected override void ShortcutEdit() {
@ -1004,7 +1004,7 @@ namespace Elwig.Windows {
DId = await ctx.NextDId(p.Year), DId = await ctx.NextDId(p.Year),
LNr = lnr, LNr = lnr,
DateString = $"{delivery.Date:yyyy-MM-dd}", DateString = $"{delivery.Date:yyyy-MM-dd}",
TimeString = $"{delivery.Time:HH:mm:SS}", TimeString = $"{delivery.Time:HH:mm:ss}",
ZwstId = delivery.ZwstId, ZwstId = delivery.ZwstId,
MgNr = delivery.MgNr, MgNr = delivery.MgNr,
Comment = delivery.Comment, Comment = delivery.Comment,

View File

@ -21,12 +21,13 @@ namespace Tests.DocumentTests {
Assert.That(text, Contains.Substring("pauschaliert")); Assert.That(text, Contains.Substring("pauschaliert"));
Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}")); Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}"));
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X001")); Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X001"));
Assert.That(text, Contains.Substring("Ich bin der Text, der auf einem Traubenübernahmeschein steht!")); Assert.That(text, Contains.Substring("Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht"));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
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: ?, ID: ? (netto/gerebelt gewogen) Waage: 1, ID: 321 09:02, 01.10.2020
Brutto: 3 219 kg Tara: 0 kg Netto: 3 219 kg gerebelt gewogen
""")); """));
}); });
} }
@ -48,18 +49,18 @@ namespace Tests.DocumentTests {
Assert.That(text, Contains.Substring("pauschaliert")); Assert.That(text, Contains.Substring("pauschaliert"));
Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}")); Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}"));
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X004")); Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X004"));
Assert.That(text, Contains.Substring("Ich bin der Text, der auf einem Traubenübernahmeschein steht!")); Assert.That(text, Contains.Substring("Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht"));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
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: ? (netto/gerebelt gewogen) Waage: ?, 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: ? (netto/gerebelt gewogen) Waage: ?, 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"));
}); });
@ -81,24 +82,24 @@ namespace Tests.DocumentTests {
Assert.That(text, Contains.Substring("pauschaliert")); Assert.That(text, Contains.Substring("pauschaliert"));
Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}")); Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}"));
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X003")); Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X003"));
Assert.That(text, Contains.Substring("Ich bin der Text, der auf einem Traubenübernahmeschein steht!")); Assert.That(text, Contains.Substring("Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht"));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
1 Grüner Veltliner Qualitätswein 75 15,4 2 561 1 Grüner Veltliner Qualitätswein 75 15,4 2 561
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (netto/gerebelt gewogen) Waage: ?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
2 Grüner Veltliner Kabinett Kabinett 87 17,6 3 129 2 Grüner Veltliner Kabinett Kabinett 87 17,6 3 129
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (netto/gerebelt gewogen) Waage: ?, ID: ? (gerebelt gewogen)
""")); """));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
3 Grüner Veltliner Qualitätswein 79 16,1 1 280 3 Grüner Veltliner Qualitätswein 79 16,1 1 280
Herkunft: Österreich / Weinland / Niederösterreich Herkunft: Österreich / Weinland / Niederösterreich
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf / Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
Waage: ?, ID: ? (netto/gerebelt gewogen) Waage: ?, 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"));
}); });
@ -120,20 +121,20 @@ namespace Tests.DocumentTests {
Assert.That(text, Contains.Substring("pauschaliert")); Assert.That(text, Contains.Substring("pauschaliert"));
Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}")); Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}"));
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201002X001")); Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201002X001"));
Assert.That(text, Contains.Substring("Ich bin der Text, der auf einem Traubenübernahmeschein steht!")); Assert.That(text, Contains.Substring("Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht"));
Assert.That(text, Contains.Substring(""" Assert.That(text, Contains.Substring("""
1 Grüner Veltliner Qualitätswein 80 16,3 3 198 1 Grüner Veltliner Qualitätswein 80 16,3 3 198
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: ? (netto/gerebelt gewogen) Waage: ?, 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: ? (netto/gerebelt gewogen) Waage: ?, 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"));
}); });

View File

@ -40,7 +40,7 @@ INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
(101, 2020, 1, '2020-10-01', NULL, 'X', 1), (101, 2020, 1, '2020-10-01', NULL, 'X', 1),
(101, 2020, 2, '2020-10-01', NULL, 'X', 2), (101, 2020, 2, '2020-10-01', NULL, 'X', 2),
(101, 2020, 3, '2020-10-01', NULL, 'X', 3); (101, 2020, 3, '2020-10-01', NULL, 'X', 3);
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, spl_check, scale_id, weighing_data, weighing_reason) VALUES
(2020, 1, 1, 'GV', 'K', NULL, 4000, 17, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 1, 1, 'GV', 'K', NULL, 4000, 17, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2020, 1, 2, 'GV', NULL, NULL, 4000, 16, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 1, 2, 'GV', NULL, NULL, 4000, 16, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2020, 2, 1, 'GV', NULL, 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 2, 1, 'GV', NULL, 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
@ -55,7 +55,7 @@ INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
(101, 2021, 1, '2021-10-01', NULL, 'X', 1), (101, 2021, 1, '2021-10-01', NULL, 'X', 1),
(101, 2021, 2, '2021-10-01', NULL, 'X', 2), (101, 2021, 2, '2021-10-01', NULL, 'X', 2),
(101, 2021, 3, '2021-10-01', NULL, 'X', 3); (101, 2021, 3, '2021-10-01', NULL, 'X', 3);
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, gebunden, net_weight, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, gebunden, net_weight, manual_weighing, spl_check, scale_id, weighing_data, weighing_reason) VALUES
(2021, 1, 1, 'GV', 'K', NULL, 4000, 17, 'KAB', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2021, 1, 1, 'GV', 'K', NULL, 4000, 17, 'KAB', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2021, 1, 2, 'GV', NULL, NULL, 4000, 16, 'QUW', 'WLNO', 06109, FALSE, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2021, 1, 2, 'GV', NULL, NULL, 4000, 16, 'QUW', 'WLNO', 06109, FALSE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2021, 2, 1, 'GV', NULL, 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2021, 2, 1, 'GV', NULL, 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL),

View File

@ -27,8 +27,8 @@ INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
(104, 2020, 11, '2020-10-03', '14:39:22', 'X', 2), (104, 2020, 11, '2020-10-03', '14:39:22', 'X', 2),
(104, 2020, 12, '2020-10-03', '15:15:41', 'X', 3); (104, 2020, 12, '2020-10-03', '15:15:41', 'X', 3);
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, spl_check, scale_id, weighing_data, weighing_reason) VALUES
(2020, 1, 1, 'GV', NULL, NULL, 3219, 15.0, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 1, 1, 'GV', NULL, NULL, 3219, 15.0, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, '1', '{"id":"321","nr":321,"gross_weight":3219,"tare_weight":0,"net_weight":3219,"date":"2020-10-01","time":"09:02:46"}', NULL),
(2020, 2, 1, 'GV', 'K', NULL, 2987, 17.5, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 2, 1, 'GV', 'K', NULL, 2987, 17.5, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2020, 2, 2, 'GV', 'K', NULL, 1873, 17.7, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 2, 2, 'GV', 'K', NULL, 1873, 17.7, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2020, 3, 1, 'GV', NULL, NULL, 2561, 15.4, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL), (2020, 3, 1, 'GV', NULL, NULL, 2561, 15.4, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),

View File

@ -45,7 +45,7 @@ INSERT INTO client_parameter (param, value) VALUES
('CLIENT_IBAN', 'AT11 1234 5678 9012 3456'), ('CLIENT_IBAN', 'AT11 1234 5678 9012 3456'),
('CLIENT_LFBISNR', '0123455'), ('CLIENT_LFBISNR', '0123455'),
('CLIENT_USTIDNR', 'ATU12345675'), ('CLIENT_USTIDNR', 'ATU12345675'),
('TEXT_DELIVERYNOTE', 'Ich bin der Text, der auf einem Traubenübernahmeschein steht!'); ('TEXT_DELIVERYNOTE', 'Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht und insbesondere die Bestimmungen über die Mengenbeschränkung sowie für die Erzeugung von Wein besonderer Leseart eingehalten wird. Alle maßgeblichen Veränderungen obiger Angaben sind der Winzergenossenschaft unverzüglich zu melden. Das Mitglied bestätigt weiters mit seiner Unterschrift, dass die gelieferten Trauben entsprechend der guten Herstellungspraxis erzeugt wurden, insbesondere die Einhaltung der vom Hersteller vorgegebenen Wartefristen für Pflanzenschutzmittel.');
INSERT INTO branch (zwstid, name, country, postal_dest, address) VALUES INSERT INTO branch (zwstid, name, country, postal_dest, address) VALUES
('X', 'Test', 40, 212005138, 'Genossenschaftsstraße 1'); ('X', 'Test', 40, 212005138, 'Genossenschaftsstraße 1');

View File

@ -37,8 +37,8 @@ namespace Tests.WeighingTests {
await Task.Delay(100); await Task.Delay(100);
Assert.That(res, Is.Not.Null); Assert.That(res, Is.Not.Null);
Assert.That(res, Is.EqualTo(new WeighingResult { Assert.That(res, Is.EqualTo(new WeighingResult {
Weight = 2345, WeighingId = "1", NetWeight = 2345,
FullWeighingId = $"2020-09-28/1", WeighingId = "1", FullWeighingId = $"2020-09-28/1",
Date = new DateOnly(2020, 9, 28), Time = new TimeOnly(9, 8), Date = new DateOnly(2020, 9, 28), Time = new TimeOnly(9, 8),
})); }));
@ -46,9 +46,8 @@ namespace Tests.WeighingTests {
await Task.Delay(100); await Task.Delay(100);
Assert.That(res, Is.Not.Null); Assert.That(res, Is.Not.Null);
Assert.That(res, Is.EqualTo(new WeighingResult { Assert.That(res, Is.EqualTo(new WeighingResult {
Weight = 4215, NetWeight = 4215,
WeighingId = "2", WeighingId = "2", FullWeighingId = $"2020-09-28/2",
FullWeighingId = $"2020-09-28/2",
Date = new DateOnly(2020, 9, 28), Date = new DateOnly(2020, 9, 28),
Time = new TimeOnly(9, 8), Time = new TimeOnly(9, 8),
})); }));

View File

@ -30,15 +30,18 @@ namespace Tests.WeighingTests {
public async Task Test_01_CurrentWeight() { public async Task Test_01_CurrentWeight() {
Mock.Weight = 1235; Mock.Weight = 1235;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
Weight = 1235, Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), GrossWeight = 1235, TareWeight = 0, NetWeight = 1235,
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 {
Weight = 1240, Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), GrossWeight = 1240, TareWeight = 0, NetWeight = 1240,
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 {
Weight = 1245, Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23), GrossWeight = 1245, TareWeight = 0, NetWeight = 1245,
Date = new DateOnly(2020, 10, 17), Time = new TimeOnly(14, 23),
})); }));
} }
@ -46,20 +49,20 @@ namespace Tests.WeighingTests {
public async Task Test_02_Normal() { public async Task Test_02_Normal() {
Mock.Weight = 1235; Mock.Weight = 1235;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
Weight = 1235, WeighingId = "1", GrossWeight = 1235, TareWeight = 0, NetWeight = 1235,
FullWeighingId = $"2020-10-17/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 {
Weight = 3335, WeighingId = "2", GrossWeight = 3335, TareWeight = 0, NetWeight = 3335,
FullWeighingId = $"2020-10-17/2", 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 {
Weight = 6420, WeighingId = "3", GrossWeight = 6420, TareWeight = 0, NetWeight = 6420,
FullWeighingId = $"2020-10-17/3", 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),
})); }));
} }

View File

@ -30,15 +30,18 @@ namespace Tests.WeighingTests {
public async Task Test_01_CurrentWeight() { public async Task Test_01_CurrentWeight() {
Mock.Weight = 1234; Mock.Weight = 1234;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
Weight = 1234, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
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 {
Weight = 1235, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), GrossWeight = 1235, TareWeight = 0, NetWeight = 1235,
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 {
Weight = 1236, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34), GrossWeight = 1236, TareWeight = 0, NetWeight = 1236,
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
})); }));
} }
@ -46,20 +49,20 @@ namespace Tests.WeighingTests {
public async Task Test_02_Normal() { public async Task Test_02_Normal() {
Mock.Weight = 1234; Mock.Weight = 1234;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
Weight = 1234, WeighingId = "1", GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
FullWeighingId = $"2020-10-15/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 {
Weight = 3333, WeighingId = "2", GrossWeight = 3333, TareWeight = 0, NetWeight = 3333,
FullWeighingId = $"2020-10-15/2", 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 {
Weight = 4321, WeighingId = "3", GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
FullWeighingId = $"2020-10-15/3", 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),
})); }));
} }

View File

@ -78,19 +78,23 @@ namespace Tests.WeighingTests {
public async Task Test_01_CurrentWeight() { public async Task Test_01_CurrentWeight() {
MockA.Weight = 1234; MockA.Weight = 1234;
Assert.That(await ScaleA!.GetCurrentWeight(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleA!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
Weight = 1234, Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
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 {
Weight = 3456, Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), GrossWeight = 3456, TareWeight = 0, NetWeight = 3456,
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 {
Weight = 1236, Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), GrossWeight = 1236, TareWeight = 0, NetWeight = 1236,
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 {
Weight = 3457, Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47), GrossWeight = 3457, TareWeight = 0, NetWeight = 3457,
Date = new DateOnly(2020, 10, 8), Time = new TimeOnly(8, 47),
})); }));
} }
@ -98,26 +102,26 @@ namespace Tests.WeighingTests {
public async Task Test_02_Normal() { public async Task Test_02_Normal() {
MockA.Weight = 1234; MockA.Weight = 1234;
Assert.That(await ScaleA!.Weigh(), Is.EqualTo(new WeighingResult { Assert.That(await ScaleA!.Weigh(), Is.EqualTo(new WeighingResult {
Weight = 1234, WeighingId = "1", GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
FullWeighingId = $"2020-10-08/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 {
Weight = 3456, WeighingId = "1", GrossWeight = 3456, TareWeight = 0, NetWeight = 3456,
FullWeighingId = $"2020-10-08/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 {
Weight = 4321, WeighingId = "2", GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
FullWeighingId = $"2020-10-08/2", 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 {
Weight = 3333, WeighingId = "2", GrossWeight = 3333, TareWeight = 0, NetWeight = 3333,
FullWeighingId = $"2020-10-08/2", 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),
})); }));
} }

View File

@ -1 +1 @@
curl --fail -s -L "https://elwig.at/files/create.sql?v=24" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql" curl --fail -s -L "https://elwig.at/files/create.sql?v=25" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"