added button to overwrite WAS_RCPT disposal values from WAS

This commit is contained in:
Daniel Schick 2023-07-18 07:56:26 +02:00
parent 73019a996d
commit 6e8fdb0d35
5 changed files with 58 additions and 2 deletions

View File

@ -182,10 +182,12 @@
</enictrl:ENIDataGrid> </enictrl:ENIDataGrid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="120" /> <ColumnDefinition Width="120" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Name="buttonWasteReceivedAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonWasteReceivedAddMissingEntries_Click"/> <Button Grid.Row="0" Grid.Column="0" Name="buttonWasteReceivedAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonWasteReceivedAddMissingEntries_Click"/>
<Button Grid.Row="0" Grid.Column="1" Name="buttonCopyFromWAS" Content="{x:Static p:Resources.textCopyFromWAS}" Margin="2" Click="buttonCopyFromWAS_Click"/>
</Grid> </Grid>
<enictrl:ENIDataGrid x:Name="dataGridWasteReceived" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <enictrl:ENIDataGrid x:Name="dataGridWasteReceived" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="2" CanUserAddRows="False"> AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="2" CanUserAddRows="False">

View File

@ -684,5 +684,35 @@ namespace ENI2.DetailViewControls
#endregion #endregion
#region Copy WAS to WAS_RCPT handler
private void buttonCopyFromWAS_Click(object sender, RoutedEventArgs e)
{
if (_selectedWAS_RCPT == null) return;
if(MessageBox.Show(Properties.Resources.textCopyToWASConfirmation, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach(Waste waste in _was.Waste)
{
if(waste.WasteDisposalAmount_MTQ.HasValue && waste.WasteDisposalAmount_MTQ > 0)
{
// find matching WAS_RCPT entry
foreach(WasteReceived wasteReceived in _selectedWAS_RCPT.WasteReceived)
{
if(wasteReceived.WasteCode.Equals(waste.WasteType.ToString()))
{
wasteReceived.AmountWasteReceived_MTQ = waste.WasteDisposalAmount_MTQ;
break;
}
}
}
}
this.dataGridWasteReceived.Items.Refresh();
}
}
#endregion
} }
} }

View File

@ -1613,6 +1613,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Copy from WAS.
/// </summary>
public static string textCopyFromWAS {
get {
return ResourceManager.GetString("textCopyFromWAS", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Copy IMO to clipboard. /// Looks up a localized string similar to Copy IMO to clipboard.
/// </summary> /// </summary>
@ -1658,6 +1667,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Do you want to copy / overwrite disposal amounts using values from WAS?.
/// </summary>
public static string textCopyToWASConfirmation {
get {
return ResourceManager.GetString("textCopyToWASConfirmation", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Copy TOWA to TOWD. /// Looks up a localized string similar to Copy TOWA to TOWD.
/// </summary> /// </summary>

View File

@ -1882,4 +1882,10 @@
<data name="textExcelValueMappings" xml:space="preserve"> <data name="textExcelValueMappings" xml:space="preserve">
<value>Excel import value mappings</value> <value>Excel import value mappings</value>
</data> </data>
<data name="textCopyFromWAS" xml:space="preserve">
<value>Copy from WAS</value>
</data>
<data name="textCopyToWASConfirmation" xml:space="preserve">
<value>Do you want to copy / overwrite disposal amounts using values from WAS?</value>
</data>
</root> </root>

View File

@ -97,8 +97,8 @@ namespace bsmd.database
public int CompareTo(object obj) public int CompareTo(object obj)
{ {
if (obj is WasteDisposalServiceProvider_Template) if (obj is WasteDisposalServiceProvider_Template template)
this.Remark?.CompareTo(((WasteDisposalServiceProvider_Template)obj).Remark ?? ""); this.Remark?.CompareTo(template.Remark ?? "");
return 0; return 0;
} }