update Zugferd job
This commit is contained in:
parent
5b2d1b8342
commit
16a7d5b915
@ -317,6 +317,7 @@ Public Class ImportZUGFeRDFiles
|
||||
oRejected = False
|
||||
End Try
|
||||
If oRejected = False Then
|
||||
HISTORY_ID = oMD5DT.Rows(0).Item("GUID")
|
||||
Throw New MD5HashException()
|
||||
Else
|
||||
_logger.Info("ZuGFeRDFile already has been worked, but formerly obviously was rejected!")
|
||||
@ -517,6 +518,8 @@ Public Class ImportZUGFeRDFiles
|
||||
If oMD5CheckSum <> String.Empty Then
|
||||
Dim oInsertCommand = $"INSERT INTO TBEDM_ZUGFERD_HISTORY_IN (MESSAGE_ID, MD5HASH) VALUES ('{oFileGroupId}', '{oMD5CheckSum}')"
|
||||
_firebird.ExecuteNonQueryWithConnection(oInsertCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction)
|
||||
'commit the transaction
|
||||
oTransaction.Commit()
|
||||
Try
|
||||
Dim oSQL = $"SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
HISTORY_ID = _firebird.GetScalarValue(oSQL)
|
||||
@ -524,12 +527,11 @@ Public Class ImportZUGFeRDFiles
|
||||
HISTORY_ID = 0
|
||||
End Try
|
||||
End If
|
||||
'commit the transaction
|
||||
oTransaction.Commit()
|
||||
|
||||
Catch ex As MD5HashException
|
||||
_logger.Error(ex)
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Already processed (MD5Hash)' WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Already processed (MD5Hash)' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
|
||||
Dim oBody = "<p>The invoice attached to your email has already been processed in our system.</p>"
|
||||
@ -540,7 +542,7 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error(ex)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - ZUGFeRD yes but incorrect format' WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - ZUGFeRD yes but incorrect format' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
Dim oBody = """
|
||||
<p>Ihre email einthielt ein ZUGFeRD Dokument, welches aber inkorrekt formatiert wurde.</p>
|
||||
@ -554,7 +556,7 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error(ex)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - More than one ZUGFeRD-document in email' WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - More than one ZUGFeRD-document in email' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
Dim oBody = "<p>Ihre email enthielt mehr als ein ZUGFeRD-Dokument.</p>"
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
@ -563,7 +565,7 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error(ex)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - no ZUGFeRD-Document in email' WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - no ZUGFeRD-Document in email' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
Dim oBody = "<p>Your email contained no ZUGFeRD-Documents.</p>"
|
||||
Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId)
|
||||
@ -576,7 +578,7 @@ Public Class ImportZUGFeRDFiles
|
||||
For Each prop In oMissingProperties
|
||||
oMessage &= $"- {prop}"
|
||||
Next
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Missing Required Properties: {oMessage}' WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Missing Required Properties: {oMessage}' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
|
||||
Dim oBody = CreateBodyForMissingProperties(ex.File.Name, oMissingProperties)
|
||||
@ -585,7 +587,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown Error occurred: {0}", ex.Message)
|
||||
_logger.Error(ex)
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE MESSAGE_ID = '{oFileGroupId}'"
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user