NSW 3.3.4 (Korrekturen und HAZA angefangen)

This commit is contained in:
Daniel Schick 2017-01-05 07:06:31 +00:00
parent 91aa27f157
commit 085a36802c
8 changed files with 184 additions and 26 deletions

Binary file not shown.

View File

@ -0,0 +1,11 @@
PRINT N'Altering [dbo].[HAZA]...';
GO
ALTER TABLE [dbo].[HAZA] ADD [DPGContactFamilyName] NVARCHAR(64) NULL;
ALTER TABLE [dbo].[HAZA] ADD [DPGContactPhone] NVARCHAR(64) NULL;
GO
PRINT N'Altering [dbo].[HAZD]...';
GO
ALTER TABLE [dbo].[HAZD] ADD [DPGContactFamilyName] NVARCHAR(64) NULL;
ALTER TABLE [dbo].[HAZD] ADD [DPGContactPhone] NVARCHAR(64) NULL;
GO

View File

@ -25,9 +25,8 @@ namespace bsmd.ExcelReadService
private int whiteColor = ColorTranslator.ToOle(Color.White);
private List<Workbook> workbooks = new List<Workbook>();
private List<Dictionary<string, Name>> nameDicts = new List<Dictionary<string, Name>>();
private List<Dictionary<string, List<Name>>> nameDicts = new List<Dictionary<string, List<Name>>>();
private List<string> templateNames = new List<string>();
private List<Dictionary<string, string>> actualNameDict = null;
#region Construction
@ -52,7 +51,7 @@ namespace bsmd.ExcelReadService
*/
Dictionary<string, Name> nameDict = new Dictionary<string, Name>();
Dictionary<string, List<Name>> nameDict = new Dictionary<string, List<Name>>();
// hier müsste etwas hin das nur aus der eben geladenen Vorlage die Namen rauszieht..
@ -67,7 +66,9 @@ namespace bsmd.ExcelReadService
}
else
{
nameDict[workbookName.Name] = workbookName;
if (!nameDict.ContainsKey(workbookName.Name))
nameDict[workbookName.Name] = new List<Name>();
nameDict[workbookName.Name].Add(workbookName);
}
}
@ -150,15 +151,14 @@ namespace bsmd.ExcelReadService
for(int i=0;i<this.workbooks.Count;i++)
{
Workbook workbook = this.workbooks[i];
Dictionary<string, Name> nameDict = this.nameDicts[i];
Dictionary<string, List<Name>> nameDict = this.nameDicts[i];
Name someName = null;
if(nameDict.ContainsKey(lookup))
{
try
{
someName = nameDict[lookup];
foreach (Name someName in nameDict[lookup])
{
Range range = someName.RefersToRange;
if (range != null)
{
@ -168,6 +168,7 @@ namespace bsmd.ExcelReadService
Marshal.ReleaseComObject(range);
_log.InfoFormat("Value {0} for lookup {1} OK", value, lookup);
}
}
catch(Exception ex)
{
_log.WarnFormat("cannot set value {0} for lookup {1}: {2}",

View File

@ -489,6 +489,22 @@ namespace bsmd.ExcelReadService
result = tmpDouble;
}
}
if ((result == null) && (val != null))
{
try
{
{
double tmpDouble2 = val[1, 1];
result = tmpDouble2;
}
}
catch (Exception)
{
// ..
}
}
if (result != null)
{
this.Conf.ConfirmNumber(lookup, result, ReadState.OK);

View File

@ -336,6 +336,111 @@ namespace bsmd.ExcelReadService
#endregion
#region HAZA
static void ScanHAZA(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{
Message hazaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.HAZA);
if(hazaMessage.Elements.Count == 0)
{
HAZ newHaza = new HAZ();
newHaza.IsDeparture = false;
newHaza.MessageHeader = hazaMessage;
hazaMessage.Elements.Add(newHaza);
}
HAZ haza = hazaMessage.Elements[0] as HAZ;
haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival");
haza.DPGContactFamilyName = reader.ReadText("HAZA.DPGContactFamilyName");
reader.Conf.ConfirmText("HAZA.DPGContactFamilyName", haza.DPGContactFamilyName, haza.DPGContactFamilyName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
haza.DPGContactPhone = reader.ReadText("HAZA.DPGContactPhone");
reader.Conf.ConfirmText("HAZA.DPGContactPhone", haza.DPGContactPhone, haza.DPGContactPhone.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
haza.MOUBaltic = reader.ReadBoolean("HAZA.MOUBaltic");
string shipClass = reader.ReadText("HAZA.INFShipClass");
if(shipClass.IsNullOrEmpty())
{
reader.Conf.ConfirmText("HAZA.INFShipClass", null, ExcelReader.ReadState.FAIL);
}
else
{
if (shipClass.Contains('1')) haza.INFShipClass = 1;
if (shipClass.Contains('2')) haza.INFShipClass = 2;
if (shipClass.Contains('3')) haza.INFShipClass = 3;
if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) haza.INFShipClass = 0;
reader.Conf.ConfirmText("HAZA.INFShipClass", shipClass, haza.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
}
// IMDG
string imdg_unno = "HAZA.IMDG.UNNumber_{0}";
string imdg_properShippingName = "HAZA.IMDG.ProperShippingName_{0}";
string imdg_imoClass = "HAZA.IMDG.IMOClass_{0}";
string imdg_packingGroup = "HAZA.IMDG.PackingGroup_{0}";
string imdg_marinePollutant = "HAZA.IMDG.MarinePollutant_{0}";
string imdg_flashpoint = "HAZA.IMDG.Flashpoint_CEL_{0}";
string imdg_numberOfPackages = "HAZA.IMDG.NumberOfPackages_{0}";
string imdg_packageType = "HAZA.IMDG.PackageType_{0}";
string imdg_limitedQuantities = "HAZA.IMDG.LimitedQuantities_{0}";
string imdg_exceptedQuantities = "HAZA.IMDG.ExceptedQuantities_{0}";
string imdg_netQuantity = "HAZA.IMDG.NetQuantity_KGM_{0}";
string imdg_grossQuantity = "HAZA.IMDG.GrossQuantity_KGM_{0}";
string imdg_number = "HAZA.IMDG.Number_{0}";
string imdg_stowagePosition = "HAZA.IMDG.StowagePosition_{0}";
string imdg_portOfLoading = "HAZA.IMDG.PortOfLoading_{0}";
string imdg_portOfDischarge = "HAZA.IMDG.PortOfDischarge_{0}";
for (int i = 1; i <= 10; i++)
{
}
// IBC
for (int i = 1; i <= 5; i++)
{
}
// IGC
for (int i = 1; i <= 5; i++)
{
}
// IMSBC
for (int i = 1; i <= 5; i++)
{
}
// MARPOL
for (int i = 1; i <= 5; i++)
{
}
}
#endregion
#region HAZD
static void ScanHAZD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{
Message hazdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.HAZD);
if (hazdMessage.Elements.Count == 0)
{
HAZ newHaza = new HAZ();
newHaza.IsDeparture = true;
newHaza.MessageHeader = hazdMessage;
hazdMessage.Elements.Add(newHaza);
}
HAZ hazd = hazdMessage.Elements[0] as HAZ;
}
#endregion
#region INFO
static void ScanINFO(List<Message> messages, MessageCore messageCore, ExcelReader reader)
@ -404,6 +509,10 @@ namespace bsmd.ExcelReadService
}
reader.Conf.ConfirmText("STAT.TransportMode", transportMode, stat.TransportMode.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
// 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);
// wird nicht wieder entfernt (core ist auch da!)
}
@ -426,7 +535,9 @@ namespace bsmd.ExcelReadService
if (messageCore.IsTransit)
noa_nod.ETAToKielCanal = messageCore.ETAKielCanal;
else {
noa_nod.ETAToPortOfCall = messageCore.ETA;
reader.Conf.ConfirmDate("NOA_NOD.ETAToPortOfCall", noa_nod.ETAToPortOfCall, ExcelReader.ReadState.OK);
for (int i = 1; i <= noa_nod.NumberOfExcelRows; i++)
{
@ -502,6 +613,7 @@ namespace bsmd.ExcelReadService
reader.Conf.ConfirmText("NOA_NOD.NextPort", nextPort, noa_nod.NextPort.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
noa_nod.ETDFromPortOfCall = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", noa_nod.ETDFromPortOfCall, ExcelReader.ReadState.OK);
noa_nod.ETDFromLastPort = reader.ReadDateTime("NOA_NOD.ETDDateFromLastPort", "NOA_NOD.ETDTimeFromLastPort");
noa_nod.ETAToNextPort = reader.ReadDateTime("NOA_NOD.ETADateToNextPort", "NOA_NOD.ETATimeToNextPort");
// DK
@ -567,6 +679,7 @@ namespace bsmd.ExcelReadService
was.WasteDisposalServiceProvider[0].WasteDisposalServiceProviderName = wastedispServProvName;
was.WasteDisposalServiceProvider[0].WasteDisposalDelivery = was.WasteDisposalDelivery;
}
reader.Conf.ConfirmText("WAS.WasteDisposalServiceProviderName", wastedispServProvName, wastedispServProvName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
// Waste 1 - 15
for (int i = 1; i <= was.NumberOfExcelRows; i++)
@ -932,7 +1045,7 @@ namespace bsmd.ExcelReadService
if (bkra.BunkerFuelType.IsNullOrEmpty() && !bkra.BunkerFuelQuantity_TNE.HasValue)
reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK);
// "WARN" Quantity falls Menge aber kein Type
if(bkra.BunkerFuelQuantity_TNE.HasValue && !bkra.BunkerFuelType.IsNullOrEmpty())
if(bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty())
{
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
reader.Conf.ConfirmNumber(lnQuantity, bkra.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN);
@ -972,7 +1085,7 @@ namespace bsmd.ExcelReadService
if (bkrd.BunkerFuelType.IsNullOrEmpty() && !bkrd.BunkerFuelQuantity_TNE.HasValue)
reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK);
// "WARN" Quantity falls Menge aber kein Type
if (bkrd.BunkerFuelQuantity_TNE.HasValue && !bkrd.BunkerFuelType.IsNullOrEmpty())
if (bkrd.BunkerFuelQuantity_TNE.HasValue && bkrd.BunkerFuelType.IsNullOrEmpty())
{
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
reader.Conf.ConfirmNumber(lnQuantity, bkrd.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN);
@ -1452,6 +1565,13 @@ namespace bsmd.ExcelReadService
reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE);
reader.Conf.ConfirmText("ID", visitTransitId, ExcelReader.ReadState.OK);
// copy poc/imo/eta to return sheet
poc = reader.ReadText("Visit.PortOfCall");
reader.Conf.ConfirmText("Visit.PortOfCall", poc, ExcelReader.ReadState.OK);
imo = reader.ReadText("Visit.IMONumber");
reader.Conf.ConfirmText("Visit.IMONumber", imo, ExcelReader.ReadState.OK);
eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall");
}
else
{

View File

@ -57,6 +57,12 @@ namespace bsmd.database
[ShowReport]
public bool? DPGClassificationMARPOL_ANNEX_I { get; set; }
// DK
public string DPGContactFamilyName { get; set; }
// DK
public string DPGContactPhone { get; set; }
public List<IMDGPosition> IMDGPositions { get { return this.imdgPositions; } }
public List<IBCPosition> IBCPositions { get { return this.ibcPositions; } }
@ -111,6 +117,8 @@ namespace bsmd.database
scmd.Parameters.AddWithNullableValue("@P9", this.DPGClassificationMARPOL_ANNEX_I);
scmd.Parameters.AddWithNullableValue("@P10", this.TransmissionType);
scmd.Parameters.AddWithNullableValue("@P11", this.MOUBaltic);
scmd.Parameters.AddWithNullableValue("@P12", this.DPGContactFamilyName);
scmd.Parameters.AddWithNullableValue("@P13", this.DPGContactPhone);
if (this.IsNew)
{
@ -120,14 +128,14 @@ namespace bsmd.database
{
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnDeparture, DPGManifestOnBoardOnDeparture, " +
"INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)",
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13)",
this.Tablename);
}
else
{
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, " +
"INFShipClass, DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)",
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13)",
this.Tablename);
}
}
@ -138,13 +146,13 @@ namespace bsmd.database
{
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, MOUBaltic = @P11 WHERE Id = @ID", this.Tablename);
"DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9, TransmissionType = @P10, MOUBaltic = @P11, DPGContactFamilyName = @P12, DPGContactPhone = @P13 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, MOUBaltic = @P11 WHERE Id = @ID", this.Tablename);
"DPGClassificationIMSBC = @P8, DPGClassificationMARPOL_ANNEX_I = @P9, TransmissionType = @P10, MOUBaltic = @P11, DPGContactFamilyName = @P12, DPGContactPhone = @P13 WHERE Id = @ID", this.Tablename);
}
}
}
@ -153,13 +161,13 @@ namespace bsmd.database
{
string query = string.Format("SELECT Id, NoDPGOnBoardOnArrival, DPGManifestOnBoardOnArrival, INFShipClass, " +
"DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic FROM {0} ", this.Tablename);
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone FROM {0} ", this.Tablename);
if (this.IsDeparture)
{
query = string.Format("SELECT Id, NoDPGOnBoardOnDeparture, DPGManifestOnBoardOnDeparture, INFShipClass, " +
"DPGClassificationIMDG, DPGClassificationIGC, DPGClassificationIBC, DPGClassificationIMSBC, " +
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic FROM {0} ", this.Tablename);
"DPGClassificationMARPOL_ANNEX_I, TransmissionType, MOUBaltic, DPGContactFamilyName, DPGContactPhone FROM {0} ", this.Tablename);
}
switch (filter)
@ -196,6 +204,8 @@ namespace bsmd.database
if (!reader.IsDBNull(8)) haz.DPGClassificationMARPOL_ANNEX_I = reader.GetBoolean(8);
if (!reader.IsDBNull(9)) haz.TransmissionType = reader.GetString(9);
if (!reader.IsDBNull(10)) haz.MOUBaltic = reader.GetBoolean(10);
if (!reader.IsDBNull(11)) haz.DPGContactFamilyName = reader.GetString(11);
if (!reader.IsDBNull(12)) haz.DPGContactPhone = reader.GetString(12);
result.Add(haz);
}

View File

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

View File

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