From a40fbe31f92ea690f12134b16cca0d334c5d818b Mon Sep 17 00:00:00 2001 From: pitzm Date: Wed, 23 Jul 2025 11:54:36 +0200 Subject: [PATCH] =?UTF-8?q?ZUGFeRD=20Service:=20Auswertung=20der=20XML-Kon?= =?UTF-8?q?figuration=20ge=C3=A4ndert=20&=20ZUGFeRD=202.3.x-Anpassungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Services.ZUGFeRDService/Config.vb | 2 + Services.ZUGFeRDService/ThreadRunner.vb | 71 ++++++++++++++----------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/Services.ZUGFeRDService/Config.vb b/Services.ZUGFeRDService/Config.vb index e2701325..b13b0f4c 100644 --- a/Services.ZUGFeRDService/Config.vb +++ b/Services.ZUGFeRDService/Config.vb @@ -71,6 +71,8 @@ Public Property AllowZugferd2x As Boolean = True + Public Property AllowZugferd23x As Boolean = True + Public Property AllowPeppolBISBill3x As Boolean = False End Class End Class diff --git a/Services.ZUGFeRDService/ThreadRunner.vb b/Services.ZUGFeRDService/ThreadRunner.vb index 47fa79f8..96982dbe 100644 --- a/Services.ZUGFeRDService/ThreadRunner.vb +++ b/Services.ZUGFeRDService/ThreadRunner.vb @@ -52,13 +52,14 @@ Public Class ThreadRunner .AllowXRechnung = _config.Config.Custom.AllowXRechnung, .AllowZugferd10 = _config.Config.Custom.AllowZugferd10, .AllowZugferd2x = _config.Config.Custom.AllowZugferd2x, + .AllowZugferd23x = _config.Config.Custom.AllowZugferd23x, .AllowPeppolBISBill3x = _config.Config.Custom.AllowPeppolBISBill3x, .RejectionTemplateId = _config.Config.Custom.RejectionTemplateId, .GDPictureVersion = _config.Config.Custom.GDPictureVersion } oArgs = LoadFolderConfig(oArgs) - oArgs = LoadPropertyMap(oArgs) + oArgs = LoadPropertyMapListFor(oArgs) _logger.Debug("Custom Options:") _logger.Debug("ExceptionEmailAddress: [{0}]", oArgs.ExceptionEmailAddress) @@ -171,36 +172,44 @@ Public Class ThreadRunner Return pArgs End Function - Private Function LoadPropertyMap(pArgs As WorkerArgs) As WorkerArgs - Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH" - Dim oResult As DataTable = _mssql.GetDatatable(oSQL) - - For Each oRow As DataRow In oResult.Rows - Dim oXmlPath As String = oRow.Item("XML_PATH") - Dim oTableName = oRow.Item("TABLE_NAME") - Dim oTableColumn = oRow.Item("TABLE_COLUMN") - Dim oDescription = oRow.Item("DESCRIPTION") - Dim oIsRequired = oRow.Item("IS_REQUIRED") - Dim oIsGrouped = oRow.Item("IS_GROUPED") - Dim oGroupScope = oRow.Item("GROUP_SCOPE") - Dim oSpecification = oRow.Item("SPECIFICATION") - Dim oItemType = oRow.Item("ITEM_TYPE") - Dim oEN16931Value = oRow.Item("EN16931_ID") - - pArgs.PropertyMap.Add(oXmlPath, New XmlItemProperty() With { - .Description = oDescription, - .TableName = oTableName, - .TableColumn = oTableColumn, - .IsRequired = oIsRequired, - .IsGrouped = oIsGrouped, - .GroupScope = oGroupScope, - .Specification = oSpecification, - .XMLPath = oXmlPath.Replace(".Value", ""), - .ItemType = oItemType, - .EN16931_ID = oEN16931Value - }) - Next + Private Function LoadPropertyMapListFor(Args As WorkerArgs) As WorkerArgs + Try + Args.PropertyMapList.Clear() + + Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH" + Dim oResult As DataTable = _mssql.GetDatatable(oSQL) + + For Each oRow As DataRow In oResult.Rows + Dim xmlPath As String = 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") + Dim groupScope = oRow.Item("GROUP_SCOPE") + Dim specification = oRow.Item("SPECIFICATION") + Dim oItemType = oRow.Item("ITEM_TYPE") + Dim oEN16931_ID = oRow.Item("EN16931_ID") + + Args.PropertyMapList.Add(New XmlItemProperty() With { + .XMLPath = xmlPath, + .Description = description, + .TableName = tableName, + .TableColumn = tableColumn, + .IsRequired = isRequired, + .IsGrouped = isGrouped, + .GroupScope = groupScope, + .Specification = specification, + .ItemType = oItemType, + .EN16931_ID = oEN16931_ID + }) + Next - Return pArgs + Return Args + Catch ex As Exception + _logger.Error(ex) + Return Args + End Try End Function + End Class