Update 20211218
This commit is contained in:
Binary file not shown.
@@ -261,30 +261,33 @@ Public Class Service1
|
|||||||
'''<param name="e"></param>
|
'''<param name="e"></param>
|
||||||
Private Sub OnFileEvent(ByVal source As Object, ByVal e As FileSystemEventArgs)
|
Private Sub OnFileEvent(ByVal source As Object, ByVal e As FileSystemEventArgs)
|
||||||
If EventStopped = True Then Exit Sub
|
If EventStopped = True Then Exit Sub
|
||||||
|
|
||||||
|
|
||||||
If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".IND" Or UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".XML" Then
|
If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".IND" Or UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".XML" Then
|
||||||
FileWatch.EnableRaisingEvents = False
|
FileWatch.EnableRaisingEvents = False
|
||||||
EventStopped = True
|
EventStopped = True
|
||||||
If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".XML" Then
|
PrintTempJournal("Fileevent raised: " + e.FullPath)
|
||||||
IntSleep(1)
|
'IntSleep(Params.WaitAfterFileevent)
|
||||||
Rename(e.FullPath, e.FullPath + ".ind")
|
'If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".XML" Then
|
||||||
End If
|
' IntSleep(Params.Wait_before_xmlind_ren)
|
||||||
|
' Rename(e.FullPath, e.FullPath + ".ind")
|
||||||
|
' PrintTempJournal("Fileevent Rename XML: " + e.FullPath + " -> " + e.FullPath + ".ind")
|
||||||
|
'End If
|
||||||
PrintOut("Neue Datei " + e.FullPath)
|
PrintOut("Neue Datei " + e.FullPath)
|
||||||
'ServiceIcon.Text = "Working..."
|
|
||||||
Verarbeiten()
|
Verarbeiten()
|
||||||
' ServiceThread = New Thread(AddressOf Verarbeiten)
|
|
||||||
' ServiceThread.Start()
|
|
||||||
FileWatch.EnableRaisingEvents = True
|
FileWatch.EnableRaisingEvents = True
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub OnFileEventRename(ByVal source As Object, ByVal e As RenamedEventArgs)
|
Private Sub OnFileEventRename(ByVal source As Object, ByVal e As RenamedEventArgs)
|
||||||
|
If Params.UseFileEventRename = False Then Exit Sub
|
||||||
If EventStopped = True Then Exit Sub
|
If EventStopped = True Then Exit Sub
|
||||||
If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".IND" Then
|
If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".IND" Then
|
||||||
FileWatch.EnableRaisingEvents = False
|
FileWatch.EnableRaisingEvents = False
|
||||||
EventStopped = True
|
EventStopped = True
|
||||||
PrintOut("Neue Datei " + e.FullPath)
|
PrintOut("Neue Datei " + e.FullPath)
|
||||||
'20130131 - Sleep von 1000 auf 3000 geändert, damit bei FinFox-Dokumente die Verarbeitung nicht aussteigt, sofern die Datei noch nicht angeliefert wurde
|
'20130131 - Sleep von 1000 auf 3000 geändert, damit bei FinFox-Dokumente die Verarbeitung nicht aussteigt, sofern die Datei noch nicht angeliefert wurde
|
||||||
Threading.Thread.CurrentThread.Sleep(3000)
|
IntSleep(3)
|
||||||
Verarbeiten()
|
Verarbeiten()
|
||||||
FileWatch.EnableRaisingEvents = True
|
FileWatch.EnableRaisingEvents = True
|
||||||
End If
|
End If
|
||||||
@@ -312,13 +315,6 @@ Public Class Service1
|
|||||||
Private Function CompareFileInfos(file1 As FileInfo, file2 As FileInfo) As Integer
|
Private Function CompareFileInfos(file1 As FileInfo, file2 As FileInfo) As Integer
|
||||||
Dim result = 0
|
Dim result = 0
|
||||||
|
|
||||||
'Select Case nameDirection
|
|
||||||
' Case SortOrder.Ascending
|
|
||||||
' result = file1.Name.CompareTo(file2.Name)
|
|
||||||
' Case SortOrder.Descending
|
|
||||||
' result = file2.Name.CompareTo(file1.Name)
|
|
||||||
'End Select
|
|
||||||
|
|
||||||
If result = 0 Then
|
If result = 0 Then
|
||||||
Select Case dateDirection
|
Select Case dateDirection
|
||||||
Case SortOrder.Ascending
|
Case SortOrder.Ascending
|
||||||
@@ -331,26 +327,32 @@ Public Class Service1
|
|||||||
Return result
|
Return result
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Sub PrintTempJournal(s As String)
|
||||||
|
If Params.Logpath = "" Then Exit Sub
|
||||||
|
FileOpen(14, Params.Logpath, OpenMode.Append)
|
||||||
|
WriteLine(14, Now.ToString("yyyy-MM-dd hh:mm:ss:hs") + " " + s)
|
||||||
|
FileClose(14)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Private Sub Verarbeiten()
|
Private Sub Verarbeiten()
|
||||||
Dim gsffilename As String = ""
|
Dim gsffilename As String = ""
|
||||||
Try
|
Try
|
||||||
Printout("Bei Verarbeiten() zuerst 5000ms warten", EventLogEntryType.Information)
|
'Printout("Bei Verarbeiten() zuerst 5000ms warten", EventLogEntryType.Information)
|
||||||
IntSleep(5)
|
PrintTempJournal("Verarbeitung Wait before start " + Params.WaitBeforeProcess.ToString + " Sekunden")
|
||||||
'Thread.Sleep(5000) 'hallo, wieder aktivieren
|
IntSleep(Params.WaitBeforeProcess)
|
||||||
|
|
||||||
'Dim bmp As New Bitmap(Me.ImageList1.Images(0))
|
|
||||||
'ServiceIcon.Icon = Icon.FromHandle(bmp.GetHicon())
|
|
||||||
Dim looper As Boolean = True
|
Dim looper As Boolean = True
|
||||||
While looper = True
|
While looper = True
|
||||||
'Alle .IND-Dateien im Verzeichnis auslesen
|
'Alle .IND-Dateien im Verzeichnis auslesen
|
||||||
|
PrintTempJournal("Read Directory .ind")
|
||||||
Dim clsindex As New clsIndexData()
|
Dim clsindex As New clsIndexData()
|
||||||
Dim di As New IO.DirectoryInfo(Watch_Directory)
|
Dim di As New IO.DirectoryInfo(Watch_Directory)
|
||||||
IntSleep(2)
|
IntSleep(Params.Wait_before_readdir)
|
||||||
Dim diar1 As IO.FileInfo() = di.GetFiles("*.ind")
|
Dim diar1 As IO.FileInfo() = di.GetFiles("*.ind")
|
||||||
Dim dra As IO.FileInfo
|
Dim dra As IO.FileInfo
|
||||||
Array.Sort(diar1, AddressOf CompareFileInfos)
|
Array.Sort(diar1, AddressOf CompareFileInfos)
|
||||||
If diar1.Length = 0 Then
|
If diar1.Length = 0 Then
|
||||||
|
PrintTempJournal("Read Directory .xml")
|
||||||
diar1 = di.GetFiles("*.xml")
|
diar1 = di.GetFiles("*.xml")
|
||||||
Array.Sort(diar1, AddressOf CompareFileInfos)
|
Array.Sort(diar1, AddressOf CompareFileInfos)
|
||||||
If diar1.Length = 0 Then
|
If diar1.Length = 0 Then
|
||||||
@@ -358,11 +360,8 @@ Public Class Service1
|
|||||||
clsindex = Nothing
|
clsindex = Nothing
|
||||||
di = Nothing
|
di = Nothing
|
||||||
diar1 = Nothing
|
diar1 = Nothing
|
||||||
'Globals.Journal.Delete_Entry()
|
|
||||||
'Dim bmp1 As New Bitmap(Me.ImageList1.Images(1))
|
|
||||||
'ServiceIcon.Icon = Icon.FromHandle(bmp1.GetHicon())
|
|
||||||
'ServiceIcon.Text = "Waiting..."
|
|
||||||
EventStopped = False
|
EventStopped = False
|
||||||
|
PrintTempJournal("----------------------------------------------")
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -370,18 +369,22 @@ Public Class Service1
|
|||||||
For Each dra In diar1
|
For Each dra In diar1
|
||||||
Dim fullname As String = ""
|
Dim fullname As String = ""
|
||||||
Globals.Fehlermeldung = ""
|
Globals.Fehlermeldung = ""
|
||||||
|
IntSleep(Params.Wait_Before_Fileprocess)
|
||||||
|
PrintTempJournal("Verarbeitung " + dra.FullName)
|
||||||
fullname = dra.FullName
|
fullname = dra.FullName
|
||||||
If UCase(System.IO.Path.GetExtension(dra.Name)) = ".XML" Then
|
If UCase(System.IO.Path.GetExtension(dra.Name)) = ".XML" Then
|
||||||
|
PrintTempJournal(" Rename " + dra.FullName + " -> " + dra.FullName + ".ind")
|
||||||
|
IntSleep(Params.Wait_before_xmlind_ren)
|
||||||
Rename(dra.FullName, dra.FullName + ".ind")
|
Rename(dra.FullName, dra.FullName + ".ind")
|
||||||
fullname = dra.FullName + ".ind"
|
fullname = dra.FullName + ".ind"
|
||||||
'IntSleep(1)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
gsffilename = dra.Name.Substring(0, dra.Name.IndexOf("."))
|
gsffilename = dra.Name.Substring(0, dra.Name.IndexOf("."))
|
||||||
|
PrintTempJournal(" Journal " + fullname)
|
||||||
PrintOut("File: " + fullname)
|
PrintOut("File: " + fullname)
|
||||||
Globals.Journal.Open_Journal()
|
Globals.Journal.Open_Journal()
|
||||||
Globals.Journal.Insert_Journal("", "", "", fullname, "", "Start der Verarbeitung", "", "")
|
Globals.Journal.Insert_Journal("", "", "", fullname, "", "Start der Verarbeitung", "", "")
|
||||||
|
|
||||||
DivFnkt.Save_Indexdata(Journal.JournalNr, fullname)
|
DivFnkt.Save_Indexdata(Journal.JournalNr, fullname)
|
||||||
clsindex.IndexFileName = fullname
|
clsindex.IndexFileName = fullname
|
||||||
If clsindex.getindexdata Then
|
If clsindex.getindexdata Then
|
||||||
@@ -393,20 +396,16 @@ Public Class Service1
|
|||||||
Journal.Insert_Journal("", "", "", fullname, "16", "Zuordnung zur Herkunftsapplikation fehlt.", "", "")
|
Journal.Insert_Journal("", "", "", fullname, "16", "Zuordnung zur Herkunftsapplikation fehlt.", "", "")
|
||||||
Else
|
Else
|
||||||
If check_and_import.Herkunftsapplikationen_auslesen Then
|
If check_and_import.Herkunftsapplikationen_auslesen Then
|
||||||
'Sofern die Herkunftsapplikation erruiert werden konnte, wird die Journaltabelle mit der Applikationsid nachgeführt
|
|
||||||
Globals.Journal.Update_Journal()
|
Globals.Journal.Update_Journal()
|
||||||
'PrintOut("test", EventLogEntryType.Error)
|
|
||||||
'Verarbeitung der Daten
|
|
||||||
check_and_import.CheckandImport()
|
check_and_import.CheckandImport()
|
||||||
check_and_import = Nothing
|
check_and_import = Nothing
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Journal.Insert_Journal("", "", "", fullname, "", "Total Index-Datensätze: " + LTrim(Str(indexdata.Rows.Count)), "", "")
|
Journal.Insert_Journal("", "", "", fullname, "", "Total Index-Datensätze: " + LTrim(Str(indexdata.Rows.Count)), "", "")
|
||||||
Journal.Insert_Journal("", "", "", fullname, "", "Verarbeitung abgeschlossen.", "", "")
|
Journal.Insert_Journal("", "", "", fullname, "", "Verarbeitung abgeschlossen.", "", "")
|
||||||
Try
|
Try
|
||||||
'20200509_Keine Logdatei erstellen
|
|
||||||
'Logdatei_Erstellen()
|
|
||||||
Catch
|
Catch
|
||||||
End Try
|
End Try
|
||||||
Try
|
Try
|
||||||
@@ -432,8 +431,8 @@ Public Class Service1
|
|||||||
IntSleep(3)
|
IntSleep(3)
|
||||||
End If
|
End If
|
||||||
PrintOut("Ende File: " + fullname)
|
PrintOut("Ende File: " + fullname)
|
||||||
|
PrintTempJournal(" Abschluss " + fullname)
|
||||||
IntSleep(5)
|
IntSleep(Params.wait_After_Fileprocess)
|
||||||
If Fehler <> 0 Then
|
If Fehler <> 0 Then
|
||||||
send_error_mail()
|
send_error_mail()
|
||||||
End If
|
End If
|
||||||
@@ -467,6 +466,7 @@ Public Class Service1
|
|||||||
End While
|
End While
|
||||||
FileWatch.EnableRaisingEvents = True
|
FileWatch.EnableRaisingEvents = True
|
||||||
EventStopped = False
|
EventStopped = False
|
||||||
|
PrintTempJournal("----------------------------------------------")
|
||||||
Exit Sub
|
Exit Sub
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Try
|
Try
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -13,4 +13,12 @@ GSF_Conf_Dateiendung =xml
|
|||||||
Directorytimer =10
|
Directorytimer =10
|
||||||
Directorys =E:\Software-Projekte\EDOKA\batch\EDKB08\EDKB08\bin\DirectoriesToScan.txt
|
Directorys =E:\Software-Projekte\EDOKA\batch\EDKB08\EDKB08\bin\DirectoriesToScan.txt
|
||||||
IndexSicherung =k:\edoka\edkb08\indsik\
|
IndexSicherung =k:\edoka\edkb08\indsik\
|
||||||
|
TempLogFile =K:\EDOKA\EDKB08\Log\log.txt
|
||||||
|
Use FileEvent Rename =False
|
||||||
|
Wait_after_fileevent =3
|
||||||
|
Wait_before_process =5
|
||||||
|
Wait_before_xmlind_ren =1
|
||||||
|
Wait_before_readdir =2
|
||||||
|
Wait_before_fileproc =2
|
||||||
|
Wait_after_fileproc =2
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,86 @@ Public Class ClsParameters
|
|||||||
m_sikind = value
|
m_sikind = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Dim m_logpath As String = ""
|
||||||
|
Property Logpath As String
|
||||||
|
Get
|
||||||
|
Return m_logpath
|
||||||
|
End Get
|
||||||
|
Set(value As String)
|
||||||
|
m_logpath = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_useFileEventRename As Boolean = False
|
||||||
|
Property UseFileEventRename As Boolean
|
||||||
|
Get
|
||||||
|
Return m_useFileEventRename
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
m_useFileEventRename = value = "True"
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_waitafterfileevent As Integer
|
||||||
|
Property WaitAfterFileevent As Integer
|
||||||
|
Get
|
||||||
|
Return m_waitafterfileevent
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_waitafterfileevent = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_waitbeforeprocess As Integer
|
||||||
|
Property WaitBeforeProcess As Integer
|
||||||
|
Get
|
||||||
|
Return m_waitbeforeprocess
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_waitbeforeprocess = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_Wait_before_xmlind_ren As Int16
|
||||||
|
Property Wait_before_xmlind_ren As Integer
|
||||||
|
Get
|
||||||
|
Return m_Wait_before_xmlind_ren
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_Wait_before_xmlind_ren = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_Wait_before_readdir As Integer
|
||||||
|
Property Wait_before_readdir As Integer
|
||||||
|
Get
|
||||||
|
Return m_Wait_before_readdir
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_Wait_before_readdir = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_wait_before_fileproc As Integer
|
||||||
|
Property Wait_Before_Fileprocess As Integer
|
||||||
|
Get
|
||||||
|
Return m_wait_before_fileproc
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_wait_before_fileproc = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Dim m_wait_afger_fileproc As Integer
|
||||||
|
Property wait_After_Fileprocess As Integer
|
||||||
|
Get
|
||||||
|
Return m_wait_afger_fileproc
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
m_wait_afger_fileproc = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
'''<summary>Laden der Parameterdaten aus parameters.cfg</summary>
|
'''<summary>Laden der Parameterdaten aus parameters.cfg</summary>
|
||||||
@@ -225,6 +305,13 @@ Public Class ClsParameters
|
|||||||
Me.DirectoryTimer_Intervall = ParamValue(oread.ReadLine) * 60 * 1000
|
Me.DirectoryTimer_Intervall = ParamValue(oread.ReadLine) * 60 * 1000
|
||||||
Me.Directoryscanner = ParamValue(oread.ReadLine)
|
Me.Directoryscanner = ParamValue(oread.ReadLine)
|
||||||
Me.sikind = ParamValue(oread.ReadLine)
|
Me.sikind = ParamValue(oread.ReadLine)
|
||||||
|
Me.Logpath = ParamValue(oread.ReadLine)
|
||||||
|
Me.UseFileEventRename = ParamValue(oread.ReadLine)
|
||||||
|
Me.WaitAfterFileevent = ParamValue(oread.ReadLine)
|
||||||
|
Me.WaitBeforeProcess = ParamValue(oread.ReadLine)
|
||||||
|
Me.Wait_before_xmlind_ren = ParamValue(oread.ReadLine)
|
||||||
|
Me.Wait_Before_Fileprocess = ParamValue(oread.ReadLine)
|
||||||
|
Me.wait_After_Fileprocess = ParamValue(oread.ReadLine)
|
||||||
oread.Close()
|
oread.Close()
|
||||||
Me.Meldung = "Parameter auslesen i.O."
|
Me.Meldung = "Parameter auslesen i.O."
|
||||||
Return True
|
Return True
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user