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}'
|
, '{pParameter2}'
|
||||||
, 77"
|
, 77"
|
||||||
|
|
||||||
|
If pTransaction IsNot Nothing Then
|
||||||
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
||||||
|
Else
|
||||||
|
_mssql.ExecuteNonQuery(oExecute)
|
||||||
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
Private ReadOnly _embeds As PDFEmbeds
|
Private ReadOnly _embeds As PDFEmbeds
|
||||||
|
|
||||||
Private SQL_xRechnung_ItemTemplate As String = ""
|
Private SQL_xRechnung_ItemTemplate As String = ""
|
||||||
|
Private SQL_ebInterface_CompleteXMLItems As String = ""
|
||||||
|
|
||||||
Private ReadOnly _gdpictureLicenseKey As String
|
Private ReadOnly _gdpictureLicenseKey As String
|
||||||
Private ReadOnly _xRechnungCreator As XRechnungViewDocument
|
Private ReadOnly _xRechnungCreator As XRechnungViewDocument
|
||||||
@@ -81,6 +82,8 @@ Public Class ImportZUGFeRDFiles
|
|||||||
|
|
||||||
Public ZugferdFileCount As Integer = 0
|
Public ZugferdFileCount As Integer = 0
|
||||||
Public MD5Checksum As String = Nothing
|
Public MD5Checksum As String = Nothing
|
||||||
|
Public XMLSpecification As String = Nothing
|
||||||
|
Public XMLSchema As String = Nothing
|
||||||
|
|
||||||
Public EmailAttachmentFiles As New List(Of FileInfo)
|
Public EmailAttachmentFiles As New List(Of FileInfo)
|
||||||
Public EmbeddedAttachmentFiles As New List(Of PDFEmbeds.EmbeddedFile)
|
Public EmbeddedAttachmentFiles As New List(Of PDFEmbeds.EmbeddedFile)
|
||||||
@@ -114,6 +117,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
Public Sub Start(Arguments As Object) Implements IJob.Start
|
Public Sub Start(Arguments As Object) Implements IJob.Start
|
||||||
Dim oArgs As WorkerArgs = Arguments
|
Dim oArgs As WorkerArgs = Arguments
|
||||||
Dim oAttachmentExtractor = New PDFEmbeds(_logConfig)
|
Dim oAttachmentExtractor = New PDFEmbeds(_logConfig)
|
||||||
|
Dim oSpecification As String = String.Empty
|
||||||
|
|
||||||
_EmailOutAccountId = oArgs.EmailOutProfileId
|
_EmailOutAccountId = oArgs.EmailOutProfileId
|
||||||
|
|
||||||
@@ -125,12 +129,16 @@ Public Class ImportZUGFeRDFiles
|
|||||||
})
|
})
|
||||||
|
|
||||||
_logger.Debug("Starting Job {0}", [GetType].Name)
|
_logger.Debug("Starting Job {0}", [GetType].Name)
|
||||||
If oArgs.AllowXRechnung Then
|
If oArgs.AllowXRechnung Or oArgs.AllowPeppolBISBill3x Or oArgs.AllowEBInterface Then
|
||||||
' TODO - Config-Schalter hat NIX mit XRechnung-Dateien u. Sichtbelegen zu tun, sondern nur mit Dateinamen zu tun.
|
|
||||||
Dim oSQL = "SELECT SQL_COMMAND FROM TBDD_SQL_COMMANDS WITH (NOLOCK) WHERE TITLE = 'VWDD_ZUGFERD_VIEW_RECEIPT_TEMPLATE_ITEMS'"
|
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)
|
SQL_xRechnung_ItemTemplate = _mssql.GetScalarValue(oSQL)
|
||||||
End If
|
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
|
Try
|
||||||
'For Each oPath As String In oArgs.WatchDirectory
|
'For Each oPath As String In oArgs.WatchDirectory
|
||||||
Dim oPath As String = oArgs.WatchDirectory
|
Dim oPath As String = oArgs.WatchDirectory
|
||||||
@@ -209,6 +217,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
Try
|
Try
|
||||||
|
|
||||||
For Each oFile In oEInvoiceFileGroup
|
For Each oFile In oEInvoiceFileGroup
|
||||||
|
oSpecification = String.Empty
|
||||||
oFileCounter += 1
|
oFileCounter += 1
|
||||||
Dim oResult As ProcessFileResult
|
Dim oResult As ProcessFileResult
|
||||||
|
|
||||||
@@ -222,6 +231,7 @@ Public Class ImportZUGFeRDFiles
|
|||||||
_logger.Debug("eInvoice File found")
|
_logger.Debug("eInvoice File found")
|
||||||
oMD5CheckSum = oResult.MD5Checksum
|
oMD5CheckSum = oResult.MD5Checksum
|
||||||
oZUGFeRDCount = oResult.ZugferdFileCount
|
oZUGFeRDCount = oResult.ZugferdFileCount
|
||||||
|
oSpecification = oResult.XMLSpecification
|
||||||
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
|
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
|
||||||
oEmbeddedAttachmentFiles.AddRange(oResult.EmbeddedAttachmentFiles)
|
oEmbeddedAttachmentFiles.AddRange(oResult.EmbeddedAttachmentFiles)
|
||||||
Else ' No zugferd found!
|
Else ' No zugferd found!
|
||||||
@@ -440,21 +450,34 @@ Public Class ImportZUGFeRDFiles
|
|||||||
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
|
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
|
||||||
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
|
_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
|
oEInvoiceFileGroup.Item(0).Extension.Equals(".xml", StringComparison.OrdinalIgnoreCase) = True Then
|
||||||
_logger.Debug("Before Creating the PDF-File from XML data / Before Commit")
|
_logger.Debug("Before Creating the PDF-File from XML data / Before Commit")
|
||||||
|
|
||||||
oxRechnungHandle = True
|
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
|
' Hier das neue PDF erzeugen
|
||||||
'but before we need to get all Data we need
|
'but before we need to get all Data we need
|
||||||
MyTemplateValues_xInvDT = Nothing
|
MyTemplateValues_xInvDT = Nothing
|
||||||
Dim oSQL_MsgIDReplace = SQL_xRechnung_ItemTemplate
|
Dim oSQL_MsgIDReplace = SQL_xRechnung_ItemTemplate
|
||||||
oSQL_MsgIDReplace = oSQL_MsgIDReplace.Replace("@MSG_ID", oFileGroup.Key)
|
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)
|
MyTemplateValues_xInvDT = _mssql.GetDatatable(oSQL_MsgIDReplace)
|
||||||
|
|
||||||
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
||||||
@@ -598,6 +621,8 @@ Public Class ImportZUGFeRDFiles
|
|||||||
|
|
||||||
If oDocument IsNot Nothing Then
|
If oDocument IsNot Nothing Then
|
||||||
sqlResult = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
|
sqlResult = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
|
||||||
|
oResult.XMLSpecification = oDocument.Specification
|
||||||
|
oResult.XMLSchema = oDocument.UsedXMLSchema
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user