2.3, Version vor Besuch in Bremen Sept 2015
This commit is contained in:
parent
d280fd9570
commit
646f356053
Binary file not shown.
BIN
nsw/GISIS_Codes_DE-Häfen_150915.xls
Normal file
BIN
nsw/GISIS_Codes_DE-Häfen_150915.xls
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -36,6 +36,7 @@ namespace SendNSWMessageService
|
||||
this.EventLog.Log = "Application";
|
||||
this.Init(args);
|
||||
this.EventLog.WriteEntry("NSW Send Service started.", EventLogEntryType.Information);
|
||||
_log.Info("NSW Send Service started");
|
||||
this.DoOnce();
|
||||
}
|
||||
|
||||
@ -100,6 +101,7 @@ namespace SendNSWMessageService
|
||||
(message.InternalStatus == Message.BSMDStatus.PREPARE) ||
|
||||
(message.InternalStatus == Message.BSMDStatus.TOSEND))
|
||||
{
|
||||
_log.Debug("Visit/Transit not found, SENDING VISIT/TRANSIT message");
|
||||
if (message.HIS == Message.NSWProvider.UNDEFINED)
|
||||
message.HIS = core.InitialHIS;
|
||||
toSendMessageList.Add(message);
|
||||
@ -109,14 +111,18 @@ namespace SendNSWMessageService
|
||||
}
|
||||
else // eine VISIT/TRANSIT Id ist vorhanden, die Daten können gesendet werden
|
||||
{
|
||||
// versendet werden nur die Nachrichten, die den Status "UNDEFINED", "PREPARE" und "TOSEND" haben
|
||||
// diese wurden entweder von EU-NOAD angelegt oder durch den Melder bearbeitet
|
||||
// Wichtig ist eine erfolgreich versendete Meldung nicht erneut zu versenden
|
||||
// Änderung Sept 15: versendet werden alle Nachrichten, die *nicht* bestätigt sind
|
||||
// also auch alles was auf in bearbeitung / Korrektur etc steht
|
||||
// Einzig bleibt die Frage offen, was mit Nachrichten passiert, die über das UI
|
||||
// nachträglich geändert werden. Ich denke hier muss in dashface ggf. der Status
|
||||
// wieder auf PREPARE gesetzt werden
|
||||
_log.Debug("Visit/Transit found, SENDING DATA messages");
|
||||
foreach (Message message in messages)
|
||||
{
|
||||
if ((message.InternalStatus == Message.BSMDStatus.UNDEFINED) ||
|
||||
(message.InternalStatus == Message.BSMDStatus.PREPARE) ||
|
||||
(message.InternalStatus == Message.BSMDStatus.TOSEND))
|
||||
// T
|
||||
if (message.InternalStatus != Message.BSMDStatus.CONFIRMED)
|
||||
//(message.InternalStatus == Message.BSMDStatus.PREPARE) ||
|
||||
//(message.InternalStatus == Message.BSMDStatus.TOSEND))
|
||||
{
|
||||
if (message.HIS == Message.NSWProvider.UNDEFINED)
|
||||
message.HIS = core.InitialHIS;
|
||||
@ -177,6 +183,12 @@ namespace SendNSWMessageService
|
||||
_log.ErrorFormat("SENDING message {0}: {1}", message.Id.ToString(), ex.Message);
|
||||
}
|
||||
}
|
||||
if (toSendMessageList.Count > 0)
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
|
||||
DBManager.Instance.Save(core);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,6 +226,7 @@ namespace SendNSWMessageService
|
||||
{
|
||||
this._timer.Enabled = false;
|
||||
this.EventLog.WriteEntry("NSW Send Service stopped.", EventLogEntryType.Information);
|
||||
_log.Info("NSW Send Service stopped");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ namespace bsmd.dakosy.ResponseService
|
||||
new SFTPService()
|
||||
};
|
||||
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
((SFTPService)ServicesToRun[0]).Init(null);
|
||||
|
||||
@ -85,7 +85,6 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="..\bsmdKey.snk" />
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
|
||||
@ -25,7 +25,7 @@ namespace bsmd.database
|
||||
#region Properties
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
public DateTime? ATAPortOfCall { get; set; }
|
||||
|
||||
#endregion
|
||||
@ -88,7 +88,7 @@ namespace bsmd.database
|
||||
ATA ata = new ATA();
|
||||
|
||||
ata.id = reader.GetGuid(0);
|
||||
if (!reader.IsDBNull(1)) ata.ATAPortOfCall = reader.GetDateTime(1);
|
||||
if (!reader.IsDBNull(1)) ata.ATAPortOfCall = DateTime.SpecifyKind(reader.GetDateTime(1), DateTimeKind.Utc);
|
||||
result.Add(ata);
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
@ -25,7 +25,7 @@ namespace bsmd.database
|
||||
#region Properties
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
public DateTime? ATDPortOfCall { get; set; }
|
||||
|
||||
#endregion
|
||||
@ -88,7 +88,7 @@ namespace bsmd.database
|
||||
ATD atd = new ATD();
|
||||
|
||||
atd.id = reader.GetGuid(0);
|
||||
if (!reader.IsDBNull(1)) atd.ATDPortOfCall = reader.GetDateTime(1);
|
||||
if (!reader.IsDBNull(1)) atd.ATDPortOfCall = DateTime.SpecifyKind(reader.GetDateTime(1), DateTimeKind.Utc);
|
||||
result.Add(atd);
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
@ -65,7 +65,7 @@ namespace bsmd.database
|
||||
public static DateTime? TryParseDateTime(string text)
|
||||
{
|
||||
DateTime date;
|
||||
if(DateTime.TryParse(text, DateTimeFormatInfo.InvariantInfo,DateTimeStyles.AssumeUniversal, out date))
|
||||
if(DateTime.TryParse(text, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out date))
|
||||
{
|
||||
return date;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace bsmd.database
|
||||
public bool? DPGClassificationIMSBC { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
public bool DPGClassificationMARPOL_ANNEX_I { get; set; }
|
||||
public bool? DPGClassificationMARPOL_ANNEX_I { get; set; }
|
||||
|
||||
public List<IMDGPosition> IMDGPositions { get { return this.imdgPositions; } }
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace bsmd.database
|
||||
/// <summary>
|
||||
/// Basisklasse aller Nachrichtentypen, zentrale Klasse für die NSW App
|
||||
/// </summary>
|
||||
public class Message : DatabaseEntity, ISublistContainer
|
||||
public class Message : DatabaseEntity, ISublistContainer, IComparable<Message>
|
||||
{
|
||||
|
||||
#region Fields
|
||||
@ -514,5 +514,17 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region IComparable implementation
|
||||
|
||||
/// <summary>
|
||||
/// Sort messages by notification class
|
||||
/// </summary>
|
||||
public int CompareTo(Message other)
|
||||
{
|
||||
return this.MessageNotificationClass.CompareTo(other.MessageNotificationClass);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,14 +82,14 @@ namespace bsmd.database
|
||||
{
|
||||
NOA_NOD nn = new NOA_NOD();
|
||||
nn.id = reader.GetGuid(0);
|
||||
if (!reader.IsDBNull(1)) nn.ETAToPortOfCall = reader.GetDateTime(1);
|
||||
if (!reader.IsDBNull(2)) nn.ETDFromPortOfCall = reader.GetDateTime(2);
|
||||
if (!reader.IsDBNull(3)) nn.ETAToKielCanal = reader.GetDateTime(3);
|
||||
if (!reader.IsDBNull(4)) nn.ETDFromKielCanal = reader.GetDateTime(4);
|
||||
if (!reader.IsDBNull(1)) nn.ETAToPortOfCall = DateTime.SpecifyKind(reader.GetDateTime(1), DateTimeKind.Utc);
|
||||
if (!reader.IsDBNull(2)) nn.ETDFromPortOfCall = DateTime.SpecifyKind(reader.GetDateTime(2), DateTimeKind.Utc);
|
||||
if (!reader.IsDBNull(3)) nn.ETAToKielCanal = DateTime.SpecifyKind(reader.GetDateTime(3), DateTimeKind.Utc);
|
||||
if (!reader.IsDBNull(4)) nn.ETDFromKielCanal = DateTime.SpecifyKind(reader.GetDateTime(4), DateTimeKind.Utc);
|
||||
if (!reader.IsDBNull(5)) nn.LastPort = reader.GetString(5);
|
||||
if (!reader.IsDBNull(6)) nn.ETDFromLastPort = reader.GetDateTime(6);
|
||||
if (!reader.IsDBNull(6)) nn.ETDFromLastPort = DateTime.SpecifyKind(reader.GetDateTime(6), DateTimeKind.Utc);
|
||||
if (!reader.IsDBNull(7)) nn.NextPort = reader.GetString(7);
|
||||
if (!reader.IsDBNull(8)) nn.ETAToNextPort = reader.GetDateTime(8);
|
||||
if (!reader.IsDBNull(8)) nn.ETAToNextPort = DateTime.SpecifyKind(reader.GetDateTime(8), DateTimeKind.Utc);
|
||||
result.Add(nn);
|
||||
}
|
||||
reader.Close();
|
||||
@ -182,14 +182,14 @@ namespace bsmd.database
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.E123, "Departure time before arrival time!", null));
|
||||
}
|
||||
|
||||
if(!this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue)
|
||||
if((this.LastPort != null) && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.E125, "ETD last port must be set!", null));
|
||||
|
||||
if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue &&
|
||||
this.ETAToNextPort < ETDFromPortOfCall)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.E122, "ETD PoC must be before ETA next port!", null));
|
||||
|
||||
if (!this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue)
|
||||
if ((this.NextPort != null) && !this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.E124, "ETA next port must be set!", null));
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("2.2.0")]
|
||||
[assembly: AssemblyInformationalVersion("2.3.0")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2015 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -4,6 +4,6 @@
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("2.2.0.*")]
|
||||
[assembly: AssemblyVersion("2.3.0.*")]
|
||||
// wenn das nicht auskommentiert wird erhalten wir eine Warnung
|
||||
// [assembly: AssemblyFileVersion("1.0.0.*")]
|
||||
|
||||
@ -20,6 +20,84 @@ namespace bsmd.database
|
||||
{
|
||||
public class RuleEngine
|
||||
{
|
||||
|
||||
#region german LOCODE's static definition
|
||||
|
||||
private static List<string> gerLocodeList = new List<string>() {
|
||||
"DE001",
|
||||
"DEAND",
|
||||
"DEBDF",
|
||||
"DEBZR",
|
||||
"DEBMK",
|
||||
"DEBKE",
|
||||
"DEBRE",
|
||||
"DEBRV",
|
||||
"DEBRB",
|
||||
"DE651",
|
||||
"DEBUM",
|
||||
"DEBUZ",
|
||||
"DECUX",
|
||||
"DEDMG",
|
||||
"DEDTM",
|
||||
"DEDUI",
|
||||
"DEDUS",
|
||||
"DEECK",
|
||||
"DEELS",
|
||||
"DEEME",
|
||||
"DEEMM",
|
||||
"DEFLF",
|
||||
"DEGEK",
|
||||
"DEGLU",
|
||||
"DEGRD",
|
||||
"DEHAM",
|
||||
"DEHHF",
|
||||
"DEHGL",
|
||||
"DEHUS",
|
||||
"DEITZ",
|
||||
"DEKEL",
|
||||
"DE136",
|
||||
"DEKCH",
|
||||
"DEKLE",
|
||||
"DECGN",
|
||||
"DEKRE",
|
||||
"DE241",
|
||||
"DELEE",
|
||||
"DELEW",
|
||||
"DELIS",
|
||||
"DELBC",
|
||||
"DELBM",
|
||||
"DE002",
|
||||
"DEMHG",
|
||||
"DEMOZ",
|
||||
"DEMUK",
|
||||
"DEMUH",
|
||||
"DENSS",
|
||||
"DENHO",
|
||||
"DENHA",
|
||||
"DEOLO",
|
||||
"DETRD",
|
||||
"DEPAP",
|
||||
"DEPEF",
|
||||
"DEPUT",
|
||||
"DEREC",
|
||||
"DEREN",
|
||||
"DERHB",
|
||||
"DERSK",
|
||||
"DESAS",
|
||||
"DESTL",
|
||||
"DEUCK",
|
||||
"DE585",
|
||||
"DEVRD",
|
||||
"DEWED",
|
||||
"DEWVN",
|
||||
"DEWIS",
|
||||
"DE003",
|
||||
"DEWOL",
|
||||
"DEWYK"
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
private static ILog log = LogManager.GetLogger(typeof(RuleEngine));
|
||||
private static Dictionary<int, string> errorTextList = null;
|
||||
private static Dictionary<int, string> violationTextList = null;
|
||||
@ -67,6 +145,8 @@ namespace bsmd.database
|
||||
object propValue = property.GetValue(entity, null);
|
||||
string value = (propValue == null) ? string.Empty : propValue.ToString();
|
||||
ValidationCode validationCode = ValidationCode.NONE;
|
||||
int maxlen = 0;
|
||||
|
||||
if (Attribute.IsDefined(property, attribType))
|
||||
{
|
||||
if (entity.GetValidationBlock() == DatabaseEntity.ValidationBlock.BLOCK1)
|
||||
@ -89,6 +169,7 @@ namespace bsmd.database
|
||||
ValidationAttribute validationAttribute = Attribute.GetCustomAttribute(property, typeof(ValidationAttribute))
|
||||
as ValidationAttribute;
|
||||
validationCode = validationAttribute.Code;
|
||||
maxlen = validationAttribute.MaxLen;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,9 +188,8 @@ namespace bsmd.database
|
||||
break;
|
||||
case ValidationCode.LOCODE_GER:
|
||||
{
|
||||
// TODO: Jan nach der Liste anhauen
|
||||
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}");
|
||||
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||
if(!RuleEngine.gerLocodeList.Contains(value))
|
||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||
}
|
||||
break;
|
||||
case ValidationCode.INT_GT_ZERO:
|
||||
@ -144,6 +224,18 @@ namespace bsmd.database
|
||||
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||
}
|
||||
break;
|
||||
case ValidationCode.STRING_EXACT_LEN:
|
||||
{
|
||||
if (value.Length != maxlen)
|
||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||
}
|
||||
break;
|
||||
case ValidationCode.STRING_MAXLEN:
|
||||
{
|
||||
if (value.Length > maxlen)
|
||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -191,6 +283,17 @@ namespace bsmd.database
|
||||
log.InfoFormat("Msg Id {0} Type {1} has {2} errors and {3} violations",
|
||||
entity.Id, entity.MessageNotificationClass, errors.Count, violations.Count);
|
||||
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
((Message)entity).InternalStatus = Message.BSMDStatus.ERROR;
|
||||
DBManager.Instance.Save(entity);
|
||||
}
|
||||
else if (violations.Count > 0)
|
||||
{
|
||||
((Message)entity).InternalStatus = Message.BSMDStatus.VIOLATION;
|
||||
DBManager.Instance.Save(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -67,6 +67,7 @@ namespace bsmd.database
|
||||
public string ISMCompanyName { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.STRING_EXACT_LEN, 7)]
|
||||
public string ISMCompanyId { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
|
||||
@ -27,6 +27,8 @@ namespace bsmd.database
|
||||
DOUBLE_GT_ZERO,
|
||||
FLAG_CODE,
|
||||
TWO_DIGIT,
|
||||
STRING_MAXLEN,
|
||||
STRING_EXACT_LEN,
|
||||
E121 = 121,
|
||||
E122 = 122,
|
||||
E123 = 123,
|
||||
@ -68,12 +70,25 @@ namespace bsmd.database
|
||||
public class ValidationAttribute : Attribute
|
||||
{
|
||||
private ValidationCode validationCode;
|
||||
private int maxlen;
|
||||
|
||||
public ValidationAttribute(ValidationCode code)
|
||||
{
|
||||
this.validationCode = code;
|
||||
}
|
||||
|
||||
public ValidationAttribute(ValidationCode code, int maxlen)
|
||||
{
|
||||
this.maxlen = maxlen;
|
||||
this.validationCode = code;
|
||||
}
|
||||
|
||||
public int MaxLen
|
||||
{
|
||||
get { return this.maxlen; }
|
||||
set { this.maxlen = value; }
|
||||
}
|
||||
|
||||
public ValidationCode Code
|
||||
{
|
||||
get { return this.validationCode; }
|
||||
|
||||
35
nsw/Source/bsmd.dbh.ResponseService/Properties/Settings.Designer.cs
generated
Normal file
35
nsw/Source/bsmd.dbh.ResponseService/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace bsmd.dbh.ResponseService.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("replace me!")]
|
||||
public string DBConnectionString {
|
||||
get {
|
||||
return ((string)(this["DBConnectionString"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.dbh.ResponseService.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="DBConnectionString" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">replace me!</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -81,6 +81,9 @@ namespace bsmd.herberg.FormService
|
||||
if (aMessageCore.HerbergReportType.Equals("Pre-Departure Notification Update") ||
|
||||
aMessageCore.HerbergReportType.Equals("Departure Notification Update"))
|
||||
isDeparture = true;
|
||||
|
||||
aMessageCore.Incoming = !isDeparture;
|
||||
|
||||
break;
|
||||
case "EmailContactReportingVessel":
|
||||
aMessageCore.HerbergEmailContactReportingVessel = formData.value;
|
||||
@ -301,6 +304,8 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in nDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> subvDict = nDict[key];
|
||||
if (subvDict.Count > 0)
|
||||
{
|
||||
CallPurpose cp = noa_nod.GetSublistElementWithIdentifier(key.ToString()) as CallPurpose;
|
||||
if (cp == null)
|
||||
{
|
||||
@ -315,6 +320,7 @@ namespace bsmd.herberg.FormService
|
||||
|
||||
saveMessages.Add(cp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -415,9 +421,13 @@ namespace bsmd.herberg.FormService
|
||||
if (vDict.ContainsKey("InfectedAreaDate")) mdh.InfectedAreaDate = Extensions.TryParseDateTime(vDict["InfectedAreaDate"]);
|
||||
|
||||
// sublisten
|
||||
if (!mdh.MDHSimplification ?? true)
|
||||
{
|
||||
foreach (int key in nDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> pDict = nDict[key];
|
||||
if (pDict.Count > 0)
|
||||
{
|
||||
PortOfCallLast30Days poc30 = mdh.GetSublistElementWithIdentifier(key.ToString()) as PortOfCallLast30Days;
|
||||
if (poc30 == null)
|
||||
{
|
||||
@ -457,6 +467,8 @@ namespace bsmd.herberg.FormService
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error reading MDH fields: {0}", ex.Message);
|
||||
@ -547,6 +559,8 @@ namespace bsmd.herberg.FormService
|
||||
{
|
||||
PortOfItinerary poi = bpol.GetSublistElementWithIdentifier(key.ToString()) as PortOfItinerary;
|
||||
Dictionary<string, string> ppDict = nDict[key];
|
||||
if (ppDict.Count > 0)
|
||||
{
|
||||
if (poi == null)
|
||||
{
|
||||
poi = new PortOfItinerary();
|
||||
@ -561,6 +575,7 @@ namespace bsmd.herberg.FormService
|
||||
saveMessages.Add(poi);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error reading BPOL fields: {0}", ex.Message);
|
||||
@ -954,11 +969,13 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in nDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> sDict = nDict[key];
|
||||
if (sDict.Count > 0)
|
||||
{
|
||||
bool changedPfC = false;
|
||||
bool changedStS = false;
|
||||
|
||||
ShipToShipActivitiesDuringLastTenPortFacilitiesCalled sts = sec.GetShipToShipWithIdentifier(key.ToString());
|
||||
if(sts == null)
|
||||
if (sts == null)
|
||||
{
|
||||
sts = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
|
||||
sts.SEC = sec;
|
||||
@ -1010,6 +1027,7 @@ namespace bsmd.herberg.FormService
|
||||
if (changedStS) saveMessages.Add(sts);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error reading SEC fields: {0}", ex.Message);
|
||||
@ -1209,6 +1227,8 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in subDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> aDict = subDict[key];
|
||||
if (aDict.Count > 0)
|
||||
{
|
||||
IMDGPosition imdgPosition = haz.GetIMDGPositionWithIdentifier(key.ToString());
|
||||
if (imdgPosition == null)
|
||||
{
|
||||
@ -1269,7 +1289,7 @@ namespace bsmd.herberg.FormService
|
||||
_log.InfoFormat("Igoring IMDGPosition identifer {0}, using row number {1} instead",
|
||||
aDict["Identifier"], key);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1279,6 +1299,8 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in subDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> aDict = subDict[key];
|
||||
if (aDict.Count > 0)
|
||||
{
|
||||
IBCPosition ibcPosition = haz.GetIBCPositionWithIdentifier(key.ToString());
|
||||
if (ibcPosition == null)
|
||||
{
|
||||
@ -1308,6 +1330,7 @@ namespace bsmd.herberg.FormService
|
||||
saveMessages.Add(ibcPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (groupedRowVals.ContainsKey("HAZ.IGC"))
|
||||
{
|
||||
@ -1315,9 +1338,11 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in subDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> aDict = subDict[key];
|
||||
|
||||
if (aDict.Count > 0)
|
||||
{
|
||||
IGCPosition igcPosition = haz.GetIGCPositionWithIdentifier(key.ToString());
|
||||
if(igcPosition == null) {
|
||||
if (igcPosition == null)
|
||||
{
|
||||
igcPosition = new IGCPosition();
|
||||
igcPosition.Identifier = key.ToString();
|
||||
haz.IGCPositions.Add(igcPosition);
|
||||
@ -1340,8 +1365,9 @@ namespace bsmd.herberg.FormService
|
||||
aDict["Identifier"], key);
|
||||
}
|
||||
|
||||
|
||||
saveMessages.Add(igcPosition);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1351,6 +1377,8 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in subDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> aDict = subDict[key];
|
||||
if (aDict.Count > 0)
|
||||
{
|
||||
IMSBCPosition imsbcPosition = haz.GetIMSBCPositionWithIdentifier(key.ToString());
|
||||
if (imsbcPosition == null)
|
||||
{
|
||||
@ -1380,6 +1408,7 @@ namespace bsmd.herberg.FormService
|
||||
saveMessages.Add(imsbcPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (groupedRowVals.ContainsKey("HAZ.MARPOLAnnexI"))
|
||||
{
|
||||
@ -1387,6 +1416,8 @@ namespace bsmd.herberg.FormService
|
||||
foreach (int key in subDict.Keys)
|
||||
{
|
||||
Dictionary<string, string> aDict = subDict[key];
|
||||
if (aDict.Count > 0)
|
||||
{
|
||||
MARPOL_Annex_I_Position marpolPosition = haz.GetMARPOLPositionWithIdentifier(key.ToString());
|
||||
if (marpolPosition == null)
|
||||
{
|
||||
@ -1412,11 +1443,11 @@ namespace bsmd.herberg.FormService
|
||||
aDict["Identifier"], key);
|
||||
}
|
||||
|
||||
|
||||
saveMessages.Add(marpolPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error reading HAZ fields: {0}", ex.Message);
|
||||
|
||||
@ -25,6 +25,8 @@ namespace bsmd.hisnord
|
||||
{
|
||||
bool retval = true;
|
||||
|
||||
messages.Sort();
|
||||
|
||||
try
|
||||
{
|
||||
nsw _nsw = new nsw();
|
||||
@ -257,10 +259,301 @@ namespace bsmd.hisnord
|
||||
#endregion
|
||||
|
||||
case Message.NotificationClass.HAZA:
|
||||
// abh. von LADG!
|
||||
break;
|
||||
case Message.NotificationClass.HAZD:
|
||||
// abh. von LADG!
|
||||
{
|
||||
HAZ haz = message.Elements[0] as HAZ;
|
||||
|
||||
#region HAZ header area
|
||||
|
||||
List<object> flagItems = new List<object>();
|
||||
if (haz.NoDPGOnBoardOnArrival ?? false)
|
||||
{
|
||||
flagItems.Add(ytype.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(haz.DPGManifestOnBoardOnArrival ?? false)
|
||||
flagItems.Add(yorntype.Y);
|
||||
else
|
||||
flagItems.Add(yorntype.N);
|
||||
if (haz.INFShipClass.HasValue)
|
||||
{
|
||||
flagItems.Add((infclasstype)haz.INFShipClass.Value);
|
||||
}
|
||||
|
||||
dgcodes _dgCodes = new dgcodes();
|
||||
List<dgcodetype> _dgCodeTypes = new List<dgcodetype>();
|
||||
if (haz.DPGClassificationIBC ?? false)
|
||||
_dgCodeTypes.Add(dgcodetype.IBC);
|
||||
if (haz.DPGClassificationIGC ?? false)
|
||||
_dgCodeTypes.Add(dgcodetype.IGC);
|
||||
if (haz.DPGClassificationIMDG ?? false)
|
||||
_dgCodeTypes.Add(dgcodetype.IMDG);
|
||||
// was ist das? dgcodetype.IMDG_MoU
|
||||
if (haz.DPGClassificationIMSBC ?? false)
|
||||
_dgCodeTypes.Add(dgcodetype.IMSBC);
|
||||
if (haz.DPGClassificationMARPOL_ANNEX_I ?? false)
|
||||
_dgCodeTypes.Add(dgcodetype.MARPOL_ANNEX_I);
|
||||
_dgCodes.DGCode = _dgCodeTypes.ToArray();
|
||||
|
||||
flagItems.Add(_dgCodes);
|
||||
|
||||
}
|
||||
|
||||
_nsw.conveyance.Items1 = flagItems.ToArray();
|
||||
|
||||
#endregion
|
||||
|
||||
// Durch Sortierung nach NotificationClass kommt LADG vor HAZ, daher sollte das Feld
|
||||
// GeneralCargo nicht leer sein
|
||||
if (_nsw.conveyance.GeneralCargo == null)
|
||||
{
|
||||
_log.Warn("LADG (conveyance.GeneralCargo) is empty. Cannot add HAZ information!");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<object> dgList = new List<object>();
|
||||
|
||||
#region IMDGPositions
|
||||
|
||||
if (haz.IMDGPositions.Count > 0)
|
||||
{
|
||||
positionimdg[] imdgPositions = new positionimdg[haz.IMDGPositions.Count];
|
||||
for (int i = 0; i < haz.IMDGPositions.Count; i++)
|
||||
{
|
||||
IMDGPosition imdgPosition = haz.IMDGPositions[i];
|
||||
positionimdg pi = new positionimdg();
|
||||
|
||||
pi.UNNumber = imdgPosition.UNNumber;
|
||||
if(imdgPosition.PackingGroup.HasValue)
|
||||
pi.PackingGroup = (packinggrouptype)imdgPosition.PackingGroup;
|
||||
pi.ProperShippingName = imdgPosition.ProperShippingName;
|
||||
pi.IMOClass = imdgPosition.IMOClass;
|
||||
pi.CompatibilityGroup = imdgPosition.CompatibilityGroup;
|
||||
pi.TechnicalName = imdgPosition.TechnicalName;
|
||||
pi.NetMassKGMSpecified = imdgPosition.NetExplosiveMass_KGM.HasValue;
|
||||
if (imdgPosition.NetExplosiveMass_KGM.HasValue)
|
||||
pi.NetMassKGM = (float) imdgPosition.NetExplosiveMass_KGM.Value;
|
||||
pi.FlashpointCEL = imdgPosition.Flashpoint_CEL;
|
||||
pi.Class7NuclideName = imdgPosition.Class7NuclideName;
|
||||
pi.Class7MaxActivityBQLSpecified = imdgPosition.Class7MaxActivity_BQL.HasValue;
|
||||
if (imdgPosition.Class7MaxActivity_BQL.HasValue)
|
||||
pi.Class7MaxActivityBQL = (float)imdgPosition.Class7MaxActivity_BQL.Value;
|
||||
pi.Class7CategorySpecified = imdgPosition.Class7Category.HasValue;
|
||||
if (imdgPosition.Class7Category.HasValue)
|
||||
pi.Class7Category = (class7cattype)imdgPosition.Class7Category.Value;
|
||||
pi.Class7TISpecified = imdgPosition.Class7TransportIndex.HasValue;
|
||||
if (imdgPosition.Class7TransportIndex.HasValue)
|
||||
pi.Class7TI = (float)imdgPosition.Class7TransportIndex.Value;
|
||||
pi.Class7CSI = imdgPosition.Class7CSI.HasValue ? imdgPosition.Class7CSI.Value.ToString() : "";
|
||||
pi.ControlTempCELSpecified = imdgPosition.ControlTemperature_CEL.HasValue;
|
||||
if (imdgPosition.ControlTemperature_CEL.HasValue)
|
||||
pi.ControlTempCEL = (float)imdgPosition.ControlTemperature_CEL.Value;
|
||||
pi.EmergencyTempCELSpecified = imdgPosition.EmergencyTemperature_CEL.HasValue;
|
||||
if (imdgPosition.EmergencyTemperature_CEL.HasValue)
|
||||
pi.EmergencyTempCEL = (float)imdgPosition.EmergencyTemperature_CEL.Value;
|
||||
if (imdgPosition.SubsidiaryRiskList.Count > 0)
|
||||
{
|
||||
pi.SubsidiaryRisks = new string[imdgPosition.SubsidiaryRiskList.Count];
|
||||
for (int j = 0; j < imdgPosition.SubsidiaryRiskList.Count; j++)
|
||||
{
|
||||
pi.SubsidiaryRisks[j] = imdgPosition.SubsidiaryRiskList[j].SubsidiaryRisk;
|
||||
}
|
||||
}
|
||||
pi.MarinePollutant = (imdgPosition.MarinePollutant ?? false) ? yorntype.Y : yorntype.N;
|
||||
pi.NumberOfPackages = imdgPosition.NumberOfPackages.HasValue ? imdgPosition.NumberOfPackages.Value.ToString() : "";
|
||||
// pi.PackageType = ?? feld nicht vorhanden
|
||||
pi.LimitedQuantities = (imdgPosition.LimitedQuantities ?? false) ? yorntype.Y : yorntype.N;
|
||||
pi.ExceptedQuantities = (imdgPosition.ExceptedQuantities ?? false) ? yorntype.Y : yorntype.N;
|
||||
// pi.NetQuantity ?? feld nicht vorhanden odér ist das NetMassKGM ?
|
||||
pi.GrossMassKGMSpecified = imdgPosition.GrossQuantity_KGM.HasValue;
|
||||
if (imdgPosition.GrossQuantity_KGM.HasValue)
|
||||
pi.GrossMassKGM = (float)imdgPosition.GrossQuantity_KGM.Value;
|
||||
// pi.Volume_MTQ ?? feld nicht vorhanden
|
||||
pi.GeneralCargoIBCSpecified = imdgPosition.GeneralCargoIBC.HasValue;
|
||||
if (imdgPosition.GeneralCargoIBC.HasValue)
|
||||
pi.GeneralCargoIBC = (imdgPosition.GeneralCargoIBC.Value) ? yorntype.Y : yorntype.N;
|
||||
pi.ContainerNumber = imdgPosition.ContainerNumber;
|
||||
pi.VehicleLicenseNumber = imdgPosition.VehicleLicenseNumber;
|
||||
pi.Remarks = imdgPosition.Remarks;
|
||||
|
||||
// hier fehlt auch StowagePosition, PortOfLoading, PortOfDischarge
|
||||
// das ist eine Ebene höher und damit ist die Zuordnung falsch, weil es nicht 1:n ist sondern nachfolgende
|
||||
// abweichende Einträge hier eine Überschreibung verursachen
|
||||
|
||||
if(!imdgPosition.StowagePosition.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].LocationOnBoard = imdgPosition.StowagePosition;
|
||||
if (!imdgPosition.PortOfLoading.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = imdgPosition.PortOfLoading;
|
||||
if (!imdgPosition.PortOfDischarge.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = imdgPosition.PortOfDischarge;
|
||||
|
||||
pi.Index = imdgPosition.Identifier;
|
||||
|
||||
imdgPositions[i] = pi;
|
||||
}
|
||||
dgList.Add(imdgPositions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IBCPositions
|
||||
|
||||
if (haz.IBCPositions.Count > 0)
|
||||
{
|
||||
positionibc[] ibcPositions = new positionibc[haz.IBCPositions.Count];
|
||||
|
||||
for (int i = 0; i < haz.IBCPositions.Count;i++)
|
||||
{
|
||||
positionibc pi = new positionibc();
|
||||
IBCPosition ibcPosition = haz.IBCPositions[i];
|
||||
pi.Name = ibcPosition.ProductName;
|
||||
if(ibcPosition.PollutionCategory.HasValue)
|
||||
pi.PollutionCategory = (polcattype)ibcPosition.PollutionCategory.Value;
|
||||
pi.HazardsSpecified = ibcPosition.Hazards.HasValue;
|
||||
if (ibcPosition.Hazards.HasValue)
|
||||
pi.Hazards = (hazardtype)ibcPosition.Hazards.Value;
|
||||
if (ibcPosition.FlashpointInformation.HasValue)
|
||||
pi.FlashpointInfo = (flashpointinfotype)ibcPosition.FlashpointInformation.Value;
|
||||
pi.FlashpointCEL = ibcPosition.Flashpoint_CEL;
|
||||
if (ibcPosition.Quantity_KGM.HasValue)
|
||||
pi.NetMassKGM = (float)ibcPosition.Quantity_KGM.Value;
|
||||
pi.SpecRef15_19Specified = ibcPosition.SpecRef15_19.HasValue;
|
||||
if (ibcPosition.SpecRef15_19.HasValue)
|
||||
pi.SpecRef15_19 = ibcPosition.SpecRef15_19.Value ? yorntype.Y : yorntype.N;
|
||||
pi.Remarks = ibcPosition.Remarks;
|
||||
|
||||
if (!ibcPosition.StowagePosition.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].LocationOnBoard = ibcPosition.StowagePosition;
|
||||
if (!ibcPosition.PortOfLoading.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = ibcPosition.PortOfLoading;
|
||||
if (!ibcPosition.PortOfDischarge.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = ibcPosition.PortOfDischarge;
|
||||
|
||||
pi.Index = ibcPosition.Identifier;
|
||||
|
||||
ibcPositions[i] = pi;
|
||||
}
|
||||
|
||||
dgList.Add(ibcPositions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGCPositions
|
||||
|
||||
if (haz.IGCPositions.Count > 0)
|
||||
{
|
||||
positionigc[] igcPositions = new positionigc[haz.IGCPositions.Count];
|
||||
|
||||
for (int i = 0; i < haz.IGCPositions.Count; i++)
|
||||
{
|
||||
positionigc pi = new positionigc();
|
||||
IGCPosition igcPosition = haz.IGCPositions[i];
|
||||
|
||||
pi.UNNumber = igcPosition.UNNumber;
|
||||
pi.IMOClass = igcPosition.IMOClass;
|
||||
pi.Name = igcPosition.ProductName;
|
||||
if (igcPosition.Quantity_KGM.HasValue)
|
||||
pi.NetMassKGM = (float)igcPosition.Quantity_KGM.Value;
|
||||
pi.Remarks = igcPosition.Remarks;
|
||||
|
||||
if (!igcPosition.StowagePosition.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].LocationOnBoard = igcPosition.StowagePosition;
|
||||
if (!igcPosition.PortOfLoading.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = igcPosition.PortOfLoading;
|
||||
if (!igcPosition.PortOfDischarge.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = igcPosition.PortOfDischarge;
|
||||
|
||||
pi.Index = igcPosition.Identifier;
|
||||
|
||||
igcPositions[i] = pi;
|
||||
}
|
||||
|
||||
dgList.Add(igcPositions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMSBCPositions
|
||||
|
||||
if (haz.IMSBCPositions.Count > 0)
|
||||
{
|
||||
positionimsbc[] imsbcPositions = new positionimsbc[haz.IMSBCPositions.Count];
|
||||
|
||||
for (int i = 0; i < haz.IMSBCPositions.Count;i++ )
|
||||
{
|
||||
positionimsbc pi = new positionimsbc();
|
||||
IMSBCPosition imsbcPosition = haz.IMSBCPositions[i];
|
||||
|
||||
pi.Name = imsbcPosition.BulkCargoShippingName;
|
||||
pi.MHB = (imsbcPosition.MHB ?? false) ? yorntype.Y : yorntype.N;
|
||||
pi.UNNumber = imsbcPosition.UNNumber;
|
||||
pi.IMOClass = imsbcPosition.IMOClass;
|
||||
if (imsbcPosition.Quantity_KGM.HasValue)
|
||||
pi.NetMassKGM = (float)imsbcPosition.Quantity_KGM.Value;
|
||||
pi.Remarks = imsbcPosition.Remarks;
|
||||
|
||||
if (!imsbcPosition.StowagePosition.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].LocationOnBoard = imsbcPosition.StowagePosition;
|
||||
if (!imsbcPosition.PortOfLoading.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = imsbcPosition.PortOfLoading;
|
||||
if (!imsbcPosition.PortOfDischarge.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = imsbcPosition.PortOfDischarge;
|
||||
|
||||
pi.Index = imsbcPosition.Identifier;
|
||||
|
||||
imsbcPositions[i] = pi;
|
||||
}
|
||||
|
||||
dgList.Add(imsbcPositions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMDGPositions
|
||||
|
||||
if (haz.MARPOLPositions.Count > 0)
|
||||
{
|
||||
positionmarpol[] marpolPositions = new positionmarpol[haz.MARPOLPositions.Count];
|
||||
|
||||
for (int i = 0; i < haz.MARPOLPositions.Count;i++)
|
||||
{
|
||||
positionmarpol pi = new positionmarpol();
|
||||
MARPOL_Annex_I_Position marpolPosition = haz.MARPOLPositions[i];
|
||||
|
||||
pi.Name = marpolPosition.Name;
|
||||
if (marpolPosition.FlashpointInformation.HasValue)
|
||||
pi.FlashpointInformation = (flashpointinfotype) marpolPosition.FlashpointInformation.Value;
|
||||
pi.Flashpoint_CEL = marpolPosition.Flashpoint_CEL;
|
||||
if (marpolPosition.Quantity_KGM.HasValue)
|
||||
pi.NetMassKGM = (float)marpolPosition.Quantity_KGM.Value;
|
||||
pi.Remarks = marpolPosition.Remarks;
|
||||
|
||||
if (!marpolPosition.StowagePosition.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].LocationOnBoard = marpolPosition.StowagePosition;
|
||||
if (!marpolPosition.PortOfLoading.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = marpolPosition.PortOfLoading;
|
||||
if (!marpolPosition.PortOfDischarge.IsNullOrEmpty())
|
||||
_nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = marpolPosition.PortOfDischarge;
|
||||
|
||||
pi.Index = marpolPosition.Identifier;
|
||||
|
||||
marpolPositions[i] = pi;
|
||||
}
|
||||
|
||||
dgList.Add(marpolPositions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// HACK! Die erste "vorhandene" Liste. Dieses Format hier setzt voraus dass man immer nur einen Listentyp
|
||||
// haben kann, das steht aber nirgends im NSW
|
||||
// alles andere wird bis zur Klärung hier erst einmal ignoriert
|
||||
_nsw.conveyance.GeneralCargo[0].DGList = (object[]) dgList[0]; //.ToArray();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#region INFO
|
||||
@ -399,6 +692,11 @@ namespace bsmd.hisnord
|
||||
if (message.MessageCore.IsTransit)
|
||||
{
|
||||
transit _transit = _nsw.conveyance.Item as transit;
|
||||
if (_transit == null)
|
||||
{
|
||||
_transit = new transit();
|
||||
_nsw.conveyance.Item = _transit;
|
||||
}
|
||||
|
||||
_transit.LastPort = new lastport();
|
||||
if (noa_nod.ETDFromLastPort.HasValue)
|
||||
@ -415,6 +713,12 @@ namespace bsmd.hisnord
|
||||
else if (message.MessageCore.Incoming) // einlaufend
|
||||
{
|
||||
import _import = _nsw.conveyance.Item as import;
|
||||
if (_import == null)
|
||||
{
|
||||
_import = new import();
|
||||
_nsw.conveyance.Item = _import;
|
||||
}
|
||||
|
||||
_import.LastPort = new lastport();
|
||||
if (noa_nod.ETDFromLastPort.HasValue)
|
||||
_import.LastPort.ETD = noa_nod.ETDFromLastPort.Value;
|
||||
@ -431,6 +735,12 @@ namespace bsmd.hisnord
|
||||
else // auslaufend
|
||||
{
|
||||
export _export = _nsw.conveyance.Item as export;
|
||||
if (_export == null)
|
||||
{
|
||||
_export = new export();
|
||||
_nsw.conveyance.Item = _export;
|
||||
}
|
||||
|
||||
_export.NextPort = new nextporthazmat();
|
||||
if (noa_nod.ETAToNextPort.HasValue)
|
||||
_export.NextPort.ETA = noa_nod.ETAToNextPort.Value;
|
||||
|
||||
94
nsw/Source/bsmd.hisnord/VisitId.cs
Normal file
94
nsw/Source/bsmd.hisnord/VisitId.cs
Normal file
@ -0,0 +1,94 @@
|
||||
//
|
||||
// Class: VisitId
|
||||
// Current CLR: 4.0.30319.34209
|
||||
// System: Microsoft Visual Studio 10.0
|
||||
// Author: dani
|
||||
// Created: 8/12/2015 8:27:03 AM
|
||||
//
|
||||
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using log4net;
|
||||
|
||||
namespace bsmd.hisnord
|
||||
{
|
||||
[Serializable]
|
||||
public class VisitId
|
||||
{
|
||||
private string _visitId = null;
|
||||
private static ILog _log = LogManager.GetLogger(typeof(bsmd.hisnord.VisitId));
|
||||
|
||||
#region Construction
|
||||
|
||||
public VisitId(string visitId)
|
||||
{
|
||||
this._visitId = visitId;
|
||||
}
|
||||
|
||||
public VisitId() { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
[XmlAttribute]
|
||||
public string ConveyanceCode { get; set; }
|
||||
|
||||
[XmlText]
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Extract Guid aus ConveyanceCode
|
||||
/// </summary>
|
||||
public Guid? MessageCoreId
|
||||
{
|
||||
get
|
||||
{
|
||||
Guid? result = null;
|
||||
if (this.ConveyanceCode != null)
|
||||
{
|
||||
int startIndex = this.ConveyanceCode.IndexOf('-');
|
||||
if (startIndex > 0)
|
||||
{
|
||||
Guid tmpGuid;
|
||||
if (Guid.TryParse(this.ConveyanceCode.Substring(startIndex + 1), out tmpGuid))
|
||||
result = tmpGuid;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Deserialization
|
||||
|
||||
public static VisitId ReadVisitId(string filename)
|
||||
{
|
||||
VisitId aVisitId = null;
|
||||
try
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(bsmd.hisnord.VisitId));
|
||||
using (FileStream fs = new FileStream(filename, FileMode.Open))
|
||||
{
|
||||
aVisitId = (VisitId)serializer.Deserialize(fs);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Exception occurred during deserialization: {0}", ex.Message);
|
||||
|
||||
}
|
||||
return aVisitId;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -31,6 +31,7 @@ namespace bsmd.hisnord
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.RedirectStandardInput = false;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
// der Transmitter schickt alles was im Ausgabe-Verzeichnis ist
|
||||
// damit das gut geht schicken wir die Nachrichten einzeln und arbeiten jeweils das
|
||||
// Ergebnis ab
|
||||
|
||||
Loading…
Reference in New Issue
Block a user