Modules.Jobs:
- EBINTERFACE_61: Aufruf externer Prozedur ermöglicht. Konfiguration über TBDD_SQL_COMMANDS. - Absicherung der Emai-Funktion
This commit is contained in:
@@ -137,7 +137,11 @@ Namespace ZUGFeRD
|
||||
, '{pParameter2}'
|
||||
, 77"
|
||||
|
||||
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
||||
If pTransaction IsNot Nothing Then
|
||||
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
||||
Else
|
||||
_mssql.ExecuteNonQuery(oExecute)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
|
||||
@@ -68,6 +68,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Private ReadOnly _embeds As PDFEmbeds
|
||||
|
||||
Private SQL_xRechnung_ItemTemplate As String = ""
|
||||
Private SQL_ebInterface_CompleteXMLItems As String = ""
|
||||
|
||||
Private ReadOnly _gdpictureLicenseKey As String
|
||||
Private ReadOnly _xRechnungCreator As XRechnungViewDocument
|
||||
@@ -81,6 +82,8 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Public ZugferdFileCount As Integer = 0
|
||||
Public MD5Checksum As String = Nothing
|
||||
Public XMLSpecification As String = Nothing
|
||||
Public XMLSchema As String = Nothing
|
||||
|
||||
Public EmailAttachmentFiles As New List(Of FileInfo)
|
||||
Public EmbeddedAttachmentFiles As New List(Of PDFEmbeds.EmbeddedFile)
|
||||
@@ -114,6 +117,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Public Sub Start(Arguments As Object) Implements IJob.Start
|
||||
Dim oArgs As WorkerArgs = Arguments
|
||||
Dim oAttachmentExtractor = New PDFEmbeds(_logConfig)
|
||||
Dim oSpecification As String = String.Empty
|
||||
|
||||
_EmailOutAccountId = oArgs.EmailOutProfileId
|
||||
|
||||
@@ -125,12 +129,16 @@ Public Class ImportZUGFeRDFiles
|
||||
})
|
||||
|
||||
_logger.Debug("Starting Job {0}", [GetType].Name)
|
||||
If oArgs.AllowXRechnung Then
|
||||
' TODO - Config-Schalter hat NIX mit XRechnung-Dateien u. Sichtbelegen zu tun, sondern nur mit Dateinamen zu tun.
|
||||
If oArgs.AllowXRechnung Or oArgs.AllowPeppolBISBill3x Or oArgs.AllowEBInterface Then
|
||||
Dim oSQL = "SELECT SQL_COMMAND FROM TBDD_SQL_COMMANDS WITH (NOLOCK) WHERE TITLE = 'VWDD_ZUGFERD_VIEW_RECEIPT_TEMPLATE_ITEMS'"
|
||||
SQL_xRechnung_ItemTemplate = _mssql.GetScalarValue(oSQL)
|
||||
End If
|
||||
|
||||
If oArgs.AllowEBInterface Then
|
||||
Dim oSQL = "SELECT SQL_COMMAND FROM TBDD_SQL_COMMANDS WITH (NOLOCK) WHERE TITLE = 'EBINTERFACE_COMPLETE_MISSING_XML_ITEMS'"
|
||||
SQL_ebInterface_CompleteXMLItems = _mssql.GetScalarValue(oSQL)
|
||||
End If
|
||||
|
||||
Try
|
||||
'For Each oPath As String In oArgs.WatchDirectory
|
||||
Dim oPath As String = oArgs.WatchDirectory
|
||||
@@ -209,6 +217,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Try
|
||||
|
||||
For Each oFile In oEInvoiceFileGroup
|
||||
oSpecification = String.Empty
|
||||
oFileCounter += 1
|
||||
Dim oResult As ProcessFileResult
|
||||
|
||||
@@ -222,6 +231,7 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Debug("eInvoice File found")
|
||||
oMD5CheckSum = oResult.MD5Checksum
|
||||
oZUGFeRDCount = oResult.ZugferdFileCount
|
||||
oSpecification = oResult.XMLSpecification
|
||||
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
|
||||
oEmbeddedAttachmentFiles.AddRange(oResult.EmbeddedAttachmentFiles)
|
||||
Else ' No zugferd found!
|
||||
@@ -440,21 +450,34 @@ Public Class ImportZUGFeRDFiles
|
||||
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
|
||||
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
|
||||
|
||||
ElseIf oArgs.AllowXRechnung And oIsSuccess And
|
||||
ElseIf (oArgs.AllowXRechnung Or oArgs.AllowPeppolBISBill3x Or oArgs.AllowEBInterface) And oIsSuccess And
|
||||
oEInvoiceFileGroup.Item(0).Extension.Equals(".xml", StringComparison.OrdinalIgnoreCase) = True Then
|
||||
_logger.Debug("Before Creating the PDF-File from XML data / Before Commit")
|
||||
|
||||
oxRechnungHandle = True
|
||||
|
||||
If oSQLTransaction IsNot Nothing Then
|
||||
' Commit Transaction - muss ausgeführt werden, sonst sind keine Daten in der DB vorhanden
|
||||
oSQLTransaction.Commit()
|
||||
_logger.Debug("XML commit triggered")
|
||||
End If
|
||||
|
||||
' Vor der Sichtbeleg-Erzeugung, müssen ggf Daten nachberechnet werden.
|
||||
' Hier wird die Prozedur für EBINTERFACE_61 aufgerufen, falls der Beleg dieses Schema verwendet
|
||||
If oArgs.AllowEBInterface AndAlso
|
||||
String.Equals(oSpecification, "EBINTERFACE_61", StringComparison.InvariantCultureIgnoreCase) AndAlso
|
||||
Not String.IsNullOrEmpty(SQL_ebInterface_CompleteXMLItems) Then
|
||||
_logger.Debug("Before Calling ebInterface Procedure")
|
||||
Dim oSQL_MsgIDReplace_1 As String = SQL_ebInterface_CompleteXMLItems.Replace("@MSG_ID", oFileGroup.Key)
|
||||
Dim oSqlResult = _mssql.ExecuteNonQuery(oSQL_MsgIDReplace_1)
|
||||
_logger.Debug("Result of ebInterface Procedure: [{0}]", oSqlResult)
|
||||
End If
|
||||
|
||||
' Hier das neue PDF erzeugen
|
||||
'but before we need to get all Data we need
|
||||
MyTemplateValues_xInvDT = Nothing
|
||||
Dim oSQL_MsgIDReplace = SQL_xRechnung_ItemTemplate
|
||||
oSQL_MsgIDReplace = oSQL_MsgIDReplace.Replace("@MSG_ID", oFileGroup.Key)
|
||||
If oSQLTransaction IsNot Nothing Then
|
||||
' Commit Transaction
|
||||
oSQLTransaction.Commit()
|
||||
_logger.Debug("XML commit triggered")
|
||||
End If
|
||||
MyTemplateValues_xInvDT = _mssql.GetDatatable(oSQL_MsgIDReplace)
|
||||
|
||||
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
||||
@@ -598,6 +621,8 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
If oDocument IsNot Nothing Then
|
||||
sqlResult = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
|
||||
oResult.XMLSpecification = oDocument.Specification
|
||||
oResult.XMLSchema = oDocument.UsedXMLSchema
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user