Zooflow: Add workfile model

This commit is contained in:
Jonathan Jenne 2021-12-14 11:13:58 +01:00
parent a7ec95cb19
commit 2436fd296f
7 changed files with 72 additions and 48 deletions

View File

@ -42,5 +42,13 @@
Public Const WM_WINDOWPOSCHANGING As Integer = &H46
Class DropType
Public Const DROP_TYPE_FILESYSTEM = "|DROPFROMFSYSTEM|"
Public Const DROP_TYPE_MESSAGE = "|OUTLOOK_MESSAGE|"
Public Const DROP_TYPE_ATTACHMENT = "|OUTLOOK_ATTACHMENT|"
Public Const DROP_TYPE_MESSAGE_ATTACHMENT = "|ATTMNTEXTRACTED|"
Public Const DROP_TYPE_FOLDERWATCH_MESSAGE = "|FW_MSGONLY|"
Public Const DROP_TYPE_FOLDERWATCH_FILE = "|FW_SIMPLEINDEXER|"
End Class
End Class

View File

@ -0,0 +1,12 @@
Namespace Globix.Models
Public Class WorkFile
Public FilePath As String
Public Id As Integer
Public IsAttachment As Boolean = False
Public Overrides Function ToString() As String
Return FilePath
End Function
End Class
End Namespace

View File

@ -3,39 +3,41 @@
Namespace Globix
Public Class State
Public Property DT_FUNCTION_REGEX As DataTable
Public Property DTACTUAL_FILES As DataTable
Public Property DTTBGI_REGEX_DOCTYPE As DataTable
Public Property REGEX_CLEAN_FILENAME As String = "[?*^""<>|]"
Public Property TEMP_FILES As List(Of String) = New List(Of String)
Public Property CurrMessageID As String
Public Property CURRENT_FILENAME As String
'Public Property CURRENT_FILENAME As String
Public Property CurrentFolderWatchPath As String
Public Property CURRENT_SCAN_FOLDERWATCH As String
Public Property CURRENT_WORKFILE_GUID As Long
Public Property CURRENT_WORKFILE As String
Public Property CURRENT_WORKFILE_EXTENSION As String
Public Property CURRENT_NEWFILENAME As String
Public Property CURRENT_MESSAGEDATE As String
'Public Property CURRENT_WORKFILE_GUID As Long
'Public Property CURRENT_WORKFILE As String
Public Property CurrentWorkfile As Globix.Models.WorkFile
Public Property CURRENT_MESSAGESUBJECT As String
Public Property CURRENT_IDB_OBJ_ID As Long
Public Property INDEXING_ACTIVE As Boolean = False
Public Property ABORT_INDEXING As Boolean = False
Public Property CURRENT_ISATTACHMENT As Boolean = False
Public Property DeleteOriginalFile As Boolean = False
Public Property CURRENT_LASTDOCTYPE As String
Public Property CURRENT_DOCTYPE_ID As Int16
Public Property CURRENT_DOCTYPE_DuplicateHandling As String
Public Property MULTIINDEXING_ACTIVE As Boolean = False
Public Property CURRENT_PROFILE_LOG_INDEX As String
Public Property CURR_DT_MAN_INDEXE As DataTable
Public Property CURR_DT_AUTO_INDEXE As DataTable
Public Property CURR_DT_DOCTYPE As DataTable
Public Property CURR_INDEX_MAN_POSTPROCESSING As DataTable
Public Property FILE_DELIMITER As String
Public Property VERSION_DELIMITER As String
Public Property CURRENT_MESSAGEID As String
'Public Property DT_FUNCTION_REGEX As DataTable
'Public Property DTTBGI_REGEX_DOCTYPE As DataTable
'Public Property REGEX_CLEAN_FILENAME As String = "[?*^""<>|]"
'Public Property CURRENT_DOCTYPE_ID As Int16
'Public Property CURRENT_WORKFILE_EXTENSION As String
'Public Property CURRENT_NEWFILENAME As String
'Public Property CURRENT_MESSAGEDATE As String
'Public Property CURRENT_MESSAGESUBJECT As String
'Public Property CURRENT_DOCTYPE_DuplicateHandling As String
'Public Property CURR_DT_MAN_INDEXE As DataTable
'Public Property CURR_DT_AUTO_INDEXE As DataTable
'Public Property CURR_DT_DOCTYPE As DataTable
'Public Property CURR_INDEX_MAN_POSTPROCESSING As DataTable
'Public Property FILE_DELIMITER As String
'Public Property VERSION_DELIMITER As String
'Public Property CURRENT_MESSAGEID As String
Public Property Folderwatchstarted As Boolean = False
Public Property DTEXCLUDE_FILES As DataTable
Public Property PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml")

