Validierung Last10PortFacilities vs NOANOD last port, Korreturen

This commit is contained in:
Daniel Schick 2021-03-07 18:09:06 +00:00
parent 1babc08768
commit f8b7350430
9 changed files with 137 additions and 15 deletions

View File

@ -678,7 +678,7 @@ namespace ENI2
vViolations.AddRange(violations);
}
#region 12.11.18: ein paar neue komische globale Plausi-Prüfungen
#region 12.11.18 / 6.3.21: globale Plausi-Prüfungen
Message crewMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREW);
Message pasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PAS);
Message pobaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.POBA);
@ -756,6 +756,31 @@ namespace ENI2
#endregion
#region last port plausibility SEC vs NOANOD
if((secMessage.Elements.Count > 0) && (noanodMessage.Elements.Count > 0))
{
SEC sec = secMessage.Elements[0] as SEC;
NOA_NOD noanod = noanodMessage.Elements[0] as NOA_NOD;
if(sec.LastTenPortFacilitesCalled.Count > 0)
{
if(!sec.LastTenPortFacilitesCalled[0].PortFacilityPortLoCode.Equals(noanod.LastPort))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "SEC last port doesn't match NOANOD last port", null, "Last port mismatch", null, "SEC");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
if(sec.LastTenPortFacilitesCalled[0].PortFacilityDateOfDeparture != (noanod.ETDFromLastPort ?? DateTime.Now).Date)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "SEC last port departure doesn't match NOANOD ETDFromLastPort", null, "Last port departure mismatch", null, "SEC");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
}
}
#endregion
#endregion
foreach (MessageError me in vErrors)

View File

