Version 5.0.9 mit vielen Korrekturpunkten

This commit is contained in:
Daniel Schick 2018-06-11 17:57:47 +00:00
parent ca9e22305e
commit f9d96001dd
20 changed files with 252 additions and 55 deletions

View File

@ -232,6 +232,10 @@ namespace ENI2
existingCore = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreByVisitId(newCore.VisitId);
}
bool skipCopyTransit = false;
bool skipCopyVisit = false;
if(existingCore != null)
{
if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists,
@ -260,6 +264,25 @@ namespace ENI2
{
((ISublistContainer)existingMessage).DeleteElements();
}
// Bearbeitungsinformationen für bestehende ID-Beantragung beibehalten, falls bereits vorhanden
if(existingCore.IsTransit &&
(existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) &&
(existingMessage.InternalStatus == Message.BSMDStatus.SENT))
{
skipCopyTransit = true;
continue;
}
if(!existingCore.IsTransit &&
(existingMessage.MessageNotificationClass == Message.NotificationClass.VISIT) &&
(existingMessage.InternalStatus == Message.BSMDStatus.SENT))
{
skipCopyVisit = true;
continue;
}
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(existingMessage);
}
@ -276,14 +299,15 @@ namespace ENI2
List<Message> newMessages = new List<Message>();
foreach (Message oldMessage in this._messages)
{
if (skipCopyTransit && (oldMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT)) continue;
if (skipCopyVisit && (oldMessage.MessageNotificationClass == Message.NotificationClass.VISIT)) continue;
Message newMessage = oldMessage.Clone() as Message;
newMessage.MessageCore = newCore;
newMessage.MessageCoreId = newCore.Id;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newMessage);
newMessage.SaveElements();
}
//
this.OnOpenNewCoreRequested(newCore);
}

View File

@ -47,7 +47,8 @@
<DatePicker Grid.Row="2" Grid.Column="1" Name="datePickerDateLastDisposal" Margin="2" SelectedDate="{Binding LastWasteDisposalDate, Mode=TwoWay}" />
<enictrl:LocodeControl Grid.Row="3" Grid.Column="1" x:Name="locodeCtrlLastWastePort" LocodeValue="{Binding LastWasteDisposalPort, Mode=TwoWay}" />
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" Name="textBoxWasteDisposalServiceProviders" Text="{Binding WasteDisposalServiceProviderText}" Margin="2" />
<Button Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Name="buttonAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonAddMissingEntries_Click"/>
<Button Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="1" Name="buttonAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonAddMissingEntries_Click"/>
<Button Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="1" Name="buttonImportFromExcel" Content="{x:Static p:Resources.textImportFromExcel}" Margin="2" Click="buttonImportFromExcel_Click" />
</Grid>
<enictrl:ENIDataGrid x:Name="dataGridWaste" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="1">

View File

