Compare commits
4 Commits
develop
...
release/en
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b414deb61 | |||
| 7d53d742a9 | |||
| 412e013799 | |||
| fa696172aa |
111
ENI2/App.config
111
ENI2/App.config
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
(c) 2017-present Informatikbüro Daniel Schick
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
<applicationSettings>
|
||||
<ENI2.Properties.Settings>
|
||||
@ -26,119 +26,28 @@
|
||||
<value>1000</value>
|
||||
</setting>
|
||||
<setting name="LockingServerAddress" serializeAs="String">
|
||||
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
|
||||
</setting>
|
||||
<setting name="ReportAuthor" serializeAs="String">
|
||||
<value>BSMD ReportGenerator</value>
|
||||
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
|
||||
</setting>
|
||||
<setting name="ConnectionString" serializeAs="String">
|
||||
<value>Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=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>
|
||||
</setting>
|
||||
</ENI2.Properties.Settings>
|
||||
</applicationSettings>
|
||||
<userSettings>
|
||||
<ENI2.Properties.Settings>
|
||||
<setting name="MainWindowPlacement" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="Width" serializeAs="String">
|
||||
<value>825</value>
|
||||
</setting>
|
||||
<setting name="Height" serializeAs="String">
|
||||
<value>450</value>
|
||||
</setting>
|
||||
<setting name="W1Left" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W1Top" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W2Left" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W2Top" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W3Left" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W3Top" serializeAs="String">
|
||||
<value>0</value>
|
||||
<value/>
|
||||
</setting>
|
||||
</ENI2.Properties.Settings>
|
||||
</userSettings>
|
||||
<system.serviceModel>
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="BasicHttpBinding_IService" maxReceivedMessageSize="2147483647" />
|
||||
<binding name="BasicHttpBinding_IService" maxReceivedMessageSize="2147483647"/>
|
||||
</basicHttpBinding>
|
||||
</bindings>
|
||||
<client>
|
||||
<endpoint address="http://localhost:11651/LockingService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="LockingServiceReference.IService" name="BasicHttpBinding_IService" />
|
||||
<endpoint address="http://localhost:11651/LockingService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="LockingServiceReference.IService" name="BasicHttpBinding_IService"/>
|
||||
</client>
|
||||
</system.serviceModel>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.2" newVersion="6.0.0.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="DocumentFormat.OpenXml.Framework" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@ -837,8 +837,7 @@ namespace ENI2
|
||||
private ValidationResult ValidateCore(List<Message> messagesSnapshot)
|
||||
{
|
||||
List<MessageViolation> vViolations = new List<MessageViolation>();
|
||||
List<MessageError> vErrors = new List<MessageError>();
|
||||
Dictionary<Message, MessageValidationCounts> counts = new Dictionary<Message, MessageValidationCounts>();
|
||||
List<MessageError> vErrors = new List<MessageError>();
|
||||
|
||||
RuleEngine ruleEngine = new RuleEngine();
|
||||
foreach (Message aMessage in messagesSnapshot)
|
||||
@ -847,15 +846,7 @@ namespace ENI2
|
||||
|
||||
List<MessageError> errors = new List<MessageError>();
|
||||
List<MessageViolation> violations = new List<MessageViolation>();
|
||||
ruleEngine.ValidateMessage(aMessage, out errors, out violations);
|
||||
|
||||
MessageValidationCounts messageCounts = new MessageValidationCounts
|
||||
{
|
||||
ErrorCount = errors.Count > 0 ? (int?)errors.Count : null,
|
||||
ViolationCount = violations.Count > 0 ? (int?)violations.Count : null,
|
||||
PositionViolationCount = violations.Count > 0 ? (int?)violations.Count(v => !v.Identifier.IsNullOrEmpty()) : null
|
||||
};
|
||||
counts[aMessage] = messageCounts;
|
||||
ruleEngine.ValidateMessage(aMessage, out errors, out violations);
|
||||
|
||||
string messageGroup = this.MessageGroupForMessage(aMessage);
|
||||
|
||||
@ -1267,7 +1258,7 @@ namespace ENI2
|
||||
case 401:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.5)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1285,7 +1276,7 @@ namespace ENI2
|
||||
case 511:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1294,7 +1285,7 @@ namespace ENI2
|
||||
case 602:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.75)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1315,7 +1306,7 @@ namespace ENI2
|
||||
case 105:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1323,7 +1314,7 @@ namespace ENI2
|
||||
case 401:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.5)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1341,7 +1332,7 @@ namespace ENI2
|
||||
case 511:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.2)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1350,7 +1341,7 @@ namespace ENI2
|
||||
case 602:
|
||||
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25)
|
||||
{
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS");
|
||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "Waste", waste.Identifier, was.Tablename);
|
||||
mv.MessageGroupName = wasMessageGroup;
|
||||
vViolations.Add(mv);
|
||||
}
|
||||
@ -1393,9 +1384,70 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Recompute per-message counts after all global validations
|
||||
Dictionary<Message, MessageValidationCounts> counts = new Dictionary<Message, MessageValidationCounts>();
|
||||
|
||||
int assignViolationCounter = 0;
|
||||
int assignErrorCounter = 0;
|
||||
|
||||
List<MessageViolation> tmpVList = new List<MessageViolation>(vViolations);
|
||||
List<MessageError> tmpEList = new List<MessageError>(vErrors);
|
||||
|
||||
foreach (Message aMessage in messagesSnapshot)
|
||||
{
|
||||
counts[aMessage] = new MessageValidationCounts();
|
||||
counts[aMessage].ErrorCount = tmpEList.Count(me => me.NotificationClass == aMessage.MessageNotificationClassDisplay); // generic
|
||||
// special cases
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.WAS_RCPT) && (me.NotificationClass == "WasteReceived"));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IMDGPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IGCPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IBCPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IMSBCPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "MARPOL_Annex_I_Position") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IMDGPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IGCPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IBCPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IMSBCPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "MARPOL_Annex_I_Position") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) && (me.NotificationClass == "Waste"));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (me.NotificationClass == "LastTenPortFacilitiesCalled"));
|
||||
counts[aMessage].ErrorCount += tmpEList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (me.NotificationClass == "ShipToShipActivitiesDuringLastTenPortFacilitiesCalled"));
|
||||
|
||||
if (counts[aMessage].ErrorCount == 0) counts[aMessage].ErrorCount = null; // set to empty if nothing counted
|
||||
assignErrorCounter += counts[aMessage].ErrorCount ?? 0;
|
||||
|
||||
counts[aMessage].ViolationCount = vViolations.Count(mv => mv.NotificationClass == aMessage.MessageNotificationClassDisplay); // generic
|
||||
// special cases
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.WAS_RCPT) && (me.NotificationClass == "WasteReceived"));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IMDGPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IGCPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IBCPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "IMSBCPosition") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && (me.NotificationClass == "MARPOL_Annex_I_Position") && me.MessageGroupName.Contains("arrival", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IMDGPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IGCPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IBCPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "IMSBCPosition") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && (me.NotificationClass == "MARPOL_Annex_I_Position") && me.MessageGroupName.Contains("departure", StringComparison.OrdinalIgnoreCase));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) && (me.NotificationClass == "Waste"));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (me.NotificationClass == "LastTenPortFacilitiesCalled"));
|
||||
counts[aMessage].ViolationCount += tmpVList.Count(me => (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (me.NotificationClass == "ShipToShipActivitiesDuringLastTenPortFacilitiesCalled"));
|
||||
|
||||
if (counts[aMessage].ViolationCount == 0) counts[aMessage].ViolationCount = null;
|
||||
|
||||
assignViolationCounter += counts[aMessage].ViolationCount ?? 0;
|
||||
}
|
||||
|
||||
|
||||
Trace.WriteLine(string.Format("Unassigned errors: {0}, unassigned violations: {1}", vErrors.Count - assignErrorCounter, vViolations.Count - assignViolationCounter));
|
||||
|
||||
|
||||
return new ValidationResult(vViolations, vErrors, counts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ApplyValidationResult(ValidationResult result, bool showMessages)
|
||||
{
|
||||
// TODO: clear highlighting
|
||||
@ -1404,8 +1456,7 @@ namespace ENI2
|
||||
Message aMessage = entry.Key;
|
||||
MessageValidationCounts messageCounts = entry.Value;
|
||||
aMessage.ErrorCount = messageCounts.ErrorCount;
|
||||
aMessage.ViolationCount = messageCounts.ViolationCount;
|
||||
aMessage.PositionViolationCount = messageCounts.PositionViolationCount;
|
||||
aMessage.ViolationCount = messageCounts.ViolationCount;
|
||||
}
|
||||
|
||||
foreach (MessageError me in result.Errors)
|
||||
|
||||
@ -341,8 +341,8 @@ namespace ENI2.DetailViewControls
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCore()
|
||||
{
|
||||
public void UpdateCore()
|
||||
{
|
||||
this.UnregisterTextboxChange(this.textBoxDisplayId);
|
||||
|
||||
this.textBoxDisplayId.DataContext = null;
|
||||
@ -367,13 +367,13 @@ namespace ENI2.DetailViewControls
|
||||
//};
|
||||
//sid.UpdateId(this.Core.DisplayId);
|
||||
//sid.Show();
|
||||
this.Core.IsDirty = false; // ist ja schon gespeichert..
|
||||
}
|
||||
|
||||
internal void RefreshMessageGrid()
|
||||
{
|
||||
this.dataGridMessages?.Items?.Refresh();
|
||||
}
|
||||
this.Core.IsDirty = false; // ist ja schon gespeichert..
|
||||
}
|
||||
|
||||
internal void RefreshMessageGrid()
|
||||
{
|
||||
this.dataGridMessages?.Items?.Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
using bsmd.database;
|
||||
using ClosedXML.Excel;
|
||||
using ENI2.EditControls;
|
||||
using ENI2.Excel;
|
||||
using ENI2.Util;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -479,88 +480,14 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
private void buttonImportFromExcel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
||||
if (ofd.ShowDialog() ?? false)
|
||||
int importWasteListCnt = ExcelLocalImportHelper.ImportWaste(_was);
|
||||
|
||||
if (importWasteListCnt > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var workbook = new XLWorkbook(stream))
|
||||
{
|
||||
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||
var rows = worksheet.RangeUsed().RowsUsed().Skip(3); // Skip first three rows
|
||||
|
||||
List<Waste> importWasteList = new List<Waste>();
|
||||
|
||||
int cnt = 0;
|
||||
object o = null;
|
||||
|
||||
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
||||
|
||||
foreach (var row in rows)
|
||||
{
|
||||
if (cnt >= 35) break; // Maximum 35 rows
|
||||
|
||||
if (worksheet.RangeUsed().ColumnCount() < 9)
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
||||
}
|
||||
|
||||
if (!row.Cell(2).IsEmpty()) o = row.Cell(2).Value; else o = null;
|
||||
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
||||
{
|
||||
Waste waste = _was.GetWasteForType(wasteType);
|
||||
if (waste == null)
|
||||
{
|
||||
waste = new Waste();
|
||||
waste.WasteType = wasteType;
|
||||
waste.WAS = this._was;
|
||||
waste.IsDirty = true;
|
||||
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
||||
this._was.Waste.Add(waste);
|
||||
}
|
||||
else
|
||||
{
|
||||
waste.IsDirty = true;
|
||||
}
|
||||
|
||||
if (!row.Cell(5).IsEmpty()) waste.WasteDescription = row.Cell(5).GetString();
|
||||
if (waste.WasteDescription.IsNullOrEmpty())
|
||||
waste.WasteDescription = "-";
|
||||
|
||||
if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value; else o = null;
|
||||
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value; else o = null;
|
||||
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value; else o = null;
|
||||
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!row.Cell(9).IsEmpty()) waste.WasteDisposalPort = row.Cell(9).GetString().ToUpper();
|
||||
|
||||
if (!row.Cell(10).IsEmpty()) o = row.Cell(10).Value; else o = null;
|
||||
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
||||
|
||||
importWasteList.Add(waste);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (importWasteList.Count > 0)
|
||||
{
|
||||
this.dataGridWaste.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
this.dataGridWaste.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteListCnt), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ENI2</RootNamespace>
|
||||
<AssemblyName>ENI2Test</AssemblyName>
|
||||
<AssemblyName>ENI2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
@ -18,7 +18,7 @@
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>eni_test\</PublishUrl>
|
||||
<PublishUrl>ENI2.publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
@ -28,16 +28,16 @@
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>http://192.168.2.24/eni_test/</InstallUrl>
|
||||
<InstallUrl>http://192.168.2.24/eni2.publish/</InstallUrl>
|
||||
<SupportUrl>http://www.textbausteine.net/</SupportUrl>
|
||||
<ProductName>ENI Testversion</ProductName>
|
||||
<ProductName>ENI</ProductName>
|
||||
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
|
||||
<SuiteName>NSW</SuiteName>
|
||||
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>7.2.14.1</ApplicationVersion>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>7.2.14.2</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textCompareExcel}" Height="260" Width="600" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_grey.ico">
|
||||
Title="{x:Static p:Resources.textCompareExcel}" Height="260" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32" />
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textCopyDeclaration}" Height="326" Width="440" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2Test;component/Resources/id_cards.ico">
|
||||
Title="{x:Static p:Resources.textCopyDeclaration}" Height="326" Width="440" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_cards.ico">
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
@ -34,28 +34,28 @@
|
||||
<Label Name="labelCopy" Grid.Row="6" Grid.Column="0" Content="Copy" />
|
||||
<TextBox Name="textBoxVisitTransitId" Margin="2" Grid.Row="0" Grid.Column="1" TextChanged="textBoxVisitTransitId_TextChanged" VerticalContentAlignment="Center"/>
|
||||
<Image Grid.Row="0" Grid.Column="2" Name="okCheckMark" Source="pack://application:,,,/Resources/check.png" Margin="2" Visibility="Hidden" />
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ClipValueToMinMax="True"
|
||||
ShowButtonSpinner="False"
|
||||
ShowButtonSpinner="False"
|
||||
AllowSpin="True"
|
||||
AllowTextInput="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
FormatString="G"
|
||||
Increment="1"
|
||||
Increment="1"
|
||||
DisplayDefaultValueOnEmptyText="False"
|
||||
ButtonSpinnerLocation="Right"
|
||||
ParsingNumberStyle="Integer"
|
||||
Watermark="Enter IMO" ValueChanged="doubleUpDownIMO_ValueChanged" TextAlignment="Left"/>
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownENI" Margin="2" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ClipValueToMinMax="True"
|
||||
ShowButtonSpinner="False"
|
||||
ShowButtonSpinner="False"
|
||||
AllowSpin="True"
|
||||
AllowTextInput="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
FormatString="00000000"
|
||||
Increment="1"
|
||||
Increment="1"
|
||||
DisplayDefaultValueOnEmptyText="False"
|
||||
ButtonSpinnerLocation="Right"
|
||||
ParsingNumberStyle="Integer"
|
||||
@ -78,4 +78,3 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</enictrl:EditWindowBase>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textCoreStatus}" Height="436" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_grey.ico" >
|
||||
Title="{x:Static p:Resources.textCoreStatus}" Height="436" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_grey.ico" >
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*"/>
|
||||
@ -22,7 +22,7 @@
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="28">
|
||||
|
||||
|
||||
</RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textCancelled}" />
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textEditRules}" Height="402" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2Test;component/Resources/mail_forward.png">
|
||||
Title="{x:Static p:Resources.textEditRules}" Height="402" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue" Icon="/ENI2;component/Resources/mail_forward.png">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32" />
|
||||
@ -76,8 +76,8 @@
|
||||
|
||||
<GroupBox Name="groupBoxConditionDetails" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Margin="0" Header="{x:Static p:Resources.textCondition}">
|
||||
<Grid Name="groupBoxConditionContainer">
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textErrors}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_red.ico" Topmost="False">
|
||||
Title="{x:Static p:Resources.textErrors}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_red.ico" Topmost="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textMessageHistory}" Height="450" Width="800" Background="AliceBlue" Icon="/ENI2Test;component/Resources/clock_history.ico">
|
||||
Title="{x:Static p:Resources.textMessageHistory}" Height="450" Width="800" Background="AliceBlue" Icon="/ENI2;component/Resources/clock_history.ico">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
@ -15,8 +15,8 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridMessageHistories"
|
||||
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridMessageHistories"
|
||||
MouseDoubleClick="DataGridViolations_MouseDoubleClick" CanUserAddRows="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding EntityName}" IsReadOnly="True" Width="0.05*" >
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textNewDGItem}" Height="350" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="CanResize"
|
||||
Icon="/ENI2Test;component/Resources/bullet_ball_yellow.ico" Loaded="EditWindowBase_Loaded">
|
||||
Title="{x:Static p:Resources.textNewDGItem}" Height="350" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="CanResize"
|
||||
Icon="/ENI2;component/Resources/bullet_ball_yellow.ico" Loaded="EditWindowBase_Loaded">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2Test;component/Resources/id_card_add.ico">
|
||||
|
||||
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_card_add.ico">
|
||||
|
||||
<Grid Margin="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
@ -30,29 +30,29 @@
|
||||
<Label Name="labelENI" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textENI}" />
|
||||
<Label Name="labelETA" Grid.Row="3" Grid.Column="0" Content="ETA" />
|
||||
<Label Name="labelHIS" Grid.Row="4" Grid.Column="0" Content="HIS" />
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ClipValueToMinMax="True"
|
||||
ShowButtonSpinner="False"
|
||||
ShowButtonSpinner="False"
|
||||
AllowSpin="True"
|
||||
AllowTextInput="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
FormatString="G"
|
||||
Increment="1"
|
||||
Increment="1"
|
||||
DisplayDefaultValueOnEmptyText="False"
|
||||
ButtonSpinnerLocation="Right"
|
||||
ParsingNumberStyle="Integer"
|
||||
Watermark="Enter IMO" ValueChanged="doubleUpDownIMO_ValueChanged"
|
||||
TextAlignment="Left" />
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownENI" Margin="2" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownENI" Margin="2" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ClipValueToMinMax="True"
|
||||
ShowButtonSpinner="False"
|
||||
ShowButtonSpinner="False"
|
||||
AllowSpin="True"
|
||||
AllowTextInput="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
FormatString="00000000"
|
||||
Increment="1"
|
||||
Increment="1"
|
||||
DisplayDefaultValueOnEmptyText="False"
|
||||
ButtonSpinnerLocation="Right"
|
||||
ParsingNumberStyle="Integer"
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
mc:Ignorable="d"
|
||||
Title="Search port area" Height="400" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="CanResize" Icon="/ENI2Test;component/Resources/bullet_ball_yellow.ico" Loaded="Window_Loaded">
|
||||
Title="Search port area" Height="400" Width="600" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="CanResize" Icon="/ENI2;component/Resources/bullet_ball_yellow.ico" Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
@ -19,7 +19,7 @@
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="90" />
|
||||
<RowDefinition Height="28" />
|
||||
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textViolations}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2Test;component/Resources/bullet_ball_yellow.ico" Topmost="False">
|
||||
Title="{x:Static p:Resources.textViolations}" Height="300" Width="600" Background="AliceBlue" Icon="/ENI2;component/Resources/bullet_ball_yellow.ico" Topmost="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
@ -16,7 +16,7 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridViolations">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding ViolationCode}" IsReadOnly="True" Width="0.05*" />
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2Test;component/Resources/id_card_new.ico">
|
||||
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_card_new.ico">
|
||||
<Grid Margin="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
@ -26,28 +26,28 @@
|
||||
<Label Name="labelPoC" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" />
|
||||
<Label Name="labelETA" Grid.Row="3" Grid.Column="0" Content="ETA" />
|
||||
<Label Name="labelHIS" Grid.Row="4" Grid.Column="0" Content="HIS" />
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="0" Grid.Column="1"
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="0" Grid.Column="1"
|
||||
ClipValueToMinMax="True"
|
||||
ShowButtonSpinner="False"
|
||||
ShowButtonSpinner="False"
|
||||
AllowSpin="True"
|
||||
AllowTextInput="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
FormatString="G"
|
||||
Increment="1"
|
||||
Increment="1"
|
||||
DisplayDefaultValueOnEmptyText="False"
|
||||
ButtonSpinnerLocation="Right"
|
||||
ParsingNumberStyle="Integer"
|
||||
Watermark="Enter IMO" ValueChanged="doubleUpDownIMO_ValueChanged" TextAlignment="Left"/>
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownENI" Margin="2" Grid.Row="1" Grid.Column="1"
|
||||
<xctk:DoubleUpDown x:Name="doubleUpDownENI" Margin="2" Grid.Row="1" Grid.Column="1"
|
||||
ClipValueToMinMax="True"
|
||||
ShowButtonSpinner="False"
|
||||
ShowButtonSpinner="False"
|
||||
AllowSpin="True"
|
||||
AllowTextInput="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
IsReadOnly="False"
|
||||
MouseWheelActiveOnFocus="True"
|
||||
FormatString="00000000"
|
||||
Increment="1"
|
||||
Increment="1"
|
||||
DisplayDefaultValueOnEmptyText="False"
|
||||
ButtonSpinnerLocation="Right"
|
||||
ParsingNumberStyle="Integer"
|
||||
|
||||
@ -4,6 +4,7 @@ using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace ENI2.Excel
|
||||
@ -41,7 +42,7 @@ namespace ENI2.Excel
|
||||
|
||||
List<LastTenPortFacilitiesCalled> importL10C = new List<LastTenPortFacilitiesCalled>();
|
||||
|
||||
|
||||
|
||||
foreach (var row in rows)
|
||||
{
|
||||
if (cnt >= 10) break; // Maximum 10 rows
|
||||
@ -115,7 +116,7 @@ namespace ENI2.Excel
|
||||
{
|
||||
throw new InvalidDataException($"Error processing row {row.RowNumber()}: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -229,7 +230,7 @@ namespace ENI2.Excel
|
||||
poc30.MDH = mdh;
|
||||
mdh.PortOfCallLast30Days.Add(poc30);
|
||||
importPoC30.Add(poc30);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -244,5 +245,89 @@ namespace ENI2.Excel
|
||||
|
||||
#endregion
|
||||
|
||||
#region Waste from Excel
|
||||
|
||||
public static int ImportWaste(WAS was)
|
||||
{
|
||||
int cnt = 0;
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
||||
if (ofd.ShowDialog() ?? false)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var workbook = new XLWorkbook(stream))
|
||||
{
|
||||
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||
var rows = worksheet.RangeUsed().RowsUsed().Skip(3); // Skip first three rows
|
||||
|
||||
List<Waste> importWasteList = new List<Waste>();
|
||||
|
||||
object o = null;
|
||||
|
||||
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
||||
|
||||
foreach (var row in rows)
|
||||
{
|
||||
if (cnt >= 35) break; // Maximum 35 rows
|
||||
|
||||
if (worksheet.RangeUsed().ColumnCount() < 9)
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
||||
}
|
||||
|
||||
if (!row.Cell(2).IsEmpty()) o = row.Cell(2).Value; else o = null;
|
||||
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
||||
{
|
||||
Waste waste = was.GetWasteForType(wasteType);
|
||||
if (waste == null)
|
||||
{
|
||||
waste = new Waste();
|
||||
waste.WasteType = wasteType;
|
||||
waste.WAS = was;
|
||||
waste.IsDirty = true;
|
||||
waste.Identifier = Waste.GetNewIdentifier(was.Waste);
|
||||
was.Waste.Add(waste);
|
||||
}
|
||||
else
|
||||
{
|
||||
waste.IsDirty = true;
|
||||
}
|
||||
|
||||
if (!row.Cell(5).IsEmpty()) waste.WasteDescription = row.Cell(5).GetString();
|
||||
if (waste.WasteDescription.IsNullOrEmpty())
|
||||
waste.WasteDescription = "-";
|
||||
|
||||
if (!row.Cell(6).IsEmpty())
|
||||
waste.WasteDisposalAmount_MTQ = row.Cell(6).GetDouble();
|
||||
|
||||
if (!row.Cell(7).IsEmpty())
|
||||
waste.WasteCapacity_MTQ = row.Cell(7).GetDouble();
|
||||
|
||||
if (!row.Cell(8).IsEmpty()) waste.WasteAmountRetained_MTQ = row.Cell(8).GetDouble();
|
||||
|
||||
if (!row.Cell(9).IsEmpty())
|
||||
waste.WasteDisposalPort = row.Cell(9).GetString().ToUpper();
|
||||
|
||||
if (!row.Cell(10).IsEmpty())
|
||||
waste.WasteAmountGeneratedTillNextPort_MTQ = row.Cell(10).GetDouble();
|
||||
|
||||
importWasteList.Add(waste);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,11 @@
|
||||
xmlns:ctrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:util="clr-namespace:ENI2.Util"
|
||||
xmlns:local="clr-namespace:ENI2"
|
||||
xmlns:local="clr-namespace:ENI2"
|
||||
mc:Ignorable="d"
|
||||
Title="ENI 2 Testversion"
|
||||
Height="{util:SettingBinding Height}" Width="{util:SettingBinding Width}"
|
||||
Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing"
|
||||
Title="ENI 2"
|
||||
Height="{util:SettingBinding Height}" Width="{util:SettingBinding Width}"
|
||||
Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing"
|
||||
SourceInitialized="Window_SourceInitialized">
|
||||
|
||||
<Window.CommandBindings>
|
||||
@ -23,7 +23,7 @@
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary
|
||||
<ResourceDictionary
|
||||
Source="ControlTemplates.xaml">
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 39 KiB |
@ -5,6 +5,7 @@
|
||||
using bsmd.database;
|
||||
using ClosedXML.Excel;
|
||||
using ENI2.EditControls;
|
||||
using ENI2.Excel;
|
||||
using Microsoft.Win32;
|
||||
|
||||
using System;
|
||||
@ -514,89 +515,14 @@ namespace ENI2.SheetDisplayControls
|
||||
|
||||
private void buttonImportFromExcel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
||||
if (ofd.ShowDialog() ?? false)
|
||||
int importWasteListCnt = ExcelLocalImportHelper.ImportWaste(_was);
|
||||
|
||||
if (importWasteListCnt > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var workbook = new XLWorkbook(stream))
|
||||
{
|
||||
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||
var rows = worksheet.RangeUsed().RowsUsed().Skip(3); // Skip first three rows
|
||||
|
||||
List<Waste> importWasteList = new List<Waste>();
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
||||
|
||||
foreach (var row in rows)
|
||||
{
|
||||
if (cnt >= 35) break; // Maximum 35 rows
|
||||
|
||||
if (worksheet.RangeUsed().ColumnCount() < 9)
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
||||
}
|
||||
|
||||
object o = null;
|
||||
|
||||
if (!row.Cell(2).IsEmpty()) o = row.Cell(2).Value; else o = null;
|
||||
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
||||
{
|
||||
Waste waste = _was.GetWasteForType(wasteType);
|
||||
if (waste == null)
|
||||
{
|
||||
waste = new Waste();
|
||||
waste.WasteType = wasteType;
|
||||
waste.WAS = this._was;
|
||||
waste.IsDirty = true;
|
||||
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
||||
this._was.Waste.Add(waste);
|
||||
}
|
||||
else
|
||||
{
|
||||
waste.IsDirty = true;
|
||||
}
|
||||
|
||||
if (!row.Cell(5).IsEmpty()) waste.WasteDescription = row.Cell(5).GetString();
|
||||
if (waste.WasteDescription.IsNullOrEmpty())
|
||||
waste.WasteDescription = "-";
|
||||
|
||||
if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value; else o = null;
|
||||
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value; else o = null;
|
||||
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value; else o = null;
|
||||
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!row.Cell(9).IsEmpty()) waste.WasteDisposalPort = row.Cell(9).GetString().ToUpper();
|
||||
|
||||
if (!row.Cell(10).IsEmpty()) o = row.Cell(10).Value; else o = null;
|
||||
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
||||
|
||||
importWasteList.Add(waste);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (importWasteList.Count > 0)
|
||||
{
|
||||
this.dataGridWaste.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
this.dataGridWaste.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteListCnt), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -431,11 +431,6 @@ namespace bsmd.database
|
||||
/// </summary>
|
||||
public int? ViolationCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of violations during last validation that have the "identifier" set and are thus detected violations
|
||||
/// from underlying list elements
|
||||
/// </summary>
|
||||
public int? PositionViolationCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of errors during last validation
|
||||
|
||||
@ -76,7 +76,7 @@ namespace bsmd.database
|
||||
wasteReceived.id = reader.GetGuid(0);
|
||||
if (!reader.IsDBNull(1)) wasteReceived.WasteCode = reader.GetString(1);
|
||||
if (!reader.IsDBNull(2)) wasteReceived.WasteDescription = reader.GetString(2);
|
||||
if (!reader.IsDBNull(3)) wasteReceived.AmountWasteReceived_MTQ = (float)reader.GetDouble(3);
|
||||
if (!reader.IsDBNull(3)) wasteReceived.AmountWasteReceived_MTQ = (float)reader.GetDouble(3);
|
||||
if (!reader.IsDBNull(4)) wasteReceived.Identifier = reader.GetString(4);
|
||||
result.Add(wasteReceived);
|
||||
}
|
||||
@ -111,7 +111,7 @@ namespace bsmd.database
|
||||
scmd.Parameters.AddWithValue("@P1", this.WAS_RCPT.Id);
|
||||
scmd.Parameters.AddWithNullableValue("@P2", this.WasteCode);
|
||||
scmd.Parameters.AddWithNullableValue("@P3", this.WasteDescription);
|
||||
scmd.Parameters.AddWithNullableValue("@P4", this.AmountWasteReceived_MTQ);
|
||||
scmd.Parameters.AddWithNullableValue("@P4", this.AmountWasteReceived_MTQ);
|
||||
scmd.Parameters.AddWithNullableValue("@P5", this.Identifier);
|
||||
|
||||
if (this.IsNew)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user