aktueller Stand 2.4.12.*

This commit is contained in:
Daniel Schick 2015-11-22 17:08:08 +00:00
parent bd4b5b4d39
commit 4eca10bfb4
8 changed files with 172 additions and 68 deletions

Binary file not shown.

View File

@ -35,8 +35,7 @@ namespace bsmd.database
[Validation(ValidationCode.NOT_NULL)]
public bool? NoDPGOnBoardOnArrival { get; set; }
[ShowReport]
[Validation(ValidationCode.NOT_NULL)]
[ShowReport]
public bool? DPGManifestOnBoardOnArrival { get; set; }
[ShowReport]

View File

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

View File

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("2.4.11.*")]
[assembly: AssemblyVersion("2.4.12.*")]

View File

@ -656,74 +656,90 @@ namespace bsmd.dbh
}
else
{ // der blöde Teil
rootMDH.Items = new object[19];
rootMDH.ItemsElementName = new ItemsChoiceType2[26];
rootMDH.ItemsElementName[0] = ItemsChoiceType2.NonAccidentialDeathsDuringVoyage;
rootMDH.Items[0] = mdh.NonAccidentalDeathsDuringVoyage ?? false ? RootMDHNonAccidentialDeathsDuringVoyage.Y : RootMDHNonAccidentialDeathsDuringVoyage.N;
rootMDH.ItemsElementName[1] = ItemsChoiceType2.NonAccidentialDeathsDuringVoyageCount;
if (mdh.NonAccidentalDeathsDuringVoyageCount.HasValue)
rootMDH.Items[1] = mdh.NonAccidentalDeathsDuringVoyageCount.Value;
rootMDH.ItemsElementName[2] = ItemsChoiceType2.SuspisionInfectiousNature;
rootMDH.Items[2] = mdh.SuspisionInfectiousNature ?? false ? RootMDHSuspisionInfectiousNature.Y : RootMDHSuspisionInfectiousNature.N;
rootMDH.ItemsElementName[3] = ItemsChoiceType2.NumberOfIllPersonsHigherThanExpected;
rootMDH.Items[3] = mdh.NumberOfIllPersonsHigherThanExpected ?? false ? RootMDHNumberOfIllPersonsHigherThanExpected.Y : RootMDHNumberOfIllPersonsHigherThanExpected.N;
rootMDH.ItemsElementName[4] = ItemsChoiceType2.NumberOfIllPersons;
if (mdh.NumberOfIllPersons.HasValue)
rootMDH.Items[4] = mdh.NumberOfIllPersons.Value;
rootMDH.ItemsElementName[5] = ItemsChoiceType2.SickPersonsOnBoard;
rootMDH.Items[5] = mdh.SickPersonsOnBoard ?? false ? RootMDHSickPersonsOnBoard.Y : RootMDHSickPersonsOnBoard.N;
rootMDH.ItemsElementName[6] = ItemsChoiceType2.MedicalConsulted;
rootMDH.Items[6] = mdh.MedicalConsulted ?? false ? RootMDHMedicalConsulted.Y : RootMDHMedicalConsulted.N;
rootMDH.ItemsElementName[7] = ItemsChoiceType2.AwareOfConditionsForFurtherInfections;
rootMDH.Items[7] = mdh.AwareOfFurtherInfections ?? false ? RootMDHAwareOfConditionsForFurtherInfections.Y : RootMDHAwareOfConditionsForFurtherInfections.N;
rootMDH.ItemsElementName[8] = ItemsChoiceType2.SanitaryMeasuresApplied;
rootMDH.Items[8] = mdh.SanitaryMeasuresApplied ?? false ? RootMDHSanitaryMeasuresApplied.Y : RootMDHSanitaryMeasuresApplied.N;
List<object> mdhItems = new List<object>();
List<ItemsChoiceType2> choiceTypes2 = new List<ItemsChoiceType2>();
choiceTypes2.Add(ItemsChoiceType2.NonAccidentialDeathsDuringVoyage);
mdhItems.Add(mdh.NonAccidentalDeathsDuringVoyage ?? false ? RootMDHNonAccidentialDeathsDuringVoyage.Y : RootMDHNonAccidentialDeathsDuringVoyage.N);
choiceTypes2.Add(ItemsChoiceType2.NonAccidentialDeathsDuringVoyageCount);
mdhItems.Add(mdh.NonAccidentalDeathsDuringVoyageCount ?? 0);
choiceTypes2.Add(ItemsChoiceType2.SuspisionInfectiousNature);
mdhItems.Add(mdh.SuspisionInfectiousNature ?? false ? RootMDHSuspisionInfectiousNature.Y : RootMDHSuspisionInfectiousNature.N);
choiceTypes2.Add(ItemsChoiceType2.NumberOfIllPersonsHigherThanExpected);
mdhItems.Add(mdh.NumberOfIllPersonsHigherThanExpected ?? false ? RootMDHNumberOfIllPersonsHigherThanExpected.Y : RootMDHNumberOfIllPersonsHigherThanExpected.N);
choiceTypes2.Add(ItemsChoiceType2.NumberOfIllPersons);
mdhItems.Add(mdh.NumberOfIllPersons ?? 0);
choiceTypes2.Add(ItemsChoiceType2.SickPersonsOnBoard);
mdhItems.Add(mdh.SickPersonsOnBoard ?? false ? RootMDHSickPersonsOnBoard.Y : RootMDHSickPersonsOnBoard.N);
choiceTypes2.Add(ItemsChoiceType2.MedicalConsulted);
mdhItems.Add(mdh.MedicalConsulted ?? false ? RootMDHMedicalConsulted.Y : RootMDHMedicalConsulted.N);
choiceTypes2.Add(ItemsChoiceType2.AwareOfConditionsForFurtherInfections);
mdhItems.Add(mdh.AwareOfFurtherInfections ?? false ? RootMDHAwareOfConditionsForFurtherInfections.Y : RootMDHAwareOfConditionsForFurtherInfections.N);
choiceTypes2.Add(ItemsChoiceType2.SanitaryMeasuresApplied);
mdhItems.Add(mdh.SanitaryMeasuresApplied ?? false ? RootMDHSanitaryMeasuresApplied.Y : RootMDHSanitaryMeasuresApplied.N);
if (mdh.SanitaryMeasuresApplied ?? false)
{
rootMDH.ItemsElementName[9] = ItemsChoiceType2.SanitaryMeasuresDetails;
choiceTypes2.Add(ItemsChoiceType2.SanitaryMeasuresDetails);
RootMDHSanitaryMeasuresDetails smDet = new RootMDHSanitaryMeasuresDetails();
if (mdh.SanitaryMeasuresDate.HasValue)
smDet.SanitaryMeasuresDate = mdh.SanitaryMeasuresDate.Value;
smDet.SanitaryMeasuresType = mdh.SanitaryMeasuresType;
smDet.SanitaryMeasuresLocation = mdh.SanitaryMeasuresLocation;
rootMDH.Items[9] = smDet;
mdhItems.Add(smDet);
}
rootMDH.ItemsElementName[10] = ItemsChoiceType2.StowawaysDetected;
rootMDH.Items[10] = mdh.StowawaysDetected ?? false ? RootMDHStowawaysDetected.Y : RootMDHStowawaysDetected.N;
rootMDH.ItemsElementName[11] = ItemsChoiceType2.StowawaysJoiningLocation;
rootMDH.Items[11] = mdh.StowawaysJoiningLocation;
rootMDH.ItemsElementName[12] = ItemsChoiceType2.SickAnimalOrPetOnBoard;
rootMDH.Items[12] = mdh.SickAnimalOrPetOnBoard ?? false ? RootMDHSickAnimalOrPetOnBoard.Y : RootMDHSickAnimalOrPetOnBoard.N;
rootMDH.ItemsElementName[13] = ItemsChoiceType2.ValidSanitaryControlExemptionOrCertificateOnBoard;
rootMDH.Items[13] = mdh.ValidSanitaryControlExemptionOrCertificateOnBoard ?? false ? RootMDHValidSanitaryControlExemptionOrCertificateOnBoard.Y : RootMDHValidSanitaryControlExemptionOrCertificateOnBoard.N;
choiceTypes2.Add(ItemsChoiceType2.StowawaysDetected);
mdhItems.Add(mdh.StowawaysDetected ?? false ? RootMDHStowawaysDetected.Y : RootMDHStowawaysDetected.N);
rootMDH.ItemsElementName[14] = ItemsChoiceType2.ValidSanitaryControlExemptionOrCertificate;
RootMDHValidSanitaryControlExemptionOrCertificate cert = new RootMDHValidSanitaryControlExemptionOrCertificate();
rootMDH.Items[14] = cert;
if (mdh.DateOfIssue.HasValue) cert.DateOfIssue = mdh.DateOfIssue.Value;
cert.PlaceOfIssue = mdh.PlaceOfIssue;
rootMDH.ItemsElementName[15] = ItemsChoiceType2.SanitaryControlReinspectionRequired;
rootMDH.Items[15] = mdh.SanitaryControlReinspectionRequired ?? false ? RootMDHSanitaryControlReinspectionRequired.Y : RootMDHSanitaryControlReinspectionRequired.N;
choiceTypes2.Add(ItemsChoiceType2.StowawaysJoiningLocation);
mdhItems.Add(mdh.StowawaysJoiningLocation);
rootMDH.ItemsElementName[16] = ItemsChoiceType2.InfectedAreaVisited;
rootMDH.Items[16] = mdh.InfectedAreaVisited ?? false ? RootMDHInfectedAreaVisited.Y : RootMDHInfectedAreaVisited.N;
choiceTypes2.Add(ItemsChoiceType2.SickAnimalOrPetOnBoard);
mdhItems.Add(mdh.SickAnimalOrPetOnBoard ?? false ? RootMDHSickAnimalOrPetOnBoard.Y : RootMDHSickAnimalOrPetOnBoard.N);
choiceTypes2.Add(ItemsChoiceType2.ValidSanitaryControlExemptionOrCertificateOnBoard);
mdhItems.Add(mdh.ValidSanitaryControlExemptionOrCertificateOnBoard ?? false ? RootMDHValidSanitaryControlExemptionOrCertificateOnBoard.Y : RootMDHValidSanitaryControlExemptionOrCertificateOnBoard.N);
if (mdh.DateOfIssue.HasValue && !mdh.PlaceOfIssue.IsNullOrEmpty())
{
choiceTypes2.Add(ItemsChoiceType2.ValidSanitaryControlExemptionOrCertificate);
RootMDHValidSanitaryControlExemptionOrCertificate cert = new RootMDHValidSanitaryControlExemptionOrCertificate();
mdhItems.Add(cert);
cert.DateOfIssue = mdh.DateOfIssue.Value;
cert.PlaceOfIssue = mdh.PlaceOfIssue;
}
choiceTypes2.Add(ItemsChoiceType2.SanitaryControlReinspectionRequired);
mdhItems.Add(mdh.SanitaryControlReinspectionRequired ?? false ? RootMDHSanitaryControlReinspectionRequired.Y : RootMDHSanitaryControlReinspectionRequired.N);
choiceTypes2.Add(ItemsChoiceType2.InfectedAreaVisited);
mdhItems.Add(mdh.InfectedAreaVisited ?? false ? RootMDHInfectedAreaVisited.Y : RootMDHInfectedAreaVisited.N);
if (!mdh.InfectedAreaPort.IsNullOrEmpty() && mdh.InfectedAreaDate.HasValue)
{
rootMDH.ItemsElementName[17] = ItemsChoiceType2.InfectedArea;
choiceTypes2.Add(ItemsChoiceType2.InfectedArea);
RootMDHInfectedArea infected = new RootMDHInfectedArea();
rootMDH.Items[17] = infected;
mdhItems.Add(infected);
infected.InfectedAreaPort = mdh.InfectedAreaPort;
if (mdh.InfectedAreaDate.HasValue) infected.InfectedAreaDate = mdh.InfectedAreaDate.Value;
infected.InfectedAreaDate = mdh.InfectedAreaDate.Value;
}
rootMDH.ItemsElementName[18] = ItemsChoiceType2.PortsOfCallLast30Days;
RootMDHPortsOfCallLast30Days l30d = new RootMDHPortsOfCallLast30Days();
rootMDH.Items[18] = l30d;
if (mdh.PortOfCallLast30Days.Count > 0)
{
choiceTypes2.Add(ItemsChoiceType2.PortsOfCallLast30Days);
RootMDHPortsOfCallLast30Days l30d = new RootMDHPortsOfCallLast30Days();
mdhItems.Add(l30d);
l30d.PortOfCallLast30Days = new RootMDHPortsOfCallLast30DaysPortOfCallLast30Days[mdh.PortOfCallLast30Days.Count];
for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++)
{
@ -743,6 +759,10 @@ namespace bsmd.dbh
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode = mdh.PortOfCallLast30Days[i].PortOfCallLast30DaysLocode;
}
}
rootMDH.Items = mdhItems.ToArray();
rootMDH.ItemsElementName = choiceTypes2.ToArray();
}
item = rootMDH;

