diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 807056b9..860add5f 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,12 +26,12 @@ 1000 - http://192.168.2.4/LockingService/LockingService.svc - + + http://heupferd/bsmd.LockingService/LockingService.svc - Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False - + + Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index c3afdae6..659a745b 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -35,8 +35,8 @@ 3.5.1.0 true publish.html - 1 - 5.0.4.%2a + 0 + 5.0.5.%2a false true true diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index 7f01adb3..abcf2888 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs index 9f681131..996636fb 100644 --- a/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs +++ b/nsw/Source/bsmd.ReportGenerator/BSMDDocument.cs @@ -1110,7 +1110,9 @@ namespace bsmd.ReportGenerator if (LocalizedLookup.getVesselTypes().ContainsKey(value)) result = string.Format("{0} - {1}", value, LocalizedLookup.getVesselTypes()[value]); break; + case "INFShipClass": case "INF-Ship-Class": + case "INF - Ship - Class": { switch(value) { @@ -1121,6 +1123,7 @@ namespace bsmd.ReportGenerator } } break; + case "PackingGroup": case "Packing Group": { switch (value) diff --git a/nsw/Source/bsmd.database/AGNT.cs b/nsw/Source/bsmd.database/AGNT.cs index 72610807..66bf31ef 100644 --- a/nsw/Source/bsmd.database/AGNT.cs +++ b/nsw/Source/bsmd.database/AGNT.cs @@ -41,7 +41,7 @@ namespace bsmd.database [ShowReport] [LookupName("AGNT.AgentStreetAndNumber")] - [MaxLength(99)] + [MaxLength(99)] [ENI2Validation] public string AgentStreetAndNumber { get; set; } diff --git a/nsw/Source/bsmd.database/IBCPosition.cs b/nsw/Source/bsmd.database/IBCPosition.cs index 0f5a4e90..60fdfa37 100644 --- a/nsw/Source/bsmd.database/IBCPosition.cs +++ b/nsw/Source/bsmd.database/IBCPosition.cs @@ -264,6 +264,11 @@ namespace bsmd.database errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "Flashpoint_CEL", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA")); } + if(!this.Hazards.HasValue) + { + violations.Add(RuleEngine.CreateViolation(ValidationCode.V810, "Hazards", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA")); + } + } #endregion diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 28152963..6382fc35 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("5.0.4")] +[assembly: AssemblyInformationalVersion("5.0.5")] [assembly: AssemblyCopyright("Copyright © 2014-2018 schick Informatik")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index f9d34805..ce2f6aa2 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("5.0.4.*")] +[assembly: AssemblyVersion("5.0.5.*")] diff --git a/nsw/Source/bsmd.database/RuleEngine.cs b/nsw/Source/bsmd.database/RuleEngine.cs index 827b6084..1e91fe30 100644 --- a/nsw/Source/bsmd.database/RuleEngine.cs +++ b/nsw/Source/bsmd.database/RuleEngine.cs @@ -157,7 +157,11 @@ namespace bsmd.database // add "generic" validation properties to check list props.AddRange(objType.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(ValidationAttribute)))); // add "block" validation properties to check list - props.AddRange(objType.GetProperties().Where( prop => Attribute.IsDefined(prop, attribType)) ); + props.AddRange(objType.GetProperties().Where( prop => Attribute.IsDefined(prop, attribType)) ); + // alle "MaxLength" Properties hinzufügen die sonst keine Validierung haben + props.AddRange(objType.GetProperties().Where(prop => (!Attribute.IsDefined(prop, typeof(ValidationAttribute)) && + !Attribute.IsDefined(prop, attribType) && + Attribute.IsDefined(prop, typeof(MaxLengthAttribute))))); foreach (PropertyInfo property in props) { diff --git a/nsw/Source/bsmd.database/ValidationAttribute.cs b/nsw/Source/bsmd.database/ValidationAttribute.cs index 32e61b65..01906dcc 100644 --- a/nsw/Source/bsmd.database/ValidationAttribute.cs +++ b/nsw/Source/bsmd.database/ValidationAttribute.cs @@ -79,6 +79,7 @@ namespace bsmd.database V807 = 807, V808 = 808, V809 = 809, + V810 = 810, V821 = 821, } diff --git a/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs b/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs index 8ef2c266..e5ebb5f7 100644 --- a/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs +++ b/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs @@ -21,7 +21,7 @@ namespace bsmd.dbh.ResponseService bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial, bsmd.dbh.response.RootReportingClassesError RootReportingClassesError, bsmd.dbh.response.RootReportingClassesResetted ReportingClassesResetted, - bsmd.dbh.response.Message[] Messages); + bsmd.dbh.response.RootMessage[] Messages); } diff --git a/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs b/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs index 5c3354b0..5e7a73cf 100644 --- a/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs +++ b/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs @@ -18,7 +18,7 @@ namespace bsmd.dbh.ResponseService bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial, bsmd.dbh.response.RootReportingClassesError RootReportingClassesError, bsmd.dbh.response.RootReportingClassesResetted ReportingClassesResetted, - bsmd.dbh.response.Message[] Messages) + bsmd.dbh.response.RootMessage[] Messages) { // Der Fehler hier aktuell ist dass alles funktioniert, außer dass "Messages" nicht diff --git a/nsw/Source/bsmd.dbh/NSWResponse.cs b/nsw/Source/bsmd.dbh/NSWResponse.cs index 57a3f1e1..8394e93b 100644 --- a/nsw/Source/bsmd.dbh/NSWResponse.cs +++ b/nsw/Source/bsmd.dbh/NSWResponse.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.34209 +// Laufzeitversion:4.0.30319.42000 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. @@ -11,13 +11,14 @@ using System.Xml.Serialization; // -// This source code was auto-generated by xsd, Version=4.0.30319.1. +// Dieser Quellcode wurde automatisch generiert von xsd, Version=4.6.1055.0. // + namespace bsmd.dbh.response { /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -34,8 +35,12 @@ namespace bsmd.dbh.response private string transitIdField; + private string[] sisNumbersField; + private System.DateTime timestampField; + private string senderReferenceField; + private RootType typeField; private RootReportingClassesFull reportingClassesFullField; @@ -46,7 +51,7 @@ namespace bsmd.dbh.response private RootReportingClassesResetted reportingClassesResettedField; - private Message[] messagesField; + private RootMessage[] messagesField; /// public string Version @@ -100,6 +105,20 @@ namespace bsmd.dbh.response } } + /// + [System.Xml.Serialization.XmlArrayItemAttribute("SisNumber", IsNullable = false)] + public string[] SisNumbers + { + get + { + return this.sisNumbersField; + } + set + { + this.sisNumbersField = value; + } + } + /// public System.DateTime Timestamp { @@ -113,6 +132,19 @@ namespace bsmd.dbh.response } } + /// + public string SenderReference + { + get + { + return this.senderReferenceField; + } + set + { + this.senderReferenceField = value; + } + } + /// public RootType Type { @@ -180,7 +212,7 @@ namespace bsmd.dbh.response /// [System.Xml.Serialization.XmlArrayItemAttribute("Message", IsNullable = false)] - public Message[] Messages + public RootMessage[] Messages { get { @@ -194,7 +226,7 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] public enum RootType @@ -217,7 +249,7 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -225,11 +257,11 @@ namespace bsmd.dbh.response public partial class RootReportingClassesFull { - private RootReportingClassesFullReportingClass[] reportingClassField; + private ReportingClassCode[] reportingClassField; /// [System.Xml.Serialization.XmlElementAttribute("ReportingClass")] - public RootReportingClassesFullReportingClass[] ReportingClass + public ReportingClassCode[] ReportingClass { get { @@ -243,10 +275,9 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] - public enum RootReportingClassesFullReportingClass + public enum ReportingClassCode { /// @@ -261,6 +292,9 @@ namespace bsmd.dbh.response /// SEC, + /// + AGNT, + /// POBA, @@ -326,7 +360,7 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -334,11 +368,11 @@ namespace bsmd.dbh.response public partial class RootReportingClassesPartial { - private RootReportingClassesPartialReportingClass[] reportingClassField; + private ReportingClassCode[] reportingClassField; /// [System.Xml.Serialization.XmlElementAttribute("ReportingClass")] - public RootReportingClassesPartialReportingClass[] ReportingClass + public ReportingClassCode[] ReportingClass { get { @@ -352,90 +386,7 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] - public enum RootReportingClassesPartialReportingClass - { - - /// - NOA_NOD, - - /// - ATA, - - /// - ATD, - - /// - SEC, - - /// - POBA, - - /// - POBD, - - /// - NAME, - - /// - TIEFA, - - /// - TIEFD, - - /// - BKRA, - - /// - BKRD, - - /// - STAT, - - /// - LADG, - - /// - INFO, - - /// - SERV, - - /// - PRE72H, - - /// - MDH, - - /// - WAS, - - /// - CREW, - - /// - PAS, - - /// - BPOL, - - /// - TOWA, - - /// - TOWD, - - /// - HAZA, - - /// - HAZD, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -443,11 +394,11 @@ namespace bsmd.dbh.response public partial class RootReportingClassesError { - private RootReportingClassesErrorReportingClass[] reportingClassField; + private ReportingClassCode[] reportingClassField; /// [System.Xml.Serialization.XmlElementAttribute("ReportingClass")] - public RootReportingClassesErrorReportingClass[] ReportingClass + public ReportingClassCode[] ReportingClass { get { @@ -461,90 +412,7 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] - public enum RootReportingClassesErrorReportingClass - { - - /// - NOA_NOD, - - /// - ATA, - - /// - ATD, - - /// - SEC, - - /// - POBA, - - /// - POBD, - - /// - NAME, - - /// - TIEFA, - - /// - TIEFD, - - /// - BKRA, - - /// - BKRD, - - /// - STAT, - - /// - LADG, - - /// - INFO, - - /// - SERV, - - /// - PRE72H, - - /// - MDH, - - /// - WAS, - - /// - CREW, - - /// - PAS, - - /// - BPOL, - - /// - TOWA, - - /// - TOWD, - - /// - HAZA, - - /// - HAZD, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -552,11 +420,11 @@ namespace bsmd.dbh.response public partial class RootReportingClassesResetted { - private RootReportingClassesResettedReportingClass[] reportingClassField; + private ReportingClassCode[] reportingClassField; /// [System.Xml.Serialization.XmlElementAttribute("ReportingClass")] - public RootReportingClassesResettedReportingClass[] ReportingClass + public ReportingClassCode[] ReportingClass { get { @@ -570,95 +438,12 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] - public enum RootReportingClassesResettedReportingClass - { - - /// - NOA_NOD, - - /// - ATA, - - /// - ATD, - - /// - SEC, - - /// - POBA, - - /// - POBD, - - /// - NAME, - - /// - TIEFA, - - /// - TIEFD, - - /// - BKRA, - - /// - BKRD, - - /// - STAT, - - /// - LADG, - - /// - INFO, - - /// - SERV, - - /// - PRE72H, - - /// - MDH, - - /// - WAS, - - /// - CREW, - - /// - PAS, - - /// - BPOL, - - /// - TOWA, - - /// - TOWD, - - /// - HAZA, - - /// - HAZD, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] - public partial class Message + public partial class RootMessage { private string idField; @@ -723,7 +508,7 @@ namespace bsmd.dbh.response } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] public enum RootMessageType @@ -741,5 +526,4 @@ namespace bsmd.dbh.response /// ERROR, } - } \ No newline at end of file diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 420eabbe..0c38b3fe 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -1249,7 +1249,27 @@ namespace bsmd.dbh rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? DBHWebReference.RootSECValidISSCOnBoard.Y : DBHWebReference.RootSECValidISSCOnBoard.N; rootIMDG.ContainerNumber = imdgPos.ContainerNumber; rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; - // rootIMDG.StowagePosition = imdgPos.StowagePosition; + + if (imdgPos.StowagePosition.IsNullOrEmpty()) + { + rootIMDG.Items = new string[3]; + rootIMDG.ItemsElementName = new ItemsChoiceType4[3]; + + rootIMDG.Items[0] = imdgPos.Bay; + rootIMDG.ItemsElementName[0] = ItemsChoiceType4.Bay; + + rootIMDG.Items[1] = imdgPos.Row; + rootIMDG.ItemsElementName[1] = ItemsChoiceType4.Row; + + rootIMDG.Items[2] = imdgPos.Tier; + rootIMDG.ItemsElementName[2] = ItemsChoiceType4.Tier; + } + else + { + rootIMDG.Items = new string[1] { imdgPos.StowagePosition }; + rootIMDG.ItemsElementName = new ItemsChoiceType4[1] { ItemsChoiceType4.StowagePosition }; + } + rootIMDG.PortOfLoading = imdgPos.PortOfLoading; rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge; rootIMDG.Remarks = imdgPos.Remarks; @@ -1482,7 +1502,27 @@ namespace bsmd.dbh rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; rootIMDG.ContainerNumber = imdgPos.ContainerNumber; rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; - //rootIMDG.StowagePosition = imdgPos.StowagePosition; + + if (imdgPos.StowagePosition.IsNullOrEmpty()) + { + rootIMDG.Items = new string[3]; + rootIMDG.ItemsElementName = new ItemsChoiceType4[3]; + + rootIMDG.Items[0] = imdgPos.Bay; + rootIMDG.ItemsElementName[0] = ItemsChoiceType4.Bay; + + rootIMDG.Items[1] = imdgPos.Row; + rootIMDG.ItemsElementName[1] = ItemsChoiceType4.Row; + + rootIMDG.Items[2] = imdgPos.Tier; + rootIMDG.ItemsElementName[2] = ItemsChoiceType4.Tier; + } + else + { + rootIMDG.Items = new string[1] { imdgPos.StowagePosition }; + rootIMDG.ItemsElementName = new ItemsChoiceType4[1] { ItemsChoiceType4.StowagePosition }; + } + rootIMDG.PortOfLoading = imdgPos.PortOfLoading; rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge; rootIMDG.Remarks = imdgPos.Remarks; diff --git a/nsw/Source/bsmd.dbh/Response.cs b/nsw/Source/bsmd.dbh/Response.cs index 299cd481..e69653f0 100644 --- a/nsw/Source/bsmd.dbh/Response.cs +++ b/nsw/Source/bsmd.dbh/Response.cs @@ -22,10 +22,10 @@ namespace bsmd.dbh private static ILog _log = LogManager.GetLogger("dbh Response"); public static void ProcessResponse(string VisitId, string TransitId, DateTime Timestamp, - string SenderReference, response.RootType Type, bsmd.dbh.response.Message[] Messages, + string SenderReference, response.RootType Type, bsmd.dbh.response.RootMessage[] Messages, bsmd.dbh.response.RootReportingClassesFull ReportingClassesFull, bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial, - bsmd.dbh.response.RootReportingClassesError RootReportingClassesError, + bsmd.dbh.response.RootReportingClassesError ReportingClassesError, bsmd.dbh.response.RootReportingClassesResetted ReportingClassesResetted, string connectionString) { @@ -52,8 +52,14 @@ namespace bsmd.dbh } DatabaseEntity dbEntity = DBManager.Instance.GetMessageById(messageId); - if (dbEntity != null) + Message aMessage = dbEntity as Message; + + if (aMessage != null) + { _log.InfoFormat("Message type {0} found for SenderReference {1}", ((Message)dbEntity).MessageNotificationClassDisplay, messageId); + foreach (MessageError existingError in aMessage.ErrorList) + DBManager.Instance.Delete(existingError); + } MessageCore aCore = null; if (dbEntity == null) @@ -65,6 +71,7 @@ namespace bsmd.dbh aCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED; aCore.Cancelled = true; DBManager.Instance.Save(aCore); + return; } } @@ -78,24 +85,28 @@ namespace bsmd.dbh { _log.WarnFormat("SenderReference DB Entity Object is no MessageHeader, aborting ({0})", dbEntity.GetType()); return; - } - Message aMessage = dbEntity as Message; + } switch (Type) { - case dbh.response.RootType.VISIT: - // neue VISIT - ID + case dbh.response.RootType.VISIT: + _log.InfoFormat("Visit-Id received: {0}", VisitId ?? "??!"); if(!VisitId.IsNullOrEmpty()) aMessage.MessageCore.VisitId = VisitId; aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE; aMessage.SendSuccess = true; DBManager.Instance.Save(aMessage.MessageCore); + aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED; + DBManager.Instance.Save(aMessage); break; case dbh.response.RootType.TRANSIT: + _log.InfoFormat("Transit-Id received: {0}", TransitId ?? "??!"); aMessage.MessageCore.TransitId = TransitId; aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE; aMessage.SendSuccess = true; DBManager.Instance.Save(aMessage.MessageCore); + aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED; + DBManager.Instance.Save(aMessage); break; case dbh.response.RootType.RESET: // Die Liste ist auch bei erfolgtem RESET offenbar immer NULL... @@ -116,15 +127,48 @@ namespace bsmd.dbh aMessage.SendSuccess = true; aMessage.InternalStatus = Message.BSMDStatus.CONFIRMED; aMessage.Status = Message.MessageStatus.ACCEPTED; - _log.InfoFormat("CONFIRMED"); + _log.InfoFormat("full message class accepted"); } - else + if ((ReportingClassesPartial != null) && (ReportingClassesPartial.ReportingClass.Length > 0)) { - _log.InfoFormat("no match"); + // this was successful, save status to MessageHeader + aMessage.SendSuccess = true; + aMessage.InternalStatus = Message.BSMDStatus.ERROR; + aMessage.Status = Message.MessageStatus.ACCEPTED; + _log.InfoFormat("partial message class accepted"); } + if ((ReportingClassesError != null) && (ReportingClassesError.ReportingClass.Length > 0)) + { + // this was successful, save status to MessageHeader + aMessage.SendSuccess = true; + aMessage.InternalStatus = Message.BSMDStatus.ERROR; + aMessage.Status = Message.MessageStatus.ACCEPTED; + _log.InfoFormat("message class accepted but error"); + } + + // check the whole thing for completion + MessageCore core = DBManager.Instance.GetMessageCoreById(aMessage.MessageCoreId.Value); + bool stillSomethingSent = false; + foreach(Message message in DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL)) + { + if (aMessage.Id.Value == message.Id.Value) continue; + if(message.InternalStatus == Message.BSMDStatus.SENT) + { + stillSomethingSent = true; + break; + } + } + if(!stillSomethingSent && (core.BSMDStatusInternal == MessageCore.BSMDStatus.SENT)) + { + core.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED; + DBManager.Instance.Save(core); + } + break; } + + if (Messages != null) { // Status zu den jeweiligen Nachrichten. Bei uns sollte die Anzahl hier immer 1 sein, da wir die Dinger