Modules.Interface + Modules.Jobs: ITEM_TYPE = 4 / Description enthält jetzt BT-Feld-Info / Kommentare / Abfrage BT-Felder
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user