View File

@ -54,13 +54,13 @@ namespace bsmd.herberg.FormService
if (formResponse.formDatasets[i].formData[n].name.Contains("Transmission"))
{
_log.Info("foundit");
}
}
// Daten werden nur aktualisiert, wenn die form ein anderes (=neueres) Rev. Date hat
if (aMessageCore.HerbergRevDate.HasValue && (formResponse.formDatasets[i].revisionDate == aMessageCore.HerbergRevDate.Value))
return;
// Daten werden nur aktualisiert, wenn die form ein anderes (=neueres) Rev. Date hat
if (aMessageCore.HerbergRevDate.HasValue && (formResponse.formDatasets[i].revisionDate == aMessageCore.HerbergRevDate.Value))
return;
if (aMessageCore.ReportStatus != MessageCore.ReportStatusEnum.COMPLETE)
aMessageCore.ReportStatus = MessageCore.ReportStatusEnum.HE_REVISION;
@ -1163,23 +1163,28 @@ namespace bsmd.herberg.FormService
}
// sanitize GISIS code
if (poc.PortFacilityGISISCode.IsNullOrEmpty())
if (changedPfC)
{
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}");
if (!rgx.IsMatch(poc.PortFacilityGISISCode))
if (poc.PortFacilityGISISCode.IsNullOrEmpty())
{
_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"] ?? "");
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}");
if (!rgx.IsMatch(poc.PortFacilityGISISCode))
{
_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"] ?? "");
}
}
}
if (sDict.ContainsKey("ShipToShipActivityLocationName")) { sts.ShipToShipActivityLocationName = sDict["ShipToShipActivityLocationName"]; changedStS = true; }
if (sDict.ContainsKey("ShipToShipActivityLocationLoCode") && sDict.ContainsKey("ShipToShipActivityCountryCode") && (sDict["ShipToShipActivityLocationLoCode"].Length < 4))
{
@ -1661,7 +1666,9 @@ namespace bsmd.herberg.FormService
foreach (DatabaseEntity saveEntity in saveMessages)
DBManager.Instance.Save(saveEntity);
}
}
}
XtraLogic.ProcessMessage(aMessageCore, messages);
DBManager.Instance.Save(aMessageCore);
}