@ -8,6 +8,10 @@ using System.Windows.Controls;
using ENI2.EditControls;
using ENI2.Util;
using bsmd.database;
using ExcelDataReader;
using System.IO;
using System;
using Microsoft.Win32;
namespace ENI2.DetailViewControls
{
@ -214,5 +218,100 @@ namespace ENI2.DetailViewControls
#endregion
#region Excel file import
private void buttonImportFromExcel_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Excel Files|*.xls;*.xlsx";
if (ofd.ShowDialog() ?? false)
{
FileStream stream = null;
try
{
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
using (var reader = ExcelReaderFactory.CreateReader(stream))
{
List<Waste> importWasteList = new List<Waste>();
try
{
do
{
// skip first two rows
reader.Read();
reader.Read();
int cnt = 0;
object o = null;
while (reader.Read() && (cnt < 14))
{
if (((IExcelDataReader)reader).FieldCount < 10)
{
throw new InvalidDataException("Sheet must have 10 Columns of data");
}
Waste waste = new Waste();
if (!reader.IsDBNull(1)) o = reader.GetValue(1);
if (o != null) waste.WasteType = Convert.ToInt32(o);
if (!reader.IsDBNull(3)) waste.WasteDescription = reader.GetString(3);
if (!reader.IsDBNull(4)) o = reader.GetValue(4);
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
if (!reader.IsDBNull(5)) o = reader.GetValue(5);
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
if (!reader.IsDBNull(6)) o = reader.GetValue(6);
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
if (!reader.IsDBNull(7)) waste.WasteDisposalPort = reader.GetString(7);
if (!reader.IsDBNull(8)) o = reader.GetValue(8);
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
if (!reader.IsDBNull(9)) o = reader.GetValue(9);
if (o != null) waste.WasteDisposedAtLastPort_MTQ = Convert.ToDouble(9);
waste.WAS = this._was;
waste.IsDirty = true;
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
this._was.Waste.Add(waste);
importWasteList.Add(waste);
cnt++;
}
} while (reader.NextResult());
}
catch (Exception ex)
{
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
}
if (importWasteList.Count > 0)
{
this.dataGridWaste.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SEC);
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
}
}
stream.Close();
}
}
#endregion
}
}

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>5.0.8.%2a</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>5.0.9.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -93,9 +93,8 @@
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExcelDataReader, Version=3.2.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
<HintPath>packages\ExcelDataReader.3.2.0\lib\net45\ExcelDataReader.dll</HintPath>
<Private>True</Private>
<Reference Include="ExcelDataReader, Version=3.4.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
<HintPath>packages\ExcelDataReader.3.4.0\lib\net45\ExcelDataReader.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
@ -103,9 +102,8 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.106.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\System.Data.SQLite.Core.1.0.106.0\lib\net451\System.Data.SQLite.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Data.SQLite, Version=1.0.108.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\System.Data.SQLite.Core.1.0.108.0\lib\net451\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
@ -126,29 +124,23 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
<Private>True</Private>
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.3.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
<Private>True</Private>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
<Private>True</Private>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
<Private>True</Private>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.DataGrid, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
<Private>True</Private>
<Reference Include="Xceed.Wpf.DataGrid, Version=3.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.3.0\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
<Private>True</Private>
<Reference Include="Xceed.Wpf.Toolkit, Version=3.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.3.3.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -819,12 +811,12 @@
<WCFMetadataStorage Include="Service References\LockingServiceReference\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\System.Data.SQLite.Core.1.0.106.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('packages\System.Data.SQLite.Core.1.0.106.0\build\net451\System.Data.SQLite.Core.targets')" />
<Import Project="packages\System.Data.SQLite.Core.1.0.108.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('packages\System.Data.SQLite.Core.1.0.108.0\build\net451\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\System.Data.SQLite.Core.1.0.106.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\System.Data.SQLite.Core.1.0.106.0\build\net451\System.Data.SQLite.Core.targets'))" />
<Error Condition="!Exists('packages\System.Data.SQLite.Core.1.0.108.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\System.Data.SQLite.Core.1.0.108.0\build\net451\System.Data.SQLite.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -526,7 +526,7 @@ namespace ENI2
if (this.userEntity.IsAdmin)
{
this.buttonUserAdmin.Visibility = Visibility.Visible;
this.buttonEditRules.Visibility = Visibility.Visible;
// this.buttonEditRules.Visibility = Visibility.Visible; // wird aktuell doch nicht so umgesetzt
}
break;
case ReportingParty.LogonResult.FAILED:

View File

