Weighing: Differentiate between scale and terminal

This commit is contained in:
2026-08-03 10:56:36 +02:00
parent 0d8cdd5d6e
commit 309f118739
20 changed files with 130 additions and 158 deletions
+4 -3
View File
@@ -119,16 +119,17 @@ namespace Elwig.Models.Entities {
public double? Acid { get; set; }
[Column("scale_id")]
public string? ScaleId { get; set; }
public string? ScaleTerminalId { get; set; }
[Column("weighing_data")]
public string? WeighingData { get; set; }
[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 {
try {
var obj = JsonNode.Parse(WeighingData!)!.AsObject();
return (
obj["scale"]?.AsValue().GetValue<string>(),
obj["id"]?.AsValue().GetValue<string>(),
obj["gross_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
);
} catch {
return (null, null, null, null, null, null);
return (null, null, null, null, null, null, null);
}
}
}