编辑页面树状目录变更,待排查问题

This commit is contained in:
2025-03-25 17:20:09 +08:00
parent adcab16382
commit 501fa77e5a
282 changed files with 19609 additions and 34059 deletions

View File

@@ -1,4 +1,5 @@
Imports System.Drawing
Imports System.Reflection.Emit
Imports System.Text
Imports System.Windows.Forms
Imports FlexCell
@@ -52,13 +53,13 @@ Namespace UTSModule.Station
''' <summary>当前活动节点</summary>
Public ActiveNode As RowNode
''' <summary>节点选择改变事件</summary>
''' <summary>节点选择改变事件</summary>
Public Event PlanNodeSelectChanged(ByVal sender As Object, ByVal e As PlanNodeSelectChangedEventArgs)
''' <summary>节点文本被修改事件</summary>
''' <summary>节点文本被修改事件</summary>
Public Event RowNodeTextChanged(ByVal sender As Object, ByVal e As RowNodeChangedEventArgs)
''' <summary>测试命令管理器</summary>
''' <summary>测试命令管理器</summary>
Private ReadOnly _testCmdManager As TestCmdManager
''' <summary>错误代码管理器</summary>
@@ -115,7 +116,7 @@ Namespace UTSModule.Station
InitializeGrid()
RemoveHandler _grd.OwnerDrawCell, AddressOf Grid_OwnerDrawCell
' RemoveHandler _grd.OwnerDrawCell, AddressOf Grid_OwnerDrawCell
RemoveHandler _grd.Click, AddressOf Grid_Click
RemoveHandler _grd.CellChange, AddressOf Grid_CellChange
RemoveHandler _grd.SelChange, AddressOf Grid_SelChange
@@ -127,7 +128,7 @@ Namespace UTSModule.Station
RemoveHandler _grd.MouseEnter, AddressOf Grid_MouseEnter
AddHandler _grd.OwnerDrawCell, AddressOf Grid_OwnerDrawCell
' AddHandler _grd.OwnerDrawCell, AddressOf Grid_OwnerDrawCell
AddHandler _grd.Click, AddressOf Grid_Click
AddHandler _grd.CellChange, AddressOf Grid_CellChange
AddHandler _grd.SelChange, AddressOf Grid_SelChange
@@ -398,11 +399,11 @@ Namespace UTSModule.Station
Case RowNode.RowTypeEnum.Flow
Select Case node.CommandType
Case "System"
If node.Command = "Call"
Return Color.Blue
If node.Command = "Call" Then
Return Color.Blue
Else
Return Color.DarkSlateGray
End If
Return Color.DarkSlateGray
End If
Case "ComPort"
Return Color.DarkCyan
Case "UtsComPort"
@@ -741,6 +742,12 @@ Namespace UTSModule.Station
'.BackColor1 = Color.AliceBlue'单行背景色
'.BackColor2 = Color.Azure'双行背景色
.Tree.Row = 2
.Tree.Col = ColNames.Description
.Tree.ShowLines = True
.Tree.CheckBoxes = False
.Tree.Nodes.Clear()
For col As Integer = 0 To ColNames.Max - 1
Select Case col
Case ColNames.Pause
@@ -903,7 +910,7 @@ Namespace UTSModule.Station
Public Sub UpdateGrid(grd As Grid, nodes As RowNodeCollection)
For Each node As RowNode In nodes
grd.AddItem("")
grd.AddItem(node.RowLever, node.Description, String.Empty)
Dim row As Integer = grd.Rows - 1
UpdateGrid(grd, row, node)
@@ -920,15 +927,11 @@ Namespace UTSModule.Station
InitializeGrid()
With _grd
' .AutoRedraw = False
LockGridAutoRedraw()
UpdateGrid(_grd, _headNode.RowNodes)
UnLockGridAutoRedraw()
'.AutoRedraw = True
'.Refresh()
End With
_uploading = False
@@ -1483,11 +1486,12 @@ Namespace UTSModule.Station
If rows < 1 Then Return
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
LockGridAutoRedraw()
Dim row As Integer = _grd.ActiveCell.Row + rows
For idx = 1 To rows
node = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + 1)
@@ -1500,18 +1504,18 @@ Namespace UTSModule.Station
node.ParentNode.InsertNode(node.RowIndex, rowNode)
'更新控件,若为最后一行,插入会失败
If rowNode.RowListIndex = _grd.Rows Then
_grd.AddItem("")
If _grd.Tree.SelectedNode.NextNode Is Nothing Then
_grd.Tree.SelectedNode.Parent.Nodes.Add("", "")
Else
_grd.InsertRow(rowNode.RowListIndex, 1)
_grd.Tree.SelectedNode.Parent.Nodes.Insert(_grd.Tree.SelectedNode.Index, "")
End If
UpdateGrid(_grd, rowNode.RowListIndex, rowNode)
'其他操作
' _grd.Cell(rowNode.RowListIndex, _drawCol).SetFocus()
Next idx
'其他操作
_grd.Cell(row, _drawCol).SetFocus()
UnLockGridAutoRedraw()
End Sub
@@ -1520,11 +1524,12 @@ Namespace UTSModule.Station
Dim node As RowNode
If rows < 1 Then Return
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
LockGridAutoRedraw()
Dim row As Integer = _grd.ActiveCell.Row - 1
For idx = 1 To rows
node = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + 1)
If node Is Nothing Then Exit For
@@ -1541,20 +1546,18 @@ Namespace UTSModule.Station
node.Remove()
'更新控件
If node.AllChildCount > 0 Then
_grd.Range(node.RowListIndex, 0, node.RowListIndex + node.AllChildCount, 0).DeleteByRow()
Else
_grd.Row(node.RowListIndex).Delete()
End If
_grd.Tree.SelectedNode.Remove()
'其他操作
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
Next idx
_grd.Cell(row, _drawCol).SetFocus()
UnLockGridAutoRedraw()
End Sub
Public Sub NodeClear()
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
Dim node As RowNode = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + 1)
@@ -1566,7 +1569,7 @@ Namespace UTSModule.Station
'更新控件
If nodeCount > 0 Then
_grd.Range(node.RowListIndex + 1, 0, node.RowListIndex + nodeCount, 0).DeleteByRow()
_grd.Tree.SelectedNode.Nodes.Clear()
End If
'其他操作
@@ -1585,7 +1588,7 @@ Namespace UTSModule.Station
Dim moveUpCount As Integer '上移动总量
If rows < 1 Then Return
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
@@ -1603,14 +1606,14 @@ Namespace UTSModule.Station
node.MoveUp()
UpdateGrid(moveDownRow, moveDownCount, moveUpRow, moveUpCount)
UpdateGrid(_grd.Tree.SelectedNode.PrevNode, _grd.Tree.SelectedNode)
_grd.Cell(node.RowListIndex, _grd.ActiveCell.Col).SetFocus()
End Sub
Public Sub NodeMoveDown()
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
Dim node As RowNode = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + 1)
@@ -1628,11 +1631,54 @@ Namespace UTSModule.Station
node.MoveDown()
UpdateGrid(moveDownRow, moveDownCount, moveUpRow, moveUpCount)
UpdateGrid(_grd.Tree.SelectedNode, _grd.Tree.SelectedNode.NextNode)
_grd.Cell(node.RowListIndex, _grd.ActiveCell.Col).SetFocus()
End Sub
Private Sub UpdateGrid(srcNode As FlexCell.Node, targetNode As FlexCell.Node)
LockGridAutoRedraw()
_uploading = True
If srcNode.ChildCount >= targetNode.ChildCount Then
targetNode.Remove()
srcNode.Parent.Nodes.Insert(srcNode.Index, String.Empty)
Dim node As RowNode = _headNode.RowList(srcNode.PrevNode.Row)
UpdateGrid(_grd, node.RowListIndex, node)
'获取表格节点,添加其子节点
Dim pNode As FlexCell.Node = _grd.Tree.FindNode(node.RowListIndex)
AddGridTreeNode(pNode, node)
Else
srcNode.Remove()
targetNode.Parent.Nodes.Insert(targetNode.Index + 1, String.Empty)
Dim node As RowNode = _headNode.RowList(targetNode.NextNode.Row)
UpdateGrid(_grd, node.RowListIndex, node)
'获取表格节点,添加其子节点
Dim pNode As FlexCell.Node = _grd.Tree.FindNode(node.RowListIndex)
AddGridTreeNode(pNode, node)
End If
'节点修改
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
_uploading = False
UnLockGridAutoRedraw()
End Sub
Private Sub AddGridTreeNode(pNode As FlexCell.Node, srcNode As RowNode)
For Each node As RowNode In srcNode.RowNodes
pNode.Nodes.Insert(node.RowIndex, "")
UpdateGrid(_grd, node.RowListIndex, node)
AddGridTreeNode(_grd.Tree.FindNode(node.RowListIndex), node)
Next
End Sub
Private Sub UpdateGrid(moveDownRow As Integer, moveDownCount As Integer, moveUpRow As Integer, moveUpCount As Integer)
LockGridAutoRedraw()
@@ -1670,22 +1716,35 @@ Namespace UTSModule.Station
Dim nextNode As RowNode
If rows < 1 Then Return
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
Dim moveLeftSatrtRow As Integer = _grd.ActiveCell.Row
Dim grdNode As FlexCell.Node
Dim grdParentNode As FlexCell.Node
LockGridAutoRedraw()
_uploading = True
For idx As Integer = 1 To rows
node = _headNode.RowList(moveLeftSatrtRow - _drawStartRow + 1)
Console.WriteLine($"Index:{node.RowListIndex}")
If node Is Nothing Then Return
If node.RowLever = 0 Then Return
If node.RowType = RowNode.RowTypeEnum.FixedModule Then Return
If node Is Nothing Then Exit For
If node.RowLever = 0 Then Exit For
If node.RowType = RowNode.RowTypeEnum.FixedModule Then Exit For
grdNode = _grd.Tree.FindNode(node.RowListIndex)
grdParentNode = grdNode.Parent
'更新内存
If node.NextNode Is Nothing Then
node.MoveLeft()
_grd.Refresh()
Return
grdNode.Remove()
grdParentNode.Parent.Nodes.Insert(grdParentNode.Index + 1, "")
UpdateGrid(_grd, node.RowListIndex, node)
AddGridTreeNode(_grd.Tree.FindNode(node.RowListIndex), node)
Exit For
End If
moveDownRow = node.RowListIndex '下移动前起始位置
moveDownCount = node.AllChildCount + 1 '下移动总量
@@ -1700,9 +1759,16 @@ Namespace UTSModule.Station
node.MoveLeft()
Console.WriteLine($"Node:{node.RowLever}")
Next
UpdateGrid(moveDownRow, moveDownCount, moveUpRow, moveUpCount)
grdNode.Remove()
grdParentNode.Parent.Nodes.Insert(grdParentNode.Index + 1, "")
UpdateGrid(_grd, node.RowListIndex, node)
AddGridTreeNode(_grd.Tree.FindNode(node.RowListIndex), node)
_grd.Cell(node.RowListIndex, _grd.ActiveCell.Col).SetFocus()
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
Next
_uploading = False
UnLockGridAutoRedraw()
End Sub
@@ -1713,19 +1779,35 @@ Namespace UTSModule.Station
Dim node As RowNode
If rows < 1 Then Return
If _grd.ActiveCell Is Nothing Then Return
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
If _headNode Is Nothing Then Return
Dim grdNode As FlexCell.Node
Dim grdPreNode As FlexCell.Node
LockGridAutoRedraw()
_uploading = True
For idx As Integer = 1 To rows
node = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + idx)
If node Is Nothing Then Return
If node.RowType = RowNode.RowTypeEnum.FixedModule Then Return
If node Is Nothing Then Exit For
If node.RowType = RowNode.RowTypeEnum.FixedModule Then Exit For
If node.RowIndex = 0 Then Exit For
grdNode = _grd.Tree.FindNode(node.RowListIndex)
grdPreNode = grdNode.PrevNode
node.MoveRight()
grdNode.Remove()
grdPreNode.Nodes.Add("", "")
UpdateGrid(_grd, node.RowListIndex, node)
AddGridTreeNode(_grd.Tree.FindNode(node.RowListIndex), node)
_grd.Cell(node.RowListIndex, _grd.ActiveCell.Col).SetFocus()
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
Next
_uploading = False
UnLockGridAutoRedraw()
End Sub
#End Region
@@ -1864,7 +1946,7 @@ Namespace UTSModule.Station
Public Sub TestNodeChanged(node As RowNode)
_grd.Cell(node.RowListIndex, ColNames.Action).EnsureVisible()
_grd.Cell(node.RowListIndex, ColNames.Action).BackColor = Color.Blue
_grd.Range(node.RowListIndex,1,node.RowListIndex,_grd.Cols-1).SelectCells()
_grd.Range(node.RowListIndex, 1, node.RowListIndex, _grd.Cols - 1).SelectCells()
End Sub