添加IF逻辑字段的着色逻辑,添加IF与ElseIF节点新增时附加其子节点

This commit is contained in:
2025-12-28 23:02:04 +08:00
parent 89429a6390
commit df790bb5b7
17 changed files with 761 additions and 26 deletions

View File

@@ -0,0 +1,207 @@
Imports System.IO
Imports System.Text
Imports System.Windows.Forms
Namespace DebugLog
''' <summary>
''' 应用程序日志
''' </summary>
Public NotInheritable Class ApplicationLog
''' <summary>日志文件所在父文件夹路径</summary>
Private Shared _logPath As String = Application.StartupPath
''' <summary>日志文件名前缀</summary>
Private Shared _logFilePrefix As String = Application.ProductName
''' <summary>日志文件所在路径</summary>
Private Shared _logFilePath As String = $"{LogDirPath}{Path.DirectorySeparatorChar}{LogFilePrefix}_{Date.Now:yyyyMMdd}.Log"
''' <summary>
''' 保存日志的文件夹完整路径
''' </summary>
Public Shared Property LogDirPath As String
Get
If Equals(_logPath, String.Empty) Then
_logPath = Application.StartupPath
End If
Return _logPath
End Get
Set(value As String)
_logPath = value
_logFilePath = $"{LogDirPath}{Path.DirectorySeparatorChar}{LogFilePrefix}_{Date.Now:yyyyMMdd}.Log"
End Set
End Property
''' <summary>
''' 日志文件前缀
''' </summary>
Public Shared Property LogFilePrefix As String
Get
Return _logFilePrefix
End Get
Set(value As String)
_logFilePrefix = value
_logFilePath = $"{LogDirPath}{Path.DirectorySeparatorChar}{LogFilePrefix}_{Date.Now:yyyyMMdd}.Log"
End Set
End Property
Public Shared ReadOnly Property LogFilePath() As String
Get
Return _logFilePath
End Get
End Property
''' <summary>
''' 写入错误信息记录日志
''' </summary>
''' <param name="ex"></param>
Public Shared Sub WriteErrorLog(ex As Exception)
Dim msg As New StringBuilder
msg.Append($"{ex.StackTrace} {ex.Message}")
WriteLog(LogTypes.Error, msg.ToString())
End Sub
''' <summary>
''' 写入流程信息记录日志
''' </summary>
''' <param name="msg"></param>
Public Shared Sub WriteDebugLog1(msg As String)
WriteLog1(LogTypes.Debug.ToString, msg.ToString())
End Sub
Public Shared Sub WriteDebugLog(msg As String)
WriteLog(LogTypes.Debug, msg.ToString())
End Sub
''' <summary>
''' 写入流程信息记录日志
''' </summary>
''' <param name="msg"></param>
Public Shared Sub WriteInfoLog(msg As String)
WriteLog(LogTypes.Info, msg.ToString())
End Sub
''' <summary>
''' 写入警告信息记录日志
''' </summary>
''' <param name="msg"></param>
Public Shared Sub WriteWarningLog(msg As String)
WriteLog(LogTypes.Warn, msg.ToString())
End Sub
''' <summary>
''' 写入错误信息记录日志
''' </summary>
''' <param name="msg"></param>
Public Shared Sub WriteErrorLog(msg As String)
WriteLog(LogTypes.Error, msg.ToString())
End Sub
''' <summary>
''' 写入数据库信息记录日志
''' </summary>
''' <param name="msg"></param>
Public Shared Sub WriteFatalLog(msg As String)
WriteLog(LogTypes.Fatal, msg.ToString())
End Sub
Private Shared ReadOnly LogLock As New Object() '日志锁,防止多线程同时写日志导致冲突
''' <summary>
''' 将信息入到日志
''' </summary>
''' <param name="logType">日志类型</param>
''' <param name="msg">日志内容</param>
Public Shared Sub WriteLog(logType As String, msg As String)
'写入记录入日志文件
SyncLock LogLock
Try
Dim logString As New StringBuilder
logString.Append($"[{Date.Now:yyyy-MM-dd HH:mm:ss:fff}]") '日志产生时间
logString.Append($"[{logType,-6}]") '日志类型
logString.Append($"[{Process.GetCurrentProcess.Id,-6}]") '日志的进程号
logString.Append($"[{Threading.Thread.CurrentThread.ManagedThreadId,-4}]") '日志的线程号
logString.Append(msg) '日志的消息主题
Using sw As StreamWriter = File.AppendText($"{LogDirPath}{Path.DirectorySeparatorChar}{LogFilePrefix}_{Date.Now:yyyyMMdd}.Log")
sw.WriteLine(logString.ToString())
End Using
Catch ex As Exception
Console.WriteLine($"Uts WriteLog Error:{ex.Message}")
End Try
End SyncLock
End Sub
Public Shared Sub WriteLog1(logType As String, msg As String)
'写入记录入日志文件
SyncLock LogLock
Try
Dim logString As New StringBuilder
logString.Append($"[{Date.Now:yyyy-MM-dd HH:mm:ss:fff}]") '日志产生时间
logString.Append($"[{logType,-6}]") '日志类型
logString.Append($"[{Process.GetCurrentProcess.Id,-6}]") '日志的进程号
logString.Append($"[{Threading.Thread.CurrentThread.ManagedThreadId,-4}]") '日志的线程号
logString.Append(msg) '日志的消息主题
Using sw As StreamWriter = File.AppendText($"{LogDirPath}{Path.DirectorySeparatorChar}{logType}_{Date.Now:yyyyMMdd}.Log")
sw.WriteLine(logString.ToString())
End Using
Catch ex As Exception
Console.WriteLine($"Uts WriteLog Error:{ex.Message}")
End Try
End SyncLock
End Sub
''' <summary>
''' 写日志
''' </summary>
Public Shared Sub WriteLog(type As LogTypes, ByVal msg As String)
WriteLog(type.ToString(), msg)
End Sub
''' <summary>
''' 日志类型
''' </summary>
Public Enum LogTypes
''' <summary>调试信息</summary>
Debug
''' <summary>系统运行信息</summary>
Info
''' <summary>警告信息</summary>
Warn
''' <summary>错误信息应该包含对象名、发生错误点所在的方法名称、具体错误信息</summary>
[Error]
''' <summary>致命信息</summary>
Fatal
End Enum
End Class
End Namespace

