Modules.Interfaces & Modules.Jobs: Neue eInvoice Spezifikation "ebInterface 6.1" implementiert

Logik zum Abfragen von Attributen von root ergänzt
This commit is contained in:
2026-09-07 16:59:58 +02:00
parent 4dc454403b
commit 676b43bbe1
6 changed files with 3550 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ Imports System.Xml
Imports System.Xml.Serialization
Imports DigitalData.Modules.Interfaces.Exceptions
Imports DigitalData.Modules.Interfaces.PDFEmbeds
Imports DigitalData.Modules.Interfaces.PropertyValues
Imports DigitalData.Modules.Interfaces.ZUGFeRD
Imports DigitalData.Modules.Logging
Imports GdPicture14
@@ -21,8 +22,6 @@ Public Class ZUGFeRDInterface
Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x"
Public Const ZUGFERD_SPEC_2_3x = "ZUGFERD_2_3x"
Public Const UBL_SPEC_21 = "UBL_21"
Public Const XMLSCHEMA_ZUGFERD_10 = "Version1_0"
Public Const XMLSCHEMA_ZUGFERD_20 = "Version2_0"
Public Const XMLSCHEMA_ZUGFERD_211 = "Version2_1_1"
@@ -31,9 +30,14 @@ Public Class ZUGFeRDInterface
Public Const XMLSCHEMA_ZUGFERD_233 = "Version2_3_3_FacturX"
Public Const XMLSCHEMA_ZUGFERD_24 = "Version2_4_FacturX"
Public Const XMLSCHEMA_ZUGFERD_25 = "Version2_5_FacturX"
Public Const UBL_SPEC_21 = "UBL_21"
Public Const XMLSCHEMA_UBL_21_INVOICE = "UBL2_1_INVOICE"
Public Const XMLSCHEMA_UBL_21_CREDITNOTE = "UBL2_1_CREDITNOTE"
Public Const EBINTERFACE_SPEC_61 = "EBINTERFACE_61"
Public Const XMLSCHEMA_EBINTERFACE_61 = "Version6_1"
Public Const RECEIPT_TYPE_XML = "XML"
Public Const RECEIPT_TYPE_PDF = "PDF"
@@ -67,6 +71,7 @@ Public Class ZUGFeRDInterface
Public Property AllowZugferd_2_x_Schema As Boolean = True
Public Property AllowZugferd_2_3_x_Schema As Boolean = True
Public Property AllowPeppol_3_x_Schema As Boolean = False
Public Property AllowEBInterface_Schema As Boolean = False
End Class
Public Class ZugferdResult
@@ -152,6 +157,20 @@ Public Class ZUGFeRDInterface
Where(Function(kv) kv.Specification = pSpecification Or kv.Specification = ZUGFERD_SPEC_DEFAULT).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
ElseIf pSpecification = EBINTERFACE_SPEC_61 Then
Try
' root-Elemente werden hier herausgefiltert
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification And Not x.XMLPath.StartsWith("root.")).Count
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification And Not kv.XMLPath.StartsWith("root.")).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
@@ -174,6 +193,28 @@ Public Class ZUGFeRDInterface
Return Nothing
End Function
Public Function FilterRootPropertyMap(pPropertyMapList As List(Of XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
' Aktuell verwendet nur ebeInterafce attribute im root-Knoten
If pSpecification = EBINTERFACE_SPEC_61 Then
Try
' root-Elemente werden hier herausgefiltert
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification And x.XMLPath.StartsWith("root.")).Count
_logger.Debug("Property map list contains [{0}] root attribute elements for specification [{1}]", countElements, pSpecification)
Return pPropertyMapList.
Where(Function(kv) kv.Specification = pSpecification And kv.XMLPath.StartsWith("root.")).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Catch ex As Exception
_logger.Error(ex)
End Try
Else
Return Nothing
End If
End Function
Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult
Dim oResult = New ZugferdResult()
Dim oMessage As String = String.Empty
@@ -455,6 +496,16 @@ Public Class ZUGFeRDInterface
})
End If
If _Options.AllowEBInterface_Schema Then
oAllowedTypes.AddRange(New List(Of AllowedType) From {
New AllowedType With {
.SchemaType = GetType(EBINTERFACE_61.InvoiceType),
.Specification = EBINTERFACE_SPEC_61,
.XMLSchema = XMLSCHEMA_EBINTERFACE_61
}
})
End If
For Each oType In oAllowedTypes
Dim oTypeName As String = oType.SchemaType.FullName
Dim oSerializer As New XmlSerializer(oType.SchemaType)
@@ -497,4 +548,5 @@ Public Class ZUGFeRDInterface
Throw New ZUGFeRDExecption(ErrorCodes.UnsupportedFerdException, oMessage)
End Try
End Function
End Class