Compare commits
3 Commits
262805d112
...
0b66b80591
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b66b80591 | |||
| 5fd924d413 | |||
| e8ebc30225 |
@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Interfaces")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.3.3.0")>
|
||||
<Assembly: AssemblyTrademark("2.3.4.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.3.3.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.3.0")>
|
||||
<Assembly: AssemblyVersion("2.3.4.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.4.0")>
|
||||
|
||||
@ -248,7 +248,7 @@ Public Class ZUGFeRDInterface
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Error while validating ZUGFeRD file with GDPicture")
|
||||
_logger.Warn("Error while validating eInvoice file with GDPicture")
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
@ -277,7 +277,7 @@ Public Class ZUGFeRDInterface
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Error while validating ZUGFeRD file with GDPicture")
|
||||
_logger.Warn("Error while validating eInvoice file with GDPicture")
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
@ -442,7 +442,7 @@ Public Class ZUGFeRDInterface
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Dim oMessage = "Datei ist eine ungültige ZUGFeRD Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."
|
||||
Dim oMessage = "Datei ist eine ungültige eInvoice Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, oMessage)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@ -3,6 +3,6 @@
|
||||
DateType '1
|
||||
MoneyType '2
|
||||
FileType '3
|
||||
ListType '4
|
||||
ListType '4 - vgl. Währung
|
||||
|
||||
End Enum
|
||||
|
||||
@ -130,7 +130,7 @@ Public Class PropertyValues
|
||||
End If
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn($"{MessageId} # oPropertyValue for column [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
_logger.Warn($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
Dim oMissingProperty = New MissingProperty() With {
|
||||
.EN16931_ID = oEN16931Value,
|
||||
.Description = oPropertyDescription,
|
||||
@ -138,7 +138,7 @@ Public Class PropertyValues
|
||||
}
|
||||
oResult.MissingProperties.Add(oMissingProperty)
|
||||
Else
|
||||
_logger.Debug($"{MessageId} # oPropertyValue for column [{oTableColumn}] is empty or not found. Continuing with Empty String.")
|
||||
_logger.Debug($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found. Continuing with Empty String.")
|
||||
End If
|
||||
|
||||
oPropertyValue = String.Empty
|
||||
@ -183,11 +183,12 @@ Public Class PropertyValues
|
||||
Dim oIsRequired = oItem.Value.IsRequired
|
||||
Dim oDescription = oItem.Value.Description
|
||||
Dim oItemType = oItem.Value.ItemType
|
||||
Dim oEN16931_ID = oItem.Value.EN16931_ID
|
||||
|
||||
Try
|
||||
oPropertyValueList = GetPropValue(pDocument, oItem.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("{2} # Unknown error occurred while fetching specification [{0}] in group [{1}]:", oTableColumn, oItem.Value.GroupScope, MessageId)
|
||||
_logger.Warn("{2} - Unknown error occurred while fetching specification [{0}] in group [{1}]:", oTableColumn, oItem.Value.GroupScope, MessageId)
|
||||
_logger.Warn("ERROR-MESSAGE [{0}]", ex.Message)
|
||||
_logger.Error(ex)
|
||||
oPropertyValueList = New List(Of Object)
|
||||
@ -219,7 +220,7 @@ Public Class PropertyValues
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oItem.Value.IsRequired Then
|
||||
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oTableColumn)
|
||||
_logger.Warn("Specification [{1}] is empty, but marked as required! Skipping.", oTableColumn)
|
||||
Dim oMissingProperty = New MissingProperty With
|
||||
{
|
||||
.Description = oPropertyDescription,
|
||||
@ -228,14 +229,14 @@ Public Class PropertyValues
|
||||
oResult.MissingProperties.Add(oMissingProperty)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oTableColumn)
|
||||
_logger.Debug("oPropertyValue for specification [{1}] is empty or not found. Skipping.", oTableColumn)
|
||||
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
' Statt dem Zahlenwert des Enums, wollen wir die Währunsgbezeichnung
|
||||
If oTableColumn = "INVOICE_CURRENCY" Then
|
||||
' Statt dem Zahlenwert des Enums, wollen wir die Währungsbezeichnung
|
||||
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = 4 Then
|
||||
oPropertyValue = oPropertyValue.ToString()
|
||||
End If
|
||||
|
||||
@ -247,7 +248,8 @@ Public Class PropertyValues
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired,
|
||||
.XMLPath = oPropertyPath,
|
||||
.ItemType = oItemType
|
||||
.ItemType = oItemType,
|
||||
.EN16931_ID = oEN16931_ID
|
||||
})
|
||||
Next
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Jobs")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.9.7.0")>
|
||||
<Assembly: AssemblyTrademark("2.9.8.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -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:
|
||||
|
||||
<Assembly: AssemblyVersion("2.9.7.0")>
|
||||
<Assembly: AssemblyFileVersion("2.9.7.0")>
|
||||
<Assembly: AssemblyVersion("2.9.8.0")>
|
||||
<Assembly: AssemblyFileVersion("2.9.8.0")>
|
||||
|
||||
@ -166,8 +166,6 @@ Public Class ImportZUGFeRDFiles
|
||||
' Start a new transaction for each file group.
|
||||
' This way we can rollback database changes for the whole filegroup in case something goes wrong.
|
||||
Dim oSQLConnection As SqlConnection = _mssql.GetConnection()
|
||||
|
||||
|
||||
Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction()
|
||||
|
||||
Dim oConnections As New DatabaseConnections() With {
|
||||
@ -220,7 +218,7 @@ Public Class ImportZUGFeRDFiles
|
||||
End If
|
||||
|
||||
If oResult.ZugferdFileFound = True Then
|
||||
_logger.Debug("Zugferd File found")
|
||||
_logger.Debug("eInvoice File found")
|
||||
oMD5CheckSum = oResult.MD5Checksum
|
||||
oZUGFeRDCount = oResult.ZugferdFileCount
|
||||
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
|
||||
@ -337,7 +335,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein eInvoice-Dokument", "", oSQLTransaction)
|
||||
|
||||
Catch ex As NoFerdsException
|
||||
_logger.Error(ex)
|
||||
@ -350,7 +348,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine eInvoice-Dokumente", "", oSQLTransaction)
|
||||
|
||||
Catch ex As MissingValueException
|
||||
_logger.Error(ex)
|
||||
@ -369,7 +367,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, oOrgFilename, oMissingFieldList)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten ZugferdSpezifikationen", "", oSQLTransaction)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten eInvoice-Spezifikationen", "", oSQLTransaction)
|
||||
|
||||
Catch ex As FileSizeLimitReachedException
|
||||
_logger.Error(ex)
|
||||
@ -402,7 +400,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"OutOfMemoryException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
.Subject = $"OutOfMemoryException im eInvoice-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
@ -425,7 +423,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
.Subject = $"UnhandledException im eInvoice-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
@ -481,7 +479,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"FileMoveException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
.Subject = $"FileMoveException im eInvoice-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
@ -567,21 +565,21 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
|
||||
_logger.Info("File [{0}] is not a valid eInvoice document. Skipping.", pFile.Name)
|
||||
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
Return oResult
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile)
|
||||
_logger.Info("File [{0}/{1}] is an unsupported eInvoice document format!", pFile.Name, ex.XmlFile)
|
||||
Throw New UnsupportedFerdException(ex.XmlFile)
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name)
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted eInvoice document!", pFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
|
||||
_logger.Warn("Unexpected Error occurred while extracting eInvoice Information from file {0}", pFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
|
||||
@ -639,21 +637,21 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
|
||||
_logger.Info("File [{0}] is not a valid eInvoice document. Skipping.", pFile.Name)
|
||||
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
Return oResult
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile)
|
||||
_logger.Info("File [{0}/{1}] is an unsupported eInvoice document format!", pFile.Name, ex.XmlFile)
|
||||
Throw New UnsupportedFerdException(ex.XmlFile)
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name)
|
||||
_logger.Info("File [{0}] is an incorrectly formatted eInvoice document!", pFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
|
||||
_logger.Warn("Unexpected Error occurred while extracting eInvoice Information from file {0}", pFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
End Try
|
||||
@ -1117,7 +1115,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Erste Zeile enthält die Spezifikation
|
||||
Dim oFirstRow As DataRow = oDataTable.NewRow()
|
||||
oFirstRow("REFERENCE_GUID") = pMessageId
|
||||
oFirstRow("ITEM_DESCRIPTION") = "ZUGFeRDSpezifikation"
|
||||
oFirstRow("ITEM_DESCRIPTION") = "Verwendete Spezifikation der E-Rechnung"
|
||||
oFirstRow("ITEM_VALUE") = pDocument.Specification
|
||||
oFirstRow("GROUP_COUNTER") = 0
|
||||
oFirstRow("SPEC_NAME") = "ZUGFERD_SPECIFICATION"
|
||||
@ -1129,7 +1127,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Zweite Zeile enthält das verwendete XML Schema
|
||||
Dim oSecondRow As DataRow = oDataTable.NewRow()
|
||||
oSecondRow("REFERENCE_GUID") = pMessageId
|
||||
oSecondRow("ITEM_DESCRIPTION") = "ZUGFeRDXMLSchema"
|
||||
oSecondRow("ITEM_DESCRIPTION") = "Verwendetes XML-Schema (XSD) der E-Rechnung"
|
||||
oSecondRow("ITEM_VALUE") = pDocument.UsedXMLSchema
|
||||
oSecondRow("GROUP_COUNTER") = 0
|
||||
oSecondRow("SPEC_NAME") = "ZUGFERD_XML_SCHEMA"
|
||||
@ -1141,7 +1139,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Dritte Zeile enthält das verwendete Datei-Format des Belegs (PDF/XML)
|
||||
Dim oThirdRow As DataRow = oDataTable.NewRow()
|
||||
oThirdRow("REFERENCE_GUID") = pMessageId
|
||||
oThirdRow("ITEM_DESCRIPTION") = "ReceiptFileType"
|
||||
oThirdRow("ITEM_DESCRIPTION") = "Dateityp der E-Rechnung"
|
||||
oThirdRow("ITEM_VALUE") = pDocument.ReceiptFileType
|
||||
oThirdRow("GROUP_COUNTER") = 0
|
||||
oThirdRow("SPEC_NAME") = "RECEIPT_FILE_TYPE"
|
||||
@ -1174,9 +1172,16 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Warn("Value for field [{0}] is longer than 900 characters, will be truncated!", oProperty.TableColumn)
|
||||
End If
|
||||
|
||||
Dim oDescription As String
|
||||
If oProperty.EN16931_ID IsNot Nothing AndAlso oProperty.EN16931_ID.Length > 1 Then
|
||||
oDescription = oProperty.EN16931_ID + " (" + oProperty.Description + ")"
|
||||
Else
|
||||
oDescription = oProperty.Description
|
||||
End If
|
||||
|
||||
Dim oNewRow As DataRow = oDataTable.NewRow()
|
||||
oNewRow("REFERENCE_GUID") = pMessageId
|
||||
oNewRow("ITEM_DESCRIPTION") = oProperty.Description
|
||||
oNewRow("ITEM_DESCRIPTION") = oDescription
|
||||
oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900)
|
||||
oNewRow("GROUP_COUNTER") = oGroupCounterValue
|
||||
oNewRow("SPEC_NAME") = oProperty.TableColumn
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user