View File

@@ -0,0 +1,95 @@
Imports System.Windows.Forms
Namespace DebugLog
''' <summary>
''' 考虑修改为自定义控件
''' </summary>
Public Class ControlRecord
Sub New(recordControl As RichTextBox)
ShowRecord = True
SuspendLayout = False
MaxRecordCount = 512
RtxRecord = recordControl
End Sub
''' <summary>
''' 是否在添加内容时先挂起布局
''' </summary>
''' <returns></returns>
Property SuspendLayout() As Boolean
''' <summary>
''' 是否添加记录到控件
''' </summary>
''' <returns></returns>
Property ShowRecord() As Boolean
''' <summary>
''' 控件记录最大行数
''' </summary>
''' <returns></returns>
Property MaxRecordCount() As Integer
''' <summary>
''' 需要被添加数据记录的控件句柄
''' </summary>
''' <returns></returns>
Property RtxRecord() As RichTextBox
''' <summary>
''' 清空内容
''' </summary>
Public Sub Clear()
If RtxRecord Is Nothing Then Return
RtxRecord.Clear()
End Sub
Public Sub AppendRecord(logString As String)
If ShowRecord = False Then Return
If RtxRecord Is Nothing Then Return
If RtxRecord.InvokeRequired Then '判断是否需要开委托
RtxRecord.Invoke(New Action(Of String)(AddressOf AppendRecord), New Object() {logString})
Return
End If
With RtxRecord
If SuspendLayout Then
.SuspendLayout()
If .Lines.Length > MaxRecordCount Then '超过上限则移除最初行内容
.ReadOnly = False
.SelectionStart = 0
.SelectionLength = .GetFirstCharIndexFromLine(1)
.SelectedText = String.Empty
.ReadOnly = True
.SelectionStart = .TextLength
End If
.AppendText($"{Now:yyyy:MM:dd HH:mm:ss} - {logString}{vbNewLine}")
.ScrollToCaret()
.ResumeLayout(False)
Else
If .Lines.Length > MaxRecordCount Then '超过上限则移除最初行内容
.ReadOnly = False
.SelectionStart = 0
.SelectionLength = .GetFirstCharIndexFromLine(1)
.SelectedText = String.Empty
.ReadOnly = True
.SelectionStart = .TextLength
End If
.AppendText($"{Now:yyyy:MM:dd HH:mm:ss} - {logString}{vbNewLine}")
.ScrollToCaret()
End If
End With
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,94 @@
Imports System.IO
''' <summary>
''' 日志类
''' </summary>
Public NotInheritable Class CsDataLog
''' <summary>
''' 日志类型
''' </summary>
Public Enum LogType
''' <summary>堆栈跟踪信息</summary>
Trace
''' <summary>警告信息</summary>
Warning
''' <summary>错误信息应该包含对象名、发生错误点所在的方法名称、具体错误信息</summary>
[Error]
''' <summary>与数据库相关的信息</summary>
SQL
End Enum
''' <summary>日志文件所在路径</summary>
Private Shared _logPath = String.Empty
''' <summary>日志前缀说明信息</summary>
Private Shared _logFilePrefix = String.Empty
''' <summary>
''' 保存日志的文件夹
''' </summary>
Public Shared Property LogPath As String
Get
If Equals(_logPath, String.Empty) Then
_logPath = Application.StartupPath
End If
Return _logPath
End Get
Set(ByVal value As String)
_logPath = value
End Set
End Property
''' <summary>
''' 日志文件前缀
''' </summary>
Public Shared Property LogFilePrefix As String
Get
Return _logFilePrefix
End Get
Set(ByVal value As String)
_logFilePrefix = value
End Set
End Property
''' <summary>
'''
''' </summary>
''' <param name="ex"></param>
Public Shared Sub WriteErrorLog(ex As Exception)
Dim msg As String = String.Empty
msg &= $"ErrorMessage:{ex.Message}{vbNewLine}"
msg &= $"ErrorTime:{Now}{vbNewLine}"
msg &= $"ErrorSource:{ex.Source}{vbNewLine}"
msg &= $"ErrorType:{ex.GetType}{vbNewLine}"
msg &= $"ErrorTargetSite:{ex.TargetSite}{vbNewLine}"
msg &= $"ErrorStackTrace:{ex.StackTrace}{vbNewLine}"
WriteLog(LogType.Error, msg)
End Sub
''' <summary>
''' 将信息入到日志
''' </summary>
''' <param name="logType">日志类型</param>
''' <param name="msg">日志内容</param>
Public Shared Sub WriteLog(ByVal logType As String, ByVal msg As String)
Dim sw As StreamWriter = Nothing
Try
'同一天同一类日志以追加形式保存
sw = File.AppendText($"{LogPath}{Path.DirectorySeparatorChar}{LogFilePrefix}_{Date.Now:yyyyMMdd}.Log")
sw.WriteLine(logType & "#" & Date.Now.ToString("yyyy-MM-dd HH:mm:ss: ") & msg)
Catch
Finally
sw.Close()
End Try
End Sub
''' <summary>
''' 写日志
''' </summary>
Public Shared Sub WriteLog(type As LogType, ByVal msg As String)
WriteLog(type.ToString(), msg)
End Sub
End Class