@ -11,6 +11,8 @@ using System.Windows.Controls;
using System.Windows.Media.Imaging;
using System;
using System.Collections.Generic;
using System.Windows.Data;
using System.Collections.Specialized;
namespace ENI2.DetailViewControls
{
@ -103,15 +105,19 @@ namespace ENI2.DetailViewControls
this.groupBoxHAZ.DataContext = haz;
this.dataGridIMDGItems.Initialize();
this.dataGridIMDGItems.ItemsSource = this.haz.IMDGPositions;
this.dataGridIMDGItems.Initialize();
this.dataGridIMDGItems.ItemsSource = this.haz.IMDGPositions;
CollectionView myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(dataGridIMDGItems.Items);
((INotifyCollectionChanged)myCollectionView).CollectionChanged += DangerousGoodsDetailControl_CollectionChanged;
this.dataGridIMDGItems.CreateRequested += DataGridIMDGItems_CreateRequested;
this.dataGridIMDGItems.AddingNewItem += DataGridIMDGItems_AddingNewItem;
this.dataGridIMDGItems.EditRequested += DataGridIMDGItems_EditRequested;
this.dataGridIMDGItems.DeleteRequested += DataGridIMDGItems_DeleteRequested;
this.dataGridIMDGItems.DeleteRequested += DataGridIMDGItems_DeleteRequested;
this.dataGridIBCItems.Initialize();
this.dataGridIBCItems.ItemsSource = this.haz.IBCPositions;
myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(dataGridIBCItems.Items);
((INotifyCollectionChanged)myCollectionView).CollectionChanged += DangerousGoodsDetailControl_CollectionChanged;
this.dataGridIBCItems.CreateRequested += DataGridIBCItems_CreateRequested;
this.dataGridIBCItems.AddingNewItem += DataGridIBCItems_AddingNewItem;
this.dataGridIBCItems.EditRequested += DataGridIBCItems_EditRequested;
@ -119,6 +125,8 @@ namespace ENI2.DetailViewControls
this.dataGridIGCItems.Initialize();
this.dataGridIGCItems.ItemsSource = this.haz.IGCPositions;
myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(dataGridIGCItems.Items);
((INotifyCollectionChanged)myCollectionView).CollectionChanged += DangerousGoodsDetailControl_CollectionChanged;
this.dataGridIGCItems.CreateRequested += DataGridIGCItems_CreateRequested;
this.dataGridIGCItems.AddingNewItem += DataGridIGCItems_AddingNewItem;
this.dataGridIGCItems.EditRequested += DataGridIGCItems_EditRequested;
@ -126,6 +134,8 @@ namespace ENI2.DetailViewControls
this.dataGridIMSBCItems.Initialize();
this.dataGridIMSBCItems.ItemsSource = this.haz.IMSBCPositions;
myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(dataGridIMSBCItems.Items);
((INotifyCollectionChanged)myCollectionView).CollectionChanged += DangerousGoodsDetailControl_CollectionChanged;
this.dataGridIMSBCItems.CreateRequested += DataGridIMSBCItems_CreateRequested;
this.dataGridIMSBCItems.AddingNewItem += DataGridIMSBCItems_AddingNewItem;
this.dataGridIMSBCItems.EditRequested += DataGridIMSBCItems_EditRequested;
@ -133,11 +143,15 @@ namespace ENI2.DetailViewControls
this.dataGridMARPOLItems.Initialize();
this.dataGridMARPOLItems.ItemsSource = this.haz.MARPOLPositions;
myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(dataGridMARPOLItems.Items);
((INotifyCollectionChanged)myCollectionView).CollectionChanged += DangerousGoodsDetailControl_CollectionChanged;
this.dataGridMARPOLItems.CreateRequested += DataGridMARPOLItems_CreateRequested;
this.dataGridMARPOLItems.AddingNewItem += DataGridMARPOLItems_AddingNewItem;
this.dataGridMARPOLItems.EditRequested += DataGridMARPOLItems_EditRequested;
this.dataGridMARPOLItems.DeleteRequested += DataGridMARPOLItems_DeleteRequested;
this.RefreshTabHeaders();
#endregion
if (!this.haz.IsDeparture)
@ -184,7 +198,7 @@ namespace ENI2.DetailViewControls
}
this._initialized = true;
}
}
#region SetEnabled
@ -747,7 +761,40 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.groupBoxHAZ, HighlightService.HighlightStyle.VIOLATION, this._hazMessage);
}
#endregion
#endregion
private void DangerousGoodsDetailControl_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
this.RefreshTabHeaders();
}
private void RefreshTabHeaders()
{
if (this.haz.IMDGPositions.Count > 0)
this.tabIMDGItems.Header = string.Format("{0} ({1})", Properties.Resources.textIMDGItems, this.haz.IMDGPositions.Count);
else
this.tabIMDGItems.Header = Properties.Resources.textIMDGItems;
if (this.haz.IBCPositions.Count > 0)
this.tabIBCItems.Header = string.Format("{0} ({1})", Properties.Resources.textIBCItems, this.haz.IBCPositions.Count);
else
this.tabIBCItems.Header = Properties.Resources.textIBCItems;
if (this.haz.IGCPositions.Count > 0)
this.tabIGCItems.Header = string.Format("{0} ({1})", Properties.Resources.textIGCItems, this.haz.IGCPositions.Count);
else
this.tabIGCItems.Header = Properties.Resources.textIGCItems;
if (this.haz.IMSBCPositions.Count > 0)
this.tabIMSBCItems.Header = string.Format("{0} ({1})", Properties.Resources.textIMSBCItems, this.haz.IMSBCPositions.Count);
else
this.tabIMSBCItems.Header = Properties.Resources.textIMSBCItems;
if (this.haz.MARPOLPositions.Count > 0)
this.tabMarpolItems.Header = string.Format("{0} ({1})", Properties.Resources.textMARPOLItems, this.haz.MARPOLPositions.Count);
else
this.tabMarpolItems.Header = Properties.Resources.textMARPOLItems;
}
}
}

View File

@ -35,7 +35,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.0.12.%2a</ApplicationVersion>
<ApplicationVersion>6.0.13.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -54,10 +54,16 @@
<DatePicker Grid.Column="3" Grid.Row="0" Name="dateTimePickerETATo" VerticalContentAlignment="Center" SelectedDateChanged="etaValueChanged" ContextMenu="{DynamicResource ClearContextMenu}"/>
</Grid>
<TextBox Grid.Column="3" Grid.Row="2" Name="textBoxTicketNr" VerticalContentAlignment="Center" Margin="2"/>
<Button Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="1" Content="Clear" Name="buttonClearInput" Click="Button_Click" Margin="2"/>
<Button Grid.Column="2" Grid.Row="3" Grid.ColumnSpan="1" Content="Last 10 Ids" Name="buttonLast10Ids" Click="buttonSuche_Click" Margin="2"/>
<Button Grid.Column="3" Grid.Row="3" Grid.ColumnSpan="1" Content="Search" Name="buttonSuche" Click="buttonSuche_Click" Margin="2"/>
<Grid Grid.Column="3" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="1" Content="Clear" Name="buttonClearInput" Click="Button_Click" Margin="2"/>
<Button Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="1" Content="Last 10 Ids" Name="buttonLast10Ids" Click="buttonSuche_Click" Margin="2"/>
<Button Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="1" Content="Search" Name="buttonSuche" Click="buttonSuche_Click" Margin="2"/>
</Grid>
<Label Name="searchResultLabel" Grid.ColumnSpan="4" Grid.Row="4" VerticalContentAlignment="Center" />
</Grid>
<DataGrid Grid.Row="1" Margin="0,8,0,0" x:Name="dataGrid" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"

