Korrekturen, Version 2.4.6

This commit is contained in:
Daniel Schick 2015-11-10 06:58:46 +00:00
parent f41d6171f9
commit 7506fb74b7
13 changed files with 123 additions and 38 deletions

Binary file not shown.

View File

@ -0,0 +1,10 @@
PRINT N'Updating MessageCore..';
ALTER TABLE [dbo].[MessageCore] ADD [DefaultReportingPartyId] UNIQUEIDENTIFIER NULL;
GO
ALTER TABLE [dbo].[HAZA] ADD [TransmissionType] NVARCHAR (50) NULL;
GO
ALTER TABLE [dbo].[HAZD] ADD [TransmissionType] NVARCHAR (50) NULL;
GO

View File

@ -110,6 +110,8 @@ namespace SendNSWMessageService
_log.Debug("Visit/Transit not found, SENDING VISIT/TRANSIT message");
if (message.HIS == Message.NSWProvider.UNDEFINED)
message.HIS = core.InitialHIS;
if (core.DefaultReportingPartyId.HasValue)
message.ReportingPartyId = core.DefaultReportingPartyId;
toSendMessageList.Add(message);
}
}
@ -159,6 +161,7 @@ namespace SendNSWMessageService
if (haz != null)
{
if (haz.NoDPGOnBoardOnArrival ?? false) continue;
if (haz.TransmissionType != "EU-NOAD") continue;
}
}
}
@ -181,6 +184,8 @@ namespace SendNSWMessageService
{
if (message.HIS == Message.NSWProvider.UNDEFINED)
message.HIS = core.InitialHIS;
if (core.DefaultReportingPartyId.HasValue)
message.ReportingPartyId = core.DefaultReportingPartyId;
toSendMessageList.Add(message);
}

View File

@ -22,6 +22,7 @@ namespace bsmd.database
private List<IGCPosition> igcPositions = new List<IGCPosition>();
private List<IMSBCPosition> imsbcPositions = new List<IMSBCPosition>();
private List<MARPOL_Annex_I_Position> marpolPositions = new List<MARPOL_Annex_I_Position>();
private bool _isDeparture;
public HAZ()
{
@ -66,8 +67,21 @@ namespace bsmd.database
public List<MARPOL_Annex_I_Position> MARPOLPositions { get { return this.marpolPositions; } }
// selektor HAZA / HAZD
[ShowReport]
public bool IsDeparture { get; set; } // selektor HAZA / HAZD
public bool IsDeparture { get { return this._isDeparture; }
set
{
this._isDeparture = value;
this.tablename = this._isDeparture ? "[dbo].[HAZD]" : "[dbo].[HAZA]";
}
}
/// <summary>
/// No NSW field! Set to determine whether HAZ info should be reported to the NSW
/// </summary>
[ShowReport]
public string TransmissionType { get; set; }
#endregion
@ -86,21 +100,40 @@ namespace bsmd.database
scmd.Parameters.AddWithNullableValue("@P7", this.DPGClassificationIBC);
scmd.Parameters.AddWithNullableValue("@P8", this.DPGClassificationIMSBC);
scmd.Parameters.AddWithNullableValue("@P9", this.DPGClassificationMARPOL_ANNEX_I);
scmd.Parameters.AddWithNullableValue("@P10", this.TransmissionType);
if (this.IsNew)
{
this.CreateId();
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, " +
"INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9)", this.Tablename);
if (IsDeparture)
{
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnDeparture, DPGManifestOnBoardOnDeparture, " +
"INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10)", this.Tablename);
}
else
{
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, " +
"INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10)", this.Tablename);
}
}
else
{
scmd.Parameters.AddWithValue("@ID", this.Id);
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 WHERE Id = @ID", this.Tablename);
if (IsDeparture)
{
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 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 WHERE Id = @ID", this.Tablename);
}
}
}
@ -108,7 +141,14 @@ namespace bsmd.database
{
string query = string.Format("SELECT Id, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, INFShipClass, " +
"DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I FROM {0} ", this.Tablename);
"DPGClassificationMARPOL_ANNEX_I, TransmissionType FROM {0} ", this.Tablename);
if (this.IsDeparture)
{
query = string.Format("SELECT Id, NoDPGOnBoardOnDeparture, DPGManifestOnBoardOnDeparture, INFShipClass, " +
"DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType FROM {0} ", this.Tablename);
}
switch (filter)
{
@ -142,6 +182,7 @@ namespace bsmd.database
if (!reader.IsDBNull(6)) haz.DPGClassificationIBC = reader.GetBoolean(6);
if (!reader.IsDBNull(7)) haz.DPGClassificationIMSBC = reader.GetBoolean(7);
if (!reader.IsDBNull(8)) haz.DPGClassificationMARPOL_ANNEX_I = reader.GetBoolean(8);
if (!reader.IsDBNull(9)) haz.TransmissionType = reader.GetString(9);
result.Add(haz);
}

