3.4.6: Eine Menge kleine Korrekturen für Excel Einlesen und NSW Versand
This commit is contained in:
parent
7e4284c787
commit
771ba4288e
Binary file not shown.
@ -90,7 +90,7 @@ namespace bsmd.ExcelReadService
|
||||
while (bsmdPopClient.ReceiveSingleMail(out attachmentLocalPath, out messageId, out mailSender, out mailSubject))
|
||||
{
|
||||
|
||||
bool readResult;
|
||||
bool readResult = false;
|
||||
string readMessage = "";
|
||||
string receiptText = "";
|
||||
MessageCore messageCore = null;
|
||||
@ -125,7 +125,15 @@ namespace bsmd.ExcelReadService
|
||||
// try to read/import attachment
|
||||
using (ExcelReader reader = new ExcelReader(attachmentLocalPath))
|
||||
{
|
||||
readResult = Util.ProcessSheet(reader, out readMessage, out messageCore);
|
||||
try
|
||||
{
|
||||
readResult = Util.ProcessSheet(reader, out readMessage, out messageCore);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
readMessage = string.Format("{0} Unerwartete Fehlersitutation:Bitte Info an Christin od. Daniel", ex.Message);
|
||||
}
|
||||
|
||||
if (!readResult)
|
||||
{
|
||||
receiptText = string.Format("Incoming sheet could not be read: {0}", readMessage);
|
||||
|
||||
@ -636,7 +636,19 @@ namespace bsmd.ExcelReadService
|
||||
reader.Conf.ConfirmText(marpol_name, name, ExcelReader.ReadState.OK);
|
||||
marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
|
||||
reader.Conf.ConfirmText(marpol_flash, marpolPosition.Flashpoint_CEL, marpolPosition.Flashpoint_CEL.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity);
|
||||
|
||||
if (marpolPosition.Flashpoint_CEL.IsNullOrEmpty()) { marpolPosition.FlashpointInformation = 0; } // NF // Ableitung Flashpoint-Info: Christin, 22.3.2017
|
||||
else
|
||||
{
|
||||
double flashval = 0;
|
||||
if (double.TryParse(marpolPosition.Flashpoint_CEL, out flashval))
|
||||
{
|
||||
if (flashval > 60) marpolPosition.FlashpointInformation = 1; // GT60CEL
|
||||
else marpolPosition.FlashpointInformation = 2; // LE60CEL
|
||||
}
|
||||
}
|
||||
|
||||
marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity);
|
||||
marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition);
|
||||
reader.Conf.ConfirmText(marpol_stowagePosition, marpolPosition.StowagePosition, marpolPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading);
|
||||
@ -645,6 +657,13 @@ namespace bsmd.ExcelReadService
|
||||
reader.Conf.ConfirmText(marpol_portOfDischarge, marpolPosition.PortOfDischarge, marpolPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(haza.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
||||
{
|
||||
haza.NoDPGOnBoardOnArrival = false;
|
||||
haza.DPGManifestOnBoardOnArrival = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -915,7 +934,19 @@ namespace bsmd.ExcelReadService
|
||||
reader.Conf.ConfirmText(marpol_name, name, ExcelReader.ReadState.OK);
|
||||
marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
|
||||
reader.Conf.ConfirmText(marpol_flash, marpolPosition.Flashpoint_CEL, marpolPosition.Flashpoint_CEL.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity);
|
||||
|
||||
if (marpolPosition.Flashpoint_CEL.IsNullOrEmpty()) { marpolPosition.FlashpointInformation = 0; } // NF // Ableitung Flashpoint-Info: Christin, 22.3.2017
|
||||
else
|
||||
{
|
||||
double flashval = 0;
|
||||
if (double.TryParse(marpolPosition.Flashpoint_CEL, out flashval))
|
||||
{
|
||||
if (flashval > 60) marpolPosition.FlashpointInformation = 1; // GT60CEL
|
||||
else marpolPosition.FlashpointInformation = 2; // LE60CEL
|
||||
}
|
||||
}
|
||||
|
||||
marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity);
|
||||
marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition);
|
||||
reader.Conf.ConfirmText(marpol_stowagePosition, marpolPosition.StowagePosition, marpolPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading);
|
||||
@ -923,9 +954,14 @@ namespace bsmd.ExcelReadService
|
||||
marpolPosition.PortOfDischarge = reader.ReadText(marpol_portOfDischarge);
|
||||
reader.Conf.ConfirmText(marpol_portOfDischarge, marpolPosition.PortOfDischarge, marpolPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
}
|
||||
if (hazd.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
||||
{
|
||||
hazd.NoDPGOnBoardOnArrival = false;
|
||||
hazd.DPGManifestOnBoardOnArrival = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -965,7 +1001,11 @@ namespace bsmd.ExcelReadService
|
||||
}
|
||||
STAT stat = statMessage.Elements[0] as STAT;
|
||||
Util.ScanMessage(stat, reader);
|
||||
stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber");
|
||||
|
||||
stat.PortOfRegistry = reader.ReadLoCode("STAT.PortOfRegistry");
|
||||
stat.Flag = reader.ReadNationality("STAT.Flag");
|
||||
|
||||
stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber");
|
||||
reader.Conf.ConfirmText("STAT.MMSINumber", stat.MMSINumber, (stat.MMSINumber.IsNullOrEmpty() || (stat.MMSINumber.Length != 9)) ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
|
||||
stat.ISMCompanyId = reader.ReadTextNoWhitespace("STAT.ISMCompanyId");
|
||||
@ -976,19 +1016,6 @@ namespace bsmd.ExcelReadService
|
||||
}
|
||||
reader.Conf.ConfirmText("STAT.ISMCompanyId", stat.ISMCompanyId, stat.ISMCompanyId.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
||||
|
||||
|
||||
if (!stat.Flag.IsNullOrEmpty() && stat.Flag.Length > 2)
|
||||
stat.Flag = LocodeDB.CountryCodeFromName(stat.Flag);
|
||||
|
||||
if (!stat.Flag.IsNullOrEmpty() && stat.Flag.Length == 2)
|
||||
{
|
||||
if (!stat.PortOfRegistry.IsNullOrEmpty() && stat.PortOfRegistry.Length != 5)
|
||||
stat.PortOfRegistry = LocodeDB.LocodeFromCity(stat.PortOfRegistry, stat.Flag);
|
||||
}
|
||||
|
||||
if (!stat.Flag.IsNullOrEmpty() && (stat.Flag.Length > 2))
|
||||
reader.Conf.ConfirmText("STAT.Flag", stat.Flag, ExcelReader.ReadState.FAIL);
|
||||
|
||||
string transportMode = reader.ReadText("STAT.TransportMode");
|
||||
if(transportMode != null)
|
||||
{
|
||||
@ -997,6 +1024,9 @@ namespace bsmd.ExcelReadService
|
||||
}
|
||||
reader.Conf.ConfirmText("STAT.TransportMode", transportMode, stat.TransportMode.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
||||
|
||||
if (!stat.ShipType.IsNullOrEmpty() && stat.ShipType.Length > 3)
|
||||
reader.Conf.ConfirmText("STAT.ShipType", stat.ShipType, ExcelReader.ReadState.WARN);
|
||||
|
||||
// Vessel Email as HerbergEmail sichern
|
||||
messageCore.HerbergEmailContactReportingVessel = reader.ReadText("ShipMail");
|
||||
reader.Conf.ConfirmText("ShipMail", messageCore.HerbergEmailContactReportingVessel, messageCore.HerbergEmailContactReportingVessel.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||
@ -1276,6 +1306,15 @@ namespace bsmd.ExcelReadService
|
||||
waste.WasteAmountGeneratedTillNextPort_MTQ = 0;
|
||||
}
|
||||
|
||||
if(i==15) // falls letzte Zeile leer, entfernen: Christin 22.3.17
|
||||
{
|
||||
if ((waste.WasteDescription.IsNullOrEmpty() || waste.WasteDescription == "-") &&
|
||||
((waste.WasteDisposalAmount_MTQ ?? 0) == 0) &&
|
||||
((waste.WasteType ?? 0) == 1300))
|
||||
was.Waste.Remove(waste);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
try
|
||||
@ -2500,6 +2539,11 @@ namespace bsmd.ExcelReadService
|
||||
else
|
||||
reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "invalid PoC";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
imo = reader.ReadText("Visit.IMONumber");
|
||||
|
||||
@ -86,6 +86,19 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
public string TransmissionType { get; set; }
|
||||
|
||||
public bool HasPositions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.IMDGPositions.Count > 0) return true;
|
||||
if (this.IBCPositions.Count > 0) return true;
|
||||
if (this.IGCPositions.Count > 0) return true;
|
||||
if (this.IMSBCPositions.Count > 0) return true;
|
||||
if (this.MARPOLPositions.Count > 0) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DatabaseEntity implementation
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.4.4")]
|
||||
[assembly: AssemblyInformationalVersion("3.4.6")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.4.4.*")]
|
||||
[assembly: AssemblyVersion("3.4.6.*")]
|
||||
|
||||
|
||||
@ -43,7 +43,6 @@ namespace bsmd.database
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.FLAG_CODE)]
|
||||
[LookupName("STAT.Flag")]
|
||||
[MaxLength(2)]
|
||||
public string Flag { get; set; }
|
||||
|
||||
@ -64,7 +63,6 @@ namespace bsmd.database
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.LOCODE)]
|
||||
[LookupName("STAT.PortOfRegistry")]
|
||||
[MaxLength(5)]
|
||||
public string PortOfRegistry { get; set; }
|
||||
|
||||
|
||||
@ -263,8 +263,6 @@ namespace bsmd.dbh
|
||||
List<object> secItems = new List<object>();
|
||||
List<ItemsChoiceType1> choiceType1s = new List<ItemsChoiceType1>();
|
||||
|
||||
rootSEC.CurrentShipSecurityLevel = (int)sec.CurrentShipSecurityLevel.Value;
|
||||
|
||||
if(!message.MessageCore.IsTransit)
|
||||
{
|
||||
if(sec.KielCanalPassagePlanned ?? false)
|
||||
@ -278,6 +276,8 @@ namespace bsmd.dbh
|
||||
}
|
||||
}
|
||||
|
||||
rootSEC.CurrentShipSecurityLevel = (int)sec.CurrentShipSecurityLevel.Value;
|
||||
|
||||
if (sec.SECSimplification ?? false)
|
||||
{
|
||||
choiceType1s.Add(ItemsChoiceType1.SECSimplification);
|
||||
@ -286,7 +286,7 @@ namespace bsmd.dbh
|
||||
secItems.Add(sec.PortOfCallWhereCompleteSECNotified);
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // ACHTUNG Reihenfolge muss exakt dem .xsd entsprechen!
|
||||
choiceType1s.Add(ItemsChoiceType1.CSOLastName);
|
||||
secItems.Add(sec.CSOLastName);
|
||||
choiceType1s.Add(ItemsChoiceType1.CSOFirstName);
|
||||
@ -295,10 +295,16 @@ namespace bsmd.dbh
|
||||
secItems.Add(sec.CSOPhone);
|
||||
choiceType1s.Add(ItemsChoiceType1.CSOFax);
|
||||
secItems.Add(sec.CSOFax);
|
||||
choiceType1s.Add(ItemsChoiceType1.CSOEMail);
|
||||
secItems.Add(sec.CSOEMail);
|
||||
choiceType1s.Add(ItemsChoiceType1.ValidISSCOnBoard);
|
||||
secItems.Add(sec.ValidISSCOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
|
||||
choiceType1s.Add(ItemsChoiceType1.ReasonsForNoValidISSC);
|
||||
secItems.Add(sec.ReasonsForNoValidISSC);
|
||||
choiceType1s.Add(ItemsChoiceType1.ISSCType);
|
||||
secItems.Add((ISSCType)(sec.ISSCType ?? 0));
|
||||
choiceType1s.Add(ItemsChoiceType1.ISSCIssuerType);
|
||||
secItems.Add((ISSCIssuerType)(sec.ISSCIssuerType ?? 0));
|
||||
choiceType1s.Add(ItemsChoiceType1.ISSCIssuerName);
|
||||
secItems.Add(sec.ISSCIssuerName);
|
||||
if (sec.ISSCDateOfExpiration.HasValue)
|
||||
@ -316,13 +322,6 @@ namespace bsmd.dbh
|
||||
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++)
|
||||
{
|
||||
@ -909,11 +908,13 @@ namespace bsmd.dbh
|
||||
}
|
||||
else
|
||||
{
|
||||
// ACHTUNG hier ist die Reihenfolge entscheidend! (siehe XSD)
|
||||
|
||||
List<object> wasteItems = new List<object>();
|
||||
List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>();
|
||||
|
||||
choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectnessAndSufficiency);
|
||||
wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? "Y" : "N");
|
||||
choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort);
|
||||
wasteItems.Add(was.LastWasteDisposalPort);
|
||||
|
||||
if (was.LastWasteDisposalDate.HasValue)
|
||||
{
|
||||
@ -921,15 +922,6 @@ namespace bsmd.dbh
|
||||
wasteItems.Add(was.LastWasteDisposalDate.Value);
|
||||
}
|
||||
|
||||
choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort);
|
||||
wasteItems.Add(was.LastWasteDisposalPort);
|
||||
|
||||
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);
|
||||
@ -937,6 +929,12 @@ namespace bsmd.dbh
|
||||
|
||||
}
|
||||
|
||||
if (was.WasteDisposalDelivery.HasValue)
|
||||
{
|
||||
choiceType3s.Add(ItemsChoiceType3.WasteDisposalDelivery);
|
||||
wasteItems.Add((DisposalType)was.WasteDisposalDelivery.Value);
|
||||
}
|
||||
|
||||
/*
|
||||
{"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."}
|
||||
@ -950,6 +948,7 @@ namespace bsmd.dbh
|
||||
if ((waste.WasteType ?? 0) == 0) continue; // not a valid waste type
|
||||
rww.WasteType = new RootWASWasteWasteType();
|
||||
rww.WasteType.WasteCode = waste.WasteType ?? 0;
|
||||
if (rww.WasteType.WasteCode == 2313) rww.WasteType.WasteCode = 2600; // Christin, 22.3.17
|
||||
rww.WasteType.WasteDescription = waste.WasteDescription;
|
||||
|
||||
rww.WasteDisposedAtLastPort_MTQ = decimal.Round((decimal) (waste.WasteDisposedAtLastPort_MTQ ?? 0), 3);
|
||||
@ -964,6 +963,9 @@ namespace bsmd.dbh
|
||||
wasteItems.Add(rww);
|
||||
}
|
||||
|
||||
choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectnessAndSufficiency);
|
||||
wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? "Y" : "N");
|
||||
|
||||
rootWAS.ItemsElementName = choiceType3s.ToArray();
|
||||
rootWAS.Items = wasteItems.ToArray();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user