diff --git a/GUIs.Test.ZUGFeRDTest/Form1.vb b/GUIs.Test.ZUGFeRDTest/Form1.vb index 94fbd144..fafb5ec2 100644 --- a/GUIs.Test.ZUGFeRDTest/Form1.vb +++ b/GUIs.Test.ZUGFeRDTest/Form1.vb @@ -66,6 +66,7 @@ Public Class Form1 For Each oRow As DataRow In oResult.Rows Dim xmlPath = oRow.Item("XML_PATH") Dim tableName = oRow.Item("TABLE_NAME") + Dim tableColumn = oRow.Item("TABLE_COLUMN") Dim description = oRow.Item("DESCRIPTION") Dim isRequired = oRow.Item("IS_REQUIRED") Dim isGrouped = oRow.Item("IS_GROUPED") @@ -74,6 +75,7 @@ Public Class Form1 Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With { .Description = description, .TableName = tableName, + .TableColumn = tableColumn, .IsRequired = isRequired, .IsGrouped = isGrouped, .GroupScope = groupScope diff --git a/Modules.Interfaces/My Project/AssemblyInfo.vb b/Modules.Interfaces/My Project/AssemblyInfo.vb index 73e75b1d..44e91dee 100644 --- a/Modules.Interfaces/My Project/AssemblyInfo.vb +++ b/Modules.Interfaces/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Modules.Interfaces/ZUGFeRDInterface/PropertyValues.vb b/Modules.Interfaces/ZUGFeRDInterface/PropertyValues.vb index 508ede7c..93fe03a6 100644 --- a/Modules.Interfaces/ZUGFeRDInterface/PropertyValues.vb +++ b/Modules.Interfaces/ZUGFeRDInterface/PropertyValues.vb @@ -22,7 +22,9 @@ Public Class PropertyValues Public Class ValidProperty Public MessageId As String Public TableName As String + Public TableColumn As String + Public ISRequired As Boolean Public GroupCounter As Integer = -1 Public Description As String @@ -60,11 +62,11 @@ Public Class PropertyValues ' get properties as a nested object, see `oPropertyList` For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup Dim oPropertyValues As List(Of Object) - + _logger.Debug($"Fetching value for itemSpecification [{oProperty.Value.TableColumn}].") Try oPropertyValues = GetPropValue(Document, oProperty.Key) Catch ex As Exception - _logger.Warn("Unknown error occurred while fetching property [{0}] in group [{1}]:", oProperty.Value.Description, oGroupScope) + _logger.Warn("Unknown error occurred while fetching property/TColumn [{0}] in group [{1}]:", oProperty.Value.TableColumn, oGroupScope) _logger.Error(ex) oPropertyValues = New List(Of Object) End Try @@ -92,6 +94,8 @@ Public Class PropertyValues For Each oColumn As KeyValuePair(Of XmlItemProperty, List(Of Object)) In oPropertyList Dim oTableName As String = oColumn.Key.TableName + Dim oTableColumn As String = oColumn.Key.TableColumn + Dim oIsRequired As Boolean = oColumn.Key.IsRequired Dim oPropertyDescription As String = oColumn.Key.Description Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1 If IsNothing(oRowCounter) Then @@ -100,27 +104,29 @@ Public Class PropertyValues ' Returns nothing if oColumn.Value contains an empty list Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex) - _logger.Debug("Processing property [{0}].", oPropertyDescription) + _logger.Debug("Processing itemSpecification *TableColumn* [{0}].", oTableColumn) If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then If oColumn.Key.IsRequired Then - _logger.Warn($"Property [{oPropertyDescription}] is empty or not found but is required. Continuing with Empty String.") + _logger.Warn($"oPropertyValue for specification [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.") oResult.MissingProperties.Add(oPropertyDescription) Else - _logger.Debug($"Property [{oPropertyDescription}] is empty or not found. Continuing with Empty String.") + _logger.Debug($"oPropertyValue for specification [{oTableColumn}] is empty or not found. Continuing with Empty String.") End If oPropertyValue = String.Empty End If - _logger.Debug("Property [{0}] has value '{1}'", oPropertyDescription, oPropertyValue) + _logger.Debug("ItemSpecification [{0}] has value '{1}'", oTableColumn, oPropertyValue) oResult.ValidProperties.Add(New ValidProperty() With { .MessageId = MessageId, .Description = oPropertyDescription, .Value = oPropertyValue, .GroupCounter = oRowCounter, - .TableName = oTableName + .TableName = oTableName, + .TableColumn = oTableColumn, + .ISRequired = oIsRequired }) Next Next @@ -131,14 +137,15 @@ Public Class PropertyValues ' Iterate through default properties For Each oItem As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties Dim oPropertyValueList As List(Of Object) - Dim oPropertyDescription As String = oItem.Value.Description + Dim oTableColumn As String = oItem.Value.TableColumn Dim oPropertyValue As Object = Nothing Dim oTableName = oItem.Value.TableName - + Dim oIsRequired = oItem.Value.IsRequired + Dim oDescription = oItem.Value.Description Try oPropertyValueList = GetPropValue(Document, oItem.Key) Catch ex As Exception - _logger.Warn("Unknown error occurred while fetching property {0} in group {1}:", oPropertyDescription, oItem.Value.GroupScope) + _logger.Warn("Unknown error occurred while fetching specification {0} in group {1}:", oTableColumn, oItem.Value.GroupScope) _logger.Error(ex) oPropertyValueList = New List(Of Object) End Try @@ -156,34 +163,36 @@ Public Class PropertyValues ' This should hopefully show config errors If TypeOf oPropertyValue Is List(Of Object) Then - _logger.Warn("Property with Description {0} may be configured incorrectly", oPropertyDescription) + _logger.Warn("Item with TableColumn [{0}] may be configured incorrectly", oTableColumn) oPropertyValue = Nothing End If End Select End If Catch ex As Exception - _logger.Warn("Unknown error occurred while processing property {0}:", oPropertyDescription) + _logger.Warn("Unknown error occurred while processing specification [{0}]:", oTableColumn) _logger.Error(ex) oPropertyValue = Nothing End Try If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then If oItem.Value.IsRequired Then - _logger.Warn("Property {0} is empty but marked as required! Skipping.", oPropertyDescription) - oResult.MissingProperties.Add(oPropertyDescription) + _logger.Warn("Specification [{0}] is empty, but marked as required! Skipping.", oTableColumn) + oResult.MissingProperties.Add(oTableColumn) Continue For Else - _logger.Debug("Property [{0}] is empty or not found. Skipping.", oPropertyDescription) + _logger.Debug("oPropertyValue for specification [{0}] is empty or not found. Skipping.", oTableColumn) Continue For End If End If oResult.ValidProperties.Add(New ValidProperty() With { .MessageId = MessageId, - .Description = oPropertyDescription, + .Description = oDescription, .Value = oPropertyValue, - .TableName = oTableName - }) + .TableName = oTableName, + .TableColumn = oTableColumn, + .ISRequired = oIsRequired + }) Next Return oResult @@ -202,7 +211,7 @@ Public Class PropertyValues Dim oPropInfo As PropertyInfo = Obj.GetType().GetProperty(PropertyName) If IsNothing(oPropInfo) Then - _logger.Debug("Property {0} does not exist.", PropertyName) + _logger.Debug("Property [{0}] does not exist(1).", PropertyName) Return New List(Of Object) Else Dim oPropValue = oPropInfo.GetValue(Obj, Nothing) @@ -224,7 +233,7 @@ Public Class PropertyValues Dim oInfo As PropertyInfo = oType.GetProperty(oPartName) If IsNothing(oInfo) OrElse IsNothing(oInfo.GetValue(Obj, Nothing)) Then - _logger.Debug("Property {0} does not exist.", oPartName) + _logger.Debug("Property {0} does not exist(2).", oPartName) Return New List(Of Object) End If diff --git a/Modules.Interfaces/ZUGFeRDInterface/XmlItemProperty.vb b/Modules.Interfaces/ZUGFeRDInterface/XmlItemProperty.vb index a6f0597e..a14c456e 100644 --- a/Modules.Interfaces/ZUGFeRDInterface/XmlItemProperty.vb +++ b/Modules.Interfaces/ZUGFeRDInterface/XmlItemProperty.vb @@ -1,5 +1,6 @@ Public Class XmlItemProperty Public TableName As String + Public TableColumn As String Public Description As String Public IsRequired As Boolean Public IsGrouped As Boolean diff --git a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index ab1497bc..894ffaf2 100644 --- a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -430,8 +430,9 @@ Public Class ImportZUGFeRDFiles oGroupCounterValue = 0 End If - Dim oCommand = $"INSERT INTO {oProperty.TableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oMessageId}', '{oProperty.Description}', '{oProperty.Value}', {oGroupCounterValue})" - _logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oProperty.Description, oProperty.Value, oProperty.TableName) + Dim oCommand = $"INSERT INTO {oProperty.TableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER,SPEC_NAME,IS_REQUIRED) VALUES + ('{oMessageId}', '{oProperty.Description}', '{oProperty.Value}', {oGroupCounterValue},'{oProperty.TableColumn}','{oProperty.ISRequired}')" + _logger.Debug("Mapping Property [{0}] with value [{1}], Will be inserted into table [{2}]", oProperty.TableColumn, oProperty.Value, oProperty.TableName) ' Insert into SQL Server If oArgs.InsertIntoSQLServer = True Then Dim oResult = _mssql.ExecuteNonQuery(oCommand) diff --git a/Modules.Jobs/My Project/AssemblyInfo.vb b/Modules.Jobs/My Project/AssemblyInfo.vb index 245cf1bc..5d2f21a5 100644 --- a/Modules.Jobs/My Project/AssemblyInfo.vb +++ b/Modules.Jobs/My Project/AssemblyInfo.vb @@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' übernehmen, indem Sie "*" eingeben: - - + + diff --git a/WEBSERVICES/ZUGFeRDRESTService/Database.cs b/WEBSERVICES/ZUGFeRDRESTService/Database.cs index c223321c..d1385669 100644 --- a/WEBSERVICES/ZUGFeRDRESTService/Database.cs +++ b/WEBSERVICES/ZUGFeRDRESTService/Database.cs @@ -51,6 +51,7 @@ namespace ZUGFeRDRESTService { Description = oRow["DESCRIPTION"].ToString(), TableName = oRow["TABLE_NAME"].ToString(), + TableColumn = oRow["TABLE_COLUMN"].ToString(), GroupScope = oRow["GROUP_SCOPE"].ToString(), IsRequired = (bool)oRow["IS_REQUIRED"], IsGrouped = (bool)oRow["IS_GROUPED"]