View File

@ -76,7 +76,8 @@ Public Class frmGlobix_Index
Try
My.Application.Globix.CURRENT_ISATTACHMENT = False
DropType = My.DatabaseECM.GetScalarValue("SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID).ToString
Dim oSql = $"SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CurrentWorkfile.Id}"
DropType = My.DatabaseECM.GetScalarValue(oSql)
My.Application.Globix.DeleteOriginalFile = My.UIConfig.Globix.DeleteOriginalFile
SplitContainerControl1.SplitterPosition = My.UIConfig.Globix.SplitterDistanceViewer
@ -86,7 +87,7 @@ Public Class frmGlobix_Index
DocumentViewer1.Init(LogConfig, My.Application.Settings.GdPictureKey)
If DropType Is Nothing Then
Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CURRENT_WORKFILE_GUID)
Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CurrentWorkfile.Id)
CancelAttempts = MAX_CANCEL_ATTEMPTS
Close()
Exit Sub
@ -95,14 +96,14 @@ Public Class frmGlobix_Index
SetDropType(DropType)
labelFilePath.Caption = My.Application.Globix.CURRENT_WORKFILE
labelFilePath.Caption = My.Application.Globix.CurrentWorkfile.FilePath
WindowLocation.LoadFormLocationSize(Me)
SetFilePreview(My.UIConfig.Globix.FilePreview)
MultifileCount = My.DatabaseECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
MultifileCount = My.DatabaseECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CurrentWorkfile.Id & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
My.Application.Globix.MULTIINDEXING_ACTIVE = False
If MultifileCount > 0 Then
@ -158,10 +159,10 @@ Public Class frmGlobix_Index
End If
Else
Dim oSQL As String = "SELECT DISTINCT T1.DOCTYPE as DocType, T.* FROM TBGI_REGEX_DOCTYPE T, VWGI_DOCTYPE T1 WHERE T.DOCTYPE_ID = T1.DOCTYPE_ID"
My.Application.Globix.DTTBGI_REGEX_DOCTYPE = Database.GetDatatable("DTTBGI_REGEX_DOCTYPE", oSQL, ECM)
Dim oRegexDoctypeTable = Database.GetDatatable("DTTBGI_REGEX_DOCTYPE", oSQL, ECM)
For Each oRoW As DataRow In My.Application.Globix.DTTBGI_REGEX_DOCTYPE.Rows
Dim oOnlyFilename = Path.GetFileName(My.Application.Globix.CURRENT_WORKFILE)
For Each oRoW As DataRow In oRegexDoctypeTable.Rows
Dim oOnlyFilename = Path.GetFileName(My.Application.Globix.CurrentWorkfile.FilePath)
If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then
Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE"))
@ -187,7 +188,7 @@ Public Class frmGlobix_Index
Public Sub SetDropType(pDropType As String)
If pDropType Is Nothing Then
Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CURRENT_WORKFILE_GUID)
Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CurrentWorkfile.Id)
CancelAttempts = MAX_CANCEL_ATTEMPTS
Close()
Else
@ -264,7 +265,7 @@ Public Class frmGlobix_Index
End Sub
Sub PreviewFile()
Try
DocumentViewer1.LoadFile(My.Application.Globix.CURRENT_WORKFILE)
DocumentViewer1.LoadFile(My.Application.Globix.CurrentWorkfile.FilePath)
Catch ex As Exception
Logger.Error(ex)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler in PreviewFile:")
@ -280,7 +281,7 @@ Public Class frmGlobix_Index
End Sub
Private Sub SkipItem_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SkipItem.ItemClick
My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CURRENT_WORKFILE_GUID}")
My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CurrentWorkfile.Id}")
CancelAttempts = MAX_CANCEL_ATTEMPTS
Close()
End Sub
@ -442,7 +443,7 @@ Public Class frmGlobix_Index
'If oDefaultValue Is Nothing Then
' 'oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CURRENT_WORKFILE)
'End If
Dim oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CURRENT_WORKFILE)
Dim oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CurrentWorkfile.FilePath)
Dim oControl As Control = Nothing
Dim oHasSqlCommand = (oSQLSuggestion = True And oIndex.SQLCommand.Length > 0)
@ -651,7 +652,7 @@ Public Class frmGlobix_Index
End Sub
Private Sub frmGlobix_Index_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
If File.Exists(My.Application.Globix.CURRENT_FILENAME) Then
If File.Exists(My.Application.Globix.CurrentWorkfile.FilePath) Then
Select Case CancelAttempts
Case 0
If My.Application.User.Language = "de-DE" Then
@ -760,16 +761,16 @@ Public Class frmGlobix_Index
Dim oValues = oValidator.GetControlValues(pnlIndex)
Dim oFileName As String = My.Application.Globix.CURRENT_WORKFILE
Dim oFilePath As String = My.Application.Globix.CurrentWorkfile.FilePath
Dim oObjectStore As String = "WORK"
Dim oObjectKind As String = "DOC"
Dim oBusinessEntity As String = "DEFAULT"
Dim oProfileId As Integer = My.Application.Globix.CURRENT_DOCTYPE_ID
Dim oProfileId As Integer = SelectedDocType.Guid
Dim oAttributes As List(Of UserAttributeValue) = oValues
Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions
Await My.Application.Service.Client.ImportFileAsync(
oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions)
oFilePath, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions)
MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text)