View File

@ -0,0 +1,77 @@
//
// Class: XtraLogic
// Current CLR: 4.0.30319.42000
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 11/21/2015 1:31:37 PM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
using log4net;
using bsmd.database;
namespace bsmd.herberg.FormService
{
public class XtraLogic
{
private static ILog _log = LogManager.GetLogger(typeof(XtraLogic));
/// <summary>
/// Diese Klasse implementiert Logik, die von BSMD separat definiert wurde, z.B. zur Vereinfachung
/// der Bearbeitung. Diese Logik ist nicht Teil der NSW Spezifikation. Sie wird nach dem kompletten Einlesen / Update
/// eines Anlaufs ausgeführt (HE).
/// </summary>
internal static void ProcessMessage(MessageCore core, Dictionary<string, Message> messageDict)
{
// Regel 1: 20.11.2015
// Fehlermeldung: MDH List of Ports during the last 30 days = leer
// => Automatische Übernahme des Letzten Hafens und des entsprechenden Abfahrtsdatums (NOA_NOD),
// damit entfällt manuelle Nachbearbeitung.
if(messageDict.ContainsKey("MDH") && messageDict.ContainsKey("NOA_NOD"))
{
MDH mdh = null;
NOA_NOD noa_nod = null;
if (messageDict["MDH"].Elements.Count > 0)
mdh = messageDict["MDH"].Elements[0] as MDH;
if (messageDict["NOA_NOD"].Elements.Count > 0)
noa_nod = messageDict["NOA_NOD"].Elements[0] as NOA_NOD;
if ((mdh != null) && (noa_nod != null))
{
if (!(mdh.MDHSimplification ?? false))
{
if (mdh.PortOfCallLast30Days.Count == 0)
{
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
poc30.PortOfCallLast30DaysCrewMembersJoined = false;
poc30.PortOfCallLast30DaysDateOfDeparture = noa_nod.ETDFromLastPort;
poc30.PortOfCallLast30DaysLocode = noa_nod.LastPort;
poc30.MDH = mdh;
mdh.PortOfCallLast30Days.Add(poc30);
DBManager.Instance.Save(poc30);
_log.InfoFormat("adding POCLast30Days for MDH. Port:{0} Departure:{1}", noa_nod.LastPort ?? "",
noa_nod.ETDFromLastPort ?? DateTime.MinValue);
}
}
}
}
/// Regel 2: Bei Transit wird der Port auf (ZZ)NOK gesetzt
/// In dashface wird "ETA" angezeigt, ich setze hier daher ETA auf ETAKielCanal
/// 20.11.2015
if (core.IsTransit)
{
core.Portname = "NOK";
core.PoC = "ZZNOK";
core.ETA = core.ETAKielCanal;
}
}
}
}

View File

@ -97,6 +97,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="XtraLogic.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">