MS Anpassungen DocType etc

This commit is contained in:
Developer01
2024-09-12 17:05:11 +02:00
parent c15a0ee5a0
commit b5ab9c5e1f
13 changed files with 285 additions and 239 deletions

View File

@@ -15,6 +15,8 @@ Imports DD_LIB_Standards
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.Data.Filtering
Public Class frmNodeNavigation
#Region "Laufzeitvariablen & Konstanten"
@@ -57,7 +59,8 @@ Public Class frmNodeNavigation
Private Property IW_COMMENT As String
Private Property INWORK_FILE As Boolean
Private Property CONTROL_DOCTYPE_MATCH As Integer = 0
Private Property FocusedNode As TreeListNode
Private Property MyFocusedNode As TreeListNode
Private Property oCollapseInAction As Boolean = False
Private Property MyTreeListViewState As ClassTreeListViewState
Private Property AvailableConfigNodes As New List(Of frmNewNode.NodeConfig)
@@ -171,11 +174,6 @@ Public Class frmNodeNavigation
'Die Standards ein/ausblenden
End If
'Dim sql_ResultList = "select T1.ENTITY_ID,T.GUID,T.TITLE,T.MANUALLY,T.CREATE_ON_REC_CREATE,T.CREATE_ON_FOLL_UP " &
' "FROM TBPMO_WORKFLOW T,TBPMO_WORKFLOW_ENTITY_STATE T1 " &
' "WHERE T.GUID = T1.WF_ID " &
' "GROUP BY T1.ENTITY_ID,T.GUID,T.TITLE,T.MANUALLY,T.CREATE_ON_REC_CREATE,T.CREATE_ON_FOLL_UP"
'DT_WORKFLOWS_MANUAL = MYDB_ECM.GetDatatable(sql_ResultList)
Load_Datafor_Entity()
If WM_READ_ONLY Then
tsitmDMSReadOnly.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
@@ -197,22 +195,6 @@ Public Class frmNodeNavigation
Try
Dim oTable = Await ClassNodeCommands.LoadNodes(CURRENT_ENTITY_ID)
DT_STRUCTURE_NODES = oTable
'Dim oToken = RunningTaskTokenSource.Token
'Dim oStructureNodeSql = $"SELECT
' T.GUID,
' T.RECORD_ID,
' T.NODE_CONFIG_ID,
' T.NODE_CAPTION,
' T.ID1,
' T.BACK_COLOR,
' T.PARENT_GUID,
' T.SEQUENCE,
' T.TYPE_NODE
' FROM
' VWPMO_STRUCTURE_NODES T
'INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID
'WHERE T.ENTITY_ID = {CURRENT_ENTITY_ID}"
'DT_STRUCTURE_NODES = MYDB_ECM.GetDatatable(oStructureNodeSql)
Dim oNodeConfigSql = String.Format("select T.* from TBPMO_STRUCTURE_NODES_CONFIGURATION T INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID WHERE T.ENTITY_ID = {0}", CURRENT_ENTITY_ID)
Dim DT_TREEVIEW_CONFIGURATION = MYDB_ECM.GetDatatable(oNodeConfigSql)
@@ -236,7 +218,7 @@ Public Class frmNodeNavigation
TreeListDevexpress.Columns("SEQUENCE").SortOrder = SortOrder.Ascending
TreeListDevexpress.StateImageList = ImageCollection1
Dim oVisibleColumns = New List(Of String) From {"NODE_CAPTION"}
Dim oVisibleColumns = New List(Of String) From {"NODE_CAPTION"} ', "NAVIGATION_PATH"}
For Each oColumn In TreeListDevexpress.Columns
If oVisibleColumns.Contains(oColumn.FieldName) = False Then
oColumn.Visible = False
@@ -296,10 +278,10 @@ Public Class frmNodeNavigation
End Class
Private Async Sub TreeListDevexpress_FocusedNodeChanged(sender As Object, e As FocusedNodeChangedEventArgs) Handles TreeListDevexpress.FocusedNodeChanged
If FORM_SHOWN = False Then
If FORM_SHOWN = False Or oCollapseInAction Then
Exit Sub
End If
FocusedNode = Nothing
MyFocusedNode = Nothing
If btnCreateNewNode.Visibility = DevExpress.XtraBars.BarItemVisibility.Always Then
btnCreateNewNode.Enabled = False
End If
@@ -316,7 +298,7 @@ Public Class frmNodeNavigation
'For Each treeListNode As TreeListNode In TreeListDevexpress.Selection
'FocusedNode = TreeListNode
FocusedNode = e.Node
MyFocusedNode = e.Node
RPGNodes.Enabled = True
@@ -351,7 +333,7 @@ Public Class frmNodeNavigation
SELECTED_NODE_CAPTION = oNodeCaption
' BEGIN NEW NODE
Dim oConfigNodeChildren = FocusedNode.Nodes.Where(Function(n) n.Item("TYPE_NODE") = 1000)
Dim oConfigNodeChildren = MyFocusedNode.Nodes.Where(Function(n) n.Item("TYPE_NODE") = 1000)
Dim oHasConfigNodeChildren = oConfigNodeChildren.Any()
Dim oConfigNodeChildrenList = oConfigNodeChildren.ToList()
@@ -945,7 +927,7 @@ Public Class frmNodeNavigation
Case GetType(System.Windows.Forms.GroupBox)
Lock_Record_Controls_Recursive(state, DirectCast(Control, GroupBox).Controls)
Case GetType(System.Windows.Forms.TextBox)
Dim txt As TextBox = CType(Control, TextBox)
Dim txt As System.Windows.Forms.TextBox = CType(Control, System.Windows.Forms.TextBox)
txt.ReadOnly = CHECK_CONTROL_CONFIGURED_RO(controlId, state)
Case Else
Control.Enabled = Not CHECK_CONTROL_CONFIGURED_RO(controlId, state) 'state
@@ -1080,30 +1062,78 @@ Public Class frmNodeNavigation
Private Sub TreeListDevexpress_ColumnFilterChanged_1(sender As Object, e As EventArgs) Handles TreeListDevexpress.ColumnFilterChanged
'oFilterActive = True
'If TreeListDevexpress.FindFilterText <> "" Then
Dim oFilterText As String = TreeListDevexpress.FindFilterText
Dim oNode = TreeListDevexpress.FocusedNode
'Dim oNode = TreeListDevexpress.FocusedNode
If LastFindFilterText <> "" And oFilterText = "" Then
TreeListDevexpress.FocusedNode = FocusedNode
TreeListDevexpress.MakeNodeVisible(FocusedNode)
End If
If SQL_OF_NODE_SEARCH <> String.Empty Then
Dim oSQL_SEARCH As String = SQL_OF_NODE_SEARCH
oSQL_SEARCH = oSQL_SEARCH.Replace("@ENTITY_ID", CURRENT_ENTITY_ID)
oSQL_SEARCH = oSQL_SEARCH.Replace("@VALUE", oFilterText)
Dim oDT As DataTable = MYDB_ECM.GetDatatable(oSQL_SEARCH)
If Not IsNothing(oDT) Then
If oDT.Rows.Count > 1 Then
ElseIf oDT.Rows.Count = 1 Then
Dim oResult As String
oResult = oDT.Rows(0).Item(0)
End If
If Not IsNothing(MyFocusedNode) Then
oCollapseInAction = True
TreeListDevexpress.CollapseAll()
TreeListDevexpress.FocusedNode = MyFocusedNode
TreeListDevexpress.MakeNodeVisible(MyFocusedNode)
oCollapseInAction = False
End If
ElseIf oFilterText <> "" Then
TreeListDevexpress.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.ShowAlways
ElseIf oFilterText = "" Then
TreeListDevexpress.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.Never
End If
'If SQL_OF_NODE_SEARCH <> String.Empty Then
' Dim oSQL_SEARCH As String = SQL_OF_NODE_SEARCH
' oSQL_SEARCH = oSQL_SEARCH.Replace("@ENTITY_ID", CURRENT_ENTITY_ID)
' oSQL_SEARCH = oSQL_SEARCH.Replace("@VALUE", oFilterText)
' Dim oDT As DataTable = MYDB_ECM.GetDatatable(oSQL_SEARCH)
' ' If Not IsNothing(oDT) Then
' ' If oDT.Rows.Count > 1 Then
' ' ElseIf oDT.Rows.Count = 1 Then
' ' Dim oResult As String
' ' oResult = oDT.Rows(0).Item(0)
' ' End If
' ' End If
'End If
LastFindFilterText = oFilterText
' End If
End Sub
Private Sub TreeListDevexpress_ParseFindPanelText(sender As Object, e As ParseFindPanelTextEventArgs) Handles TreeListDevexpress.ParseFindPanelText
' Exit if the search text is empty
If String.IsNullOrWhiteSpace(e.FindPanelText) Then Return
' Split the search text into individual criteria
Dim criteriaStrings As String() = e.FindPanelText.Split(New Char() {" "c}, StringSplitOptions.RemoveEmptyEntries)
' Construct the filter string by searching in the desired fields
Dim filterConditions As IEnumerable(Of String) = criteriaStrings.Select(Function(str) _
$"Contains([NODE_CAPTION], '{str}') OR Contains([NAVIGATION_PATH], '{str}')")
' Join the conditions with OR
Dim filterString As String = String.Join(" OR ", filterConditions)
' Parse the filter string into a CriteriaOperator
Dim findCriteria As CriteriaOperator = CriteriaOperator.Parse(filterString)
' Set the find criteria for the TreeList
e.SetFindCriteria(findCriteria)
' Mark the event as handled
e.Handled = True
End Sub
'Private Sub TreeListDevexpress_DoubleClick(sender As Object, e As EventArgs) Handles TreeListDevexpress.DoubleClick
' If TreeListDevexpress.FindFilterText <> "" Then
' TreeListDevexpress.FindFilterText = ""
' End If
' MyFocusedNode = Nothing
' Dim oMyTreeList As TreeList = sender
' Dim oTlHI As TreeListHitInfo = oMyTreeList.CalcHitInfo(oMyTreeList.PointToClient(MousePosition))
' If Not IsNothing(oTlHI.Node) Then
' MyFocusedNode = sender
' End If
'End Sub
'Private Async Sub LoadRecord(pRecord As Integer)
' Try
' CURRENT_RECORD_ID = pRecord
@@ -2855,8 +2885,8 @@ Public Class frmNodeNavigation
Cursor = Cursors.WaitCursor
Dim oSQL = $"EXEC PRCUST_REORDER_CHILD_NODES "
Dim oNodeGUID As Integer = 0
Dim oID = FocusedNode.Id
Dim PID = FocusedNode.ParentNode
Dim oID = MyFocusedNode.Id
Dim PID = MyFocusedNode.ParentNode
Dim Column_pRecord As TreeListColumn = TreeListDevexpress.Columns("RECORD_ID")
Dim Column_Caption As TreeListColumn = TreeListDevexpress.Columns("NODE_CAPTION")
@@ -2867,7 +2897,7 @@ Public Class frmNodeNavigation
MYDB_ECM.ExecuteNonQuery(oSQL)
Await ReloadTreeView()
MyTreeListViewState.LoadState()
TreeListDevexpress.FocusedNode = FocusedNode
TreeListDevexpress.FocusedNode = MyFocusedNode
End If
@@ -2977,8 +3007,8 @@ Public Class frmNodeNavigation
Cursor = Cursors.WaitCursor
Dim oSQL = $"EXEC PRCUST_REORDER_CHILD_NODES "
Dim oNodeGUID As Integer = 0
Dim oID = FocusedNode.Id
Dim PID = FocusedNode.ParentNode
Dim oID = MyFocusedNode.Id
Dim PID = MyFocusedNode.ParentNode
Dim Column_pRecord As TreeListColumn = TreeListDevexpress.Columns("RECORD_ID")
Dim Column_Caption As TreeListColumn = TreeListDevexpress.Columns("NODE_CAPTION")
@@ -2989,7 +3019,7 @@ Public Class frmNodeNavigation
MYDB_ECM.ExecuteNonQuery(oSQL)
Await ReloadTreeView()
MyTreeListViewState.LoadState()
TreeListDevexpress.FocusedNode = FocusedNode
TreeListDevexpress.FocusedNode = MyFocusedNode
Update_Status_Label(True, "Nodes reordered")
End If
@@ -3045,8 +3075,8 @@ Public Class frmNodeNavigation
Dim oRow = NODE_CONFIGURABLE_NODES_DT.Select($"GUID = {oForm.Id}").First()
Dim oCreateRecord = oRow.Item("CREATE_RECORD")
Dim oParentNodeGuid As Integer = FocusedNode.Item("GUID")
Dim oIsExpanded As Boolean = FocusedNode.Expanded
Dim oParentNodeGuid As Integer = MyFocusedNode.Item("GUID")
Dim oIsExpanded As Boolean = MyFocusedNode.Expanded
Dim oNodeCreator = New ClassNodeCreator(LOGCONFIG, ImageCollection1)
Dim oSuccess = oNodeCreator.AddNode(_EntityId, oForm.Title, oParentNodeGuid, oForm.Id, oCreateRecord)
@@ -3079,14 +3109,38 @@ Public Class frmNodeNavigation
Exit Sub
End If
Dim oTable = MYDB_ECM.GetDatatable($"SELECT DOKUMENTTYPE_ID AS ID, DOKUMENTTYPE AS NAME FROM VWPMO_DOKUMENTTYPES WHERE FORM_ID = {CURRENT_ENTITY_ID}")
Dim oTable = MYDB_ECM.GetDatatable($"SELECT DOKUMENTTYPE_ID AS ID, DOKUMENTTYPE AS NAME FROM VWPMO_DOKUMENTTYPES WHERE FORM_ID = {CURRENT_ENTITY_ID} ORDER BY DOKUMENTTYPE")
Dim oDocTypes = oTable.Rows.Cast(Of DataRow).Select(AddressOf ToDocType).ToList()
Dim oFileNames = oSelectedDocs.Select(Function(d) d.DisplayName).ToList()
Dim oFileNames = oSelectedDocs.Select(Function(d) d.Filename).ToList()
Dim oForm As New frmChangeDocType With {.DocTypes = oDocTypes, .FileNames = oFileNames}
'For Each oDoc As ClassWindreamDocGrid.WindreamDoc In oSelectedDocs
' oForm.FileNames = Nothing
' If oDoc.DocPath <> "" Then
' oForm.FileNames.Add(oDoc.DocPath)
' End If
'Next
If oForm.ShowDialog() = DialogResult.OK Then
If Not IsNothing(oForm.SelectedDocType) Then
For Each oDoc As ClassWindreamDocGrid.WindreamDoc In oSelectedDocs
If oDoc.DocPath <> "" Then
Dim oWMObject As WINDREAMLib.WMObject
Dim oReldocpath = ClassHelper.GetRelPath(oDoc.DocPath)
LOGGER.Info("oReldocpath: " & oReldocpath)
oWMObject = WMMOD.GetFileByPath(oReldocpath)
If Not IsNothing(oWMObject) Then
WMMOD.SetFileIndex(oReldocpath, WMINDEX_DOCTYPE, oForm.SelectedDocType.ToString, WMOBJECTTYPE)
Dim oupd = $"UPDATE TBPMO_DOCRESULT_LIST SET DOCTYPE = '{oForm.SelectedDocType.ToString}', CHANGED_WHO = '{USER_USERNAME}',Change_DateTime = GETDATE(),CHANGED_WHEN = GETDATE() WHERE DocID = {oDoc.DocId}"
MYDB_ECM.ExecuteNonQuery(oupd)
End If
End If
Next
RUN_WDSEARCH_GRID(True)
End If
End If
Catch ex As Exception
LOGGER.Error(ex)
@@ -3201,4 +3255,6 @@ Public Class frmNodeNavigation
LOGGER.Warn($"Unexpected error in TimerFileHandleTick [{ex.Message}]!!")
End Try
End Sub
End Class