GetNextDocGUID
This commit is contained in:
@@ -125,7 +125,8 @@ Public Class frmValidator
|
||||
|
||||
End Try
|
||||
Try
|
||||
TBPM_FILES_USER_NOT_INDEXEDTableAdapter.CmdDelete(Environment.UserName)
|
||||
Dim oDel = $"DELETE FROM TBPM_FILES_USER_NOT_INDEXED WHERE UPPER(USR_NAME) = UPPER('{USER_USERNAME}')"
|
||||
ClassDatabase.Execute_non_Query(oDel)
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
MsgBox("Fehler bei Übersprungene Files löschen:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
@@ -320,7 +321,7 @@ Public Class frmValidator
|
||||
Dim _step = 0
|
||||
Try
|
||||
_step = 1
|
||||
TBPM_FILES_USER_NOT_INDEXEDTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
||||
|
||||
TBPM_PROFILE_CONTROLSTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
||||
TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
||||
TBPM_PROFILE_FILESTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
||||
@@ -1303,22 +1304,24 @@ Public Class frmValidator
|
||||
Replace("K:", "\\windream\objects")
|
||||
End Function
|
||||
|
||||
Function Next_GUID(Filepath As String, ProfilId As Integer, OrderByNewest As Boolean) As Integer
|
||||
Dim oFilePath = ReplaceWindreamDriveLetter(Filepath).ToUpper()
|
||||
Dim oSQL = $"
|
||||
SELECT GUID FROM TBPM_PROFILE_FILES WHERE
|
||||
PROFIL_ID = {CURRENT_ProfilGUID} AND EDIT = 0 AND IN_WORK = 0 AND
|
||||
UPPER(REPLACE(FILE_PATH, 'W:','\\windream\objects')) <> '{oFilePath}' AND
|
||||
UPPER(REPLACE(FILE_PATH, 'W:','\\windream\objects')) NOT IN (
|
||||
SELECT UPPER(FILE_PATH)
|
||||
FROM TBPM_FILES_USER_NOT_INDEXED
|
||||
WHERE (PROFIL_ID = {ProfilId}) AND (UPPER(USR_NAME) = UPPER('{Environment.UserName}'))
|
||||
)
|
||||
{IIf(OrderByNewest, " ORDER BY DMS_ERSTELLT_DATE DESC", "")}
|
||||
"
|
||||
'Function Next_GUID() As Integer
|
||||
' 'Dim id = CURRENT_DOC_GUID
|
||||
' 'Dim oFilePath = ReplaceWindreamDriveLetter(Filepath).ToUpper()
|
||||
' Dim oSQL = $"SELECT [dbo].[FNPM_GET_NEXT_DOC_GUID] ({CURRENT_ProfilGUID},{PROFIL_sortbynewest},{CURRENT_DOC_GUID},'{USER_USERNAME}')"
|
||||
|
||||
Return ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING, True)
|
||||
End Function
|
||||
' 'SELECT GUID FROM TBPM_PROFILE_FILES WHERE
|
||||
' ' PROFIL_ID = {CURRENT_ProfilGUID} AND EDIT = 0 AND IN_WORK = 0 AND
|
||||
' ' UPPER(REPLACE(FILE_PATH, 'W:','\\windream\objects')) <> '{oFilePath}' AND
|
||||
' ' UPPER(REPLACE(FILE_PATH, 'W:','\\windream\objects')) NOT IN (
|
||||
' ' SELECT UPPER(FILE_PATH)
|
||||
' ' FROM TBPM_FILES_USER_NOT_INDEXED
|
||||
' ' WHERE (PROFIL_ID = {ProfilId}) AND (UPPER(USR_NAME) = UPPER('{Environment.UserName}'))
|
||||
' ' )
|
||||
' ' {IIf(OrderByNewest, " ORDER BY DMS_ERSTELLT_DATE DESC", "")}
|
||||
' ' "
|
||||
|
||||
' Return ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING, True)
|
||||
'End Function
|
||||
|
||||
Function Get_Next_GUID() As Integer
|
||||
Try
|
||||
@@ -1331,7 +1334,13 @@ Public Class frmValidator
|
||||
' newGUID = TBPM_PROFILE_FILESTableAdapter.cmdGetNextFile_GUID(CURRENT_ProfilGUID, OLD_Document_Path, Environment.UserName)
|
||||
'End If
|
||||
LOGGER.Debug("Old Document_Path: " & OLD_Document_Path)
|
||||
newGUID = Next_GUID(OLD_Document_Path, CURRENT_ProfilGUID, PROFIL_sortbynewest)
|
||||
Dim oBIT As Integer = 0
|
||||
If PROFIL_sortbynewest = True Then
|
||||
oBIT = 1
|
||||
End If
|
||||
Dim oSQL = $"SELECT [dbo].[FNPM_GET_NEXT_DOC_GUID] ({CURRENT_ProfilGUID},{oBIT},{CURRENT_DOC_GUID},'{USER_USERNAME}')"
|
||||
|
||||
newGUID = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING, True)
|
||||
|
||||
WMDocPathWindows = ""
|
||||
CURRENT_DOC_PATH = ""
|
||||
@@ -1339,7 +1348,7 @@ Public Class frmValidator
|
||||
If newGUID > 0 Then
|
||||
LOGGER.Debug("newGUID: " & newGUID.ToString)
|
||||
|
||||
Else
|
||||
ElseIf newGUID <> 0 Then
|
||||
LOGGER.Info(" >> ACHTUNG: Ausnahme in GetNextGUID - Es konnte keine GUID abgerufen werden!")
|
||||
newGUID = 0
|
||||
End If
|
||||
@@ -1365,7 +1374,7 @@ Public Class frmValidator
|
||||
End If
|
||||
If CURRENT_DOC_GUID = 0 Then
|
||||
Dim DT As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_FILES
|
||||
CURRENT_DOC_GUID = DT.Rows(0).Item("GUID")
|
||||
CURRENT_DOC_GUID = 0 'DT.Rows(0).Item("GUID")
|
||||
AnzDoks = DT.Rows.Count
|
||||
Else
|
||||
AnzDoks = 1
|
||||
@@ -1422,7 +1431,7 @@ Public Class frmValidator
|
||||
Catch ex As Exception
|
||||
Dim _err1 As Boolean = False
|
||||
LOGGER.Error(ex)
|
||||
allgFunk.Insert_LogEntry(CURRENT_ProfilGUID, "error in creatin WMObject - DocGUID: " & CURRENT_DOC_GUID & " - ERROR: " & ex.Message, Environment.UserName)
|
||||
allgFunk.Insert_LogEntry(CURRENT_ProfilGUID, "error in creating WMObject - DocGUID: " & CURRENT_DOC_GUID & " - ERROR: " & ex.Message, Environment.UserName)
|
||||
LOGGER.Info("Unexpected error creating WMObject(1) in GetWMDocFileString: " & ex.Message)
|
||||
LOGGER.Info("Error Number: " & Err.Number.ToString)
|
||||
errormessage = $"Could not create a WMObject(1) for [{oWMOwnPath}]!"
|
||||
@@ -1501,6 +1510,8 @@ Public Class frmValidator
|
||||
LOGGER.Debug($"CURRENT_JUMP_DOC_GUID: {CURRENT_JUMP_DOC_GUID}'")
|
||||
If CURRENT_JUMP_DOC_GUID = 0 Then
|
||||
CURRENT_DOC_GUID = Get_Next_GUID()
|
||||
ElseIf first = False Then
|
||||
CURRENT_DOC_GUID = 0
|
||||
End If
|
||||
LOGGER.Debug("Dokument-GUID: '" & CURRENT_DOC_GUID.ToString & "'")
|
||||
If CURRENT_DOC_GUID > 0 Then
|
||||
@@ -1521,34 +1532,9 @@ Public Class frmValidator
|
||||
tstrlbl_Info.Text = "Datei " & docCounter.ToString & " von " & Anzahl_ValDoks.ToString
|
||||
LOGGER.Info(">> Validierung für Dokument '" & WMDocPathWindows & "' gestartet")
|
||||
|
||||
'Try
|
||||
' CURRENT_WMFILE = WINDREAM.oSession.GetWMObjectByPath(WMEntity.WMEntityDocument, WINDREAM.NormalizePath(WMDocFileString))
|
||||
'Catch ex As Exception
|
||||
' LOGGER.Error(ex)
|
||||
' allgFunk.Insert_LogEntry(CURRENT_ProfilGUID, "Fehler bei Erzeugen windream-Objekt - DocGUID: " & CURRENT_DOC_GUID & " - ERROR: " & ex.Message, Environment.UserName)
|
||||
' LOGGER.Info("Fehler bei Erzeugen windream-Objekt in (LoadNextDokument): " & ex.Message)
|
||||
' LOGGER.Info("Error Number: " & Err.Number.ToString)
|
||||
' Dim _err1 As Boolean = False
|
||||
' 'Nochmaliger Versuch windream zu initialiseren
|
||||
' If Init_windream() = True Then
|
||||
' Try
|
||||
' CURRENT_WMFILE = WINDREAM.oSession.GetWMObjectByPath(WMEntity.WMEntityDocument, WINDREAM.NormalizePath(WMDocPathWindows))
|
||||
' Catch ex1 As Exception
|
||||
' LOGGER.Info("1- Fehler bei 2. Versuch windream-Objekt: " & ex1.Message)
|
||||
' oErrorMessage = $"1-Could not create a WMObject for [{WMDocPathWindows}]!"
|
||||
' _err1 = True
|
||||
' End Try
|
||||
' Else
|
||||
' oErrorMessage = "2-Could not login to ECM - Please check Your log for further details!"
|
||||
' _err1 = True
|
||||
' End If
|
||||
' If _err1 = True Then
|
||||
' errormessage = oErrorMessage
|
||||
' frmError.ShowDialog()
|
||||
' Exit Sub
|
||||
' End If
|
||||
|
||||
'End Try
|
||||
Dim oSQL = $"SELECT DOC_ID FROM TBPM_PROFILE_FILES WHERE GUID = {CURRENT_DOC_GUID}"
|
||||
CURRENT_DOC_ID = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING)
|
||||
tsslblDocID.Text = "Document-ID: " & CURRENT_DOC_ID & " - GUID: " & CURRENT_DOC_GUID
|
||||
|
||||
LOGGER.Debug("WMDoc created...")
|
||||
oErrorMessage = Windream_get_Doc_info()
|
||||
@@ -3661,11 +3647,10 @@ Public Class frmValidator
|
||||
'Das Dokument freigeben
|
||||
TBPM_PROFILE_FILESTableAdapter.CmdSETWORK(False, "", CURRENT_DOC_GUID)
|
||||
|
||||
If TBPM_FILES_USER_NOT_INDEXEDTableAdapter.FileExists(Environment.UserName, CURRENT_ProfilGUID, WMDocPathWindows) = 0 Then
|
||||
TBPM_FILES_USER_NOT_INDEXEDTableAdapter.cmdInsert(Environment.UserName, CURRENT_ProfilGUID, WMDocPathWindows)
|
||||
End If
|
||||
Dim oSQL = $"EXECUTE PRPM_FILES_NOT_INDEXED '{USER_USERNAME}',{CURRENT_ProfilGUID},'{WMDocPathWindows}',{CURRENT_DOC_GUID}"
|
||||
ClassDatabase.Execute_non_Query(oSQL)
|
||||
|
||||
LOGGER.Debug("Dokument freigegeben")
|
||||
LOGGER.Debug($"Skipped DocGUID {CURRENT_DOC_GUID}")
|
||||
LOGGER.Info("")
|
||||
Load_Next_Document(False)
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user