diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index ac23dbbc..926b75dc 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/SQL/Update_3.5.1_To_3.5.2.sql b/nsw/Source/SQL/Update_3.5.1_To_3.5.2.sql new file mode 100644 index 00000000..076701e3 --- /dev/null +++ b/nsw/Source/SQL/Update_3.5.1_To_3.5.2.sql @@ -0,0 +1,11 @@ +PRINT N'Altering [dbo].[HAZA]...'; +GO +ALTER TABLE [dbo].[HAZA] ADD [DPGContactFamilyName] NVARCHAR(64) NULL; +ALTER TABLE [dbo].[HAZA] ADD [DPGContactPhone] NVARCHAR(64) NULL; +GO + +PRINT N'Altering [dbo].[HAZD]...'; +GO +ALTER TABLE [dbo].[HAZD] ADD [DPGContactFamilyName] NVARCHAR(64) NULL; +ALTER TABLE [dbo].[HAZD] ADD [DPGContactPhone] NVARCHAR(64) NULL; +GO \ No newline at end of file diff --git a/nsw/Source/bsmd.ExcelReadService/Confirmation.cs b/nsw/Source/bsmd.ExcelReadService/Confirmation.cs index d5cee001..961bc471 100644 --- a/nsw/Source/bsmd.ExcelReadService/Confirmation.cs +++ b/nsw/Source/bsmd.ExcelReadService/Confirmation.cs @@ -25,9 +25,8 @@ namespace bsmd.ExcelReadService private int whiteColor = ColorTranslator.ToOle(Color.White); private List workbooks = new List(); - private List> nameDicts = new List>(); - private List templateNames = new List(); - private List> actualNameDict = null; + private List>> nameDicts = new List>>(); + private List templateNames = new List(); #region Construction @@ -52,7 +51,7 @@ namespace bsmd.ExcelReadService */ - Dictionary nameDict = new Dictionary(); + Dictionary> nameDict = new Dictionary>(); // hier müsste etwas hin das nur aus der eben geladenen Vorlage die Namen rauszieht.. @@ -67,7 +66,9 @@ namespace bsmd.ExcelReadService } else { - nameDict[workbookName.Name] = workbookName; + if (!nameDict.ContainsKey(workbookName.Name)) + nameDict[workbookName.Name] = new List(); + nameDict[workbookName.Name].Add(workbookName); } } @@ -150,23 +151,23 @@ namespace bsmd.ExcelReadService for(int i=0;i nameDict = this.nameDicts[i]; - - Name someName = null; + Dictionary> nameDict = this.nameDicts[i]; + if(nameDict.ContainsKey(lookup)) { try { - someName = nameDict[lookup]; - - Range range = someName.RefersToRange; - if (range != null) + foreach (Name someName in nameDict[lookup]) { - range.Interior.Color = this.ColorForState(state); - range.Value = value; + Range range = someName.RefersToRange; + if (range != null) + { + range.Interior.Color = this.ColorForState(state); + range.Value = value; + } + Marshal.ReleaseComObject(range); + _log.InfoFormat("Value {0} for lookup {1} OK", value, lookup); } - Marshal.ReleaseComObject(range); - _log.InfoFormat("Value {0} for lookup {1} OK", value, lookup); } catch(Exception ex) { diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs b/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs index fb2bcfa7..7fa18d1a 100644 --- a/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs +++ b/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs @@ -489,6 +489,22 @@ namespace bsmd.ExcelReadService result = tmpDouble; } } + + if ((result == null) && (val != null)) + { + try + { + { + double tmpDouble2 = val[1, 1]; + result = tmpDouble2; + } + } + catch (Exception) + { + // .. + } + } + if (result != null) { this.Conf.ConfirmNumber(lookup, result, ReadState.OK); diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs index 72440ed4..46d40655 100644 --- a/nsw/Source/bsmd.ExcelReadService/Util.cs +++ b/nsw/Source/bsmd.ExcelReadService/Util.cs @@ -336,6 +336,111 @@ namespace bsmd.ExcelReadService #endregion + #region HAZA + + static void ScanHAZA(List messages, MessageCore messageCore, ExcelReader reader) + { + Message hazaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.HAZA); + if(hazaMessage.Elements.Count == 0) + { + HAZ newHaza = new HAZ(); + newHaza.IsDeparture = false; + newHaza.MessageHeader = hazaMessage; + hazaMessage.Elements.Add(newHaza); + } + HAZ haza = hazaMessage.Elements[0] as HAZ; + + haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival"); + haza.DPGContactFamilyName = reader.ReadText("HAZA.DPGContactFamilyName"); + reader.Conf.ConfirmText("HAZA.DPGContactFamilyName", haza.DPGContactFamilyName, haza.DPGContactFamilyName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + haza.DPGContactPhone = reader.ReadText("HAZA.DPGContactPhone"); + reader.Conf.ConfirmText("HAZA.DPGContactPhone", haza.DPGContactPhone, haza.DPGContactPhone.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + haza.MOUBaltic = reader.ReadBoolean("HAZA.MOUBaltic"); + string shipClass = reader.ReadText("HAZA.INFShipClass"); + if(shipClass.IsNullOrEmpty()) + { + reader.Conf.ConfirmText("HAZA.INFShipClass", null, ExcelReader.ReadState.FAIL); + } + else + { + if (shipClass.Contains('1')) haza.INFShipClass = 1; + if (shipClass.Contains('2')) haza.INFShipClass = 2; + if (shipClass.Contains('3')) haza.INFShipClass = 3; + if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) haza.INFShipClass = 0; + reader.Conf.ConfirmText("HAZA.INFShipClass", shipClass, haza.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN); + } + + // IMDG + + string imdg_unno = "HAZA.IMDG.UNNumber_{0}"; + string imdg_properShippingName = "HAZA.IMDG.ProperShippingName_{0}"; + string imdg_imoClass = "HAZA.IMDG.IMOClass_{0}"; + string imdg_packingGroup = "HAZA.IMDG.PackingGroup_{0}"; + string imdg_marinePollutant = "HAZA.IMDG.MarinePollutant_{0}"; + string imdg_flashpoint = "HAZA.IMDG.Flashpoint_CEL_{0}"; + string imdg_numberOfPackages = "HAZA.IMDG.NumberOfPackages_{0}"; + string imdg_packageType = "HAZA.IMDG.PackageType_{0}"; + string imdg_limitedQuantities = "HAZA.IMDG.LimitedQuantities_{0}"; + string imdg_exceptedQuantities = "HAZA.IMDG.ExceptedQuantities_{0}"; + string imdg_netQuantity = "HAZA.IMDG.NetQuantity_KGM_{0}"; + string imdg_grossQuantity = "HAZA.IMDG.GrossQuantity_KGM_{0}"; + string imdg_number = "HAZA.IMDG.Number_{0}"; + string imdg_stowagePosition = "HAZA.IMDG.StowagePosition_{0}"; + string imdg_portOfLoading = "HAZA.IMDG.PortOfLoading_{0}"; + string imdg_portOfDischarge = "HAZA.IMDG.PortOfDischarge_{0}"; + + for (int i = 1; i <= 10; i++) + { + + + } + + // IBC + for (int i = 1; i <= 5; i++) + { + + } + + // IGC + for (int i = 1; i <= 5; i++) + { + + } + + // IMSBC + for (int i = 1; i <= 5; i++) + { + + } + + // MARPOL + for (int i = 1; i <= 5; i++) + { + + } + + } + + #endregion + + #region HAZD + + static void ScanHAZD(List messages, MessageCore messageCore, ExcelReader reader) + { + Message hazdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.HAZD); + if (hazdMessage.Elements.Count == 0) + { + HAZ newHaza = new HAZ(); + newHaza.IsDeparture = true; + newHaza.MessageHeader = hazdMessage; + hazdMessage.Elements.Add(newHaza); + } + HAZ hazd = hazdMessage.Elements[0] as HAZ; + + } + + #endregion + #region INFO static void ScanINFO(List messages, MessageCore messageCore, ExcelReader reader) @@ -404,6 +509,10 @@ namespace bsmd.ExcelReadService } reader.Conf.ConfirmText("STAT.TransportMode", transportMode, stat.TransportMode.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + // Vessel Email as HerbergEmail sichern + messageCore.HerbergEmailContactReportingVessel = reader.ReadText("ShipMail"); + reader.Conf.ConfirmText("ShipMail", messageCore.HerbergEmailContactReportingVessel, messageCore.HerbergEmailContactReportingVessel.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); + // wird nicht wieder entfernt (core ist auch da!) } @@ -426,7 +535,9 @@ namespace bsmd.ExcelReadService if (messageCore.IsTransit) noa_nod.ETAToKielCanal = messageCore.ETAKielCanal; else { + noa_nod.ETAToPortOfCall = messageCore.ETA; + reader.Conf.ConfirmDate("NOA_NOD.ETAToPortOfCall", noa_nod.ETAToPortOfCall, ExcelReader.ReadState.OK); for (int i = 1; i <= noa_nod.NumberOfExcelRows; i++) { @@ -502,6 +613,7 @@ namespace bsmd.ExcelReadService reader.Conf.ConfirmText("NOA_NOD.NextPort", nextPort, noa_nod.NextPort.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); noa_nod.ETDFromPortOfCall = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall"); + reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", noa_nod.ETDFromPortOfCall, ExcelReader.ReadState.OK); noa_nod.ETDFromLastPort = reader.ReadDateTime("NOA_NOD.ETDDateFromLastPort", "NOA_NOD.ETDTimeFromLastPort"); noa_nod.ETAToNextPort = reader.ReadDateTime("NOA_NOD.ETADateToNextPort", "NOA_NOD.ETATimeToNextPort"); // DK @@ -567,6 +679,7 @@ namespace bsmd.ExcelReadService was.WasteDisposalServiceProvider[0].WasteDisposalServiceProviderName = wastedispServProvName; was.WasteDisposalServiceProvider[0].WasteDisposalDelivery = was.WasteDisposalDelivery; } + reader.Conf.ConfirmText("WAS.WasteDisposalServiceProviderName", wastedispServProvName, wastedispServProvName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); // Waste 1 - 15 for (int i = 1; i <= was.NumberOfExcelRows; i++) @@ -932,7 +1045,7 @@ namespace bsmd.ExcelReadService if (bkra.BunkerFuelType.IsNullOrEmpty() && !bkra.BunkerFuelQuantity_TNE.HasValue) reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK); // "WARN" Quantity falls Menge aber kein Type - if(bkra.BunkerFuelQuantity_TNE.HasValue && !bkra.BunkerFuelType.IsNullOrEmpty()) + if(bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty()) { reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL); reader.Conf.ConfirmNumber(lnQuantity, bkra.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN); @@ -972,7 +1085,7 @@ namespace bsmd.ExcelReadService if (bkrd.BunkerFuelType.IsNullOrEmpty() && !bkrd.BunkerFuelQuantity_TNE.HasValue) reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK); // "WARN" Quantity falls Menge aber kein Type - if (bkrd.BunkerFuelQuantity_TNE.HasValue && !bkrd.BunkerFuelType.IsNullOrEmpty()) + if (bkrd.BunkerFuelQuantity_TNE.HasValue && bkrd.BunkerFuelType.IsNullOrEmpty()) { reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL); reader.Conf.ConfirmNumber(lnQuantity, bkrd.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN); @@ -1452,6 +1565,13 @@ namespace bsmd.ExcelReadService reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE); reader.Conf.ConfirmText("ID", visitTransitId, ExcelReader.ReadState.OK); + + // copy poc/imo/eta to return sheet + poc = reader.ReadText("Visit.PortOfCall"); + reader.Conf.ConfirmText("Visit.PortOfCall", poc, ExcelReader.ReadState.OK); + imo = reader.ReadText("Visit.IMONumber"); + reader.Conf.ConfirmText("Visit.IMONumber", imo, ExcelReader.ReadState.OK); + eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall"); } else { diff --git a/nsw/Source/bsmd.database/HAZ.cs b/nsw/Source/bsmd.database/HAZ.cs index d05fe8c4..55f0fb80 100644 --- a/nsw/Source/bsmd.database/HAZ.cs +++ b/nsw/Source/bsmd.database/HAZ.cs @@ -57,6 +57,12 @@ namespace bsmd.database [ShowReport] public bool? DPGClassificationMARPOL_ANNEX_I { get; set; } + // DK + public string DPGContactFamilyName { get; set; } + + // DK + public string DPGContactPhone { get; set; } + public List IMDGPositions { get { return this.imdgPositions; } } public List IBCPositions { get { return this.ibcPositions; } } @@ -111,6 +117,8 @@ namespace bsmd.database scmd.Parameters.AddWithNullableValue("@P9", this.DPGClassificationMARPOL_ANNEX_I); scmd.Parameters.AddWithNullableValue("@P10", this.TransmissionType); scmd.Parameters.AddWithNullableValue("@P11", this.MOUBaltic); + scmd.Parameters.AddWithNullableValue("@P12", this.DPGContactFamilyName); + scmd.Parameters.AddWithNullableValue("@P13", this.DPGContactPhone); if (this.IsNew) { @@ -120,14 +128,14 @@ namespace bsmd.database { scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnDeparture, DPGManifestOnBoardOnDeparture, " + "INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " + - "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)", + "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13)", this.Tablename); } else { scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, " + "INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " + - "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)", + "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13)", this.Tablename); } } @@ -138,13 +146,13 @@ namespace bsmd.database { scmd.CommandText = string.Format("UPDATE {0} SET NODPGOnBoardOnDeparture = @P2, DPGManifestOnBoardOnDeparture = @P3, " + "INFShipClass = @P4, DPGClassificationIMDG = @P5, DPGClassificationIGC = @P6, DPGClassificationIBC = @P7, " + - "DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9, TransmissionType = @P10, MOUBaltic = @P11 WHERE Id = @ID", this.Tablename); + "DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9, TransmissionType = @P10, MOUBaltic = @P11, DPGContactFamilyName = @P12, DPGContactPhone = @P13 WHERE Id = @ID", this.Tablename); } else { scmd.CommandText = string.Format("UPDATE {0} SET NODPGOnBoardOnArrival = @P2, DPGManifestOnBoardOnArrival = @P3, " + "INFShipClass = @P4, DPGClassificationIMDG = @P5, DPGClassificationIGC = @P6, DPGClassificationIBC = @P7, " + - "DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9, TransmissionType = @P10, MOUBaltic = @P11 WHERE Id = @ID", this.Tablename); + "DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9, TransmissionType = @P10, MOUBaltic = @P11, DPGContactFamilyName = @P12, DPGContactPhone = @P13 WHERE Id = @ID", this.Tablename); } } } @@ -153,13 +161,13 @@ namespace bsmd.database { string query = string.Format("SELECT Id, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, INFShipClass, " + "DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " + - "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic FROM {0} ", this.Tablename); + "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone FROM {0} ", this.Tablename); if (this.IsDeparture) { query = string.Format("SELECT Id, NoDPGOnBoardOnDeparture, DPGManifestOnBoardOnDeparture, INFShipClass, " + "DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " + - "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic FROM {0} ", this.Tablename); + "DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone FROM {0} ", this.Tablename); } switch (filter) @@ -196,6 +204,8 @@ namespace bsmd.database if (!reader.IsDBNull(8)) haz.DPGClassificationMARPOL_ANNEX_I = reader.GetBoolean(8); if (!reader.IsDBNull(9)) haz.TransmissionType = reader.GetString(9); if (!reader.IsDBNull(10)) haz.MOUBaltic = reader.GetBoolean(10); + if (!reader.IsDBNull(11)) haz.DPGContactFamilyName = reader.GetString(11); + if (!reader.IsDBNull(12)) haz.DPGContactPhone = reader.GetString(12); result.Add(haz); } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index e6f44653..7b32e2a6 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.3.3")] +[assembly: AssemblyInformationalVersion("3.3.4")] [assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")] [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 1f983515..34da9674 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("3.3.3.*")] +[assembly: AssemblyVersion("3.3.4.*")]