[WIP] Tara
Test / Run tests (push) Successful in 2m45s

This commit is contained in:
2026-09-14 10:32:14 +02:00
parent fea779bd95
commit dbc1363213
6 changed files with 33 additions and 6 deletions
+9 -2
View File
@@ -565,16 +565,23 @@
TextChanged="WeightInput_TextChanged"
Grid.Column="1" Width="70" Margin="0,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Tara:" Margin="10,40,10,10"/>
<TextBlock x:Name="Tare" Text="{Binding Tare}" Width="40"
Grid.Column="1" Margin="30,44,10,10" TextAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<CheckBox x:Name="ManualWeighingInput" IsChecked="{Binding IsManualWeighing, Mode=TwoWay}"
Content="Handwiegung" IsEnabled="False"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,45,10,10" Grid.Column="0" Grid.ColumnSpan="2"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,70,10,10" Grid.Column="0" Grid.ColumnSpan="2"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
<CheckBox x:Name="GerebeltGewogenInput" IsChecked="{Binding IsNetWeightValue, Mode=TwoWay}"
Content="Gerebelt gewogen" IsThreeState="True"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,95,10,10" Grid.Column="0" Grid.ColumnSpan="2"
Checked="GerebeltGewogenInput_Changed" Unchecked="GerebeltGewogenInput_Changed" Indeterminate="GerebeltGewogenInput_Changed"/>
<Button x:Name="CorrectTareButton" Content="Tara korrigieren" Width="120" Visibility="Hidden"
Click="CorrectTareButton_Click"
VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,10,10,10" Grid.Column="2"/>
<Button x:Name="WeighingAButton" Content="Wiegen A" Width="120"
Click="WeighingButton_Click"
VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10,10,10,10" Grid.Column="2"/>
@@ -612,14 +612,20 @@ namespace Elwig.Windows {
ClearOriginalValues();
ClearDefaultValues();
ViewModel.FillInputs(p);
CorrectTareButton.Visibility = !ViewModel.IsReceipt && p.WeighingInfo.Tare != null && p.WeighingInfo.Tare != 0 ? Visibility.Visible : Visibility.Hidden;
FinishInputFilling();
}
new protected void ClearInputs(bool validate = false) {
ViewModel.ClearInputs();
CorrectTareButton.Visibility = Visibility.Hidden;
base.ClearInputs(validate);
}
private void CorrectTareButton_Click(object sender, RoutedEventArgs evt) {
}
private void WeighingButton_Click(object sender, RoutedEventArgs evt) {
int index = Array.IndexOf(WeighingButtons, sender as Button);
if (index >= 0) WeighingButton_Click(index);
@@ -651,6 +657,7 @@ namespace Elwig.Windows {
private void OnWeighingResult(IScale scale, WeighingResult res) {
if ((res.NetWeight ?? 0) > 0 && res.FullWeighingId != null) {
ViewModel.Weight = res.NetWeight;
ViewModel.Tare = res.TareWeight is int t && t != 0 ? $"{t:N0} kg" : "-";
ViewModel.ScaleTerminalId = scale.ScaleTerminalId;
ViewModel.WeighingData = res.ToJson().ToJsonString();
ViewModel.ManualWeighingReason = null;