@ -19,7 +19,7 @@ namespace ENI2.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
@ -4625,6 +4625,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to {0} waste positions imported.
/// </summary>
public static string textWasteImported {
get {
return ResourceManager.GetString("textWasteImported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Max.waste capacity on board.
/// </summary>

View File

@ -1648,4 +1648,7 @@
<data name="textMessagesAlreadySent" xml:space="preserve">
<value>One or more messages have already been sent. Cannot overwrite target declaration!</value>
</data>
<data name="textWasteImported" xml:space="preserve">
<value>{0} waste positions imported</value>
</data>
</root>

View File

@ -3,8 +3,8 @@
Sample license text.
-->
<packages>
<package id="ExcelDataReader" version="3.2.0" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="3.2.0" targetFramework="net452" />
<package id="ExcelDataReader" version="3.4.0" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="3.3.0" targetFramework="net452" />
<package id="log4net" version="2.0.8" targetFramework="net452" />
<package id="System.Data.SQLite.Core" version="1.0.106.0" targetFramework="net452" />
<package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net452" />
</packages>

BIN
ENI-2/data/WAS.xlsx Normal file

Binary file not shown.

BIN
ENI-2/data/testCrew.xlsx Normal file

Binary file not shown.

Binary file not shown.

View File

@ -48,9 +48,8 @@
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.105.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.105.1\lib\net45\System.Data.SQLite.dll</HintPath>
<Private>True</Private>
<Reference Include="System.Data.SQLite, Version=1.0.108.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.108.0\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
@ -132,12 +131,12 @@
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets')" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net45\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets'))" />
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.108.0\build\net45\System.Data.SQLite.Core.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -2,5 +2,5 @@
<packages>
<package id="log4net" version="2.0.8" targetFramework="net45" />
<package id="OpenPop.NET" version="2.0.6.1120" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.105.1" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net45" />
</packages>

View File

@ -227,6 +227,19 @@ namespace bsmd.database
this.CargoCodeNST.Equals("19")) &&
!this.CargoNumberOfItems.HasValue)
violations.Add(RuleEngine.CreateViolation(ValidationCode.V721, "CargoNumberOfItems" , null, this.Title, this.Identifier, this.Tablename));
if (RuleEngine.LocodeChecker != null && !this.PortOfDischarge.IsNullOrEmpty())
{
if (!RuleEngine.LocodeChecker.Invoke(this.PortOfDischarge, RuleEngine.LocodeMode.STANDARD))
errors.Add(RuleEngine.CreateError(ValidationCode.LOCODE, "PortOfDischarge", this.PortOfDischarge, this.Title, this.Identifier, this.Tablename));
}
if (RuleEngine.LocodeChecker != null && !this.PortOfLoading.IsNullOrEmpty())
{
if (!RuleEngine.LocodeChecker.Invoke(this.PortOfLoading, RuleEngine.LocodeMode.STANDARD))
errors.Add(RuleEngine.CreateError(ValidationCode.LOCODE, "PortOfLoading", this.PortOfLoading, this.Title, this.Identifier, this.Tablename));
}
}
#endregion

View File

