Excel: changed 2 subtables of SEC and a subtable of MDH to Dakosy read mode
This commit is contained in:
parent
9ad543e705
commit
1df95d2807
@ -1438,15 +1438,15 @@ namespace ENI2.Excel
|
|||||||
}
|
}
|
||||||
else // "normal mode", aus den Zellen lesen
|
else // "normal mode", aus den Zellen lesen
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string sheetTitle = "1. VOYAGE";
|
||||||
|
// 4.8.25: Changed this area to work like reading from a Dakosy Sheet (by values in rows, not cell names)
|
||||||
|
if (reader.HasWorksheetNamed(sheetTitle))
|
||||||
|
{
|
||||||
|
|
||||||
// POC last 30 days
|
// POC last 30 days
|
||||||
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
|
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
|
||||||
{
|
{
|
||||||
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
|
|
||||||
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
|
|
||||||
string locode = string.Format("MDH.PortOfCallLast30DaysLocode_{0}", i + 1);
|
|
||||||
string crewJoined = string.Format("MDH.PortOfCallLast30DaysCrewMembersJoined_{0}", i + 1);
|
|
||||||
string crewName = string.Format("MDH.PortOfCallLast30DaysCrewJoinedShipName_{0}", i + 1);
|
|
||||||
string depDate = string.Format("MDH.PortOfCallLast30DaysDateOfDeparture_{0}", i + 1);
|
|
||||||
|
|
||||||
if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
|
if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
|
||||||
{
|
{
|
||||||
@ -1456,16 +1456,17 @@ namespace ENI2.Excel
|
|||||||
mdh.PortOfCallLast30Days.Add(poc30d);
|
mdh.PortOfCallLast30Days.Add(poc30d);
|
||||||
}
|
}
|
||||||
|
|
||||||
string pName = reader.ReadText(portName);
|
string pName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", 81 + i));
|
||||||
string pCountry = reader.ReadText(portCountry);
|
string pCountry = reader.ReadCellAsText(sheetTitle, string.Format("E{0}", 81 + i));
|
||||||
|
|
||||||
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
|
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadCellAsDateTime(sheetTitle, string.Format("G{0}", 81 + i));
|
||||||
poc30d.PortOfCallLast30DaysLocode = reader.ReadLoCode(locode);
|
poc30d.PortOfCallLast30DaysLocode = reader.ReadCellAsText(sheetTitle, string.Format("F{0}", 81 + i));
|
||||||
|
if (LocodeDB.PortNameFromLocode(poc30d.PortOfCallLast30DaysLocode).IsNullOrEmpty()) poc30d.PortOfCallLast30DaysLocode = "";
|
||||||
|
|
||||||
// Verbesserungsvorschlag Jul/21: CrewMembersJoined Häkchen abhängig von den Namen in der Spalte
|
// Verbesserungsvorschlag Jul/21: CrewMembersJoined Häkchen abhängig von den Namen in der Spalte
|
||||||
bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadBoolean(crewJoined);
|
bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", 81 + i));
|
||||||
|
|
||||||
string crewNameString = reader.ReadText(crewName);
|
string crewNameString = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 81 + i));
|
||||||
poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty();
|
poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty();
|
||||||
|
|
||||||
// if crew members joined is set explicitly to true and the name is empty, still set the field to true
|
// if crew members joined is set explicitly to true and the name is empty, still set the field to true
|
||||||
@ -1498,6 +1499,7 @@ namespace ENI2.Excel
|
|||||||
mdh.PortOfCallLast30Days.Remove(poc30d);
|
mdh.PortOfCallLast30Days.Remove(poc30d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion PoC last 30 days
|
#endregion PoC last 30 days
|
||||||
|
|
||||||
@ -1658,17 +1660,13 @@ namespace ENI2.Excel
|
|||||||
if (!sec.KielCanalPassagePlannedIncomming.HasValue && !sec.KielCanalPassagePlannedOutgoing.HasValue)
|
if (!sec.KielCanalPassagePlannedIncomming.HasValue && !sec.KielCanalPassagePlannedOutgoing.HasValue)
|
||||||
sec.KielCanalPassagePlanned = false;
|
sec.KielCanalPassagePlanned = false;
|
||||||
|
|
||||||
// Last10PortFacilitesCalled
|
string sheetTitle = "1. VOYAGE";
|
||||||
for (int i = 1; i <= 10; i++)
|
// 4.8.25: Changed this area to work like reading from a Dakosy Sheet (by values in rows, not cell names)
|
||||||
|
if (reader.HasWorksheetNamed(sheetTitle))
|
||||||
|
{
|
||||||
|
// Last10PortFacilitesCalled
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
string portName = string.Format("SEC.PortFacilityPortName_{0}", i);
|
|
||||||
string portCountry = string.Format("SEC.PortFacilityPortCountry_{0}", i);
|
|
||||||
string portLocode = string.Format("SEC.PortFacilityPortLoCode_{0}", i);
|
|
||||||
string portDateOfArrival = string.Format("SEC.PortFacilityDateOfArrival_{0}", i);
|
|
||||||
string portDateOfDeparture = string.Format("SEC.PortFacilityDateOfDeparture_{0}", i);
|
|
||||||
string portShipSecLevel = string.Format("SEC.PortFacilityShipSecurityLevel_{0}", i);
|
|
||||||
string portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
|
|
||||||
string portSecMatters = string.Format("SEC.PortFacilitySecurityMattersToReport_{0}", i);
|
|
||||||
|
|
||||||
if (!(sec.GetPortFacilityWithIdentifier(i.ToString()) is LastTenPortFacilitiesCalled l10fc))
|
if (!(sec.GetPortFacilityWithIdentifier(i.ToString()) is LastTenPortFacilitiesCalled l10fc))
|
||||||
{
|
{
|
||||||
@ -1678,13 +1676,14 @@ namespace ENI2.Excel
|
|||||||
sec.LastTenPortFacilitesCalled.Add(l10fc);
|
sec.LastTenPortFacilitesCalled.Add(l10fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
l10fc.PortFacilityPortName = reader.ReadText(portName);
|
l10fc.PortFacilityPortName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", 54 + i), 99);
|
||||||
l10fc.PortFacilityPortCountry = reader.ReadText(portCountry);
|
l10fc.PortFacilityPortCountry = reader.ReadCellAsText(sheetTitle, string.Format("E{0}", 54 + i), 99);
|
||||||
l10fc.PortFacilityPortLoCode = reader.ReadLoCode(portLocode);
|
l10fc.PortFacilityPortLoCode = reader.ReadCellAsText(sheetTitle, string.Format("F{0}", 54 + i), 5);
|
||||||
l10fc.PortFacilityDateOfArrival = reader.ReadDate(portDateOfArrival);
|
if (LocodeDB.PortNameFromLocode(l10fc.PortFacilityPortLoCode).IsNullOrEmpty()) l10fc.PortFacilityPortLoCode = "";
|
||||||
l10fc.PortFacilityDateOfDeparture = reader.ReadDate(portDateOfDeparture);
|
l10fc.PortFacilityDateOfArrival = reader.ReadCellAsDateTime(sheetTitle, string.Format("G{0}", 54 + i));
|
||||||
|
l10fc.PortFacilityDateOfDeparture = reader.ReadCellAsDateTime(sheetTitle, string.Format("H{0}", 54 + i));
|
||||||
|
|
||||||
string sLevel = reader.ReadText(portShipSecLevel);
|
string sLevel = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 54 + i), 1);
|
||||||
if (!sLevel.IsNullOrEmpty())
|
if (!sLevel.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
if (sLevel.Contains('1')) l10fc.PortFacilityShipSecurityLevel = 1;
|
if (sLevel.Contains('1')) l10fc.PortFacilityShipSecurityLevel = 1;
|
||||||
@ -1692,7 +1691,7 @@ namespace ENI2.Excel
|
|||||||
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
|
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
|
l10fc.PortFacilityGISISCode = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", 54 + i), 4);
|
||||||
|
|
||||||
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
|
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
|
||||||
l10fc.PortFacilityGISISCode = "0000";
|
l10fc.PortFacilityGISISCode = "0000";
|
||||||
@ -1701,7 +1700,7 @@ namespace ENI2.Excel
|
|||||||
while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode;
|
while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
l10fc.PortFacilitySecurityMattersToReport = reader.ReadText(portSecMatters);
|
l10fc.PortFacilitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 54 + i), 255);
|
||||||
|
|
||||||
// keinen "leeren" Hafen anlegen, wenn der Eintrag leer war (trifft anscheinend bei Neubauten zu, siehe E-Mail Christin vom 20./22.6.17
|
// keinen "leeren" Hafen anlegen, wenn der Eintrag leer war (trifft anscheinend bei Neubauten zu, siehe E-Mail Christin vom 20./22.6.17
|
||||||
if (l10fc.PortFacilityPortName.IsNullOrEmpty() && l10fc.PortFacilityPortLoCode.IsNullOrEmpty() && l10fc.PortFacilityPortCountry.IsNullOrEmpty())
|
if (l10fc.PortFacilityPortName.IsNullOrEmpty() && l10fc.PortFacilityPortLoCode.IsNullOrEmpty() && l10fc.PortFacilityPortCountry.IsNullOrEmpty())
|
||||||
@ -1709,17 +1708,8 @@ namespace ENI2.Excel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ship2ShipActivities
|
// Ship2ShipActivities
|
||||||
for (int i = 1; i <= 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
string s2sName = string.Format("SEC.ShipToShipActivityLocationName_{0}", i);
|
|
||||||
string s2sLocode = string.Format("SEC.ShipToShipActivityLocationLoCode_{0}", i);
|
|
||||||
string s2sLatitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLatitude_{0}", i);
|
|
||||||
string s2sLongitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLongitude_{0}", i);
|
|
||||||
string s2sFromDate = string.Format("SEC.ShipToShipActivityDateFrom_{0}", i);
|
|
||||||
string s2sToDate = string.Format("SEC.ShipToShipActivityDateTo_{0}", i);
|
|
||||||
string s2sSec = string.Format("SEC.ShipToShipActivitySecurityMattersToReport_{0}", i);
|
|
||||||
string s2sActivityString = string.Format("SEC.ShipToShipActivityType_{0}", i);
|
|
||||||
|
|
||||||
|
|
||||||
if (!(sec.GetShipToShipWithIdentifier(i.ToString()) is ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2sActivity))
|
if (!(sec.GetShipToShipWithIdentifier(i.ToString()) is ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2sActivity))
|
||||||
{
|
{
|
||||||
@ -1729,26 +1719,28 @@ namespace ENI2.Excel
|
|||||||
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(s2sActivity);
|
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(s2sActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
s2sActivity.ShipToShipActivityLocationName = reader.ReadText(s2sName);
|
s2sActivity.ShipToShipActivityLocationName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", 68 + i), 255);
|
||||||
if (s2sActivity.ShipToShipActivityLocationName.IsNullOrEmpty())
|
if (s2sActivity.ShipToShipActivityLocationName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2sActivity);
|
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2sActivity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
s2sActivity.ShipToShipActivityLocationLoCode = reader.ReadLoCode(s2sLocode);
|
s2sActivity.ShipToShipActivityLocationLoCode = reader.ReadCellAsText(sheetTitle, string.Format("E{0}", 68 + i), 5);
|
||||||
s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = (int?)reader.ReadNumber(s2sLatitude);
|
if (LocodeDB.PortNameFromLocode(s2sActivity.ShipToShipActivityLocationLoCode).IsNullOrEmpty()) s2sActivity.ShipToShipActivityLocationLoCode = "";
|
||||||
|
|
||||||
|
s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = (int?) reader.ReadCellAsDecimal(sheetTitle, string.Format("F{0}", 68 + i));
|
||||||
// keine "0" (d.h. fehlerhafte Koordinaten) ins ANSW übergeben falls im Sheet nichts ist aber der Reader das aus irgendeinem Grund liest
|
// keine "0" (d.h. fehlerhafte Koordinaten) ins ANSW übergeben falls im Sheet nichts ist aber der Reader das aus irgendeinem Grund liest
|
||||||
if (s2sActivity.ShipToShipActivityLocationCoordinatesLatitude == 0)
|
if (s2sActivity.ShipToShipActivityLocationCoordinatesLatitude == 0)
|
||||||
s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = null;
|
s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = null;
|
||||||
s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = (int?)reader.ReadNumber(s2sLongitude);
|
s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = (int?)reader.ReadCellAsDecimal(sheetTitle, string.Format("G{0}", 68 + i));
|
||||||
if (s2sActivity.ShipToShipActivityLocationCoordinatesLongitude == 0)
|
if (s2sActivity.ShipToShipActivityLocationCoordinatesLongitude == 0)
|
||||||
s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = null;
|
s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = null;
|
||||||
s2sActivity.ShipToShipActivityDateFrom = reader.ReadDate(s2sFromDate);
|
s2sActivity.ShipToShipActivityDateFrom = reader.ReadCellAsDateTime(sheetTitle, string.Format("H{0}", 68 + i));
|
||||||
s2sActivity.ShipToShipActivityDateTo = reader.ReadDate(s2sToDate);
|
s2sActivity.ShipToShipActivityDateTo = reader.ReadCellAsDateTime(sheetTitle, string.Format("I{0}", 68 + i));
|
||||||
s2sActivity.ShipToShipActivityTypeCode = (int?)reader.ReadNumber(s2sActivityString);
|
s2sActivity.ShipToShipActivityTypeCode = (int?)reader.ReadCellAsDecimal(sheetTitle, string.Format("J{0}", 68 + i));
|
||||||
reader.ReadShip2ShipActivityType(s2sActivityString); // 24.8.21 nicht Code dem Klartext zuordnen, nur das Feld kolorieren
|
s2sActivity.ShipToShipActivitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 68 + i), 255);
|
||||||
s2sActivity.ShipToShipActivitySecurityMattersToReport = reader.ReadText(s2sSec);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user