Weiter voran am Reporting, letzte Restpunkte bearbeitet

This commit is contained in:
Daniel Schick 2021-09-13 05:53:42 +00:00
parent 015a8665a8
commit a8df8cc417
9 changed files with 16214 additions and 111 deletions

View File

@ -26,12 +26,12 @@
<value>1000</value>
</setting>
<setting name="LockingServerAddress" serializeAs="String">
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
<!--value>http://heupferd/bsmd.LockingService/LockingService.svc</value-->
<!--value>http://192.168.2.24/LockingService/LockingService.svc</value-->
<value>http://heupferd/bsmd.LockingService/LockingService.svc</value>
</setting>
<setting name="ConnectionString" serializeAs="String">
<value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
<!--value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value-->
<!--value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value-->
<value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value>
</setting>
</ENI2.Properties.Settings>
</applicationSettings>

View File

@ -35,7 +35,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.4.3.%2a</ApplicationVersion>
<ApplicationVersion>6.5.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -22,14 +22,18 @@ using ENI2;
using bsmd.ExcelReadService;
using bsmd.database;
using System.Text;
namespace bsmd.ReportGenerator
{
public class BSMDDocument
{
private static Orientation _lastOrientation = Orientation.Portrait;
#region static lookup helpers
private static Dictionary<string, string> _cargoCodesNST = null;
private static Dictionary<string, string> _cargoCodesNST = null;
private static Dictionary<string, string> cargoCodesNST
{
@ -111,7 +115,9 @@ namespace bsmd.ReportGenerator
BSMDDocument.DefineSingleStyle(document);
BSMDDocument.DefineSingleHeader(document, coverInfos, rp);
BSMDDocument.DefineContentSectionInitial(document);
DatabaseEntity.ReportReplacer += DatabaseEntity_ReportReplacer;
DatabaseEntity.ReportReplacer += DatabaseEntity_ReportReplacer; // ist das ein Leak?
_lastOrientation = Orientation.Portrait; // Reset orientation (if last page was landscape..)
return document;
}
@ -450,15 +456,22 @@ namespace bsmd.ReportGenerator
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.CREW))
{
// Landscape!
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
// Landscape
if (_lastOrientation == Orientation.Portrait)
{
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
_lastOrientation = Orientation.Landscape;
}
else
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Subtitle), "Heading3");
BSMDDocument.CreateCrewTable(document, message);
BSMDDocument.DefineContentSection(document, Orientation.Portrait, false);
return;
}
@ -468,15 +481,22 @@ namespace bsmd.ReportGenerator
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.PAS))
{
// Landscape!
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
// Landscape
if (_lastOrientation == Orientation.Portrait)
{
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
_lastOrientation = Orientation.Landscape;
}
else
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Subtitle), "Heading3");
BSMDDocument.CreatePassengerTable(document, message);
BSMDDocument.DefineContentSection(document, Orientation.Portrait, false);
return;
}
@ -486,15 +506,22 @@ namespace bsmd.ReportGenerator
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.TOWA))
{
// Landscape!
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
// Landscape
if (_lastOrientation == Orientation.Portrait)
{
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
_lastOrientation = Orientation.Landscape;
}
else
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Subtitle), "Heading3");
BSMDDocument.CreateTOWATable(document, message);
BSMDDocument.DefineContentSection(document, Orientation.Portrait, false);
return;
}
@ -504,15 +531,22 @@ namespace bsmd.ReportGenerator
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.TOWD))
{
// Landscape!
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
// Landscape
if (_lastOrientation == Orientation.Portrait)
{
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
_lastOrientation = Orientation.Landscape;
}
else
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Subtitle), "Heading3");
BSMDDocument.CreateTOWDTable(document, message);
BSMDDocument.DefineContentSection(document, Orientation.Portrait, false);
return;
}
@ -525,26 +559,38 @@ namespace bsmd.ReportGenerator
(message.Elements.Count > 0)
)
{
HAZ haz = message.Elements[0] as HAZ;
if ((haz != null) &&
if ((message.Elements[0] is HAZ haz) &&
((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)))
{
// Landscape!
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
// Landscape
if (_lastOrientation == Orientation.Portrait)
{
BSMDDocument.DefineContentSection(document, Orientation.Landscape, false);
_lastOrientation = Orientation.Landscape;
}
else
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Subtitle), "Heading3");
BSMDDocument.CreateHAZPage(document, haz);
BSMDDocument.DefineContentSection(document, Orientation.Portrait, false);
BSMDDocument.CreateHAZPage(document, haz);
}
return;
}
#endregion
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
if(_lastOrientation == Orientation.Landscape)
{
BSMDDocument.DefineContentSection(document, Orientation.Portrait, false);
_lastOrientation = Orientation.Portrait;
}
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Title), "Heading2");
document.LastSection.AddParagraph(BSMDDocument.ReplaceTitle(messageParagraph.Subtitle), "Heading3");
#region Spezialbehandlung WAS Meldung
@ -703,10 +749,7 @@ namespace bsmd.ReportGenerator
#region CREW
private static void CreateCrewTable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Color = Colors.LightGray;
table.Borders.Visible = true;
Table table = AddGrayTable(document);
Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(1);
@ -765,10 +808,7 @@ namespace bsmd.ReportGenerator
#region PAS
private static void CreatePassengerTable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(0.8);
@ -840,10 +880,7 @@ namespace bsmd.ReportGenerator
if (mdh.PortOfCallLast30Days.Count > 0)
{
document.LastSection.AddParagraph("Port of call last 30 days", "Heading3");
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(20);
table.AddColumn(80);
@ -949,10 +986,7 @@ namespace bsmd.ReportGenerator
private static void CreateLADGTable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(1);
@ -990,10 +1024,7 @@ namespace bsmd.ReportGenerator
private static void CreateSERVTable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(30);
table.AddColumn(90);
@ -1027,11 +1058,8 @@ namespace bsmd.ReportGenerator
if (sec.LastTenPortFacilitesCalled.Count > 0)
{
document.LastSection.AddParagraph("Last 10 port facilites called", "Heading3");
Table table = document.LastSection.AddTable();
table.Format.Font.Size = 8;
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.Format.Font.Size = 8;
Column column = table.AddColumn();
column.Width = Unit.FromCentimeter(0.8);
@ -1190,10 +1218,7 @@ namespace bsmd.ReportGenerator
private static void CreateBKRDTable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(30);
table.AddColumn(290);
@ -1219,10 +1244,7 @@ namespace bsmd.ReportGenerator
private static void CreateBKRATable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(30);
table.AddColumn(290);
@ -1250,10 +1272,7 @@ namespace bsmd.ReportGenerator
{
WAS was = message.Elements[0] as WAS;
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(290);
table.AddColumn(200);
@ -1386,10 +1405,7 @@ namespace bsmd.ReportGenerator
private static void CreateTOWATable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(20); // lfd. Nr.
table.AddColumn(50); // Name
@ -1459,10 +1475,7 @@ namespace bsmd.ReportGenerator
private static void CreateTOWDTable(Document document, Message message)
{
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(20); // lfd. Nr.
table.AddColumn(50); // Name
@ -1528,55 +1541,358 @@ namespace bsmd.ReportGenerator
{
// für jede Liste (IMDG, IGC, IBC, IMSBC, Marpol) wird eine eigene Seite angelegt, falls > 0 Elemente vorhanden sind
bool didPage = false;
#region IMDG
if(haz.IMDGPositions.Count > 0)
{
Paragraph p = document.LastSection.AddParagraph("IMDG positions", "Heading4");
p.Format.Borders.Top = new Border() { Width = "1pt", Color = Colors.DarkGray };
Table table = AddGrayTable(document);
table.Format.Font.Size = 8;
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(3.2));
table.AddColumn(Unit.FromCentimeter(1.7));
table.AddColumn(Unit.FromCentimeter(0.9));
table.AddColumn(Unit.FromCentimeter(1.0)); //
table.AddColumn(Unit.FromCentimeter(0.6)); // 5
table.AddColumn(Unit.FromCentimeter(0.8)); // MP
table.AddColumn(Unit.FromCentimeter(0.8));
table.AddColumn(Unit.FromCentimeter(1.7));
table.AddColumn(Unit.FromCentimeter(1.4)); //10
table.AddColumn(Unit.FromCentimeter(0.6));
table.AddColumn(Unit.FromCentimeter(0.6));
table.AddColumn(Unit.FromCentimeter(2.3));
table.AddColumn(Unit.FromCentimeter(8.8));
Row hRow = table.AddRow();
hRow.Format.Font.Bold = true;
hRow.Format.Font.Size = 7;
hRow.Format.Alignment = ParagraphAlignment.Left;
hRow.Format.SpaceBefore = Unit.FromMillimeter(0.5);
hRow.Cells[0].AddParagraph("Id");
hRow.Cells[1].AddParagraph("Container- no/kind");
hRow.Cells[2].AddParagraph("Position");
hRow.Cells[3].AddParagraph("Class");
hRow.Cells[4].AddParagraph("UN No");
hRow.Cells[5].AddParagraph("PG");
hRow.Cells[6].AddParagraph("MP");
hRow.Cells[7].AddParagraph("Flp");
hRow.Cells[8].AddParagraph("Qty");
hRow.Cells[9].AddParagraph("Package type");
hRow.Cells[10].AddParagraph("LQ");
hRow.Cells[11].AddParagraph("EQ");
hRow.Cells[12].AddParagraph("Weight (kg)");
hRow.Cells[13].AddParagraph("Remarks");
for (int i = 0; i < haz.IMDGPositions.Count; i++)
{
IMDGPosition pos = haz.IMDGPositions[i];
Row row = table.AddRow();
row.Cells[0].AddParagraph(pos.Identifier ?? "");
row.Cells[1].AddParagraph(string.Format("{0}\n{1}",pos.ContainerNumber, pos.VehicleLicenseNumber));
row.Cells[2].AddParagraph(pos.StowagePosition.IsNullOrEmpty() ? string.Format("{0} {1} {2}", pos.Bay, pos.Row, pos.Tier) : pos.StowagePosition);
row.Cells[3].AddParagraph(pos.IMOClass);
row.Cells[4].AddParagraph(pos.UNNumber);
row.Cells[5].AddParagraph(DatabaseEntity_ReportReplacer("PackingGroup", pos.PackingGroup.ToString()));
row.Cells[6].AddParagraph((pos.MarinePollutant ?? false) ? "Y" : "N");
row.Cells[7].AddParagraph(pos.Flashpoint_CEL);
row.Cells[8].AddParagraph(pos.NumberOfPackages.ToString());
row.Cells[9].AddParagraph(pos.PackageType);
row.Cells[10].AddParagraph((pos.LimitedQuantities ?? false) ? "Y" : "N");
row.Cells[11].AddParagraph((pos.ExceptedQuantities ?? false) ? "Y" : "N");
row.Cells[12].AddParagraph(string.Format("GW:{0}\nNW:{1}", pos.GrossQuantity_KGM, pos.NetQuantity_KGM));
// if available, put remaining fields together in a single cell
StringBuilder sb = new StringBuilder();
if (!pos.ProperShippingName.IsNullOrEmpty()) { sb.Append("Ship. name:"); sb.Append(pos.ProperShippingName); sb.Append("\n"); }
if (!pos.TechnicalName.IsNullOrEmpty()) { sb.Append("Tech. name:"); sb.Append(pos.TechnicalName); sb.Append("\n"); }
if (pos.NetExplosiveMass_KGM.HasValue) { sb.Append("Net expl. mass:"); sb.Append(pos.NetExplosiveMass_KGM.Value); sb.Append("kgm\n"); }
if (!pos.Class7NuclideName.IsNullOrEmpty()) { sb.Append("Radionuclide:"); sb.Append(pos.Class7NuclideName); sb.Append("\n"); }
if (pos.Class7MaxActivity_BQL.HasValue) { sb.Append("Max Act.:"); sb.Append(pos.Class7MaxActivity_BQL.Value); sb.Append("BQL\n"); }
if (pos.Class7Category.HasValue) { sb.Append("C7 Cat.:"); sb.Append(pos.Class7Category.Value); sb.Append("\n"); }
if (pos.Class7TransportIndex.HasValue) { sb.Append("Tr. Ind.:"); sb.Append(pos.Class7TransportIndex.Value); sb.Append("\n"); }
if (pos.Class7CSI.HasValue) { sb.Append("CSI:"); sb.Append(pos.Class7CSI.Value); sb.Append("\n"); }
if (pos.ControlTemperature_CEL.HasValue) { sb.Append("Ctrl. Temp:"); sb.Append(pos.ControlTemperature_CEL.Value); sb.Append("°C\n"); }
if (pos.EmergencyTemperature_CEL.HasValue) { sb.Append("Em. Temp:"); sb.Append(pos.EmergencyTemperature_CEL.Value); sb.Append("°C\n"); }
if (!pos.SubsidiaryRiskText.IsNullOrEmpty()) { sb.Append("Sub. risks:"); sb.Append(pos.SubsidiaryRiskText); sb.Append("\n"); }
//if (pos.LimitedQuantities.HasValue) { sb.Append("Lim. quant:"); sb.Append(pos.LimitedQuantities.Value ? "Y\n" : "N\n"); }
//if (pos.ExceptedQuantities.HasValue) { sb.Append("Exp. quant:"); sb.Append(pos.ExceptedQuantities.Value ? "Y\n" : "N\n"); }
if (pos.Volume_MTQ.HasValue) { sb.Append("Vol:"); sb.Append(pos.Volume_MTQ.Value); sb.Append("m³\n"); }
//if (pos.GeneralCargoIBC.HasValue) { sb.Append("Gen.cargo:"); sb.Append(pos.GeneralCargoIBC.Value ? "Y\n" : "N\n"); }
if (!pos.PortOfLoading.IsNullOrEmpty()) { sb.Append("Port of L.:"); sb.Append(pos.PortOfLoading); sb.Append("\n"); }
if (!pos.PortOfDischarge.IsNullOrEmpty()) { sb.Append("Port of D.:"); sb.Append(pos.PortOfDischarge); sb.Append("\n"); }
if (!pos.Remarks.IsNullOrEmpty()) { sb.Append("Rem.:"); sb.Append(pos.Remarks); }
row.Cells[13].AddParagraph(sb.ToString());
}
didPage = true;
}
if(didPage)
{
document.LastSection.AddPageBreak();
didPage = false;
}
if(haz.IGCPositions.Count > 0)
{
#endregion
}
if (didPage)
{
document.LastSection.AddPageBreak();
didPage = false;
}
#region IBC
if (haz.IBCPositions.Count > 0)
{
if (didPage)
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph("IBC positions", "Heading4");
Table table = AddGrayTable(document);
table.Format.Font.Size = 8;
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(1.0));
table.AddColumn(Unit.FromCentimeter(2.0));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(2.2));
table.AddColumn(Unit.FromCentimeter(6.7));
Row hRow = table.AddRow();
hRow.Format.Font.Bold = true;
hRow.Format.Font.Size = 8;
hRow.Format.Alignment = ParagraphAlignment.Left;
hRow.Format.SpaceBefore = Unit.FromMillimeter(0.5);
hRow.Cells[0].AddParagraph("Id");
hRow.Cells[1].AddParagraph("Prod. name");
hRow.Cells[2].AddParagraph("Cat");
hRow.Cells[3].AddParagraph("Hazards");
hRow.Cells[4].AddParagraph("Fl I");
hRow.Cells[5].AddParagraph("Flp (C°)");
hRow.Cells[6].AddParagraph("Quantity");
hRow.Cells[7].AddParagraph("Stow");
hRow.Cells[8].AddParagraph("PoL");
hRow.Cells[9].AddParagraph("PoD");
hRow.Cells[10].AddParagraph("15.19 in IBC column O");
hRow.Cells[11].AddParagraph("Remarks");
for (int i = 0; i < haz.IBCPositions.Count; i++)
{
IBCPosition pos = haz.IBCPositions[i];
Row row = table.AddRow();
row.Cells[0].AddParagraph(pos.Identifier);
row.Cells[1].AddParagraph(pos.ProductName ?? "");
row.Cells[2].AddParagraph(pos.PollutionCategoryDisplay);
row.Cells[3].AddParagraph(pos.HazardsDisplay);
row.Cells[4].AddParagraph(pos.FlashpointInformationDisplay);
row.Cells[5].AddParagraph(pos.Flashpoint_CEL ?? "");
row.Cells[6].AddParagraph(pos.Quantity_KGM.HasValue ? pos.Quantity_KGM.Value.ToString("N3") : "");
row.Cells[7].AddParagraph(pos.StowagePosition ?? "");
row.Cells[8].AddParagraph(pos.PortOfLoading ?? "");
row.Cells[9].AddParagraph(pos.PortOfDischarge ?? "");
row.Cells[10].AddParagraph(pos.SpecRef15_19.HasValue ? (pos.SpecRef15_19.Value ? "Y" : "N") : "");
row.Cells[11].AddParagraph(pos.Remarks ?? "");
}
didPage = true;
}
if (didPage)
#endregion
#region IGC
if (haz.IGCPositions.Count > 0)
{
document.LastSection.AddPageBreak();
didPage = false;
if (didPage)
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph("IGC positions", "Heading4");
Table table = AddGrayTable(document);
table.Format.Font.Size = 8;
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(4.0));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(3.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(7.4));
Row hRow = table.AddRow();
hRow.Format.Font.Bold = true;
hRow.Format.Font.Size = 8;
hRow.Format.Alignment = ParagraphAlignment.Left;
hRow.Format.SpaceBefore = Unit.FromMillimeter(0.5);
hRow.Cells[0].AddParagraph("Id");
hRow.Cells[1].AddParagraph("UN No");
hRow.Cells[2].AddParagraph("IMO Class");
hRow.Cells[3].AddParagraph("Product name");
hRow.Cells[4].AddParagraph("Quantity");
hRow.Cells[5].AddParagraph("Stow. pos");
hRow.Cells[6].AddParagraph("PoL");
hRow.Cells[7].AddParagraph("PoD");
hRow.Cells[8].AddParagraph("Remarks");
for (int i = 0; i < haz.IGCPositions.Count; i++)
{
IGCPosition pos = haz.IGCPositions[i];
Row row = table.AddRow();
row.Cells[0].AddParagraph(pos.Identifier);
row.Cells[1].AddParagraph(pos.UNNumber ?? "");
row.Cells[2].AddParagraph(pos.IMOClass ?? "");
row.Cells[3].AddParagraph(pos.ProductName ?? "");
row.Cells[4].AddParagraph(pos.Quantity_KGM.HasValue ? pos.Quantity_KGM.Value.ToString("N3") : "");
row.Cells[5].AddParagraph(pos.StowagePosition ?? "");
row.Cells[6].AddParagraph(pos.PortOfLoading ?? "");
row.Cells[7].AddParagraph(pos.PortOfDischarge ?? "");
row.Cells[8].AddParagraph(pos.Remarks ?? "");
}
didPage = true;
}
#endregion
#region IMSBC
if (haz.IMSBCPositions.Count > 0)
{
if (didPage)
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph("IMSBC positions", "Heading4");
Table table = AddGrayTable(document);
table.Format.Font.Size = 8;
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(3.0));
table.AddColumn(Unit.FromCentimeter(1.0));
table.AddColumn(Unit.FromCentimeter(1.0));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(7.4));
Row hRow = table.AddRow();
hRow.Format.Font.Bold = true;
hRow.Format.Font.Size = 8;
hRow.Format.Alignment = ParagraphAlignment.Left;
hRow.Format.SpaceBefore = Unit.FromMillimeter(0.5);
hRow.Cells[0].AddParagraph("Id");
hRow.Cells[1].AddParagraph("Shipping name");
hRow.Cells[2].AddParagraph("Haz");
hRow.Cells[3].AddParagraph("MHB");
hRow.Cells[4].AddParagraph("UN No");
hRow.Cells[5].AddParagraph("IMO Class");
hRow.Cells[6].AddParagraph("Quantity");
hRow.Cells[7].AddParagraph("Stow. pos");
hRow.Cells[8].AddParagraph("PoL");
hRow.Cells[9].AddParagraph("PoD");
hRow.Cells[10].AddParagraph("Remarks");
for (int i = 0; i < haz.IMSBCPositions.Count; i++)
{
IMSBCPosition pos = haz.IMSBCPositions[i];
Row row = table.AddRow();
row.Cells[0].AddParagraph(pos.Identifier);
row.Cells[1].AddParagraph(pos.BulkCargoShippingName ?? "");
row.Cells[2].AddParagraph(pos.IMOHazardClassDisplay);
row.Cells[3].AddParagraph(pos.MHB.HasValue ? (pos.MHB.Value ? "Y" : "N") : "");
row.Cells[4].AddParagraph(pos.UNNumber ?? "");
row.Cells[5].AddParagraph(pos.IMOClass);
row.Cells[6].AddParagraph(pos.Quantity_KGM.HasValue ? pos.Quantity_KGM.Value.ToString("N3") : "");
row.Cells[7].AddParagraph(pos.StowagePosition ?? "");
row.Cells[8].AddParagraph(pos.PortOfLoading ?? "");
row.Cells[9].AddParagraph(pos.PortOfDischarge ?? "");
row.Cells[10].AddParagraph(pos.Remarks ?? "");
}
didPage = true;
}
if (didPage)
{
document.LastSection.AddPageBreak();
}
#endregion
#region Marpol
if (haz.MARPOLPositions.Count > 0)
{
if (didPage)
{
document.LastSection.AddPageBreak();
}
document.LastSection.AddParagraph("Marpol annex I positions", "Heading4");
Table table = AddGrayTable(document);
table.Format.Font.Size = 8;
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(3.0));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(2.0));
table.AddColumn(Unit.FromCentimeter(3.0));
table.AddColumn(Unit.FromCentimeter(2.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(1.5));
table.AddColumn(Unit.FromCentimeter(8.5));
Row hRow = table.AddRow();
hRow.Format.Font.Bold = true;
hRow.Format.Font.Size = 8;
hRow.Format.Alignment = ParagraphAlignment.Left;
hRow.Format.SpaceBefore = Unit.FromMillimeter(0.5);
hRow.Cells[0].AddParagraph("Id");
hRow.Cells[1].AddParagraph("Name");
hRow.Cells[2].AddParagraph("Fl I");
hRow.Cells[3].AddParagraph("Flp (C°)");
hRow.Cells[4].AddParagraph("Quantity");
hRow.Cells[5].AddParagraph("Stow. pos");
hRow.Cells[6].AddParagraph("PoL");
hRow.Cells[7].AddParagraph("PoD");
hRow.Cells[8].AddParagraph("Remarks");
for (int i = 0; i < haz.MARPOLPositions.Count; i++)
{
MARPOL_Annex_I_Position pos = haz.MARPOLPositions[i];
Row row = table.AddRow();
row.Cells[0].AddParagraph(pos.Identifier);
row.Cells[1].AddParagraph(pos.Name ?? "");
row.Cells[2].AddParagraph(pos.FlashpointInformationDisplay);
row.Cells[3].AddParagraph(pos.Flashpoint_CEL ?? "");
row.Cells[4].AddParagraph(pos.Quantity_KGM.HasValue ? pos.Quantity_KGM.Value.ToString("N3") : "");
row.Cells[5].AddParagraph(pos.StowagePosition ?? "");
row.Cells[6].AddParagraph(pos.PortOfLoading ?? "");
row.Cells[7].AddParagraph(pos.PortOfDischarge ?? "");
row.Cells[8].AddParagraph(pos.Remarks ?? "");
}
}
#endregion
}
#endregion
@ -1589,10 +1905,7 @@ namespace bsmd.ReportGenerator
{
document.LastSection.AddParagraph("Call purposes", "Heading3");
Table table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
Table table = AddGrayTable(document);
table.AddColumn(30);
table.AddColumn(460);
@ -1642,7 +1955,7 @@ namespace bsmd.ReportGenerator
KeyValuePair<string, string> elem = messageText[i];
Row row = table.AddRow();
Cell cell = row.Cells[0];
Paragraph aParagraph = cell.AddParagraph(elem.Key);
cell.AddParagraph(elem.Key);
// if (elem.Value.IsNullOrEmpty()) // 14.6.21: CH: nichts ausgrauen
// aParagraph.Style = "Gray";
string val = elem.Value;
@ -1691,12 +2004,7 @@ namespace bsmd.ReportGenerator
// ACHTUNG! Die Name (propertyName) sind die bereits in report.db *ersetzten* Namen, d.h. ändert man dort
// wieder etwas funktioniert es ggf. hier nicht mehr. Das ist leider aufwändig zu ändern, man müsste die Report
// Erzeugung komplett umbauen
if(propertyName.Contains("fumigated", StringComparison.OrdinalIgnoreCase))
{
int bla = 23;
}
// Erzeugung komplett umbauen
switch(propertyName)
{
@ -1842,5 +2150,18 @@ namespace bsmd.ReportGenerator
#endregion
#region Document helper
static Table AddGrayTable(Document aDocument)
{
Table table = aDocument.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;
table.Borders.Visible = true;
table.Borders.Color = Colors.LightGray;
return table;
}
#endregion
}
}