View File

@@ -0,0 +1,60 @@
Public NotInheritable Class CsDebugPrint
Enum EnDebugType
System
ComPort
Network
Ftp
End Enum
''' <summary>是否需要打印调试信息</summary>
Public Shared Property IsDebug As Boolean = True
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="message">需要打印的信息</param>
Public Shared Sub DebugPrint(message As String)
If IsDebug Then
Console.WriteLine(message)
End If
End Sub
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="type">打印信息类型</param>
''' <param name="msg">需要打印的信息</param>
Public Shared Sub DebugPrint(type As String, msg As String)
DebugPrint($"[{type}]{msg}")
End Sub
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="type">打印信息类型</param>
''' <param name="msg">需要打印的信息</param>
Public Shared Sub DebugPrint(type As EnDebugType, msg As String)
DebugPrint(type.ToString, msg)
End Sub
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="type">打印信息类型</param>
''' <param name="tip">需要打印信息的提示前缀</param>
''' <param name="msg">需要打印的信息</param>
Public Shared Sub DebugPrint(type As String, tip As String, msg As String)
DebugPrint(type, $"{tip}:{msg}")
End Sub
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="type">打印信息类型</param>
''' <param name="tip">需要打印信息的提示前缀</param>
''' <param name="msg">需要打印的信息</param>
Public Shared Sub DebugPrint(type As EnDebugType, tip As String, msg As String)
DebugPrint(type.ToString, $"{tip}:{msg}")
End Sub
End Class

View File

@@ -0,0 +1,119 @@
Imports System.Text
Namespace DebugLog
Public Class DebugPrintClass
Enum DebugPrintType
System
Comport
Database
NetWork
Ftp
End Enum
''' <summary>
''' 显示所有数据,优先度最高
''' </summary>
''' <returns></returns>
Public Shared Property ShowAllData() As Boolean = True
''' <summary>
''' 是否显示系统信息
''' </summary>
''' <returns></returns>
Public Shared Property ShowSystemData() As Byte = 1
''' <summary>
''' 是否显示串口信息
''' </summary>
''' <returns></returns>
Public Shared Property ShowComportData() As Byte = 1
''' <summary>
''' 是否显示数据库信息
''' </summary>
''' <returns></returns>
Public Shared Property ShowDatabaseData() As Byte = 1
''' <summary>
''' 是否显示网络信息
''' </summary>
''' <returns></returns>
Public Shared Property ShowNetWorkData() As Byte = 1
''' <summary>
''' 是否显示Ftp信息
''' </summary>
''' <returns></returns>
Public Shared Property ShowFtpData() As Byte = 1
''' <summary>
''' 显示信息的集合,对应数据位为1则打印为0不打印
''' </summary>
''' <returns></returns>
Public Shared Property ShowDataType() As Integer = ShowSystemData >> DebugPrintType.System Or
ShowComportData >> DebugPrintType.Comport Or
ShowDatabaseData >> DebugPrintType.Database Or
ShowNetWorkData >> DebugPrintType.NetWork Or
ShowFtpData >> DebugPrintType.Ftp
''' <summary>
''' 是否添加时间前缀
''' </summary>
''' <returns></returns>
Public Shared Property ShowTime() As Boolean = True
''' <summary>
''' 是否显示与上包显示的间隔
''' </summary>
''' <returns></returns>
Public Shared Property ShowTimeSpan() As Boolean = True
Private Shared _lastShowTime As DateTime = Now
Private Shared _timeSpan As TimeSpan
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="printString">需要打印的信息</param>
Private Shared Sub DebugPrint(printString As String)
Console.WriteLine(printString)
End Sub
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="type">打印信息类型</param>
''' <param name="printString">需要打印的信息</param>
Public Shared Sub DebugPrint(type As DebugPrintType, printString As String)
If ShowAllData = False Then Return
If ((ShowDataType >> type) And 1) = 0 Then Return
_timeSpan = Now - _lastShowTime
_lastShowTime = Now
Dim msgBuilder As New StringBuilder
If ShowTime Then msgBuilder.Append($"{Now:yyyy-MM-dd HH:mm:ss} - ")
If ShowTimeSpan Then msgBuilder.Append($"{_timeSpan.TotalMilliseconds,8} - ")
msgBuilder.Append($"{type} - ")
msgBuilder.Append($"{printString}")
DebugPrint(msgBuilder.ToString())
End Sub
''' <summary>
''' 打印调试信息
''' </summary>
''' <param name="type">打印信息类型</param>
''' <param name="tip">需要打印信息的提示前缀</param>
''' <param name="printString">需要打印的信息</param>
Public Shared Sub DebugPrint(type As DebugPrintType, tip As String, printString As String)
DebugPrint(type, $"{tip}:{printString}")
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,21 @@
Imports UTS_Core.UTSModule.Station
Public Class GridControlNodeAddCommand : Implements ICommand
Private ReadOnly grd As StationPlanGrid
Private ReadOnly startMoveRow As Integer
Private ReadOnly nodes As List(Of RowNode)
Sub New(grd As StationPlanGrid, startMoveRow As Integer, nodes As List(Of RowNode))
Me.grd = grd
Me.startMoveRow = startMoveRow
Me.nodes = nodes
End Sub
Public Sub Redo() Implements ICommand.Redo
grd.NodeAddChildCommand(startMoveRow, nodes)
End Sub
Public Sub Undo() Implements ICommand.Undo
grd.NodeDeleteChildCommand(startMoveRow, nodes)
End Sub
End Class

