Update 20211218

master
Stefan Hutter 4 years ago
parent a8d23de738
commit c910bc7cc9

Binary file not shown.

@ -261,30 +261,33 @@ Public Class Service1
'''<param name="e"></param>
Private Sub OnFileEvent(ByVal source As Object, ByVal e As FileSystemEventArgs)
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
FileWatch.EnableRaisingEvents = False
EventStopped = True
If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".XML" Then
IntSleep(1)
Rename(e.FullPath, e.FullPath + ".ind")
End If
PrintTempJournal("Fileevent raised: " + e.FullPath)
'IntSleep(Params.WaitAfterFileevent)
'If UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".XML" Then
' 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)
'ServiceIcon.Text = "Working..."
Verarbeiten()
' ServiceThread = New Thread(AddressOf Verarbeiten)
' ServiceThread.Start()
FileWatch.EnableRaisingEvents = True
End If
End Sub
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 UCase(Microsoft.VisualBasic.Right(e.FullPath, 4)) = ".IND" Then
FileWatch.EnableRaisingEvents = False
EventStopped = True
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
Threading.Thread.CurrentThread.Sleep(3000)
IntSleep(3)
Verarbeiten()
FileWatch.EnableRaisingEvents = True
End If
@ -312,13 +315,6 @@ Public Class Service1
Private Function CompareFileInfos(file1 As FileInfo, file2 As FileInfo) As Integer
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
Select Case dateDirection
Case SortOrder.Ascending
@ -331,26 +327,32 @@ Public Class Service1
Return result
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()
Dim gsffilename As String = ""
Try
Printout("Bei Verarbeiten() zuerst 5000ms warten", EventLogEntryType.Information)
IntSleep(5)
'Thread.Sleep(5000) 'hallo, wieder aktivieren
'Dim bmp As New Bitmap(Me.ImageList1.Images(0))
'ServiceIcon.Icon = Icon.FromHandle(bmp.GetHicon())
'Printout("Bei Verarbeiten() zuerst 5000ms warten", EventLogEntryType.Information)
PrintTempJournal("Verarbeitung Wait before start " + Params.WaitBeforeProcess.ToString + " Sekunden")
IntSleep(Params.WaitBeforeProcess)
Dim looper As Boolean = True
While looper = True
'Alle .IND-Dateien im Verzeichnis auslesen
PrintTempJournal("Read Directory .ind")
Dim clsindex As New clsIndexData()
Dim di As New IO.DirectoryInfo(Watch_Directory)
IntSleep(2)
IntSleep(Params.Wait_before_readdir)
Dim diar1 As IO.FileInfo() = di.GetFiles("*.ind")
Dim dra As IO.FileInfo
Array.Sort(diar1, AddressOf CompareFileInfos)
If diar1.Length = 0 Then
PrintTempJournal("Read Directory .xml")
diar1 = di.GetFiles("*.xml")
Array.Sort(diar1, AddressOf CompareFileInfos)
If diar1.Length = 0 Then
@ -358,11 +360,8 @@ Public Class Service1
clsindex = Nothing
di = 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
PrintTempJournal("----------------------------------------------")
Exit Sub
End If
End If
@ -370,18 +369,22 @@ Public Class Service1
For Each dra In diar1
Dim fullname As String = ""
Globals.Fehlermeldung = ""
IntSleep(Params.Wait_Before_Fileprocess)
PrintTempJournal("Verarbeitung " + dra.FullName)
fullname = dra.FullName
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")
fullname = dra.FullName + ".ind"
'IntSleep(1)
End If
gsffilename = dra.Name.Substring(0, dra.Name.IndexOf("."))
PrintTempJournal(" Journal " + fullname)
PrintOut("File: " + fullname)
Globals.Journal.Open_Journal()
Globals.Journal.Insert_Journal("", "", "", fullname, "", "Start der Verarbeitung", "", "")
DivFnkt.Save_Indexdata(Journal.JournalNr, fullname)
clsindex.IndexFileName = fullname
If clsindex.getindexdata Then
@ -393,20 +396,16 @@ Public Class Service1
Journal.Insert_Journal("", "", "", fullname, "16", "Zuordnung zur Herkunftsapplikation fehlt.", "", "")
Else
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()
'PrintOut("test", EventLogEntryType.Error)
'Verarbeitung der Daten
check_and_import.CheckandImport()
check_and_import = Nothing
End If
End If
End If
Journal.Insert_Journal("", "", "", fullname, "", "Total Index-Datensätze: " + LTrim(Str(indexdata.Rows.Count)), "", "")
Journal.Insert_Journal("", "", "", fullname, "", "Verarbeitung abgeschlossen.", "", "")
Try
'20200509_Keine Logdatei erstellen
'Logdatei_Erstellen()
Catch
End Try
Try
@ -432,8 +431,8 @@ Public Class Service1
IntSleep(3)
End If
PrintOut("Ende File: " + fullname)
IntSleep(5)
PrintTempJournal(" Abschluss " + fullname)
IntSleep(Params.wait_After_Fileprocess)
If Fehler <> 0 Then
send_error_mail()
End If
@ -467,6 +466,7 @@ Public Class Service1
End While
FileWatch.EnableRaisingEvents = True
EventStopped = False
PrintTempJournal("----------------------------------------------")
Exit Sub
Catch ex As Exception
Try

Binary file not shown.

Binary file not shown.

@ -13,4 +13,12 @@ GSF_Conf_Dateiendung =xml
Directorytimer =10
Directorys =E:\Software-Projekte\EDOKA\batch\EDKB08\EDKB08\bin\DirectoriesToScan.txt
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
End Set
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
'''<summary>Laden der Parameterdaten aus parameters.cfg</summary>
@ -225,6 +305,13 @@ Public Class ClsParameters
Me.DirectoryTimer_Intervall = ParamValue(oread.ReadLine) * 60 * 1000
Me.Directoryscanner = 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()
Me.Meldung = "Parameter auslesen i.O."
Return True

Loading…
Cancel
Save