View File

@ -138,14 +138,14 @@ namespace bsmd.database
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
bool locationOK = (!this.PortFacilityPortLoCode.IsNullOrEmpty()) ||
(!this.PortFacilityPortName.IsNullOrEmpty() && !this.PortFacilityPortCountry.IsNullOrEmpty());
bool locationInsufficient = (this.PortFacilityPortLoCode.IsNullOrEmpty()) &&
(this.PortFacilityPortName.IsNullOrEmpty() || this.PortFacilityPortCountry.IsNullOrEmpty());
if (!locationOK)
if (locationInsufficient)
{
string val = string.Format("LoCode:{0} Port:{1} Country:{2}", this.PortFacilityPortLoCode ?? "", this.PortFacilityPortName ?? "",
this.PortFacilityPortCountry ?? "");
RuleEngine.CreateViolation(ValidationCode.V703, "Either LoCode or Country + Name must be given", val);
RuleEngine.CreateViolation(ValidationCode.V703, "Last 10 Port facilities: Either LoCode or Country + Name must be given", val);
}
}

View File

@ -270,10 +270,10 @@ namespace bsmd.database
}
else
{
if((this.NonAccidentalDeathsDuringVoyage ?? false) && ((this.NonAccidentalDeathsDuringVoyageCount ?? 0) == 0))
if ((this.NonAccidentalDeathsDuringVoyage ?? false) && ((this.NonAccidentalDeathsDuringVoyageCount ?? 0) == 0))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V761, "NonAccidentalDeathsDuringVoyageCount missing", null));
if((this.NumberOfIllPersonsHigherThanExpected ?? false) && ((this.NumberOfIllPersons ?? 0) == 0))
if ((this.NumberOfIllPersonsHigherThanExpected ?? false) && ((this.NumberOfIllPersons ?? 0) == 0))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V762, "Number of ill persons missing", null));
if ((this.SanitaryMeasuresApplied ?? false) && (
@ -293,12 +293,16 @@ namespace bsmd.database
(!this.InfectedAreaDate.HasValue || this.InfectedAreaPort.IsNullOrEmpty()))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V766, "Infected area date or port missing", null));
}
if (this.portOfCallLast30Days.Count == 0)
{
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "Port of Call last 30 day list is EMPTY", null));
}
foreach (PortOfCallLast30Days poc30d in this.portOfCallLast30Days)
{
RuleEngine.ValidateProperties(poc30d, errors);
poc30d.Validate(errors, violations);
foreach (PortOfCallLast30Days poc30d in this.portOfCallLast30Days)
{
RuleEngine.ValidateProperties(poc30d, errors);
poc30d.Validate(errors, violations);
}
}
}

View File

@ -212,6 +212,11 @@ namespace bsmd.database
/// </summary>
public List<MessageViolation> ViolationList { get { return this.violationList; } }
/// <summary>
/// Property to overwrite reporting party in certain circumstances (other melder meldet)
/// </summary>
public Guid? ReportingPartyId { get { return this.reportingPartyId; } set { this.reportingPartyId = value; } }
#endregion
#region IDatabaseEntity implementation

View File