@ -399,15 +399,27 @@ namespace bsmd.database
sb.Append(string.Format("TOP {0} ", this.ResultLimit));
}
sb.Append(string.Format("[{0}].[Id], [{0}].[VisitId], [{0}].[TransitId], [{0}].[IMO], [{0}].[ENI], [{0}].[PoC], [{0}].[Portname], " +
sb.AppendFormat("[{0}].[Id], [{0}].[VisitId], [{0}].[TransitId], [{0}].[IMO], [{0}].[ENI], [{0}].[PoC], [{0}].[Portname], " +
"[{0}].[ETA], [{0}].[CustomerId], [{0}].[Previous], [{0}].[Next], [{0}].[IsTransit], [{0}].[Wetris_zz_56_datensatz_id], [{0}].[BSMDStatus], " +
"[{0}].[InitialHIS], [{0}].[HerbergFormGuid], [{0}].[HerbergFormTemplateGuid], [{0}].[HerbergReportType], [{0}].[HerbergEmailContactReportingVessel], " +
"[{0}].[HerbergEmail24HrsContact], [{0}].[ETAKielCanal], [{0}].[HerbergRevDate], [{0}].[ReportStatus], [{0}].[SietasSheetVersion], [{0}].[Incoming], " +
"[{0}].[DefaultReportingPartyId], [{0}].[Created], [{0}].[Changed], [{0}].[CreateExcel], [{0}].[EditedBy], [{0}].[TicketNo], " +
"[{0}].[Cancelled], [{0}].[VisitIdOrTransitIdCancellable], [{0}].[BlockedNotificationClasses], [{0}].[FreeNotificationClasses], " +
"[{0}].[OwnNotificationClasses], [{0}].[StatusCheckErrorCode], [{0}].[StatusCheckErrorMessage], [{0}].[QueryNSWStatus], " +
"[{0}].[ExcelImportComplete] FROM {0} ",
this.Tablename));
"[{0}].[ExcelImportComplete]",
this.Tablename);
if(filter == Message.LoadFilter.SEARCH_CORE_FILTERS)
{
Dictionary<SearchFilterType, string> searchDict = criteria[0] as Dictionary<SearchFilterType, string>;
if (searchDict != null && (searchDict.Count > 0))
{
if (searchDict.ContainsKey(SearchFilterType.FILTER_ETA))
sb.Append(", NOA_NOD.ETAToPortOfCall, NOA_NOD.ETAToKielCanal");
}
}
sb.AppendFormat(" FROM {0} ", this.Tablename);
this.SetFilters(sb, cmd, filter, criteria);
@ -505,6 +517,12 @@ namespace bsmd.database
sb.Append(" JOIN MessageHeader mh ON MessageCore.Id = mh.MessageCoreId JOIN STAT ON mh.Id = STAT.MessageHeaderId");
}
if(searchDict.ContainsKey(SearchFilterType.FILTER_ETA))
{
// perform NOA_NOD join
sb.Append(" LEFT JOIN MessageHeader mh ON mh.MessageCoreId = MessageCore.Id AND mh.NotificationClass = 2 LEFT JOIN NOA_NOD ON MessageHeaderId = mh.Id");
}
sb.Append(" WHERE ");
foreach (SearchFilterType key in searchDict.Keys)
{
@ -517,20 +535,24 @@ namespace bsmd.database
if (!elems[0].IsNullOrEmpty()) from = UInt32.Parse(elems[0]);
if (!elems[1].IsNullOrEmpty()) to = UInt32.Parse(elems[1]);
// SQL Logik für die Zeitfilterung: Wenn es bereits eine Tabelle NOA_NOD mit einem Eintrag für ETAToPortOfCall / ETAToKielCanal gibt
// soll dieser Wert als Vergleich herangezogen werden, sonst ETA / ETAKielCanal aus MessageCore
// Das *sollte* so funktionieren: CASE WHEN ETAToPortOfCall IS NULL THEN ETA ELSE ETAToPortOfCall END
if (from.HasValue && !to.HasValue)
{
sb.Append(" ((ETA > @SEARCHFROM) OR (ETAKielCanal > @SEARCHFROM)) ");
sb.Append(" ((CASE WHEN ETAToPortOfCall IS NULL THEN ETA ELSE ETAToPortOfCall END > @SEARCHFROM) OR (CASE WHEN ETAToKielCanal IS NULL THEN ETAKielCanal ELSE ETAToKielCanal END > @SEARCHFROM)) ");
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHFROM", from.Value.FromUnixTimeStamp());
}
if (to.HasValue && !from.HasValue)
{
sb.Append(" ((ETA < @SEARCHTO) OR (ETAKielCanal < @SEARCHTO)) ");
sb.Append(" ((CASE WHEN ETAToPortOfCall IS NULL THEN ETA ELSE ETAToPortOfCall END < @SEARCHTO) OR (CASE WHEN ETAToKielCanal IS NULL THEN ETAKielCanal ELSE ETAToKielCanal END < @SEARCHTO)) ");
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHTO", to.Value.FromUnixTimeStamp());
}
if (from.HasValue && to.HasValue)
{
sb.Append(" ((ETA > @SEARCHFROM AND ETA < @SEARCHTO) OR (ETAKielCanal > @SEARCHFROM AND ETAKielCanal < @SEARCHTO)) ");
sb.Append(" ((CASE WHEN ETAToPortOfCall IS NULL THEN ETA ELSE ETAToPortOfCall END > @SEARCHFROM AND CASE WHEN ETAToPortOfCall IS NULL THEN ETA ELSE ETAToPortOfCall END < @SEARCHTO) OR (CASE WHEN ETAToKielCanal IS NULL THEN ETAKielCanal ELSE ETAToKielCanal END > @SEARCHFROM AND CASE WHEN ETAToKielCanal IS NULL THEN ETAKielCanal ELSE ETAToKielCanal END < @SEARCHTO)) ");
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHFROM", from.Value.FromUnixTimeStamp());
((SqlCommand)cmd).Parameters.AddWithValue("@SEARCHTO", to.Value.FromUnixTimeStamp());
}

View File

@ -250,9 +250,9 @@ namespace bsmd.database
if((this.LastPort != null) && this.LastPort.Equals("ZZUKN") && this.ETDFromLastPort.HasValue)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETDFromLastPort", null, this.Title, null, this.Tablename));
if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue &&
this.ETAToNextPort < ETDFromPortOfCall)
errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETAToNextPort", null, this.Title, null, this.Tablename));
if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue && !this.NextPort.Equals("ZZUKN") &&
(this.ETAToNextPort <= ETDFromPortOfCall))
errors.Add(RuleEngine.CreateError(ValidationCode.E122, "ETAToNextPort", null, this.Title, null, this.Tablename));
if ((this.NextPort != null) && !this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue)
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETAToNextPort", null, this.Title, null, this.Tablename));
@ -260,6 +260,9 @@ namespace bsmd.database
if((this.NextPort != null) && this.NextPort.Equals("ZZUKN") && this.ETAToNextPort.HasValue)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETAToNextPort", null, this.Title, null, this.Tablename));
if (this.ETDFromLastPort.HasValue && this.ETAToPortOfCall.HasValue && (this.ETDFromLastPort >= this.ETAToPortOfCall))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "ETDFromLastPort", null, this.Title, null, this.Tablename));
}
public override DatabaseEntity.ValidationBlock GetValidationBlock()

