Version 2.9.2.0: Verbesserte Dokumentenverarbeitung

Die Assembly-Version wurde auf 2.9.2.0 aktualisiert.
Wesentliche Änderungen umfassen:

- Aggregation und Caching von Dokumentensuchergebnissen.
- Copy2TempPath und Mapping nun auch bei Exportfunktion
- Verbesserte Fehlerbehandlung und Logging bei Exporten.
- Konsistente Verarbeitung von Dateipfaden mit `.ToString()`.
- Codebereinigung und Entfernung redundanter Zeilen.
- Erweiterte Debug-Logs zur besseren Nachvollziehbarkeit.
This commit is contained in:
Developer01
2026-05-19 10:51:49 +02:00
parent 46a9742d5d
commit bd72e9cecc
2 changed files with 46 additions and 11 deletions

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.9.1.0")>
<Assembly: AssemblyVersion("2.9.2.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: NeutralResourcesLanguage("")>

View File

@@ -1018,6 +1018,8 @@ Public Class frmValidator
MyValidationLogger.Debug($"Current_Document: Id={Current_Document?.Id}, Path={Current_Document?.FullPath}")
MyValidationLogger.Debug("========================================")
DT_AdditionalSearches_Resultset_Docs = Nothing
Dim allSQLSearches As DataTable = DT_FILTERED_PROFILE_SEARCHES_DATA
Dim allDocSearches As DataTable = DT_FILTERED_PROFILE_SEARCHES_DOC
@@ -1048,6 +1050,7 @@ Public Class frmValidator
MyValidationLogger.Debug("--- Ergebnisse werden geprüft (DATA/DOC) ---")
Dim validSQLSearches As DataTable = allSQLSearches.Clone()
Dim validDocSearches As DataTable = allDocSearches.Clone()
Dim aggregatedDocResults As DataTable = Nothing
If hasDATASearches Then
For i As Integer = 0 To allSQLSearches.Rows.Count - 1
@@ -1091,6 +1094,12 @@ Public Class frmValidator
If IsValidDocSearchResult(testDT) Then
validDocSearches.ImportRow(searchRow)
MyValidationLogger.Info($"✓ Doc-Search '{tabTitle}': {testDT.Rows.Count} Dokumente gefunden")
If aggregatedDocResults Is Nothing Then
aggregatedDocResults = testDT.Clone()
End If
For Each resultRow As DataRow In testDT.Rows
aggregatedDocResults.ImportRow(resultRow)
Next
Else
MyValidationLogger.Warn($"⚠️ Doc-Search '{tabTitle}' liefert kein Dokument-Schema (DocID/FULL_FILENAME) und wird übersprungen.")
End If
@@ -1102,6 +1111,10 @@ Public Class frmValidator
End Try
Next
End If
DT_AdditionalSearches_Resultset_Docs = aggregatedDocResults
If DT_AdditionalSearches_Resultset_Docs IsNot Nothing Then
MyValidationLogger.Debug($"Zusätzliche Doc-Results gecached: {DT_AdditionalSearches_Resultset_Docs.Rows.Count} Rows")
End If
AdditionalDataResultsExist = validSQLSearches.Rows.Count > 0
AdditionalDocResultsExist = validDocSearches.Rows.Count > 0
@@ -8631,16 +8644,39 @@ Public Class frmValidator
Dim oFileCount As Integer = 1
If Not IsNothing(DT_AdditionalSearches_Resultset_Docs) Then
For Each oFileRecord As DataRow In DT_AdditionalSearches_Resultset_Docs.Rows
Dim oFromFilename = oFileRecord.Item("FULL_FILENAME")
Dim oFromFilename = oFileRecord.Item("FULL_FILENAME")?.ToString()
Dim oDocID = oFileRecord.Item("DocID")
If File.Exists(oFromFilename) Then
MyValidationLogger.Debug($"Found additional document for export: [{oFromFilename}] with DocID [{oDocID}]")
' COPY_WMFILE_2TEMP: Pfad analog zu GetDocPathWindows() auflösen
Dim oResolvedFilename As String = oFromFilename
If COPY_WMFILE_2TEMP = True AndAlso Not String.IsNullOrWhiteSpace(oFromFilename) Then
Dim options As New DocumentPathHandler.DocumentPathOptions With {
.EnableMapping = True,
.WMSuffix = WMSUFFIX,
.SpecificDrive = If(Len(MAP_SHARE_DRIVE) = 1, MAP_SHARE_DRIVE, ""),
.DriveBlacklist = MAP_BLACKLIST,
.CopyToTemp = True,
.TempFolder = TEMP_DOCUMENT_FOLDER,
.UnmapAfterCopy = True
}
Dim result = _documentPathHandler.ProcessDocumentPath(oFromFilename, options)
If result.Success AndAlso Not String.IsNullOrWhiteSpace(result.FinalPath) AndAlso File.Exists(result.FinalPath) Then
MyValidationLogger.Info($"✓ Zusatzdokument via Temp aufgelöst: [{result.FinalPath}]")
oResolvedFilename = result.FinalPath
Else
MyValidationLogger.Warn($"⚠️ Temp-Auflösung fehlgeschlagen für [{oFromFilename}]: {result.ErrorMessage} - Fallback auf Originalpfad")
oResolvedFilename = oFromFilename
End If
End If
If File.Exists(oResolvedFilename) Then
MyValidationLogger.Debug($"Found additional document for export: [{oResolvedFilename}] (WM: [{oFromFilename}]) with DocID [{oDocID}]")
oFileCount += 1
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbCrLf &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {oDocID}, {oFileCount}, @Outputfilename = @Filename OUTPUT;" & vbCrLf &
"SELECT @Filename"
oExportFilename = DatabaseFallback.GetScalarValueECM(oSQLGetFilename)
oExtension = Path.GetExtension(oFromFilename)
oExtension = Path.GetExtension(oResolvedFilename)
If Not IsNothing(oExportFilename) Then
If IsDBNull(oExportFilename) Then
MyValidationLogger.Info($"#### ATTENTION: oExportFilename is DBNULL - SQL: {oSQLGetFilename}")
@@ -8648,8 +8684,8 @@ Public Class frmValidator
End If
If oExportFilename <> String.Empty Then
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
File.Copy(oFromFilename, oTargetPath)
LOGGER.Info($"Additional file [{oFromFilename}] exported successfully to [{oTargetPath}]")
File.Copy(oResolvedFilename, oTargetPath)
MyValidationLogger.Info($"Additional file [{oResolvedFilename}] exported successfully to [{oTargetPath}]")
oCount += 1
Else
Dim omsg = $"Error encountered while extracting ATTACHMENT-Export-Filename DocID [{oDocID}]!"
@@ -8661,9 +8697,8 @@ Public Class frmValidator
MyValidationLogger.Info($"#### ATTENTION: {omsg} SQL: {oSQLGetFilename}")
MsgBox(omsg & vbCrLf & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
End If
'oFilenameOnly = Path.GetFileName(oFromFilename)
Else
MyValidationLogger.Warn($"⚠️ Additional file for export not found: [{oFromFilename}] with DocID [{oDocID}]")
MyValidationLogger.Warn($"⚠️ Additional file for export not found: [{oResolvedFilename}] (WM: [{oFromFilename}]) with DocID [{oDocID}]")
End If
Next
Else