feat: 更新节能属性和服务行添加功能
- 在 EnergySavingAttribute.vb 中添加了全局亮度节能的字典初始化。 - 在 FrmMain.vb 中修改了 AddServiceRow 方法,增加了可选参数以支持显示标志。 - 在 PowerSupply.vb 中实现了删除和设置服务的功能,增强了对场景号的处理。 - 在 ServiceAttribute.vb 中增加了对服务类型的删除确认,避免误删系统服务。 - 更新了版本号至 4.4.5.42,并修改了相关的发布文件。
This commit is contained in:
@@ -45,12 +45,137 @@ Public Class PowerSupply
|
||||
'改用设置标志位到无卡取电中
|
||||
|
||||
End If
|
||||
|
||||
Dim portname, chname As String
|
||||
For i = 1 To PortTable.Rows - 1
|
||||
portname = PortTable.Cell(i, 2).Text
|
||||
chname = PortTable.Cell(i, 0).Text
|
||||
If String.IsNullOrEmpty(portname) Then Continue For
|
||||
SetG_TableGridService(portname, chname)
|
||||
Next
|
||||
|
||||
Me.DialogResult = System.Windows.Forms.DialogResult.OK
|
||||
Me.Close()
|
||||
Return
|
||||
End Sub
|
||||
|
||||
Public Sub deleteG_TableGridService(intenndoe As DeviceChildNode)
|
||||
Dim portname, chname As String
|
||||
Dim cbuf As String() = intenndoe.Description.Split(",")
|
||||
If cbuf.Length > 1 Then
|
||||
portname = cbuf(1)
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
|
||||
|
||||
chname = intenndoe.Name
|
||||
If String.IsNullOrEmpty(portname) Then Return
|
||||
'从名称中提取场景号绑定端口名称格式为 portname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})"
|
||||
Dim addserviceData As String
|
||||
Dim sceneid As String = portname.Substring(portname.LastIndexOf("(") + 1, portname.LastIndexOf(")") - portname.LastIndexOf("(") - 1)
|
||||
Dim serviceData As String
|
||||
'遍历g_TableGrid表找到该场景号对应行
|
||||
Dim tabrows As Integer = g_TableGrid.Rows - 2
|
||||
|
||||
For tabrow = 1 To tabrows
|
||||
serviceData = g_TableGrid.Cell(tabrow, TableColNumber.SceneID).Text
|
||||
If g_TableGrid.Cell(tabrow, TableColNumber.SceneID).Text.Equals(sceneid) Then
|
||||
serviceData = g_TableGrid.Cell(tabrow, TableColNumber.ServerAttribute).Text
|
||||
If chname.Contains("CH1") Then
|
||||
addserviceData = "13,1,0,1,"
|
||||
ElseIf chname.Contains("CH2") Then
|
||||
addserviceData = "32,1,0,1,"
|
||||
ElseIf chname.Contains("CH3") Then
|
||||
addserviceData = "33,1,0,1,"
|
||||
ElseIf chname.Contains("CH4") Then
|
||||
addserviceData = "34,1,0,1,"
|
||||
ElseIf chname.Contains("CH5") Then
|
||||
addserviceData = "35,1,0,1,"
|
||||
ElseIf chname.Contains("CH6") Then
|
||||
addserviceData = "36,1,0,1,"
|
||||
ElseIf chname.Contains("CH7") Then
|
||||
addserviceData = "37,1,0,1,"
|
||||
ElseIf chname.Contains("CH8") Then
|
||||
addserviceData = "38,1,0,1,"
|
||||
ElseIf chname.Contains("CH9") Then
|
||||
addserviceData = "39,1,0,1,"
|
||||
ElseIf chname.Contains("CH10") Then
|
||||
addserviceData = "40,1,0,1,"
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
'判断serviceData是否包含addserviceData
|
||||
If serviceData.Contains(addserviceData) Then
|
||||
'清除serviceData中addserviceData
|
||||
serviceData = serviceData.Replace(addserviceData, "")
|
||||
'更新g_TableGrid表中的ServerAttribute列
|
||||
g_TableGrid.Cell(tabrow, TableColNumber.ServerAttribute).Text = serviceData.Trim
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub SetG_TableGridService(portname As String, chname As String)
|
||||
Dim serviceData As String
|
||||
Dim addserviceData As String
|
||||
''遍历PortTable表
|
||||
'For i = 1 To PortTable.Rows - 1
|
||||
' '获取绑定端口名称
|
||||
' portname = PortTable.Cell(i, 2).Text
|
||||
' chname = PortTable.Cell(i, 0).Text
|
||||
'判断该名称是否为空
|
||||
If String.IsNullOrEmpty(portname) Then Return
|
||||
'从名称中提取场景号绑定端口名称格式为 portname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})"
|
||||
Dim sceneid As String = portname.Substring(portname.LastIndexOf("(") + 1, portname.LastIndexOf(")") - portname.LastIndexOf("(") - 1)
|
||||
'遍历g_TableGrid表找到该场景号对应行
|
||||
For j = 1 To g_TableGrid.Rows - 1
|
||||
If g_TableGrid.Cell(j, TableColNumber.SceneID).Text.Equals(sceneid) Then
|
||||
serviceData = g_TableGrid.Cell(j, TableColNumber.ServerAttribute).Text
|
||||
'21,1,0,1,
|
||||
'21,2,10,2,
|
||||
If chname.Contains("CH1") Then
|
||||
addserviceData = "13,1,0,1,"
|
||||
ElseIf chname.Contains("CH2") Then
|
||||
addserviceData = "32,1,0,1,"
|
||||
ElseIf chname.Contains("CH3") Then
|
||||
addserviceData = "33,1,0,1,"
|
||||
ElseIf chname.Contains("CH4") Then
|
||||
addserviceData = "34,1,0,1,"
|
||||
ElseIf chname.Contains("CH5") Then
|
||||
addserviceData = "35,1,0,1,"
|
||||
ElseIf chname.Contains("CH6") Then
|
||||
addserviceData = "36,1,0,1,"
|
||||
ElseIf chname.Contains("CH7") Then
|
||||
addserviceData = "37,1,0,1,"
|
||||
ElseIf chname.Contains("CH8") Then
|
||||
addserviceData = "38,1,0,1,"
|
||||
ElseIf chname.Contains("CH9") Then
|
||||
addserviceData = "39,1,0,1,"
|
||||
ElseIf chname.Contains("CH10") Then
|
||||
addserviceData = "40,1,0,1,"
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
'判断serviceData是否包含addserviceData
|
||||
If serviceData.Contains(addserviceData) Then
|
||||
Return
|
||||
End If
|
||||
'判断serviceData是否为空
|
||||
If String.IsNullOrEmpty(serviceData) Then
|
||||
serviceData = addserviceData
|
||||
Else
|
||||
serviceData = $"{addserviceData}{vbLf}{serviceData}"
|
||||
End If
|
||||
g_TableGrid.Cell(j, TableColNumber.ServerAttribute).Text = serviceData
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
'Next
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub SetDevDescription()
|
||||
If IsNothing(UniqueDevice) Then Return
|
||||
|
||||
@@ -119,6 +244,7 @@ Public Class PowerSupply
|
||||
' Continue For
|
||||
End If
|
||||
'rstr = rstr.Remove(0, 1)
|
||||
deleteG_TableGridService(NoCardNode.Nodes(i - 1))
|
||||
NoCardNode.Nodes(i - 1).Description = rstr
|
||||
Next
|
||||
Else
|
||||
@@ -137,6 +263,7 @@ Public Class PowerSupply
|
||||
' Continue For
|
||||
End If
|
||||
'rstr = rstr.Remove(0, 1)
|
||||
deleteG_TableGridService(NoCardNode.Nodes(i - 1))
|
||||
NoCardNode.Nodes(i - 1).Description = rstr
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -9,7 +9,7 @@ Public Class ServiceAttribute
|
||||
Public G_input As String
|
||||
|
||||
Private g_dicComboBox1 As Dictionary(Of String, String)
|
||||
|
||||
Public g_diaplay As Boolean
|
||||
Public G_result As String
|
||||
Enum STcolname
|
||||
<Description("输入序号")>
|
||||
@@ -69,6 +69,7 @@ Public Class ServiceAttribute
|
||||
Dim buff() As String = datastr.Split(vbLf)
|
||||
Dim isok As Boolean
|
||||
For Each index In buff
|
||||
If String.IsNullOrEmpty(index) Then Continue For
|
||||
isok = False
|
||||
|
||||
Dim buf() As String = index.Split(",")
|
||||
@@ -115,6 +116,7 @@ Public Class ServiceAttribute
|
||||
Dim C1, C2, C3, C4 As String
|
||||
|
||||
For Each index In buff
|
||||
If String.IsNullOrEmpty(index) Then Continue For
|
||||
C1 = String.Empty
|
||||
C2 = String.Empty
|
||||
C3 = String.Empty
|
||||
@@ -389,6 +391,19 @@ Public Class ServiceAttribute
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
If Table_Grid1.ActiveCell.Row > 0 Then
|
||||
'判断选中服务是否在25 到57区间
|
||||
Dim tstr As String = Table_Grid1.Cell(Table_Grid1.ActiveCell.Row, STcolname.服务类型).Text.Trim
|
||||
Dim arr As String() = tstr.Split(":")
|
||||
Dim LoopAddri As Integer = Integer.Parse(arr(0).Trim)
|
||||
If LoopAddri >= 25 AndAlso LoopAddri <= 57 Then
|
||||
'弹框二次删除确认
|
||||
If MessageBox.Show("该服务为系统服务,删除后可能导致系统异常,是否继续删除?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.Yes Then
|
||||
Table_Grid1.Row(Table_Grid1.ActiveCell.Row).Delete()
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
|
||||
Table_Grid1.Row(Table_Grid1.ActiveCell.Row).Delete()
|
||||
End If
|
||||
End Sub
|
||||
@@ -416,7 +431,27 @@ Public Class ServiceAttribute
|
||||
|
||||
|
||||
Case STcolname.服务类型
|
||||
Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_1.ToArray)
|
||||
|
||||
For Each item In Dic_1
|
||||
'切割字符串(item) 提取LoopAddr
|
||||
Dim arr As String() = item.Split(":")
|
||||
'判斷 g_display
|
||||
If g_diaplay Then
|
||||
|
||||
Else
|
||||
'将arr(0)转为int
|
||||
Dim LoopAddri As Integer = Integer.Parse(arr(0).Trim)
|
||||
'過濾掉arr >= 25 AndAlso Node.LoopAddr <= 57
|
||||
If LoopAddri >= 25 AndAlso LoopAddri <= 57 Then
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Table_Grid1.ComboBox(e.Col).Items.Add(item)
|
||||
Next
|
||||
'Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_1.ToArray)
|
||||
|
||||
Case Else
|
||||
|
||||
|
||||
@@ -1431,10 +1431,11 @@ Public Class TableInteraction
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function AddServiceRow() As Boolean
|
||||
Public Function AddServiceRow(Optional display As Boolean = False) As Boolean
|
||||
Dim fromshow As New ServiceAttribute
|
||||
fromshow.G_input ="" '_grd.Cell(_grd.ActiveCell.Row, TableColNumber.ServerAttribute).Text
|
||||
fromshow.G_hostNode = Nothing
|
||||
fromshow. g_diaplay=display
|
||||
For Each Anode In Dic_Devicemodel.Item(hostname).Nodes
|
||||
If Anode.Name.Equals("HOSTSERVICE") Then
|
||||
fromshow.G_hostNode = Anode
|
||||
|
||||
Reference in New Issue
Block a user