@ -99,6 +99,8 @@ namespace bsmd.database
public string SietasSheetVersion { get; set; }
public Guid? DefaultReportingPartyId { get; set; }
#endregion
#region DatabaseEntity implementation
@ -142,6 +144,7 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@P22", this.ReportStatus);
scmd.Parameters.AddWithNullableValue("@P23", this.SietasSheetVersion);
scmd.Parameters.AddWithValue("@P24", this.Incoming ? 1 : 0);
scmd.Parameters.AddWithNullableValue("@P25", this.DefaultReportingPartyId);
if (this.IsNew)
{
@ -150,9 +153,9 @@ namespace bsmd.database
string query = string.Format("INSERT INTO {0} (Id, VisitId, TransitId, IMO, ENI, PoC, Portname, ETA, CustomerId, " +
"Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, HerbergFormGuid, " +
"HerbergFormTemplateGuid, HerbergReportType, HerbergEmailcontactReportingVessel, HerbergEmail24HrsContact, " +
"ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming) VALUES " +
"ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming, DefaultReportingPartyId) VALUES " +
"(@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, " +
"@P18, @P19, @P20, @P21, @P22, @P23, @P24)",
"@P18, @P19, @P20, @P21, @P22, @P23, @P24, @P25)",
this.Tablename);
scmd.CommandText = query;
}
@ -164,7 +167,7 @@ namespace bsmd.database
"Wetris_zz_56_datensatz_id = @P12, BSMDStatus = @P13, InitialHIS = @P14, HerbergFormGuid = @P15, " +
"HerbergFormTemplateGuid = @P16, HerbergReportType = @P17, HerbergEmailContactReportingVessel = @P18, " +
"HerbergEmail24HrsContact = @P19, ETAKielCanal = @P20, HerbergRevDate = @P21, ReportStatus = @P22, " +
"SietasSheetVersion = @P23, Incoming = @P24 WHERE Id = @ID", this.Tablename);
"SietasSheetVersion = @P23, Incoming = @P24, DefaultReportingPartyId = @P25 WHERE Id = @ID", this.Tablename);
scmd.CommandText = query;
}
}
@ -174,7 +177,8 @@ namespace bsmd.database
string query = string.Format("SELECT Id, VisitId, TransitId, IMO, ENI, PoC, Portname, " +
"ETA, CustomerId, Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, " +
"HerbergFormGuid, HerbergFormTemplateGuid, HerbergReportType, HerbergEmailContactReportingVessel, " +
"HerbergEmail24HrsContact, ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming FROM {0} ",
"HerbergEmail24HrsContact, ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming, " +
"DefaultReportingPartyId FROM {0} ",
this.Tablename);
switch (filter)
@ -256,6 +260,7 @@ namespace bsmd.database
if (!reader.IsDBNull(22)) core.ReportStatus = (ReportStatusEnum) Enum.ToObject(typeof(ReportStatusEnum), reader.GetByte(22));
if (!reader.IsDBNull(23)) core.SietasSheetVersion = reader.GetString(23);
if (!reader.IsDBNull(24)) core.Incoming = reader.GetBoolean(24);
if (!reader.IsDBNull(25)) core.DefaultReportingPartyId = reader.GetGuid(25);
result.Add(core);
}

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("2.4.3")]
[assembly: AssemblyInformationalVersion("2.4.6")]
[assembly: AssemblyCopyright("Copyright © 2014-2015 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")]

View File

@ -4,6 +4,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.3.*")]
[assembly: AssemblyVersion("2.4.6.*")]
// wenn das nicht auskommentiert wird erhalten wir eine Warnung
// [assembly: AssemblyFileVersion("1.0.0.*")]

View File

@ -139,14 +139,13 @@ namespace bsmd.database
{
// check violation 701
bool locationInsufficient = (this.ShipToShipActivityLocationLoCode.IsNullOrEmpty()) &&
(!this.ShipToShipActivityLocationCoordinatesLatitude.HasValue || !this.ShipToShipActivityLocationCoordinatesLongitude.HasValue);
bool locationOK = !this.ShipToShipActivityLocationName.IsNullOrEmpty() ||
!this.ShipToShipActivityLocationLoCode.IsNullOrEmpty() ||
(this.ShipToShipActivityLocationCoordinatesLatitude.HasValue &&
this.ShipToShipActivityLocationCoordinatesLongitude.HasValue);
if (!locationOK)
violations.Add(RuleEngine.CreateViolation(ValidationCode.V701, "Either LoCode, Name or Coordinates must be given", null));
if (locationInsufficient)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.V701, "Ship To Ship: Either LoCode or Coordinates must be given", null));
}
}
#endregion

View File

@ -570,6 +570,8 @@ namespace bsmd.dbh
rootInfo.ConstructionCharacteristicsOfShip = info.ConstructionCharacteristicsOfShip;
if (info.FumigatedBulkCargo.HasValue)
rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N;
else
rootInfo.FumigatedBulkCargo = RootINFOFumigatedBulkCargo.N;
rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue;
if (info.DeplacementSummerDraught_TNE.HasValue)
rootInfo.DeadWeightSummer_TNE = (float) info.DeplacementSummerDraught_TNE.Value;