View File

@ -31,11 +31,6 @@ Module ModuleHelpers
End Function
Public Sub NNRefresh_RegexTable()
Dim oSQL = "select * from TBGI_FUNCTION_REGEX"
My.Application.Globix.DT_FUNCTION_REGEX = clsDataASorDB.GetDatatable("DD_ECM", oSQL, "TBGI_FUNCTION_REGEX", "", "")
End Sub
Public Function GetConnectionString(id As Integer)
Dim connectionString As String = ""
Try

View File

@ -246,6 +246,7 @@
</Compile>
<Compile Include="Globix\Models\DocumentType.vb" />
<Compile Include="Globix\Models\ManualIndex.vb" />
<Compile Include="Globix\Models\WorkFile.vb" />
<Compile Include="modCurrent.vb" />
<Compile Include="MyDataset.Designer.vb">
<AutoGen>True</AutoGen>

View File

@ -531,12 +531,15 @@ Public Class frmFlowForm
End If
For Each oFileRow As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows
Dim filestring As String = oFileRow.Item("FILENAME2WORK").ToString
My.Application.Globix.CURRENT_FILENAME = oFileRow.Item("FILENAME2WORK").ToString
My.Application.Globix.CURRENT_WORKFILE_GUID = oFileRow.Item(0)
My.Application.Globix.CURRENT_WORKFILE = oFileRow.Item("FILENAME2WORK").ToString
Logger.Info(" CURRENT_WORKFILE: " & My.Application.Globix.CURRENT_WORKFILE)
If IO.File.Exists(My.Application.Globix.CURRENT_WORKFILE) = True And My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then
Dim oFilePath As String = oFileRow.Item("FILENAME2WORK").ToString
My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With {
.Id = oFileRow.Item(0),
.FilePath = oFilePath
}
Logger.Info(" CURRENT_WORKFILE: {0}", My.Application.Globix.CurrentWorkfile)
If IO.File.Exists(My.Application.Globix.CurrentWorkfile.FilePath) = True And My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then
Globix_Open_IndexDialog()
End If
Next
@ -717,9 +720,11 @@ Public Class frmFlowForm
Dim fileexists As Boolean = System.IO.File.Exists(FileForWork)
If fileInUse = False Then
If fileexists = True Then
My.Application.Globix.CURRENT_WORKFILE = FileForWork
My.Application.Globix.CURRENT_FILENAME = FileForWork
My.Application.Globix.CURRENT_WORKFILE_GUID = DirectCast(row.Item("GUID"), Integer)
My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With {
.Id = DirectCast(row.Item("GUID"), Integer),
.FilePath = FileForWork
}
Globix_Open_IndexDialog()
Else
Logger.Info(" File not existing - Row will be deleted!")