Binary file not shown.

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("6.0.12")]
[assembly: AssemblyInformationalVersion("6.0.13")]
[assembly: AssemblyCopyright("Copyright © 2014-2021 schick Informatik")]
[assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("6.0.12.*")]
[assembly: AssemblyVersion("6.0.13.*")]

View File

@ -315,7 +315,7 @@ namespace bsmd.database
// Neue Regeln vom 1.4.2019
if (this.LengthOverall_MTR.HasValue && ((this.LengthOverall_MTR.Value < 10) || (this.LengthOverall_MTR.Value > 500)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Length valid?", null, this.Title, null, this.Tablename));
if (this.Beam_MTR.HasValue && ((this.Beam_MTR.Value < 5) || (this.Beam_MTR.Value > 50)))
if (this.Beam_MTR.HasValue && ((this.Beam_MTR.Value < 5) || (this.Beam_MTR.Value > 65)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Beam valid?", null, this.Title, null, this.Tablename));
if (this.GrossTonnage.HasValue && ((this.GrossTonnage.Value < 50) || (this.GrossTonnage > 500000)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gross tonnage valid?", null, this.Title, null, this.Tablename));

View File

@ -371,6 +371,7 @@ namespace bsmd.database
bool entryMissing = false;
int missingType = 0;
foreach(int wasteCode in RequiredCodes)
{
bool codeFound = false;
@ -379,7 +380,7 @@ namespace bsmd.database
if((w.WasteType ?? 0) == wasteCode)
{
codeFound = true; break;
}
}
}
if(!codeFound)
{
@ -389,6 +390,49 @@ namespace bsmd.database
}
}
// Extravalidierung für "0" Meldung (5.3.21)
double totalSludgeRetained = 0;
double totalWDALP = 0;
double totalWC = 0;
double totalWAR = 0;
double totalWAGTNP = 0;
double totalWDA = 0;
foreach(Waste w in this.Waste)
{
if (w.WasteType == 1100) totalSludgeRetained += w.WasteAmountRetained_MTQ ?? 0;
if (w.WasteType == 1300) totalSludgeRetained += w.WasteAmountRetained_MTQ ?? 0;
totalWDALP += w.WasteDisposedAtLastPort_MTQ ?? 0;
totalWC += w.WasteCapacity_MTQ ?? 0;
totalWAR += w.WasteAmountRetained_MTQ ?? 0;
totalWAGTNP += w.WasteAmountGeneratedTillNextPort_MTQ ?? 0;
totalWDA += w.WasteDisposalAmount_MTQ ?? 0;
}
if(totalSludgeRetained == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste amount retained on board for types 1100 'sludge' and 1300 'oil-others' = 0", null, this.Title, null, this.Tablename));
}
if(totalWDALP == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteDisposedAtLastPort for all waste types", null, this.Title, null, this.Tablename));
}
if(totalWC == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteCapacity for all waste types", null, this.Title, null, this.Tablename));
}
if(totalWAR == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteAmountRetained for all waste types", null, this.Title, null, this.Tablename));
}
if(totalWAGTNP == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteAmountGeneratedTillNextPort for all waste types", null, this.Title, null, this.Tablename));
}
if((totalWDA == 0) && !(WasteDisposalDelivery.HasValue && (WasteDisposalDelivery.Value == 2)))
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteDisposalDelivery for all waste types", null, this.Title, null, this.Tablename));
}
if(entryMissing)
{
errors.Add(RuleEngine.CreateError(ValidationCode.POSITION_COUNT, string.Format("Waste {0}", missingType), null, this.Title, null, this.Tablename));