EXG MRN Suche (PDF)
This commit is contained in:
@@ -22,21 +22,21 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Me.SplitContainer = New System.Windows.Forms.SplitContainer()
|
||||
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
|
||||
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel()
|
||||
Me.btnAllgemein = New System.Windows.Forms.Button()
|
||||
Me.pnl = New System.Windows.Forms.Panel()
|
||||
Me.cboDakosyAction = New VERAG_PROG_ALLGEMEIN.MyComboBox()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.Label10 = New System.Windows.Forms.Label()
|
||||
Me.Button5 = New System.Windows.Forms.Button()
|
||||
Me.Label9 = New System.Windows.Forms.Label()
|
||||
Me.Button4 = New System.Windows.Forms.Button()
|
||||
Me.Label5 = New System.Windows.Forms.Label()
|
||||
Me.Button2 = New System.Windows.Forms.Button()
|
||||
Me.cbxNCTS = New System.Windows.Forms.CheckBox()
|
||||
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
|
||||
Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel()
|
||||
Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
|
||||
Me.Label7 = New System.Windows.Forms.Label()
|
||||
Me.Label4 = New System.Windows.Forms.Label()
|
||||
Me.TextBox1 = New System.Windows.Forms.TextBox()
|
||||
@@ -46,7 +46,7 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
Me.Label2 = New System.Windows.Forms.Label()
|
||||
Me.cboStammreferenz = New VERAG_PROG_ALLGEMEIN.MyComboBox()
|
||||
Me.Label6 = New System.Windows.Forms.Label()
|
||||
Me.MyPanel2 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
|
||||
Me.MyPanel2 = New VERAG_PROG_ALLGEMEIN.MyPanel()
|
||||
Me.cboStammreferenz2 = New VERAG_PROG_ALLGEMEIN.MyComboBox()
|
||||
Me.cbxAutoTranslate = New System.Windows.Forms.CheckBox()
|
||||
Me.Label8 = New System.Windows.Forms.Label()
|
||||
@@ -55,14 +55,13 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
Me.Button3 = New System.Windows.Forms.Button()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.lblBezugsnummer = New System.Windows.Forms.Label()
|
||||
Me.cntxtBezugsnr = New System.Windows.Forms.ContextMenuStrip(Me.components)
|
||||
Me.cntxtBezugsnr = New System.Windows.Forms.ContextMenuStrip()
|
||||
Me.NeueBezugsnummerVergebenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.Panel1 = New System.Windows.Forms.Panel()
|
||||
Me.txtDyMandant = New System.Windows.Forms.Label()
|
||||
Me.txtDyNiederlassung = New System.Windows.Forms.Label()
|
||||
Me.MenuStrip = New System.Windows.Forms.MenuStrip()
|
||||
Me.OptionenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.Label10 = New System.Windows.Forms.Label()
|
||||
CType(Me.SplitContainer, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainer.Panel1.SuspendLayout()
|
||||
Me.SplitContainer.Panel2.SuspendLayout()
|
||||
@@ -189,6 +188,15 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
Me.Button1.Text = "An DAKOSY senden -->"
|
||||
Me.Button1.UseVisualStyleBackColor = False
|
||||
'
|
||||
'Label10
|
||||
'
|
||||
Me.Label10.Location = New System.Drawing.Point(18, 153)
|
||||
Me.Label10.Name = "Label10"
|
||||
Me.Label10.Size = New System.Drawing.Size(120, 67)
|
||||
Me.Label10.TabIndex = 31
|
||||
Me.Label10.Text = "-"
|
||||
Me.Label10.TextAlign = System.Drawing.ContentAlignment.TopRight
|
||||
'
|
||||
'Button5
|
||||
'
|
||||
Me.Button5.BackColor = System.Drawing.Color.White
|
||||
@@ -278,7 +286,7 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
Me.MyPanel1.Enabled = False
|
||||
Me.MyPanel1.Location = New System.Drawing.Point(454, 88)
|
||||
Me.MyPanel1.Name = "MyPanel1"
|
||||
Me.MyPanel1.Size = New System.Drawing.Size(560, 522)
|
||||
Me.MyPanel1.Size = New System.Drawing.Size(560, 525)
|
||||
Me.MyPanel1.TabIndex = 20
|
||||
Me.MyPanel1.Visible = False
|
||||
'
|
||||
@@ -291,7 +299,7 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
Me.MyDatagridview1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
|
||||
Me.MyDatagridview1.Location = New System.Drawing.Point(20, 51)
|
||||
Me.MyDatagridview1.Name = "MyDatagridview1"
|
||||
Me.MyDatagridview1.Size = New System.Drawing.Size(537, 454)
|
||||
Me.MyDatagridview1.Size = New System.Drawing.Size(537, 457)
|
||||
Me.MyDatagridview1.TabIndex = 26
|
||||
'
|
||||
'Label7
|
||||
@@ -568,16 +576,6 @@ Partial Class usrCntlATLAS_EXGestellung
|
||||
Me.OptionenToolStripMenuItem.Size = New System.Drawing.Size(69, 20)
|
||||
Me.OptionenToolStripMenuItem.Text = "Optionen"
|
||||
'
|
||||
'Label10
|
||||
'
|
||||
Me.Label10.AutoSize = True
|
||||
Me.Label10.Location = New System.Drawing.Point(18, 153)
|
||||
Me.Label10.Name = "Label10"
|
||||
Me.Label10.Size = New System.Drawing.Size(10, 13)
|
||||
Me.Label10.TabIndex = 31
|
||||
Me.Label10.Text = "-"
|
||||
Me.Label10.TextAlign = System.Drawing.ContentAlignment.TopRight
|
||||
'
|
||||
'usrCntlATLAS_EXGestellung
|
||||
'
|
||||
Me.Controls.Add(Me.SplitContainer)
|
||||
|
||||
@@ -787,12 +787,13 @@ Public Class usrCntlATLAS_EXGestellung
|
||||
Private Function readEXDataFromPDF() As List(Of cPDFMRNResult)
|
||||
Dim f As New frmImportFromAVISOAnhaenge(AVISO, SENDUNG)
|
||||
f.ShowDialog(Me)
|
||||
|
||||
If f.DialogResult <> DialogResult.OK Then Return New List(Of cPDFMRNResult)
|
||||
If f.LIST_FILES Is Nothing OrElse f.LIST_FILES.Count = 0 Then Return New List(Of cPDFMRNResult)
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor
|
||||
Try
|
||||
Return ExtractMRNsFromPDFs(f.LIST_FILES)
|
||||
Return ExtractMRNsFromPDFs(f.LIST_FILES, Label10)
|
||||
Finally
|
||||
Cursor.Current = Cursors.Default
|
||||
End Try
|
||||
@@ -802,12 +803,15 @@ Public Class usrCntlATLAS_EXGestellung
|
||||
|
||||
|
||||
|
||||
|
||||
Public Shared Function ExtractMRNsFromPDFs(files As IEnumerable(Of String)) As List(Of cPDFMRNResult)
|
||||
Public Shared Function ExtractMRNsFromPDFs(files As IEnumerable(Of String), Optional lblProgress As Label = Nothing) As List(Of cPDFMRNResult)
|
||||
Dim results As New List(Of cPDFMRNResult)
|
||||
Dim pdfFiles = files.ToList()
|
||||
Dim fileNr As Integer = 0
|
||||
|
||||
For Each pdfPath In files
|
||||
For Each pdfPath In pdfFiles
|
||||
fileNr += 1
|
||||
Console.WriteLine("PDF: " & pdfPath)
|
||||
|
||||
If String.IsNullOrWhiteSpace(pdfPath) OrElse Not System.IO.File.Exists(pdfPath) Then Continue For
|
||||
|
||||
Try
|
||||
@@ -820,6 +824,14 @@ Public Class usrCntlATLAS_EXGestellung
|
||||
For pageIndex As Integer = 0 To textPdf.NumberOfPages - 1
|
||||
Dim found As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
|
||||
|
||||
' Fortschritt anzeigen
|
||||
If lblProgress IsNot Nothing Then
|
||||
lblProgress.Text = $"PDF: {fileNr}/{pdfFiles.Count}" & vbCrLf &
|
||||
$"Seite: {pageIndex + 1}/{textPdf.NumberOfPages}" & vbCrLf &
|
||||
$"MRNs: {results.Count}"
|
||||
lblProgress.Refresh()
|
||||
End If
|
||||
|
||||
' 1. Zuerst Text auslesen
|
||||
Try
|
||||
For Each mrn In ExtractMRNsFromPDFText(textPdf, pageIndex)
|
||||
@@ -851,6 +863,12 @@ Public Class usrCntlATLAS_EXGestellung
|
||||
Next
|
||||
|
||||
Console.WriteLine($"SEITE {pageIndex + 1} ENDE | MRNs={found.Count}")
|
||||
|
||||
' Fortschritt nach abgeschlossener Seite aktualisieren
|
||||
If lblProgress IsNot Nothing Then
|
||||
lblProgress.Text = $"PDF {fileNr}/{pdfFiles.Count} | Seite {pageIndex + 1}/{textPdf.NumberOfPages} | MRNs: {results.Count}"
|
||||
lblProgress.Refresh()
|
||||
End If
|
||||
Next
|
||||
Finally
|
||||
If imagePdf IsNot Nothing Then imagePdf.Dispose()
|
||||
@@ -863,6 +881,12 @@ Public Class usrCntlATLAS_EXGestellung
|
||||
Next
|
||||
|
||||
Console.WriteLine("FERTIG | MRNs gesamt: " & results.Count)
|
||||
|
||||
If lblProgress IsNot Nothing Then
|
||||
lblProgress.Text = $"Fertig: {results.Count} MRNs"
|
||||
lblProgress.Refresh()
|
||||
End If
|
||||
|
||||
Return results
|
||||
End Function
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user