diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index a84f816a..5446d2eb 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 085df73c..2a63217f 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.0.3")] +[assembly: AssemblyInformationalVersion("3.0.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 f8fa6578..df71804a 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.0.3.*")] +[assembly: AssemblyVersion("3.0.4.*")] diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 75e3bdc8..bfc01b63 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -458,7 +458,7 @@ namespace bsmd.dbh { BRKA bkra = message.Elements[i] as BRKA; rootBKRA.BunkerFuelArrival[i] = new RootBKRABunkerFuelArrival(); - rootBKRA.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = (decimal) (bkra.BunkerFuelQuantity_TNE ?? 0); + rootBKRA.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = Decimal.Round((decimal) (bkra.BunkerFuelQuantity_TNE ?? 0),3); rootBKRA.BunkerFuelArrival[i].BunkerFuelType = bkra.BunkerFuelType; } item = rootBKRA; @@ -477,7 +477,7 @@ namespace bsmd.dbh { BRKD bkrd = message.Elements[i] as BRKD; rootBKRD.BunkerFuelDeparture[i] = new RootBKRDBunkerFuelDeparture(); - rootBKRD.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = (decimal) (bkrd.BunkerFuelQuantity_TNE ?? 0); + rootBKRD.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = Decimal.Round((decimal) (bkrd.BunkerFuelQuantity_TNE ?? 0),3); rootBKRD.BunkerFuelDeparture[i].BunkerFuelType = bkrd.BunkerFuelType; } item = rootBKRD; @@ -490,7 +490,7 @@ namespace bsmd.dbh { RootTIEFA rootTIEFA = new RootTIEFA(); TIEFA tiefa = message.Elements[0] as TIEFA; - rootTIEFA.DraughtUponArrival_DMT = (decimal) (tiefa.DraughtUponArrival_DMT ?? 0); + rootTIEFA.DraughtUponArrival_DMT = Decimal.Round((decimal) (tiefa.DraughtUponArrival_DMT ?? 0), 1); item = rootTIEFA; } break; @@ -501,7 +501,7 @@ namespace bsmd.dbh { RootTIEFD rootTIEFD = new RootTIEFD(); TIEFD tiefd = message.Elements[0] as TIEFD; - rootTIEFD.DraughtUponDeparture_DMT = (decimal) (tiefd.DraughtUponDeparture_DMT ?? 0); + rootTIEFD.DraughtUponDeparture_DMT = Decimal.Round((decimal) (tiefd.DraughtUponDeparture_DMT ?? 0)); item = rootTIEFD; } break; @@ -555,8 +555,8 @@ namespace bsmd.dbh rootStat.CallSign = stat.CallSign; rootStat.MMSINumber = stat.MMSINumber; rootStat.Flag = stat.Flag; - if (stat.LengthOverall_MTR.HasValue) rootStat.LengthOverall_MTR = (decimal) (stat.LengthOverall_MTR.Value); - if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = (decimal) (stat.Beam_MTR.Value); + if (stat.LengthOverall_MTR.HasValue) rootStat.LengthOverall_MTR = Decimal.Round((decimal) (stat.LengthOverall_MTR.Value), 2); + if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = Decimal.Round((decimal) (stat.Beam_MTR.Value)); if (stat.GrossTonnage.HasValue) rootStat.GrossTonnage = stat.GrossTonnage.Value; rootStat.PortOfRegistry = stat.PortOfRegistry; rootStat.ShipType = stat.ShipType; @@ -597,7 +597,7 @@ namespace bsmd.dbh rootLADG.Cargo[i].CargoHandlingType = (HandlingType)(ladg.CargoHandlingType); rootLADG.Cargo[i].CargoCodeNST = ladg.CargoCodeNST; if (ladg.CargoGrossQuantity_TNE.HasValue) - rootLADG.Cargo[i].CargoGrossQuantity_TNE = (decimal) ladg.CargoGrossQuantity_TNE.Value; + rootLADG.Cargo[i].CargoGrossQuantity_TNE = Decimal.Round((decimal) ladg.CargoGrossQuantity_TNE.Value, 3); rootLADG.Cargo[i].CargoNumberOfItemsSpecified = ladg.CargoNumberOfItems.HasValue; if (ladg.CargoNumberOfItems.HasValue) rootLADG.Cargo[i].CargoNumberOfItems = ladg.CargoNumberOfItems.Value; @@ -631,7 +631,7 @@ namespace bsmd.dbh rootInfo.FumigatedBulkCargo = RootINFOFumigatedBulkCargo.N; rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue; if (info.DeplacementSummerDraught_TNE.HasValue) - rootInfo.DeadWeightSummer_TNE = (decimal) info.DeplacementSummerDraught_TNE.Value; + rootInfo.DeadWeightSummer_TNE = Decimal.Round((decimal) info.DeplacementSummerDraught_TNE.Value, 3); item = rootInfo; } break; @@ -673,13 +673,14 @@ namespace bsmd.dbh } if (pre72h.VolumeOfCargo.HasValue) - rootPre.TankerDetails.VolumeOfCargo_TNE = (decimal) (pre72h.VolumeOfCargo.Value); + rootPre.TankerDetails.VolumeOfCargo_TNE = Decimal.Round((decimal) (pre72h.VolumeOfCargo.Value), 3); rootPre.PlannedOperations = pre72h.PlannedOperations; rootPre.PlannedWorks = pre72h.PlannedWorks; + rootPre.DateOfLastExpandedInspectionSpecified = pre72h.DateOfLastExpandedInspection.HasValue; if (pre72h.DateOfLastExpandedInspection.HasValue) rootPre.DateOfLastExpandedInspection = pre72h.DateOfLastExpandedInspection.Value; if (pre72h.PlannedPeriodOfStay_HUR.HasValue) - rootPre.PlannedPeriodOfStay_HUR = (decimal) (pre72h.PlannedPeriodOfStay_HUR.Value); + rootPre.PlannedPeriodOfStay_HUR = Decimal.Round((decimal) (pre72h.PlannedPeriodOfStay_HUR.Value), 2); item = rootPre; } @@ -899,15 +900,15 @@ namespace bsmd.dbh if (was.Waste[j - 5].WasteType.HasValue) rww.WasteType = (WasteType) (was.Waste[j - 5].WasteType.Value - 1); // im generierten Code ist das 0-basiert if (was.Waste[j - 5].WasteDisposalAmount_MTQ.HasValue) - rww.WasteDisposalAmount_MTQ = (decimal)was.Waste[j - 5].WasteDisposalAmount_MTQ.Value; + rww.WasteDisposalAmount_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteDisposalAmount_MTQ.Value,3); rww.WasteDetails = new RootWASWasteWasteDetails(); if (was.Waste[j - 5].WasteCapacity_MTQ.HasValue) - rww.WasteDetails.WasteCapacity_MTQ = (decimal)was.Waste[j - 5].WasteCapacity_MTQ.Value; + rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteCapacity_MTQ.Value,3); if (was.Waste[j - 5].WasteAmountRetained_MTQ.HasValue) - rww.WasteDetails.WasteAmountRetained_MTQ = (decimal)was.Waste[j - 5].WasteAmountRetained_MTQ.Value; + rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteAmountRetained_MTQ.Value,3); rww.WasteDetails.WasteDisposalPort = was.Waste[j - 5].WasteDisposalPort; if (was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.HasValue) - rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (decimal)was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.Value; + rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.Value, 3); } } } @@ -941,12 +942,12 @@ namespace bsmd.dbh if (towa.TowageOnArrivalGrossTonnage.HasValue) rootTowa.TowageOnArrival[i].TowageOnArrivalGrossTonnage = towa.TowageOnArrivalGrossTonnage.Value; if (towa.TowageOnArrivalLengthOverall_MTR.HasValue) - rootTowa.TowageOnArrival[i].TowageOnArrivalLengthOverall_MTR = (decimal) towa.TowageOnArrivalLengthOverall_MTR.Value; + rootTowa.TowageOnArrival[i].TowageOnArrivalLengthOverall_MTR = decimal.Round((decimal) towa.TowageOnArrivalLengthOverall_MTR.Value, 2); if (towa.TowageOnArrivalBeam_MTR.HasValue) - rootTowa.TowageOnArrival[i].TowageOnArrivalBeam_MTR = (decimal) towa.TowageOnArrivalBeam_MTR.Value; + rootTowa.TowageOnArrival[i].TowageOnArrivalBeam_MTR = decimal.Round((decimal) towa.TowageOnArrivalBeam_MTR.Value, 2); rootTowa.TowageOnArrival[i].TowageOnArrivalPurposeOfCall = towa.TowageOnArrivalPurposeOfCall; if (towa.TowageOnArrivalDraught_DMT.HasValue) - rootTowa.TowageOnArrival[i].TowageOnArrivalDraught_DMT = (decimal) towa.TowageOnArrivalDraught_DMT.Value; + rootTowa.TowageOnArrival[i].TowageOnArrivalDraught_DMT = decimal.Round((decimal) towa.TowageOnArrivalDraught_DMT.Value, 1); rootTowa.TowageOnArrival[i].TowageOnArrivalRemarks = towa.TowageOnArrivalRemarks; } item = rootTowa; @@ -975,11 +976,11 @@ namespace bsmd.dbh rootTowd.TowageOnDeparture[i].TowageOnDepartureOperator.TowageOnDepartureOperatorFax = towd.TowageOnDepartureOperatorFax; rootTowd.TowageOnDeparture[i].TowageOnDepartureOperator.TowageOnDepartureOperatorEMail = towd.TowageOnDepartureOperatorEmail; if (towd.TowageOnDepartureLengthOverall_MTR.HasValue) - rootTowd.TowageOnDeparture[i].TowageOnDepartureLengthOverall_MTR = (decimal) towd.TowageOnDepartureLengthOverall_MTR.Value; + rootTowd.TowageOnDeparture[i].TowageOnDepartureLengthOverall_MTR = decimal.Round((decimal) towd.TowageOnDepartureLengthOverall_MTR.Value, 2); if (towd.TowageOnDepartureBeam_MTR.HasValue) - rootTowd.TowageOnDeparture[i].TowageOnDepartureBeam_MTR = (decimal) towd.TowageOnDepartureBeam_MTR.Value; + rootTowd.TowageOnDeparture[i].TowageOnDepartureBeam_MTR = decimal.Round((decimal) towd.TowageOnDepartureBeam_MTR.Value, 2); if (towd.TowageOnDepartureDraught_DMT.HasValue) - rootTowd.TowageOnDeparture[i].TowageOnDepartureDraught_DMT = (decimal) towd.TowageOnDepartureDraught_DMT.Value; + rootTowd.TowageOnDeparture[i].TowageOnDepartureDraught_DMT = decimal.Round((decimal) towd.TowageOnDepartureDraught_DMT.Value, 1); rootTowd.TowageOnDeparture[i].TowageOnDepartureRemarks = towd.TowageOnDepartureRemarks; } item = rootTowd; @@ -1033,27 +1034,27 @@ namespace bsmd.dbh rootIMDG.TechnicalName = imdgPos.TechnicalName; rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue; if (imdgPos.NetExplosiveMass_KGM.HasValue) - rootIMDG.NetExplosiveMass_KGM = (decimal)imdgPos.NetExplosiveMass_KGM.Value; + rootIMDG.NetExplosiveMass_KGM = decimal.Round((decimal)imdgPos.NetExplosiveMass_KGM.Value, 3); rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue; if (imdgPos.Class7MaxActivity_BQL.HasValue) - rootIMDG.Class7MaxActivity_BQL = (decimal)imdgPos.Class7MaxActivity_BQL.Value; + rootIMDG.Class7MaxActivity_BQL = decimal.Round((decimal)imdgPos.Class7MaxActivity_BQL.Value, 6); rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue; if (imdgPos.Class7Category.HasValue) rootIMDG.Class7Category = imdgPos.Class7Category.Value; rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue; if (imdgPos.Class7TransportIndex.HasValue) - rootIMDG.Class7TransportIndex = (decimal)imdgPos.Class7TransportIndex.Value; + rootIMDG.Class7TransportIndex = decimal.Round((decimal)imdgPos.Class7TransportIndex.Value, 1); rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue; if (imdgPos.Class7CSI.HasValue) rootIMDG.Class7CSI = imdgPos.Class7CSI.Value; rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue; if (imdgPos.ControlTemperature_CEL.HasValue) - rootIMDG.ControlTemperature_CEL = (decimal)imdgPos.ControlTemperature_CEL.Value; + rootIMDG.ControlTemperature_CEL = decimal.Round((decimal)imdgPos.ControlTemperature_CEL.Value, 2); rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue; if (imdgPos.EmergencyTemperature_CEL.HasValue) - rootIMDG.EmergencyTemperature_CEL = (decimal)imdgPos.EmergencyTemperature_CEL.Value; + rootIMDG.EmergencyTemperature_CEL = decimal.Round((decimal)imdgPos.EmergencyTemperature_CEL.Value, 2); if (imdgPos.SubsidiaryRiskList.Count > 0) { rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count]; @@ -1071,13 +1072,13 @@ namespace bsmd.dbh rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue; if (imdgPos.NetQuantity_KGM.HasValue) - rootIMDG.NetQuantity_KGM = (decimal)imdgPos.NetQuantity_KGM.Value; + rootIMDG.NetQuantity_KGM = decimal.Round((decimal)imdgPos.NetQuantity_KGM.Value, 3); rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue; if (imdgPos.GrossQuantity_KGM.HasValue) - rootIMDG.GrossQuantity_KGM = (decimal)imdgPos.GrossQuantity_KGM.Value; + rootIMDG.GrossQuantity_KGM = decimal.Round((decimal)imdgPos.GrossQuantity_KGM.Value, 3); rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue; if (imdgPos.Volume_MTQ.HasValue) - rootIMDG.Volume_MTQ = (decimal)imdgPos.Volume_MTQ.Value; + rootIMDG.Volume_MTQ = decimal.Round((decimal)imdgPos.Volume_MTQ.Value, 3); rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; if (imdgPos.GeneralCargoIBC.HasValue) rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; @@ -1112,7 +1113,7 @@ namespace bsmd.dbh rootIBC.FlashpointInformation = (FlashpointInfoType)ibcPos.FlashpointInformation.Value; rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL; if (ibcPos.Quantity_KGM.HasValue) - rootIBC.Quantity_KGM = (decimal)ibcPos.Quantity_KGM.Value; + rootIBC.Quantity_KGM = decimal.Round((decimal)ibcPos.Quantity_KGM.Value, 3); rootIBC.StowagePosition = ibcPos.StowagePosition; rootIBC.PortOfLoading = ibcPos.PortOfLoading; rootIBC.PortOfDischarge = ibcPos.PortOfDischarge; @@ -1139,7 +1140,7 @@ namespace bsmd.dbh rootIGC.IMOClass = igcPos.IMOClass; rootIGC.ProductName = igcPos.ProductName; if (igcPos.Quantity_KGM.HasValue) - rootIGC.Quantity_KGM = (decimal)igcPos.Quantity_KGM.Value; + rootIGC.Quantity_KGM = decimal.Round((decimal)igcPos.Quantity_KGM.Value, 3); rootIGC.StowagePosition = igcPos.StowagePosition; rootIGC.PortOfLoading = igcPos.PortOfLoading; rootIGC.PortOfDischarge = igcPos.PortOfDischarge; @@ -1165,7 +1166,7 @@ namespace bsmd.dbh rootIMSBC.UNNumber = imsbcPos.UNNumber; rootIMSBC.IMOClass = imsbcPos.IMOClass; if (imsbcPos.Quantity_KGM.HasValue) - rootIMSBC.Quantity_KGM = (decimal)imsbcPos.Quantity_KGM.Value; + rootIMSBC.Quantity_KGM = decimal.Round((decimal)imsbcPos.Quantity_KGM.Value, 3); rootIMSBC.StowagePosition = imsbcPos.StowagePosition; rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading; rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge; @@ -1190,7 +1191,7 @@ namespace bsmd.dbh rootMarpol.FlashpointInformation = (FlashpointInfoType)marpolPos.FlashpointInformation.Value; rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL; if (marpolPos.Quantity_KGM.HasValue) - rootMarpol.Quantity_KGM = (decimal)marpolPos.Quantity_KGM.Value; + rootMarpol.Quantity_KGM = decimal.Round((decimal)marpolPos.Quantity_KGM.Value, 3); rootMarpol.StowagePosition = marpolPos.StowagePosition; rootMarpol.PortOfLoading = marpolPos.PortOfLoading; rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge; @@ -1266,27 +1267,27 @@ namespace bsmd.dbh rootIMDG.TechnicalName = imdgPos.TechnicalName; rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue; if (imdgPos.NetExplosiveMass_KGM.HasValue) - rootIMDG.NetExplosiveMass_KGM = (decimal)imdgPos.NetExplosiveMass_KGM.Value; + rootIMDG.NetExplosiveMass_KGM = decimal.Round((decimal)imdgPos.NetExplosiveMass_KGM.Value, 3); rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue; if (imdgPos.Class7MaxActivity_BQL.HasValue) - rootIMDG.Class7MaxActivity_BQL = (decimal)imdgPos.Class7MaxActivity_BQL.Value; + rootIMDG.Class7MaxActivity_BQL = decimal.Round((decimal)imdgPos.Class7MaxActivity_BQL.Value, 6); rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue; if (imdgPos.Class7Category.HasValue) rootIMDG.Class7Category = imdgPos.Class7Category.Value; rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue; if (imdgPos.Class7TransportIndex.HasValue) - rootIMDG.Class7TransportIndex = (decimal)imdgPos.Class7TransportIndex.Value; + rootIMDG.Class7TransportIndex = decimal.Round((decimal)imdgPos.Class7TransportIndex.Value, 1); rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue; if (imdgPos.Class7CSI.HasValue) rootIMDG.Class7CSI = imdgPos.Class7CSI.Value; rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue; if (imdgPos.ControlTemperature_CEL.HasValue) - rootIMDG.ControlTemperature_CEL = (decimal)imdgPos.ControlTemperature_CEL.Value; + rootIMDG.ControlTemperature_CEL = decimal.Round((decimal)imdgPos.ControlTemperature_CEL.Value, 2); rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue; if (imdgPos.EmergencyTemperature_CEL.HasValue) - rootIMDG.EmergencyTemperature_CEL = (decimal)imdgPos.EmergencyTemperature_CEL.Value; + rootIMDG.EmergencyTemperature_CEL = decimal.Round((decimal)imdgPos.EmergencyTemperature_CEL.Value, 2); if (imdgPos.SubsidiaryRiskList.Count > 0) { rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count]; @@ -1304,13 +1305,13 @@ namespace bsmd.dbh rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue; if (imdgPos.NetQuantity_KGM.HasValue) - rootIMDG.NetQuantity_KGM = (decimal)imdgPos.NetQuantity_KGM.Value; + rootIMDG.NetQuantity_KGM = decimal.Round((decimal)imdgPos.NetQuantity_KGM.Value, 3); rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue; if (imdgPos.GrossQuantity_KGM.HasValue) - rootIMDG.GrossQuantity_KGM = (decimal)imdgPos.GrossQuantity_KGM.Value; + rootIMDG.GrossQuantity_KGM = decimal.Round((decimal)imdgPos.GrossQuantity_KGM.Value, 3); rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue; if (imdgPos.Volume_MTQ.HasValue) - rootIMDG.Volume_MTQ = (decimal)imdgPos.Volume_MTQ.Value; + rootIMDG.Volume_MTQ = decimal.Round((decimal)imdgPos.Volume_MTQ.Value, 3); rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; if (imdgPos.GeneralCargoIBC.HasValue) rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; @@ -1345,7 +1346,7 @@ namespace bsmd.dbh rootIBC.FlashpointInformation = (FlashpointInfoType)ibcPos.FlashpointInformation.Value; rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL; if (ibcPos.Quantity_KGM.HasValue) - rootIBC.Quantity_KGM = (decimal) ibcPos.Quantity_KGM.Value; + rootIBC.Quantity_KGM = decimal.Round((decimal) ibcPos.Quantity_KGM.Value, 3); rootIBC.StowagePosition = ibcPos.StowagePosition; rootIBC.PortOfLoading = ibcPos.PortOfLoading; rootIBC.PortOfDischarge = ibcPos.PortOfDischarge; @@ -1372,7 +1373,7 @@ namespace bsmd.dbh rootIGC.IMOClass = igcPos.IMOClass; rootIGC.ProductName = igcPos.ProductName; if (igcPos.Quantity_KGM.HasValue) - rootIGC.Quantity_KGM = (decimal)igcPos.Quantity_KGM.Value; + rootIGC.Quantity_KGM = decimal.Round((decimal)igcPos.Quantity_KGM.Value, 3); rootIGC.StowagePosition = igcPos.StowagePosition; rootIGC.PortOfLoading = igcPos.PortOfLoading; rootIGC.PortOfDischarge = igcPos.PortOfDischarge; @@ -1398,7 +1399,7 @@ namespace bsmd.dbh rootIMSBC.UNNumber = imsbcPos.UNNumber; rootIMSBC.IMOClass = imsbcPos.IMOClass; if (imsbcPos.Quantity_KGM.HasValue) - rootIMSBC.Quantity_KGM = (decimal)imsbcPos.Quantity_KGM.Value; + rootIMSBC.Quantity_KGM = decimal.Round((decimal)imsbcPos.Quantity_KGM.Value, 3); rootIMSBC.StowagePosition = imsbcPos.StowagePosition; rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading; rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge; @@ -1423,7 +1424,7 @@ namespace bsmd.dbh rootMarpol.FlashpointInformation = (FlashpointInfoType) marpolPos.FlashpointInformation.Value; rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL; if (marpolPos.Quantity_KGM.HasValue) - rootMarpol.Quantity_KGM = (decimal)marpolPos.Quantity_KGM.Value; + rootMarpol.Quantity_KGM = decimal.Round((decimal)marpolPos.Quantity_KGM.Value, 3); rootMarpol.StowagePosition = marpolPos.StowagePosition; rootMarpol.PortOfLoading = marpolPos.PortOfLoading; rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge; diff --git a/nsw/Source/bsmd.herberg.FormService/Util.cs b/nsw/Source/bsmd.herberg.FormService/Util.cs index 68b007fa..98f59db9 100644 --- a/nsw/Source/bsmd.herberg.FormService/Util.cs +++ b/nsw/Source/bsmd.herberg.FormService/Util.cs @@ -1099,63 +1099,106 @@ namespace bsmd.herberg.FormService if (vDict.ContainsKey("WasteDisposalDelivery")) was.WasteDisposalDelivery = (byte) Enum.Parse(typeof(Enums.WasteDisposalDelivery), vDict["WasteDisposalDelivery"], true); if (vDict.ContainsKey("ConfirmationOfCorrectness")) was.ConfirmationOfCorrectness = vDict["ConfirmationOfCorrectness"].Equals("Y"); - // parse given waste - foreach(int key in nDict.Keys) { - Dictionary wDict = nDict[key]; - Waste waste = was.GetSublistElementWithIdentifier(key.ToString()) as Waste; - if (waste == null) + // parse given waste, depending on old (pre 3.0) or new (3.0) Style + + if (nDict.Keys.Count < 2) + { + for (int wCounter = 1; wCounter <= 9; wCounter++) { - foreach (Waste existingWaste in was.Waste) + string wda = string.Format("WasteDisposalAmount_MTQ{0}", wCounter); + string wc = string.Format("WasteCapacity_MTQ{0}", wCounter); + string war = string.Format("WasteAmountRetained_MTQ{0}", wCounter); + string wagtnp = string.Format("WasteAmountGeneratedTillNextPort_MTQ{0}", wCounter); + string wt = string.Format("WasteType{0}", wCounter); + string wdpc = string.Format("WasteDisposalPortCode{0}", wCounter); + string wdcc = string.Format("WasteDisposalCountryCode{0}", wCounter); + string wd = string.Format("WasteDescription{0}", wCounter); + + Waste waste = was.GetSublistElementWithIdentifier(wCounter.ToString()) as Waste; + if (waste == null) { - if (wDict.ContainsKey("WasteType") && - ((existingWaste.WasteType ?? 0) == (Enums.ParseWasteType(wDict["WasteType"]) ?? 0)) - ) - { - waste = existingWaste; - break; - } + waste = new Waste(); + waste.Identifier = wCounter.ToString(); + waste.WAS = was; + was.Waste.Add(waste); } - } - if (waste == null) - { - waste = new Waste(); - waste.Identifier = key.ToString(); - waste.WAS = was; - was.Waste.Add(waste); - } + waste.WasteType = (byte) wCounter; + if (vDict.ContainsKey(wda)) waste.WasteDisposalAmount_MTQ = Extensions.TryParseDouble(vDict[wda]); + if (vDict.ContainsKey(wc)) waste.WasteCapacity_MTQ = Extensions.TryParseDouble(vDict[wc]); + if (vDict.ContainsKey(war)) waste.WasteAmountRetained_MTQ = Extensions.TryParseDouble(vDict[war]); + if (vDict.ContainsKey(wagtnp)) waste.WasteAmountGeneratedTillNextPort_MTQ = Extensions.TryParseDouble(vDict[wagtnp]); + if ((vDict.ContainsKey(wdpc)) && (vDict.ContainsKey(wdcc))) waste.WasteDisposalPort = vDict[wdcc] + vDict[wdpc]; + if (vDict.ContainsKey(wd)) waste.WasteDescription = vDict[wd]; - if (wDict.ContainsKey("WasteAmountGeneratedTillNextPort_MTQ")) waste.WasteAmountGeneratedTillNextPort_MTQ = Extensions.TryParseDouble(wDict["WasteAmountGeneratedTillNextPort_MTQ"]); - if (wDict.ContainsKey("WasteAmountRetained_MTQ")) waste.WasteAmountRetained_MTQ = Extensions.TryParseDouble(wDict["WasteAmountRetained_MTQ"]); - if (wDict.ContainsKey("WasteCapacity_MTQ")) waste.WasteCapacity_MTQ = Extensions.TryParseDouble(wDict["WasteCapacity_MTQ"]); - if (wDict.ContainsKey("WasteDisposalAmount_MTQ")) waste.WasteDisposalAmount_MTQ = Extensions.TryParseDouble(wDict["WasteDisposalAmount_MTQ"]); - if (wDict.ContainsKey("WasteDescription")) waste.WasteDescription = wDict["WasteDescription"]; - if (wDict.ContainsKey("WasteType")) waste.WasteType = Enums.ParseWasteType(wDict["WasteType"]); - if (wDict.ContainsKey("WasteDisposalCountryCode") && wDict.ContainsKey("WasteDisposalPortCode")) - waste.WasteDisposalPort = wDict["WasteDisposalCountryCode"] + wDict["WasteDisposalPortCode"]; + if (!waste.WasteDisposalPort.IsNullOrEmpty() && waste.WasteDisposalPort.Length > 5) + { + _log.WarnFormat("WasteDisposalPort format ERROR [{0}], truncating", was.LastWasteDisposalPort); + waste.WasteDisposalPort = waste.WasteDisposalPort.Substring(0, 5); + } - // Wenn das Feld leer ist mit "-" entwerten - if (((waste.WasteType ?? 0) == 3) && waste.WasteDescription.IsNullOrEmpty()) - waste.WasteDescription = "-"; - if (((waste.WasteType ?? 0) == 8) && waste.WasteDescription.IsNullOrEmpty()) - waste.WasteDescription = "-"; - if (((waste.WasteType ?? 0) == 9) && waste.WasteDescription.IsNullOrEmpty()) - waste.WasteDescription = "-"; - - if(!waste.WasteDisposalPort.IsNullOrEmpty() && waste.WasteDisposalPort.Length > 5) - { - _log.WarnFormat("WasteDisposalPort format ERROR [{0}], truncating", was.LastWasteDisposalPort); - waste.WasteDisposalPort = waste.WasteDisposalPort.Substring(0, 5); - } - - if (waste.WasteType.HasValue) - { saveMessages.Add(waste); } - else + } + else { + foreach (int key in nDict.Keys) { - // wenn nichtmal der WasteType gesetzt ist verwenden wir lieber den default und speichern das nicht - was.Waste.Remove(waste); + Dictionary wDict = nDict[key]; + Waste waste = was.GetSublistElementWithIdentifier(key.ToString()) as Waste; + if (waste == null) + { + foreach (Waste existingWaste in was.Waste) + { + if (wDict.ContainsKey("WasteType") && + ((existingWaste.WasteType ?? 0) == (Enums.ParseWasteType(wDict["WasteType"]) ?? 0)) + ) + { + waste = existingWaste; + break; + } + } + } + + if (waste == null) + { + waste = new Waste(); + waste.Identifier = key.ToString(); + waste.WAS = was; + was.Waste.Add(waste); + } + + if (wDict.ContainsKey("WasteAmountGeneratedTillNextPort_MTQ")) waste.WasteAmountGeneratedTillNextPort_MTQ = Extensions.TryParseDouble(wDict["WasteAmountGeneratedTillNextPort_MTQ"]); + if (wDict.ContainsKey("WasteAmountRetained_MTQ")) waste.WasteAmountRetained_MTQ = Extensions.TryParseDouble(wDict["WasteAmountRetained_MTQ"]); + if (wDict.ContainsKey("WasteCapacity_MTQ")) waste.WasteCapacity_MTQ = Extensions.TryParseDouble(wDict["WasteCapacity_MTQ"]); + if (wDict.ContainsKey("WasteDisposalAmount_MTQ")) waste.WasteDisposalAmount_MTQ = Extensions.TryParseDouble(wDict["WasteDisposalAmount_MTQ"]); + if (wDict.ContainsKey("WasteDescription")) waste.WasteDescription = wDict["WasteDescription"]; + if (wDict.ContainsKey("WasteType")) waste.WasteType = Enums.ParseWasteType(wDict["WasteType"]); + if (wDict.ContainsKey("WasteDisposalCountryCode") && wDict.ContainsKey("WasteDisposalPortCode")) + waste.WasteDisposalPort = wDict["WasteDisposalCountryCode"] + wDict["WasteDisposalPortCode"]; + + // Wenn das Feld leer ist mit "-" entwerten + if (((waste.WasteType ?? 0) == 3) && waste.WasteDescription.IsNullOrEmpty()) + waste.WasteDescription = "-"; + if (((waste.WasteType ?? 0) == 8) && waste.WasteDescription.IsNullOrEmpty()) + waste.WasteDescription = "-"; + if (((waste.WasteType ?? 0) == 9) && waste.WasteDescription.IsNullOrEmpty()) + waste.WasteDescription = "-"; + + if (!waste.WasteDisposalPort.IsNullOrEmpty() && waste.WasteDisposalPort.Length > 5) + { + _log.WarnFormat("WasteDisposalPort format ERROR [{0}], truncating", was.LastWasteDisposalPort); + waste.WasteDisposalPort = waste.WasteDisposalPort.Substring(0, 5); + } + + if (waste.WasteType.HasValue) + { + saveMessages.Add(waste); + } + else + { + // wenn nichtmal der WasteType gesetzt ist verwenden wir lieber den default und speichern das nicht + was.Waste.Remove(waste); + } } } diff --git a/nsw/Source/bsmd.herberg.FormService/packages.config b/nsw/Source/bsmd.herberg.FormService/packages.config new file mode 100644 index 00000000..a51db168 --- /dev/null +++ b/nsw/Source/bsmd.herberg.FormService/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file