EXG MRN Suche (PDF)

This commit is contained in:
2026-10-19 07:39:42 +02:00
parent b008311cfb
commit e7023fdb0f
3 changed files with 87 additions and 37 deletions

View File

@@ -194,12 +194,15 @@ Public Class cDATENSERVER
Function moveTo_ARCHIVARCHIV() As Boolean
Dim oldDIR = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
Dim newDIR = DATENVERVER_OPTIONS.getDescPath(rootDirARCHIVARCHIV, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
Function moveTo_ARCHIVARCHIV(Optional fehlerListe As List(Of String) = Nothing, Optional logPfad As String = Nothing) As Boolean
Dim hasErrors As Boolean = False
Try
Dim hasErrors As Boolean = False
Dim oldDIR = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
Dim newDIR = DATENVERVER_OPTIONS.getDescPath(rootDirARCHIVARCHIV, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
Dim oldBase = System.IO.Path.GetFullPath(oldDIR).TrimEnd("\"c) & "\"
Dim newBase = System.IO.Path.GetFullPath(newDIR).TrimEnd("\"c) & "\"
Dim createdDirectories As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
@@ -236,11 +239,19 @@ Public Class cDATENSERVER
Throw New Exception("Datenbankupdate fehlgeschlagen: " & alterPfad)
End If
System.IO.File.Delete(alterPfad)
Else
li.coll_pfad = alterPfad.Replace("\\datenarchiv.verag.ost.dmn\", "\\DELETED\")
Try
System.IO.File.Delete(alterPfad)
Catch exDelete As Exception
hasErrors = True
LogArchivFehler("LÖSCHEN FEHLGESCHLAGEN | da_id=" & da_id & " | " & alterPfad & " | " & exDelete.Message, fehlerListe, logPfad)
End Try
Else
Dim deletedPfad = alterPfad.Replace("\\datenarchiv.verag.ost.dmn\", "\\DELETED\")
If deletedPfad <> alterPfad Then
li.coll_pfad = deletedPfad
If li.coll_pfad <> alterPfad Then
If Not li.UPDATE() Then
li.coll_pfad = alterPfad
Throw New Exception("Datenbankupdate fehlgeschlagen: " & alterPfad)
@@ -250,22 +261,39 @@ Public Class cDATENSERVER
Catch ex2 As Exception
hasErrors = True
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex2.Message, alterPfad & vbNewLine & ex2.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
li.coll_pfad = alterPfad
LogArchivFehler("FEHLER | da_id=" & da_id & " | " & alterPfad & " | " & ex2.Message, fehlerListe, logPfad)
End Try
Next
If hasErrors Then Return False
Return UPDATE()
If Not UPDATE() Then
hasErrors = True
LogArchivFehler("UPDATE FEHLGESCHLAGEN | da_id=" & da_id, fehlerListe, logPfad)
End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
hasErrors = True
LogArchivFehler("ALLGEMEINER FEHLER | da_id=" & da_id & " | " & ex.Message, fehlerListe, logPfad)
End Try
Return False
Return Not hasErrors
End Function
Private Sub LogArchivFehler(fehlerText As String, fehlerListe As List(Of String), logPfad As String)
Dim eintrag As String = Date.Now.ToString("dd.MM.yyyy HH:mm:ss") & " | " & fehlerText
If fehlerListe IsNot Nothing Then fehlerListe.Add(eintrag)
If Not String.IsNullOrWhiteSpace(logPfad) Then
Try
System.IO.File.AppendAllText(logPfad, eintrag & Environment.NewLine, System.Text.Encoding.UTF8)
Catch ex As Exception
Debug.WriteLine("Archiv-Log konnte nicht geschrieben werden: " & ex.Message)
End Try
End If
End Sub
Function UPDATE() As Boolean
Try
'If coll_id < 0 Then 'Wenn noch keine ID vergeben