DeliveryAdminWindow: Add button to correct tare

This commit is contained in:
2026-09-14 14:43:24 +02:00
parent fea779bd95
commit 8ba051198f
11 changed files with 185 additions and 20 deletions
+3 -2
View File
@@ -124,7 +124,7 @@ namespace Elwig.Models.Entities {
[Column("weighing_data")]
public string? WeighingData { get; set; }
[NotMapped]
public (string? ScaleId, string? Id, int? Gross, int? Tare, int? Net, DateOnly? Date, TimeOnly? Time) WeighingInfo {
public (string? ScaleId, string? Id, int? Gross, int? Tare, int? TareCorrection, int? Net, DateOnly? Date, TimeOnly? Time) WeighingInfo {
get {
try {
var obj = JsonNode.Parse(WeighingData!)!.AsObject();
@@ -133,12 +133,13 @@ namespace Elwig.Models.Entities {
obj["id"]?.AsValue().GetValue<string>(),
obj["gross_weight"]?.AsValue().GetValue<int>(),
obj["tare_weight"]?.AsValue().GetValue<int>(),
obj["tare_correction"]?.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, null);
return (null, null, null, null, null, null, null, null);
}
}
}