DeliveryAdminWindow: Invalidate non-positive weight
Test / Run tests (push) Successful in 2m12s

This commit is contained in:
2026-10-02 10:31:47 +02:00
parent 829ad106cf
commit 0e586cc438
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ namespace Elwig.ViewModels {
public partial string? WeightString { get; set; } public partial string? WeightString { get; set; }
public int? Weight { public int? Weight {
get => int.TryParse(WeightString?.Replace(Utils.GroupSeparator, ""), out var w) ? w : null; get => int.TryParse(WeightString?.Replace(Utils.GroupSeparator, ""), out var w) ? w : null;
set => WeightString = $"{value:N0}"; set => WeightString = value > 0 ? $"{value:N0}" : null;
} }
[ObservableProperty] [ObservableProperty]
public partial string? TareString { get; set; } = "-"; public partial string? TareString { get; set; } = "-";
+2 -2
View File
@@ -629,7 +629,7 @@ namespace Elwig.Windows {
var correction = Utils.ShowTareCorrectionDialog(ViewModel.ActualTare, ViewModel.TargetTare); var correction = Utils.ShowTareCorrectionDialog(ViewModel.ActualTare, ViewModel.TargetTare);
if (correction == null) return; if (correction == null) return;
ViewModel.Weight += lastCorrection - correction; ViewModel.Weight += lastCorrection - correction;
if (ViewModel.WeighingData is string s) { if (ViewModel.Weight != null && ViewModel.WeighingData is string s) {
ViewModel.TargetTare = correction == 0 ? null : (ViewModel.ActualTare ?? 0) + correction; ViewModel.TargetTare = correction == 0 ? null : (ViewModel.ActualTare ?? 0) + correction;
ViewModel.Tare = ViewModel.TargetTare ?? ViewModel.ActualTare; ViewModel.Tare = ViewModel.TargetTare ?? ViewModel.ActualTare;
var obj = JsonNode.Parse(s)!.AsObject(); var obj = JsonNode.Parse(s)!.AsObject();
@@ -1514,7 +1514,7 @@ namespace Elwig.Windows {
} }
private void WeightInput_TextChanged(object sender, TextChangedEventArgs evt) { private void WeightInput_TextChanged(object sender, TextChangedEventArgs evt) {
InputTextChanged((TextBox)sender); InputTextChanged((TextBox)sender, new ValidationResult(ViewModel.Weight > 0, null));
} }
private void TemperatureAcidInput_TextChanged(object sender, TextChangedEventArgs evt) { private void TemperatureAcidInput_TextChanged(object sender, TextChangedEventArgs evt) {