Bugfixing und Verbesserungen NodeBNavigation

This commit is contained in:
Developer01
2025-09-10 15:28:57 +02:00
parent e62741c0ac
commit 0d64b5e887
10 changed files with 592 additions and 491 deletions

View File

@@ -14,4 +14,6 @@ Public Class ClassConfig
Public Property TreeListSplitterWidth As Integer = 0
Public Property DocumentSearchSplitterWidth As Integer = 0
Public Property DocumentViewerShown As Boolean = True
End Class

View File

@@ -92,7 +92,34 @@ Public Class ClassDocGrid
Dim oSelectedRows As List(Of Integer) = pGridView.GetSelectedRows().ToList()
Return oSelectedRows.Count = 0
End Function
Public Shared Function GetSingleSelectedDocument(pGridView As GridView) As List(Of clsWMDoc)
If pGridView.RowCount = 0 Then
Return Nothing
End If
Dim oDocuments As New List(Of clsWMDoc)
Dim oDocId = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "DocID")
Dim oSQL = $"Select dwParentID FROM TBPMO_DOCRESULT_LIST where DocID = {oDocId}"
Dim odwParentID = MYDB_ECM.GetScalarValue(oSQL)
Dim oDisplayName = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "Displayname")
Dim oDocPath = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "FULLPATH")
Dim oObjecttype = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "OBJECTTYPE")
Dim oFilename = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "Dateiname")
Dim oInWork = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "in work?")
Dim oInWorkUser = pGridView.GetRowCellValue(pGridView.FocusedRowHandle, "in work User")
oDocuments.Add(New clsWMDoc With {
.DocId = oDocId,
.ParentID = odwParentID,
.DocPath = oDocPath,
.DocType = oObjecttype,
.DisplayName = oDisplayName,
.Filename = oFilename,
.InWork = oInWork,
.InWorkUser = oInWorkUser
})
Return oDocuments
End Function
Public Shared Function GetSelectedDocuments(pGridView As GridView, Optional pGetFirst As Boolean = False) As List(Of clsWMDoc)
Dim oSelectedRows As List(Of Integer)
If pGridView.RowCount = 0 Then
@@ -134,7 +161,6 @@ Public Class ClassDocGrid
Public Shared Sub GetDocItems(gridView As GridView)
_Helper = New ClassHelper
SELECTED_DOC_ID = 0
If Init_Table() = True Then
Console.WriteLine("gridView.SelectedRowsCount: " & gridView.SelectedRowsCount.ToString)
gridView.EndSelection()
@@ -143,31 +169,12 @@ Public Class ClassDocGrid
DT_RESULTFILES.Clear()
For Each row In gridView.GetSelectedRows
Dim newRow As DataRow = DT_RESULTFILES.NewRow()
Try
Dim DOC_ID = gridView.GetRowCellValue(row, "DocID")
Dim CHeckDT As DataTable = ClassHelper.FILTER_DATATABLE(CURRENT_DT_TBPMO_DOC_RECORD_LINK, "DOC_ID = " + DOC_ID.ToString, "")
If CHeckDT.Rows.Count = 1 Then
SELECTED_DOC_ID = DOC_ID
newRow("DOC_ID") = gridView.GetRowCellValue(row, "DocID")
Else
If Not IsNothing(DOC_ID) Then
SELECTED_DOC_ID = DOC_ID
Else
Continue For
End If
End If
Catch ex As Exception
newRow("DOC_ID") = 0
SELECTED_DOC_ID = 0
End Try
Dim oDocID = gridView.GetRowCellValue(row, "DocID")
Dim CHeckDT As DataTable = ClassHelper.FILTER_DATATABLE(CURRENT_DT_TBPMO_DOC_RECORD_LINK, "DOC_ID = " + oDocID.ToString, "")
Try
newRow("INWORK") = False
SELECTED_INWORK = False
Dim oSQL = "Select IN_WORK,IN_WORK_USER FROM TBPMO_DOCRESULT_LIST where DocID = " + SELECTED_DOC_ID
Dim oSQL = "Select IN_WORK,IN_WORK_USER FROM TBPMO_DOCRESULT_LIST where DocID = " + oDocID
Dim oDT As DataTable = MYDB_ECM.GetDatatable(oSQL)
If Not IsNothing(oDT) Then
If oDT.Rows.Count = 1 Then
@@ -258,7 +265,7 @@ Public Class ClassDocGrid
End If
End Sub
Public Shared Sub FillColumns(gridView As GridView,
Public Shared Sub FillColumns(pDocGridView As GridView,
DT_RESULT As DataTable, DT_WINDREAM_RESULTLIST As DataTable, DT_DOCRESULT_DROPDOWN_ITEMS As DataTable,
DropdownValueChangedHandler As EventHandler, DatepickerValueChangedHandler As EventHandler, TextValueChangedHandler As EventHandler, CheckValueChangedHandler As EventHandler,
SearchType As String, RECORD_ID As Integer)
@@ -315,39 +322,46 @@ Public Class ClassDocGrid
End Select
'"FROM TBPMO_DOC_VALUES T INNER JOIN TBPMO_DOCSEARCH_RESULTLIST_CONFIG T1 ON T.CONFIG_ID = T1.GUID WHERE T1.ENTITY_ID = {0} AND T1.LANGUAGE = '{1}' AND T.RECORD_ID = {2} ORDER BY T.DocID, T1.SEQUENCE", CURRENT_ENTITY_ID, USER_LANGUAGE, RECORD_ID)
Dim DT_DETAILS As DataTable = MYDB_ECM.GetDatatable(DT_DETAILS_SQL)
Dim docId As Integer
Dim configId As Integer
Dim DT_DETAIL_VALUES As DataTable = MYDB_ECM.GetDatatable(DT_DETAILS_SQL)
Dim oDocID As Integer
Dim oConfigID As Integer
Dim recordId As Integer
Try
' Werte für Konfigurierte Spalten aus TBPMO_DOC_VALUES auslesen und Zellenweise einfügen
For Each row As DataRow In DT_RESULT.Rows
For Each oRow As DataRow In DT_RESULT.Rows
For Each col As DataColumn In DT_RESULT.Columns
Dim colName As String = col.ColumnName
docId = row.Item("DocID")
configId = RESULT_CONFIG_IDS.Item(col.ColumnName)
oDocID = oRow.Item("DocID")
oConfigID = RESULT_CONFIG_IDS.Item(col.ColumnName)
If configId <> 0 Then
If oConfigID <> 0 Then
Dim value As String = ""
Try
value = MYDB_ECM.GetScalarValue(String.Format("SELECT VALUE FROM TBPMO_DOC_VALUES WHERE CONFIG_ID = {0} AND DocID = {1} AND RECORD_ID = {2}", configId, docId, RECORD_ID))
Dim oFilter = $"DocID = {oDocID} AND CONFIG_ID = {oConfigID}"
Dim oFlteredRows() As DataRow = DT_DETAIL_VALUES.Select(oFilter)
If oFlteredRows.Length > 0 Then
value = oFlteredRows(0)("VALUE").ToString()
End If
'value = MYDB_ECM.GetScalarValue(String.Format("SELECT VALUE FROM TBPMO_DOC_VALUES WHERE CONFIG_ID = {0} AND DocID = {1} AND RECORD_ID = {2}", oConfigID, oDocID, RECORD_ID))
Catch ex As Exception
LOGGER.Warn(String.Format("Attention: Could not get Value from TBPMO_DOC_VALUES for ConfigId[{0}], DocId[{1}]: ", configId, docId) & ex.Message)
LOGGER.Warn(String.Format("Attention: Could not get Value from TBPMO_DOC_VALUES for ConfigId[{0}], DocId[{1}]: ", oConfigID, oDocID) & ex.Message)
End Try
row.Item(colName) = value
oRow.Item(colName) = value
End If
Next
Next
Catch ex As Exception
LOGGER.Warn($"Attention: Could not load values from TBPMO_DOC_VALUES: " & ex.Message & vbNewLine & $"SELECT VALUE FROM TBPMO_DOC_VALUES WHERE CONFIG_ID = {configId} AND DocID = {docId} AND RECORD_ID = {RECORD_ID}")
LOGGER.Warn($"Attention: Could not load values from TBPMO_DOC_VALUES: " & ex.Message & vbNewLine & $"SELECT VALUE FROM TBPMO_DOC_VALUES WHERE CONFIG_ID = {oConfigID} AND DocID = {oDocID} AND RECORD_ID = {RECORD_ID}")
End Try
LOGGER.Debug("Values loaded...")
Try
' Tabellen zum DataSet hinzufügen
ds.Tables.Add(DT_RESULT)
ds.Tables.Add(DT_DETAILS)
ds.Tables.Add(DT_DETAIL_VALUES)
LOGGER.Debug("tables added to ds.Tables...")
Catch ex As Exception
LOGGER.Warn("Attention: Could not Add tables to ds.Tables: " & ex.Message)
@@ -375,7 +389,7 @@ Public Class ClassDocGrid
LOGGER.Warn("Could not set master-detail Relation DocSearch: " & ex.Message)
End Try
Dim gridControl As GridControl = gridView.GridControl
Dim gridControl As GridControl = pDocGridView.GridControl
' Datasource auf Master-Tabelle setzen
@@ -384,28 +398,29 @@ Public Class ClassDocGrid
gridControl.ForceInitialize()
' Detail View anlegen und der Relation `docIdDetails` zuweisen
Dim grvwDetail As New GridView(gridControl)
Dim GVDoc_Values As New GridView(gridControl)
'grvwDetail.OptionsBehavior.Editable = False
grvwDetail.OptionsView.ShowGroupPanel = False
grvwDetail.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D
grvwDetail.OptionsView.EnableAppearanceEvenRow = True
grvwDetail.Appearance.EvenRow.BackColor = Color.Orange
grvwDetail.Appearance.HeaderPanel.BackColor = Color.Orange
grvwDetail.Appearance.HeaderPanel.Options.UseBackColor = True
GVDoc_Values.OptionsView.ShowGroupPanel = False
GVDoc_Values.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D
GVDoc_Values.OptionsView.EnableAppearanceEvenRow = True
GVDoc_Values.Appearance.EvenRow.BackColor = Color.Orange
GVDoc_Values.Appearance.HeaderPanel.BackColor = Color.Orange
GVDoc_Values.Appearance.HeaderPanel.Options.UseBackColor = True
gridControl.LevelTree.Nodes.Add("docIdDetails", grvwDetail)
gridControl.LevelTree.Nodes.Add("docIdDetails", GVDoc_Values)
Catch ex As Exception
MsgBox("Error in FillColumns: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
LOGGER.Warn("Attention: Could not load converted datatable DocSearch: " & ex.Message)
End Try
AddHandler gridView.MasterRowExpanded, AddressOf gridView_MasterRowExpanded
AddHandler gridView.CustomColumnDisplayText, AddressOf gridView_CustomColumnDisplayText
AddHandler pDocGridView.MasterRowExpanded, AddressOf gridView_MasterRowExpanded
AddHandler pDocGridView.CustomColumnDisplayText, AddressOf gridView_CustomColumnDisplayText
AddHandler pDocGridView.FocusedRowChanged, AddressOf GVDoc_Values_FocusedRowChanged
For Each row As DataRow In DT_WINDREAM_RESULTLIST.Rows
Dim col As GridColumn = gridView.Columns(row.Item("HEADER_CAPTION"))
Dim col As GridColumn = pDocGridView.Columns(row.Item("HEADER_CAPTION"))
Dim colCaption = row.Item("HEADER_CAPTION")
Dim type As Integer = row.Item("TYPE_ID")
Dim isConfig As Boolean = row.Item("CONFIG_COLUMNS")
@@ -417,12 +432,12 @@ Public Class ClassDocGrid
End If
Next
gridView.Columns.Item("ICON").MaxWidth = 24
gridView.Columns.Item("ICON").MinWidth = 24
gridView.Columns.Item("FULLPATH").Visible = False
gridView.Columns.Item("OBJECTTYPE").Visible = False
pDocGridView.Columns.Item("ICON").MaxWidth = 24
pDocGridView.Columns.Item("ICON").MinWidth = 24
pDocGridView.Columns.Item("FULLPATH").Visible = False
pDocGridView.Columns.Item("OBJECTTYPE").Visible = False
If Not System.IO.File.Exists(LAYOUT_DOC_GRIDVIEW) Then
gridView.Columns.Item("DocID").Visible = False
pDocGridView.Columns.Item("DocID").Visible = False
End If
Dim oCreatedFieldName, oChangedFieldName As String
@@ -434,25 +449,25 @@ Public Class ClassDocGrid
oCreatedFieldName = "Erstellt"
End If
Dim oCreatedColumn = gridView.Columns(oCreatedFieldName)
Dim oCreatedColumn = pDocGridView.Columns(oCreatedFieldName)
If Not IsNothing(oCreatedColumn) Then
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
oCreatedColumn.DisplayFormat.FormatString = CURRENT_DATE_FORMAT & " HH:MM:ss"
End If
Dim oChangedColumn = gridView.Columns(oChangedFieldName)
Dim oChangedColumn = pDocGridView.Columns(oChangedFieldName)
If Not IsNothing(oChangedColumn) Then
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
oChangedColumn.DisplayFormat.FormatString = CURRENT_DATE_FORMAT & " HH:MM:ss"
End If
If GridDocResult_BestFitColumns Then
gridView.OptionsView.BestFitMaxRowCount = -1
gridView.BestFitColumns(True)
pDocGridView.OptionsView.BestFitMaxRowCount = -1
pDocGridView.BestFitColumns(True)
End If
' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt
For Each column As GridColumn In gridView.Columns
For Each column As GridColumn In pDocGridView.Columns
column.OptionsColumn.AllowEdit = False
Next
End Sub
@@ -583,7 +598,16 @@ Public Class ClassDocGrid
End Try
End Sub
Public Shared Sub GVDoc_Values_FocusedRowChanged(sender As GridView, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs)
Try
ClassDocGrid.GetDocItems(sender)
Catch ex As Exception
LOGGER.Warn("Unexpected error in GVDoc_Values_FocusedRowChanged: " & ex.Message)
MsgBox("Unexpected error in GVDoc_Values_FocusedRowChanged: " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Shared Sub gridView_MasterRowExpanded(sender As GridView, e As DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs)
Try
ClassDocGrid.GetDocItems(sender)