View File

@ -32,6 +32,7 @@ namespace bsmd.herberg.FormService
if (repDict[key].Name.Equals("BSMD"))
{
bsmdParty = repDict[key];
break;
}
}
@ -152,7 +153,10 @@ namespace bsmd.herberg.FormService
List<DatabaseEntity> saveMessages = new List<DatabaseEntity>(); // 1:n messages
foreach (string groupMessageType in groupedVals.Keys)
List<string> groupedValsKeyList = new List<string>(groupedVals.Keys);
groupedValsKeyList.Sort(); // "AGENT" now at the beginning!
foreach (string groupMessageType in groupedValsKeyList)
{
string messageType = groupMessageType;
@ -803,14 +807,19 @@ namespace bsmd.herberg.FormService
info.SpecialRequirementsOfShipAtBerth = aMessageCore.Customer.Name;
else
{
if((aMessageCore.Customer != null) && (aMessageCore.Customer.Name != null))
if((aMessageCore.Customer != null) && (aMessageCore.Customer.Name != null) && !info.SpecialRequirementsOfShipAtBerth.Contains("- Agent: "))
info.SpecialRequirementsOfShipAtBerth = string.Format("{0} - Agent: {1}", info.SpecialRequirementsOfShipAtBerth, aMessageCore.Customer.Name);
}
if (vDict.ContainsKey("ConstructionCharacteristicsOfShip")) info.ConstructionCharacteristicsOfShip = vDict["ConstructionCharacteristicsOfShip"];
if (vDict.ContainsKey("FumigatedBulkCargo") && !vDict["FumigatedBulkCargo"].IsNullOrEmpty())
{
info.FumigatedBulkCargo = (byte)Enum.Parse(typeof(Enums.FumigatedBulkCargo), vDict["FumigatedBulkCargo"]);
_log.DebugFormat("FumigatedBulkCargo {0} parsed to {1}", vDict["FumigatedBulkCargo"], info.FumigatedBulkCargo);
}
else
info.FumigatedBulkCargo = (byte) Enums.FumigatedBulkCargo.N;
{
info.FumigatedBulkCargo = (byte)Enums.FumigatedBulkCargo.N;
}
}
catch(Exception ex)
{
@ -1135,6 +1144,8 @@ namespace bsmd.herberg.FormService
if (poc.PortFacilityGISISCode.IsNullOrEmpty())
{
poc.PortFacilityGISISCode = "0000";
if (poc.PortFacilitySecurityMattersToReport.IsNullOrEmpty()) poc.PortFacilitySecurityMattersToReport = string.Format("Remark: GISIS-Code not reported");
else poc.PortFacilitySecurityMattersToReport = string.Format("{0} - Remark: GISIS-Code not reported", poc.PortFacilitySecurityMattersToReport);
}
else {
Regex rgx = new Regex("[0-9]{4}");
@ -1142,6 +1153,8 @@ namespace bsmd.herberg.FormService
{
_log.WarnFormat("PortFacilityGISISCode invalid: {0}, replacing with 0000", poc.PortFacilityGISISCode);
poc.PortFacilityGISISCode = "0000";
if (poc.PortFacilitySecurityMattersToReport.IsNullOrEmpty()) poc.PortFacilitySecurityMattersToReport = string.Format("Remark: Reported GISIS-Code: {0}", sDict["PortFacilityGISISCode"] ?? "");
else poc.PortFacilitySecurityMattersToReport = string.Format("{0} - Remark: Reported GISIS-Code: {1}", poc.PortFacilitySecurityMattersToReport, sDict["PortFacilityGISISCode"] ?? "");
}
}
@ -1348,6 +1361,7 @@ namespace bsmd.herberg.FormService
{
try
{
if (vDict.ContainsKey("TransmissionType")) haz.TransmissionType = vDict["TransmissionType"];
if (vDict.ContainsKey("NoDPGOnBoard")) haz.NoDPGOnBoardOnArrival = vDict["NoDPGOnBoard"].Equals("Y");
if (vDict.ContainsKey("DPGManifestOnBoard")) haz.DPGManifestOnBoardOnArrival = vDict["DPGManifestOnBoard"].Equals("Y");
if (vDict.ContainsKey("INFShipClass")) haz.INFShipClass = (byte)Enum.Parse(typeof(Enums.INFShipClass), vDict["INFShipClass"], true);