View File

@ -247,7 +247,7 @@ namespace bsmd.ReportGenerator
(aMessage.Elements.Count > 0)
)
reportMessages.Add(aMessage);
aMessage.InternalStatus = aMessage.LastStatus.HasValue ? aMessage.LastStatus.Value : Message.BSMDStatus.PREPARE;
aMessage.InternalStatus = aMessage.LastStatus ?? Message.BSMDStatus.PREPARE;
DBManager.Instance.Save(aMessage);
sb.Append(aMessage.MessageNotificationClassDisplay);
sb.Append("_");
@ -260,7 +260,7 @@ namespace bsmd.ReportGenerator
string classes = sb.ToString();
if (!classes.IsNullOrEmpty())
{
ReportingParty rp = null;
ReportingParty rp;
if (DBManager.Instance.GetReportingPartyDict().ContainsKey(reportingPartyId))
{
rp = DBManager.Instance.GetReportingPartyDict()[reportingPartyId];

View File

@ -22,6 +22,13 @@ namespace bsmd.database
public class IMSBCPosition : DatabaseEntity, ISublistElement
{
public static string[] hazardClass =
{
"A",
"B",
"A and B"
};
public IMSBCPosition()
{
this.tablename = "[dbo].[IMSBCPosition]";
@ -86,6 +93,19 @@ namespace bsmd.database
[ENI2Validation]
public int? IMOHazardClass { get; set; }
[ShowReport]
[ReportDisplayName("IMO hazard class")]
[JsonIgnore]
public string IMOHazardClassDisplay
{
get
{
if (this.IMOHazardClass.HasValue && (this.IMOHazardClass.Value < hazardClass.Length))
return hazardClass[this.IMOHazardClass.Value];
return "";
}
}
public string Identifier { get; set; }
[JsonIgnore]