Working Rejected

This commit is contained in:
Digital Data - Marlon Schreiber
2019-09-24 13:16:01 +02:00
parent 82a839949d
commit cf461c79d9
5 changed files with 106 additions and 54 deletions

View File

@@ -39,8 +39,8 @@ Public Class ThreadRunner
args = LoadPropertyMapFor(args, "DEFAULT")
' Use MSSQL Server if available
If _mssql IsNot Nothing Then
_logger.Debug("Data will be inserted into MSSQL Server.")
If Not IsNothing(_mssql) Then
_logger.Debug("Data will also be inserted into MSSQL Server.")
args.InsertIntoSQLServer = True
End If
@@ -113,7 +113,25 @@ Public Class ThreadRunner
Dim args As WorkerArgs = e.Argument
_logger.Debug("Background worker running..")
' Use MSSQL Server if available
If Not IsNothing(_mssql) Then
'Checking if documents have bee´n rejected
Dim oSQL As String = "Select * from TBEDMI_DOC_REJECTED WHERE MD5_UPDATE = 0"
Dim oDT As DataTable = _mssql.GetDatatable(oSQL)
If Not IsNothing(oDT) Then
For Each oRow As DataRow In oDT.Rows
oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET REJECTED = TRUE WHERE MESSAGE_ID = '{oRow.Item("MESSAGE_ID")}'"
If _firebird.ExecuteNonQuery(oSQL) = True Then
oSQL = $"UPDATE TBEDMI_DOC_REJECTED SET MD5_UPDATE = 1 WHERE GUID = '{oRow.Item("GUID")}'"
If _mssql.ExecuteNonQuery(oSQL) = True Then
_logger.Debug($"Refreshed the Rejected Info for messageid [{oRow.Item("MESSAGE_ID")}]")
End If
End If
Next
Else
_logger.Warn("oDTTBEDMI_DOC_REJECTED is nothing...")
End If
End If
Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird, _mssql)
job.Start(args)
Catch ex As Exception
@@ -159,7 +177,7 @@ Public Class ThreadRunner
End Function
Private Function LoadPropertyMapFor(args As WorkerArgs, specification As String)
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{specification}' AND ACTIVE = True"
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{specification}' AND ACTIVE = True ORDER BY XML_PATH"
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
For Each row As DataRow In oResult.Rows