This commit is contained in:
Daniel Schick 2016-03-24 09:22:02 +00:00
parent 465872fe1f
commit c16160cb29
4 changed files with 102 additions and 103 deletions

Binary file not shown.

View File

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

View File

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

View File

@ -259,61 +259,63 @@ namespace bsmd.dbh
{ {
RootSEC rootSEC = new RootSEC(); RootSEC rootSEC = new RootSEC();
SEC sec = message.Elements[0] as SEC; SEC sec = message.Elements[0] as SEC;
int numFields = (sec.SECSimplification ?? false) ?
2 : (14 + sec.LastTenPortFacilitesCalled.Count + sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count); List<object> secItems = new List<object>();
rootSEC.Items = new object[numFields]; List<ItemsChoiceType1> choiceType1s = new List<ItemsChoiceType1>();
rootSEC.ItemsElementName = new ItemsChoiceType1[numFields];
rootSEC.CurrentShipSecurityLevel = (int)sec.CurrentShipSecurityLevel.Value; rootSEC.CurrentShipSecurityLevel = (int)sec.CurrentShipSecurityLevel.Value;
if (sec.SECSimplification ?? false) if (sec.SECSimplification ?? false)
{ {
rootSEC.ItemsElementName[0] = ItemsChoiceType1.SECSimplification; choiceType1s.Add(ItemsChoiceType1.SECSimplification);
rootSEC.Items[0] = "Y"; secItems.Add("Y");
rootSEC.ItemsElementName[1] = ItemsChoiceType1.PortOfCallWhereCompleteSECNotified; choiceType1s.Add(ItemsChoiceType1.PortOfCallWhereCompleteSECNotified);
rootSEC.Items[1] = sec.PortOfCallWhereCompleteSECNotified; secItems.Add(sec.PortOfCallWhereCompleteSECNotified);
} }
else else
{ {
rootSEC.ItemsElementName[0] = ItemsChoiceType1.CSOLastName; choiceType1s.Add(ItemsChoiceType1.CSOLastName);
rootSEC.Items[0] = sec.CSOLastName; secItems.Add(sec.CSOLastName);
rootSEC.ItemsElementName[1] = ItemsChoiceType1.CSOFirstName; choiceType1s.Add(ItemsChoiceType1.CSOFirstName);
rootSEC.Items[1] = sec.CSOFirstName; secItems.Add(sec.CSOFirstName);
rootSEC.ItemsElementName[2] = ItemsChoiceType1.CSOPhone; choiceType1s.Add(ItemsChoiceType1.CSOPhone);
rootSEC.Items[2] = sec.CSOPhone; secItems.Add(sec.CSOPhone);
rootSEC.ItemsElementName[3] = ItemsChoiceType1.CSOFax; choiceType1s.Add(ItemsChoiceType1.CSOFax);
rootSEC.Items[3] = sec.CSOFax; secItems.Add(sec.CSOFax);
rootSEC.ItemsElementName[4] = ItemsChoiceType1.ValidISSCOnBoard; choiceType1s.Add(ItemsChoiceType1.ValidISSCOnBoard);
rootSEC.Items[4] = sec.ValidISSCOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; secItems.Add(sec.ValidISSCOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
rootSEC.ItemsElementName[5] = ItemsChoiceType1.ISSCType; choiceType1s.Add(ItemsChoiceType1.ISSCType);
rootSEC.Items[5] = (ISSCType) (sec.ISSCType ?? 0); secItems.Add((ISSCType)(sec.ISSCType ?? 0));
rootSEC.ItemsElementName[6] = ItemsChoiceType1.ISSCIssuerName; choiceType1s.Add(ItemsChoiceType1.ISSCIssuerName);
rootSEC.Items[6] = sec.ISSCIssuerName; secItems.Add(sec.ISSCIssuerName);
rootSEC.ItemsElementName[7] = ItemsChoiceType1.ISSCDateOfExpiration; if (sec.ISSCDateOfExpiration.HasValue)
if(sec.ISSCDateOfExpiration.HasValue)
rootSEC.Items[7] = sec.ISSCDateOfExpiration.Value;
rootSEC.ItemsElementName[8] = ItemsChoiceType1.ApprovedSecurityPlanOnBoard;
rootSEC.Items[8] = sec.ApprovedSecurityPlanOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootSEC.ItemsElementName[9] = ItemsChoiceType1.PortFacilityOfArrival;
rootSEC.Items[9] = sec.PortFacilityOfArrival;
rootSEC.ItemsElementName[10] = ItemsChoiceType1.GeneralDescriptionOfCargo;
if (sec.GeneralDescriptionOfCargo.HasValue)
rootSEC.Items[10] = (CargoDescription)sec.GeneralDescriptionOfCargo.Value;
rootSEC.ItemsElementName[11] = ItemsChoiceType1.ReasonsForNoValidISSC;
rootSEC.Items[11] = sec.ReasonsForNoValidISSC;
rootSEC.ItemsElementName[12] = ItemsChoiceType1.ISSCIssuerType;
rootSEC.Items[12] = (ISSCIssuerType) (sec.ISSCIssuerType ?? 0);
rootSEC.ItemsElementName[13] = ItemsChoiceType1.CSOEMail;
rootSEC.Items[13] = sec.CSOEMail;
int index = 14;
for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; index++, i++)
{ {
rootSEC.ItemsElementName[index] = ItemsChoiceType1.LastTenPortFacilitiesCalled; choiceType1s.Add(ItemsChoiceType1.ISSCDateOfExpiration);
secItems.Add(sec.ISSCDateOfExpiration.Value);
}
choiceType1s.Add(ItemsChoiceType1.ApprovedSecurityPlanOnBoard);
secItems.Add(sec.ApprovedSecurityPlanOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
choiceType1s.Add(ItemsChoiceType1.PortFacilityOfArrival);
secItems.Add(sec.PortFacilityOfArrival);
if (sec.GeneralDescriptionOfCargo.HasValue)
{
choiceType1s.Add(ItemsChoiceType1.GeneralDescriptionOfCargo);
secItems.Add((CargoDescription)sec.GeneralDescriptionOfCargo.Value);
}
choiceType1s.Add(ItemsChoiceType1.ReasonsForNoValidISSC);
secItems.Add(sec.ReasonsForNoValidISSC);
choiceType1s.Add(ItemsChoiceType1.ISSCIssuerType);
secItems.Add((ISSCIssuerType) (sec.ISSCIssuerType ?? 0));
choiceType1s.Add(ItemsChoiceType1.CSOEMail);
secItems.Add(sec.CSOEMail);
for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; i++)
{
choiceType1s.Add(ItemsChoiceType1.LastTenPortFacilitiesCalled);
RootSECLastTenPortFacilitiesCalled lastTen = new RootSECLastTenPortFacilitiesCalled(); RootSECLastTenPortFacilitiesCalled lastTen = new RootSECLastTenPortFacilitiesCalled();
rootSEC.Items[index] = lastTen; secItems.Add(lastTen);
lastTen.PortFacilityPortName = sec.LastTenPortFacilitesCalled[i].PortFacilityPortName; lastTen.PortFacilityPortName = sec.LastTenPortFacilitesCalled[i].PortFacilityPortName;
lastTen.PortFacilityPortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry; lastTen.PortFacilityPortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry;
lastTen.PortFacilityPortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode; lastTen.PortFacilityPortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode;
@ -327,11 +329,11 @@ namespace bsmd.dbh
lastTen.PortFacilityGISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode; lastTen.PortFacilityGISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode;
} }
for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; index++, i++ ) for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; i++)
{ {
rootSEC.ItemsElementName[index] = ItemsChoiceType1.ShipToShipActivities; choiceType1s.Add(ItemsChoiceType1.ShipToShipActivities);
RootSECShipToShipActivities s2s = new RootSECShipToShipActivities(); RootSECShipToShipActivities s2s = new RootSECShipToShipActivities();
rootSEC.Items[index] = s2s; secItems.Add(s2s);
s2s.ShipToShipActivityLocation = new RootSECShipToShipActivitiesShipToShipActivityLocation(); s2s.ShipToShipActivityLocation = new RootSECShipToShipActivitiesShipToShipActivityLocation();
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationName = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationName; s2s.ShipToShipActivityLocation.ShipToShipActivityLocationName = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationName;
s2s.ShipToShipActivityLocation.ShipToShipActivityLocationLoCode = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationLoCode; s2s.ShipToShipActivityLocation.ShipToShipActivityLocationLoCode = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationLoCode;
@ -347,9 +349,11 @@ namespace bsmd.dbh
s2s.ShipToShipActivityType = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityType; s2s.ShipToShipActivityType = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityType;
s2s.ShipToShipActivitySecurityMattersToReport = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivitySecurityMattersToReport; s2s.ShipToShipActivitySecurityMattersToReport = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivitySecurityMattersToReport;
} }
} }
rootSEC.Items = secItems.ToArray();
rootSEC.ItemsElementName = choiceType1s.ToArray();
item = rootSEC; item = rootSEC;
} }
break; break;
@ -626,7 +630,7 @@ namespace bsmd.dbh
rootInfo.BowThrusterPower = info.BowThrusterPower; rootInfo.BowThrusterPower = info.BowThrusterPower;
rootInfo.SternThrusterPower = info.SternThrusterPower; rootInfo.SternThrusterPower = info.SternThrusterPower;
if (info.FumigatedBulkCargo.HasValue) if (info.FumigatedBulkCargo.HasValue)
rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N; rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.N : RootINFOFumigatedBulkCargo.Y;
else else
rootInfo.FumigatedBulkCargo = RootINFOFumigatedBulkCargo.N; rootInfo.FumigatedBulkCargo = RootINFOFumigatedBulkCargo.N;
rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue; rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue;
@ -851,68 +855,63 @@ namespace bsmd.dbh
} }
else else
{ {
rootWAS.Items = new object[14]; List<object> wasteItems = new List<object>();
rootWAS.ItemsElementName = new ItemsChoiceType3[14]; List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>();
rootWAS.ItemsElementName[0] = ItemsChoiceType3.ConfirmationOfCorrectness; choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectness);
rootWAS.Items[0] = was.ConfirmationOfCorrectness ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
rootWAS.ItemsElementName[1] = ItemsChoiceType3.LastWasteDisposalDate;
if (was.LastWasteDisposalDate.HasValue) if (was.LastWasteDisposalDate.HasValue)
rootWAS.Items[1] = was.LastWasteDisposalDate.Value;
rootWAS.ItemsElementName[2] = ItemsChoiceType3.LastWasteDisposalPort;
rootWAS.Items[2] = was.LastWasteDisposalPort;
rootWAS.ItemsElementName[3] = ItemsChoiceType3.WasteDisposalDelivery;
if (was.WasteDisposalDelivery.HasValue)
rootWAS.Items[3] = (DisposalType)was.WasteDisposalDelivery.Value;
rootWAS.ItemsElementName[4] = ItemsChoiceType3.WasteDisposalServiceProviderName;
if (was.WasteDisposalServiceProvider.Count > 0)
{ {
// TODO: Klären wie es nun genau hier aussieht! choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalDate);
string serviceProviderName = ""; wasteItems.Add(was.LastWasteDisposalDate.Value);
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) }
{
serviceProviderName = string.Format("{0}{1}", serviceProviderName, was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort);
} wasteItems.Add(was.LastWasteDisposalPort);
rootWAS.Items[4] = serviceProviderName;
if (was.WasteDisposalDelivery.HasValue)
{
choiceType3s.Add(ItemsChoiceType3.WasteDisposalDelivery);
wasteItems.Add((DisposalType)was.WasteDisposalDelivery.Value);
}
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
{
choiceType3s.Add(ItemsChoiceType3.WasteDisposalServiceProviderName);
wasteItems.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName);
} }
/* /*
{"Wert von 'ItemsElementName' stimmt nicht mit dem Typ von 'bsmd.dbh.DBHWebReference.RootWASWaste' überein. {"Wert von 'ItemsElementName' stimmt nicht mit dem Typ von 'bsmd.dbh.DBHWebReference.RootWASWaste' überein.
* Sie müssen ihn auf 'bsmd.dbh.DBHWebReference.ItemsChoiceType3.@Waste' festlegen."} * Sie müssen ihn auf 'bsmd.dbh.DBHWebReference.ItemsChoiceType3.@Waste' festlegen."}
*/ */
for (int j = 5; j < 14; j++) for (int j = 0; j < was.Waste.Count; j++)
{ {
if (was.Waste.Count > 0) choiceType3s.Add(ItemsChoiceType3.Waste);
{ RootWASWaste rww = new RootWASWaste();
rootWAS.ItemsElementName[j] = ItemsChoiceType3.Waste; wasteItems.Add(rww);
RootWASWaste rww = new RootWASWaste();
rootWAS.Items[j] = rww; Waste waste = was.Waste[j];
if(was.Waste.Count > (j - 5))
{ rww.WasteDescription = waste.WasteDescription;
rww.WasteDescription = was.Waste[j-5].WasteDescription; if (waste.WasteType.HasValue)
if (was.Waste[j - 5].WasteType.HasValue) rww.WasteType = (WasteType)(waste.WasteType.Value - 1); // in unserer DB 1-basiert(!) im dbh Struct nicht
rww.WasteType = (WasteType) (was.Waste[j - 5].WasteType.Value - 1); // im generierten Code ist das 0-basiert rww.WasteDisposalAmount_MTQ = decimal.Round((decimal)(waste.WasteDisposalAmount_MTQ ?? 0), 3);
rww.WasteDisposalAmount_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteDisposalAmount_MTQ ?? 0), 3); rww.WasteDetails = new RootWASWasteWasteDetails();
rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal)(waste.WasteCapacity_MTQ ?? 0), 3);
rww.WasteDetails = new RootWASWasteWasteDetails(); rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal)(waste.WasteAmountRetained_MTQ ?? 0), 3);
rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = decimal.Round((decimal)(waste.WasteAmountGeneratedTillNextPort_MTQ ?? 0), 3);
rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteCapacity_MTQ ?? 0),3); rww.WasteDetails.WasteDisposalPort = waste.WasteDisposalPort;
rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteAmountRetained_MTQ ?? 0),3); if (rww.WasteDetails.WasteDisposalPort.IsNullOrEmpty()) rww.WasteDetails.WasteDisposalPort = "ZZUKN";
rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ ?? 0), 3);
rww.WasteDetails.WasteDisposalPort = was.Waste[j - 5].WasteDisposalPort; }
if (rww.WasteDetails.WasteDisposalPort.IsNullOrEmpty()) rww.WasteDetails.WasteDisposalPort = "ZZUKN";
rootWAS.ItemsElementName = choiceType3s.ToArray();
} rootWAS.Items = wasteItems.ToArray();
}
}
} }
item = rootWAS; item = rootWAS;