1,优化撤销功能,对调试结果信息不记录撤销

2,优化F10测试流程,连续调试时不清空测试记录
This commit is contained in:
2025-06-12 21:59:43 +08:00
parent 4581aa6492
commit 16aa21550d
27 changed files with 507 additions and 332 deletions

View File

@@ -1,5 +1,6 @@
Imports System.Diagnostics.Eventing.Reader
Imports System.Drawing
Imports System.Web.UI.WebControls
Imports System.Windows.Forms
Imports FlexCell
Imports FluentFTP
@@ -528,24 +529,28 @@ Namespace UTSModule.Station
Select Case node.RowType
Case RowNode.RowTypeEnum.Flow
Select Case node.CommandType
Case "System"
If node.Command = "Call" Then
Return Color.Blue
Else
Return Color.DarkSlateGray
End If
Case "ComPort"
Return Color.Olive
Case "UtsComPort"
Return Color.SeaGreen
Case "Converter"
Return Color.DarkOrange
Case "Process"
Return Color.DarkBlue
Case Else
Return Color.Black
End Select
If String.IsNullOrEmpty(node.CommandType) OrElse String.IsNullOrEmpty(node.Command) Then
Return Color.DarkGray
Else
Select Case node.CommandType
Case "System"
If node.Command = "Call" Then
Return Color.Blue
Else
Return Color.DarkSlateGray
End If
Case "ComPort"
Return Color.Olive
Case "UtsComPort"
Return Color.SeaGreen
Case "Converter"
Return Color.DarkOrange
Case "Process"
Return Color.DarkBlue
Case Else
Return Color.Black
End Select
End If
Case RowNode.RowTypeEnum.Module
Return Color.DeepPink
Case RowNode.RowTypeEnum.FixedModule
@@ -594,7 +599,7 @@ Namespace UTSModule.Station
_grd.Range(row, ColNames.Result, row, ColNames.ErrorMessage).ForeColor = tmpRowColor '着色
If node.SaveToDb = False Then
_grd.Cell(row, ColNames.RecordName).ForeColor = Color.LightGray '着色
_grd.Cell(row, ColNames.RecordName).ForeColor = Color.DarkGray '着色
End If
If node.CommandType = "" And node.Description = "" Then '空白行字体与底色同色,避免对编辑产生干扰
@@ -624,7 +629,7 @@ Namespace UTSModule.Station
_grd.Range(row, ColNames.Result, row, ColNames.ErrorMessage).ForeColor = tmpRowColor '着色
If node.SaveToDb = False Then
_grd.Cell(row, ColNames.RecordName).ForeColor = Color.LightGray '着色
_grd.Cell(row, ColNames.RecordName).ForeColor = Color.DarkGray '着色
End If
If node.CommandType = "" And node.Description = "" Then '空白行字体与底色同色,避免对编辑产生干扰
@@ -685,10 +690,10 @@ Namespace UTSModule.Station
gMouseOldCol = tmpMouseCol
Else
If gRowType <> RowNode.RowTypeEnum.FixedModule Then '光标移动到flow节点
_grd.Range(tmpMouseRow, ColNames.Result, tmpMouseRow, ColNames.ErrorMessage).BackColor = Color.LemonChiffon
_grd.Range(tmpMouseRow, ColNames.Result, tmpMouseRow, ColNames.ErrorMessage).BackColor = Color.FromArgb(40, Color.LemonChiffon)
_grd.Cell(tmpMouseRow, tmpMouseCol).FontBold = True
If gRowType = RowNode.RowTypeEnum.Module Then '光标移动到module节点
Mouse_MoveOnNode_BackColorRepain(_grd, gRowType, tmpMouseRow, Color.LemonChiffon)
Mouse_MoveOnNode_BackColorRepain(_grd, gRowType, tmpMouseRow, Color.FromArgb(40, Color.LemonChiffon))
End If
End If
End If
@@ -806,6 +811,7 @@ Namespace UTSModule.Station
.FrozenCols = ColNames.Description '冻结列
.BorderStyle = BorderStyleEnum.None
.DefaultRowHeight = 22 '默认行高
.DefaultFont = New Font("微软雅黑", 8)
'.DefaultFont = New Font("Consolas", 8)
.Range(0, 0, 0, .Cols - 1).Font = New Font($"幼圆", 8) '首行样式
@@ -878,6 +884,9 @@ Namespace UTSModule.Station
UnLockGridAutoRedraw()
End With
Dim s As Integer = _grd.DefaultRowHeight
Console.WriteLine(s)
End Sub
@@ -950,11 +959,18 @@ Namespace UTSModule.Station
.Cell(row, ColNames.Parameters).Text = $"{ParamsToString(node.Parameters)}"
.Cell(row, ColNames.SaveToDb).Text = $"{node.SaveToDb}"
.Cell(row, ColNames.RecordName).Text = $"{node.RecordName}"
.Cell(row, ColNames.Retry).Text = $"{node.Retry}"
.Cell(row, ColNames.RetryInterval).Text = $"{node.RetryInterval}"
.Cell(row, ColNames.ErrorCode).Text = $"{node.ErrorCode}"
.Cell(row, ColNames.ErrorMessage).Text = $"{node.ErrorMessage}"
If node.RowType <> RowNode.RowTypeEnum.FixedModule Then
.Cell(row, ColNames.Retry).Text = $"{node.Retry}"
.Cell(row, ColNames.RetryInterval).Text = $"{node.RetryInterval}"
Else
.Cell(row, ColNames.Retry).Text = String.Empty
.Cell(row, ColNames.RetryInterval).Text = String.Empty
End If
rowCmdType = .Cell(row, ColNames.CommandType).Text
tmpIsAction = .Cell(row, ColNames.Action).BooleanValue
'tmpColor = setRowTextForeColor(rowCmdType, tmpIsAction, node.RowType)
@@ -971,7 +987,7 @@ Namespace UTSModule.Station
If .Cell(row, ColNames.Action).BooleanValue = True Then
.Range(row, ColNames.Result, row, ColNames.ErrorMessage).ForeColor = Color.DeepPink
Else
.Range(row, ColNames.Result, row, ColNames.ErrorMessage).ForeColor = Color.LightGray
.Range(row, ColNames.Result, row, ColNames.ErrorMessage).ForeColor = Color.DarkGray
End If
.Range(row, ColNames.Result, row, ColNames.ErrorMessage).FontSize = 8
.Range(row, ColNames.Result, row, ColNames.ErrorMessage).FontBold = False
@@ -1123,7 +1139,7 @@ Namespace UTSModule.Station
changeType = RowNodeChangedEventArgs.RowNodeChangeType.None
Dim beforeNode As RowNode = node.Clone()
OnUserAction(beforeNode)
If e.Col = ColNames.Action OrElse e.Col >= ColNames.Label Then OnUserAction(beforeNode)
Select Case e.Col
Case ColNames.[Pause]
@@ -1163,6 +1179,7 @@ Namespace UTSModule.Station
Else
node.RowType = RowNode.RowTypeEnum.Module
AddLabelName(node.Label, e.Row) '记录新的标签名称
NodeActionChanged(node)
End If
changeType = RowNodeChangedEventArgs.RowNodeChangeType.Label
@@ -1182,7 +1199,7 @@ Namespace UTSModule.Station
node.CommandType = _grd.Cell(e.Row, e.Col).Text
node.Command = ""
node.Parameters.Clear()
node.Action = Not String.IsNullOrWhiteSpace(node.Command)
'node.Action = Not String.IsNullOrWhiteSpace(node.Command)
CommandTypeChanged(node)
changeType = RowNodeChangedEventArgs.RowNodeChangeType.CommandType
@@ -1193,7 +1210,7 @@ Namespace UTSModule.Station
If node.Command <> _grd.Cell(e.Row, e.Col).Text Then
node.Command = _grd.Cell(e.Row, e.Col).Text
node.Parameters.Clear()
node.Action = Not String.IsNullOrWhiteSpace(node.Command)
'node.Action = Not String.IsNullOrWhiteSpace(node.Command)
'拷贝所有参数到当前节点信息中
Dim planCommand As TestCmd = _testCmdManager.GetCommand(node.CommandType, node.Command)
@@ -1205,6 +1222,8 @@ Namespace UTSModule.Station
CommandChanged(node)
changeType = RowNodeChangedEventArgs.RowNodeChangeType.Command
End If
NodeActionChanged(node)
Case ColNames.Parameters
Dim str() As String = _grd.Cell(e.Row, e.Col).Text.Split(New Char() {_paramChar})
@@ -1257,7 +1276,6 @@ Namespace UTSModule.Station
changeType = RowNodeChangedEventArgs.RowNodeChangeType.ErrorMessage
End Select
OnUserActionEnd(node)
'触发事件
@@ -1265,6 +1283,8 @@ Namespace UTSModule.Station
Select Case changeType
Case RowNodeChangedEventArgs.RowNodeChangeType.None
Return
Case Else
OnUserActionEnd(node)
End Select
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
@@ -1284,7 +1304,8 @@ Namespace UTSModule.Station
Private Sub Grid_SelChange(sender As Object, e As Grid.SelChangeEventArgs)
'todo:更新详情表格
If _headNode Is Nothing Then Return
Dim node As RowNode = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + 1)
Dim node As RowNode = _headNode.RowList(e.FirstRow - _drawStartRow + 1)
'Dim node As RowNode = _headNode.RowList(_grd.ActiveCell.Row - _drawStartRow + 1)
If node Is Nothing Then Return
Console.WriteLine($"Grid_SelChange: row:{e.FirstRow} col:{e.FirstCol} end row{e.LastRow} {e.LastCol}")
If Not GridNavigationManager.IsRunning Then
@@ -1315,6 +1336,7 @@ Namespace UTSModule.Station
ActiveNode = node
Dim LineNumber As Integer = e.FirstRow
Dim LineActionEn As Boolean = node.Action
@@ -1569,6 +1591,11 @@ Namespace UTSModule.Station
Dim startNode As RowNode = _headNode.RowList(startMoveRow - _drawStartRow + 1)
For i As Integer = 1 To rows
node = _headNode.RowList(startMoveRow - _drawStartRow + i)
If Not node.CanDelete Then
MsgBox("当前级别节点不允许删除") '过滤非删除节点
Return
End If
If startNode.RowLever <> node.RowLever Then
MsgBox("请选择同一级别节点再尝试此操作") '非同级别节点不移动
Return
@@ -1610,6 +1637,19 @@ Namespace UTSModule.Station
UnLockGridAutoRedraw()
End Sub
Public Sub SetFocus(row As Integer, col As Integer)
If row >= _grd.Rows Then row = 0
If col >= _grd.Cols Then col = 0
_grd.Cell(row, col).SetFocus()
End Sub
Public Sub SetRowFocus(row As Integer)
If row >= _grd.Rows Then row = 0
_grd.Range(row, 0, row, _grd.Cols - 1).SelectCells()
End Sub
Public Sub NodeClear()
If _grd.ActiveCell Is Nothing OrElse _grd.Tree.SelectedNode Is Nothing Then Return
@@ -1638,6 +1678,7 @@ Namespace UTSModule.Station
Dim startNode As RowNode = _headNode.RowList(startMoveRow - _drawStartRow + 1)
Dim prevNode As RowNode = startNode.PrevNode
If prevNode Is Nothing Then Return
If Not startNode.CanMove Then Return
Dim node As RowNode
For i As Integer = 2 To moveRows
@@ -1646,6 +1687,11 @@ Namespace UTSModule.Station
MsgBox("请选择同一级别节点再尝试此操作") '非同级别节点不移动
Return
End If
If Not node.CanMove Then
MsgBox("当前选择节点不允许移动")
Return
End If
Next
@@ -1663,6 +1709,7 @@ Namespace UTSModule.Station
Dim endNode As RowNode = _headNode.RowList(startMoveRow + moveRows - _drawStartRow)
Dim nextNode As RowNode = endNode.NextNode
If nextNode Is Nothing Then Return
If Not startNode.CanMove Then Return
Dim node As RowNode
For i As Integer = 2 To moveRows
@@ -1671,6 +1718,11 @@ Namespace UTSModule.Station
MsgBox("请选择同一级别节点再尝试此操作") '非同级别节点不移动
Return
End If
If Not node.CanMove Then
MsgBox("当前选择节点不允许移动")
Return
End If
Next
Dim moveEndRow As Integer = startMoveRow + nextNode.AllChildCount + 1
@@ -1775,6 +1827,7 @@ Namespace UTSModule.Station
preNode = node
Next
_grd.Range(downNode(0).RowListIndex, 0, downNode(0).RowListIndex + downNode.Count - 1, _grd.Cols - 1).SelectCells() '设置焦点
'节点修改
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
@@ -1808,6 +1861,8 @@ Namespace UTSModule.Station
nextNode = node
Next
_grd.Range(upNode(0).RowListIndex, 0, upNode(0).RowListIndex + upNode.Count - 1, _grd.Cols - 1).SelectCells() '设置焦点
'节点修改
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
@@ -1844,6 +1899,11 @@ Namespace UTSModule.Station
Return
End If
If Not node.CanChangeLever Then
MsgBox("当前选择节点不允许修改级别")
Return
End If
moveEndRow -= (node.AllChildCount + 1)
Next
@@ -1906,6 +1966,11 @@ Namespace UTSModule.Station
MsgBox("请选择同一级别节点再尝试此操作") '非同级别节点不移动
Return
End If
If Not node.CanChangeLever Then
MsgBox("当前选择节点不允许修改级别")
Return
End If
Next
Dim moveRightNodeIndex As Integer = startNode.PrevNode.Children.Count