View File

@@ -0,0 +1,21 @@
Imports UTS_Core.UTSModule.Station
Public Class GridControlNodeDeleteCommand : Implements ICommand
Private ReadOnly grd As StationPlanGrid
Private ReadOnly startMoveRow As Integer
Private ReadOnly nodes As List(Of RowNode)
Sub New(grd As StationPlanGrid, startMoveRow As Integer, nodes As List(Of RowNode))
Me.grd = grd
Me.startMoveRow = startMoveRow
Me.nodes = nodes
End Sub
Public Sub Redo() Implements ICommand.Redo
grd.NodeDeleteChildCommand(startMoveRow, nodes)
End Sub
Public Sub Undo() Implements ICommand.Undo
grd.NodeAddChildCommand(startMoveRow, nodes)
End Sub
End Class

View File

@@ -1,6 +1,8 @@
Imports System.Drawing
Imports System.Windows.Forms
Imports FlexCell
Imports FluentFTP
Imports Mysqlx.XDevAPI.Relational
Imports UTS_Core.UTSModule.Production
Imports UTS_Core.UTSModule.Test.Command
Imports UTS_Core.UTSModule.Test.StatusMonitor
@@ -487,17 +489,20 @@ Namespace UTSModule.Station
Dim tmpCurrRowIdx As Integer = startRowIdx
Dim tmpCurrRowNodeLevel As Integer = GetRowNodeLevel(grd, tmpCurrRowIdx)
'判断当前行Row type = 1记录下本行的NodeLevel = tempNodeLevel记录NodeLstIndx
If rowType = RowNode.RowTypeEnum.Module Then
'从起始行开始往下遍历
Do
If tmpCurrRowIdx < Grid.Rows Then '遍历到最大行还未结束
tmpCurrRowIdx = tmpCurrRowIdx + 1
tmpCurrRowNodeLevel = GetRowNodeLevel(grd, tmpCurrRowIdx)
Else
Return
End If
Loop Until tmpCurrRowNodeLevel <= startRowNodeLevel Or tmpCurrRowIdx >= Grid.Rows '再次遍历到与起始行同级或更高级别的行,就算是该节点遍历结束
endRowNodeIdx = tmpCurrRowIdx - 1
Dim node As RowNode = _headNode.RowList(startRowIdx - _drawStartRow + 1)
If rowType = RowNode.RowTypeEnum.Module OrElse rowType = RowNode.RowTypeEnum.Control Then
''从起始行开始往下遍历
'Do
' If tmpCurrRowIdx < Grid.Rows Then '遍历到最大行还未结束
' tmpCurrRowIdx = tmpCurrRowIdx + 1
' tmpCurrRowNodeLevel = GetRowNodeLevel(grd, tmpCurrRowIdx)
' Else
' Return
' End If
'Loop Until tmpCurrRowNodeLevel <= startRowNodeLevel Or tmpCurrRowIdx >= Grid.Rows '再次遍历到与起始行同级或更高级别的行,就算是该节点遍历结束
'endRowNodeIdx = tmpCurrRowIdx - 1
endRowNodeIdx = startRowIdx + node.AllChildCount
'底色着色
LockGridAutoRedraw()
@@ -681,6 +686,8 @@ Namespace UTSModule.Station
_grd.Cell(gMouseOldRow, gMouseOldCol).FontBold = False
If gOldRowType = RowNode.RowTypeEnum.Module Then '光标离开Module节点
Mouse_MoveOnNode_BackColorRepain(_grd, gOldRowType, gMouseOldRow, Color.White)
ElseIf gOldRowType = RowNode.RowTypeEnum.Control Then '光标离开Module节点
Mouse_MoveOnNode_BackColorRepain(_grd, gOldRowType, gMouseOldRow, Color.White)
End If
End If
gMouseOldRow = tmpMouseRow
@@ -691,6 +698,8 @@ Namespace UTSModule.Station
_grd.Cell(tmpMouseRow, tmpMouseCol).FontBold = True
If gRowType = RowNode.RowTypeEnum.Module Then '光标移动到module节点
Mouse_MoveOnNode_BackColorRepain(_grd, gRowType, tmpMouseRow, Color.FromArgb(40, Color.LemonChiffon))
ElseIf gRowType = RowNode.RowTypeEnum.Control Then
Mouse_MoveOnNode_BackColorRepain(_grd, gRowType, tmpMouseRow, Color.FromArgb(40, Color.LemonChiffon))
End If
End If
End If
@@ -701,6 +710,10 @@ Namespace UTSModule.Station
gIsGri_MouseMove_EventReady = True
End Sub
''' <summary>
''' 获取指定行的NodeIndex
''' </summary>
@@ -845,7 +858,7 @@ Namespace UTSModule.Station
.Column(ColNames.Pause).Width = 20
.Column(ColNames.Action).Width = 20
.Column(ColNames.Description).Width = 200
.Column(ColNames.ControlType).Width = 50
.Column(ColNames.ControlType).Width = 80
.Column(ColNames.CommandType).Width = 80
.Column(ColNames.Command).Width = 120
.Column(ColNames.Parameters).Width = 340
@@ -1185,8 +1198,51 @@ Namespace UTSModule.Station
node.ControlType = _grd.Cell(e.Row, e.Col).Text
If String.IsNullOrWhiteSpace(node.ControlType) Then
node.RowType = RowNode.RowTypeEnum.Flow
Dim cmd As New GridControlNodeDeleteCommand(Me, e.Row, node.Children)
CommandManager.RunCommand(cmd) '添加到撤销堆栈执行
RaiseEvent PlanGridCommandChanged(Nothing, Nothing)
'clear
Else
node.RowType = RowNode.RowTypeEnum.Control
Dim nodes As New List(Of RowNode)
Dim tmpNode As New RowNode
If node.ControlType = "If" Then
tmpNode.RowType = RowNode.RowTypeEnum.Control
tmpNode.ControlType = "Then"
tmpNode.AddNode(New RowNode)
tmpNode.AddNode(New RowNode)
nodes.Add(tmpNode)
nodes.Add(New RowNode) '添加空行
tmpNode = New RowNode
tmpNode.RowType = RowNode.RowTypeEnum.Control
tmpNode.ControlType = "ElseIf"
tmpNode.AddNode(New RowNode)
tmpNode.AddNode(New RowNode)
nodes.Add(tmpNode)
nodes.Add(New RowNode) '添加空行
tmpNode = New RowNode
tmpNode.RowType = RowNode.RowTypeEnum.Control
tmpNode.ControlType = "Else"
tmpNode.AddNode(New RowNode)
tmpNode.AddNode(New RowNode)
nodes.Add(tmpNode)
nodes.Add(New RowNode) '添加空行
Dim cmd As New GridControlNodeAddCommand(Me, e.Row, nodes)
CommandManager.RunCommand(cmd) '添加到撤销堆栈执行
RaiseEvent PlanGridCommandChanged(Nothing, Nothing)
ElseIf node.ControlType = "ElseIf" Then
nodes.Add(New RowNode)
nodes.Add(New RowNode)
Dim cmd As New GridControlNodeAddCommand(Me, e.Row, nodes)
CommandManager.RunCommand(cmd) '添加到撤销堆栈执行
RaiseEvent PlanGridCommandChanged(Nothing, Nothing)
End If
End If
changeType = RowNodeChangedEventArgs.RowNodeChangeType.ControlType
@@ -1567,7 +1623,70 @@ Namespace UTSModule.Station
End Sub
''' <summary>
''' 子级节点添加
''' </summary>
''' <param name="startMoveRow"></param>
''' <param name="nodes"></param>
Friend Sub NodeAddChildCommand(startMoveRow As Integer, nodes As List(Of RowNode))
Dim node As RowNode
Dim startNode As RowNode = _headNode.RowList(startMoveRow - _drawStartRow + 1)
Dim grdNode As FlexCell.Node = _grd.Tree.FindNode(startMoveRow)
LockGridAutoRedraw()
_uploading = True
For i As Integer = 0 To nodes.Count - 1
'更新内存
node = nodes(i)
'在当前节点插入节点
startNode.AddNode(node)
'更新控件
grdNode.Nodes.Add("", "")
UpdateGrid(_grd, node.RowListIndex, node)
Dim pNode As FlexCell.Node = _grd.Tree.FindNode(node.RowListIndex)
AddGridTreeNode(pNode, node)
Next
_uploading = False
UnLockGridAutoRedraw()
End Sub
Friend Sub NodeDeleteChildCommand(startMoveRow As Integer, nodes As List(Of RowNode))
LockGridAutoRedraw()
_uploading = True
Dim node As RowNode
Dim grdNode As FlexCell.Node
For i As Integer = 0 To nodes.Count - 1
node = nodes(i) '前面节点已删除,所以每次都是固定位置
If node Is Nothing Then Exit For
'更新控件
grdNode = _grd.Tree.FindNode(node.RowListIndex)
grdNode.Remove()
'更新内存
If node.CanDelete = False Then Exit For
node.Remove()
'其他操作
StationEditStatusMonitor.StationEditStatus = StationEditStatusMonitor.StationEditStatusEnum.Changed
Next
_uploading = False
UnLockGridAutoRedraw()
End Sub
''' <summary>
''' 同级节点添加
''' </summary>
''' <param name="startMoveRow"></param>
''' <param name="rows"></param>
''' <param name="nodes"></param>
Friend Sub NodeAddCommand(startMoveRow As Integer, rows As Integer, Optional nodes As List(Of RowNode) = Nothing)
Dim node As RowNode
Dim startNode As RowNode = _headNode.RowList(startMoveRow - _drawStartRow + 1)

View File

@@ -130,7 +130,7 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="TeeChart">
<HintPath>..\AUTS_Repair\bin\Debug\TeeChart.dll</HintPath>
<HintPath>..\DLL\TeeChart.dll</HintPath>
</Reference>
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.26\lib\net48\Ubiety.Dns.Core.dll</HintPath>
@@ -200,6 +200,8 @@
<Compile Include="Security\Aes128.vb" />
<Compile Include="Security\MD5.vb" />
<Compile Include="Serialize\Serializer.vb" />
<Compile Include="UTSModule\Station\GridNodeCommands\GridControlNodeDeleteCommand.vb" />
<Compile Include="UTSModule\Station\GridNodeCommands\GridControlNodeAddCommand.vb" />
<Compile Include="UTSModule\Station\GridNodeCommands\GridNodeAddCommand.vb" />
<Compile Include="UTSModule\Station\GridNodeCommands\GridNodeCopyPasteCommand.vb" />
<Compile Include="UTSModule\Station\GridNodeCommands\GridNodeCutPasteCommand.vb" />