DeliveryAdminWindow: Use last scale error as default manual weighing reason

This commit is contained in:
2023-09-13 23:19:04 +02:00
parent 62fe087598
commit 1e9cad6de7
4 changed files with 22 additions and 13 deletions

View File

@ -25,6 +25,7 @@ namespace Elwig.Windows {
private List<string> TextFilter = new();
private readonly RoutedCommand CtrlF = new();
private string? LastScaleError = null;
private string? ManualWeighingReason = null;
private string? ScaleId = null;
private string? WeighingId = null;
@ -147,6 +148,11 @@ namespace Elwig.Windows {
}
private void InitialInputs() {
LastScaleError = null;
WeighingId = null;
ScaleId = null;
ManualWeighingReason = null;
ClearOriginalValues();
ClearDefaultValues();
@ -651,12 +657,18 @@ namespace Elwig.Windows {
ScaleId = null;
WeighingId = null;
}
ManualWeighingReason = null;
ManualWeighingInput.IsChecked = false;
LastScaleError = null;
} catch (Exception e) {
LastScaleError = e.Message.Split(": ")[^1];
WeightInput.Text = "";
ScaleId = null;
WeighingId = null;
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
MessageBoxButton.OK, MessageBoxImage.Error);
}
ManualWeighingReason = null;
ManualWeighingInput.IsChecked = false;
base.TextBox_TextChanged(WeightInput, null);
EnableWeighingButtons();
UpdateButtons();
}
@ -885,7 +897,7 @@ namespace Elwig.Windows {
}
private void WeighingManualButton_Click(object sender, RoutedEventArgs evt) {
var res = Utils.ShowManualWeighingDialog();
var res = Utils.ShowManualWeighingDialog(LastScaleError);
if (res == null) return;
WeightInput.Text = $"{res?.Item1:N0}";
ManualWeighingInput.IsChecked = true;