View File

@ -70,6 +70,7 @@ namespace bsmd.database
V781 = 781,
V782 = 782,
V783 = 783,
V784 = 784,
V801 = 801,
V802 = 802,
V803 = 803,

View File

@ -124,6 +124,35 @@ namespace bsmd.database
public string SublistCollectionKey { get { return "waste"; } }
public bool HasValidWasteCode
{
get
{
if (!this.WasteType.HasValue) return false;
switch(this.WasteType.Value)
{
case 1100:
case 1200:
case 1300:
case 2100:
case 2200:
case 2300:
case 2311:
case 2308:
case 2313:
case 2600:
case 2309:
case 3000:
case 5100:
case 5200:
case 5300:
return true;
default:
return false;
}
}
}
#endregion
#region DatabaseEntity implementation
@ -218,7 +247,9 @@ namespace bsmd.database
if (this.WasteType.HasValue && (this.WasteType.Value == 1300) && this.WasteDescription.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V781, "WasteDescription", null, this.Title, this.Identifier, this.Tablename));
// TODO: 782
if (!this.HasValidWasteCode)
violations.Add(RuleEngine.CreateViolation(ValidationCode.V784, "WasteCode", null, this.Title, this.Identifier, this.Tablename));
}
#endregion

View File

@ -160,7 +160,7 @@ namespace bsmd.hisnord
(core.Cancelled ?? false) ? "YES" : "NO"
);
if((nswResponse.Status == "ACCEPTED") && ((core.Cancelled == false) == true))
if((nswResponse.Status == "ACCEPTED") && ((core.Cancelled ?? false) == true))
{
core.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
_log.InfoFormat("Core cancel confirmed for {0}", core.DisplayId);

Binary file not shown.