优化回路上传页面、节能属性上传页面、限制内部预留服务

This commit is contained in:
2026-01-05 11:03:10 +08:00
parent 5e9358ffb9
commit f845225ed7
10 changed files with 198 additions and 29 deletions

View File

@@ -79,14 +79,35 @@ Public Class SetLoopInformation
G_ReportingScenario = nReportingScenario
Dim li As List(Of MDevNodeMessage) = nReportingScenario.getDateDisposeRuning
Dim bdic As Dictionary(Of String, String) = nReportingScenario.getDevloop()
For Each item In li
If G_loopNameAddr.ContainsKey(item.ModalAddress) Then
Continue For
Else
G_loopNameAddr.Add(item.ModalAddress, item.Name)
'判断类型为 24 的 名称只取前2个字符
If item.Type.Equals("4") Then
'判断名称长度是否大于2
If item.Name.Length > 2 Then
G_loopNameAddr.Add(item.ModalAddress, item.Name.Substring(0, 2))
Else
G_loopNameAddr.Add(item.ModalAddress, item.Name)
End If
Else
G_loopNameAddr.Add(item.ModalAddress, item.Name)
End If
End If
Next
For Each item In bdic
If G_loopNameAddr.ContainsKey(item.Key) Then
Continue For
Else
G_loopNameAddr.Add(item.Key, item.Value)
End If
Next
' 在 InitializeComponent() 调用之后添加任何初始化。
@@ -531,7 +552,7 @@ Public Class SetLoopInformation
Dim strInputMsg As String = InputBox("请输入回路发布密码", "密码确认")
If strInputMsg <> "Cc2022OK" Then Return
If strInputMsg <> "123456" Then Return
ToolStripButton6.Enabled = False
Dim mSaveRoomTypeModal As SaveRoomTypeModal
Dim mSaveRoomTypeModalList As New List(Of SaveRoomTypeModal)
@@ -557,6 +578,7 @@ Public Class SetLoopInformation
mSaveRoomTypeModal.TCLDeviceName = Grid1.Cell(i, 18).Text
mSaveRoomTypeModal.MultipleGroupID = CInt(Grid1.Cell(i, 19).Text)
mSaveRoomTypeModal.MultipleTCLName = Grid1.Cell(i, 20).Text
mSaveRoomTypeModal.color = GetColorFromString(mSaveRoomTypeModal.modalAddress)
Dim str As String = Grid1.Cell(i, 1).Text
Console.WriteLine(str)
@@ -598,7 +620,60 @@ Public Class SetLoopInformation
End If
End Sub
Public Function GetColorFromString(inputString As String) As String
' 检查输入字符串是否有效
If String.IsNullOrEmpty(inputString) OrElse inputString.Length < 3 Then
Throw New ArgumentException("输入字符串必须至少包含3个字符")
End If
'提取前三位字符
Dim firstThreeDigits As String = inputString.Substring(0, 3)
' 将提取的字符串转换为数字(去掉前导零)
Dim number As Integer
If Not Integer.TryParse(firstThreeDigits, number) Then
Throw New ArgumentException("前三位字符必须是有效的数字")
End If
'判断是为4
If number <> 4 Then
Return "#000000"
End If
' 提取最后三位字符
Dim lastThreeDigits As String = inputString.Substring(inputString.Length - 3, 3)
' 将提取的字符串转换为数字(去掉前导零)
'Dim number As Integer
If Not Integer.TryParse(lastThreeDigits, number) Then
Throw New ArgumentException("最后三位字符必须是有效的数字")
End If
' 根据图片内容创建数字到颜色的映射
Dim colorMap As New Dictionary(Of Integer, String) From {
{1, "#FF8C69"}, {2, "#802A2A"}, {3, "#228B22"}, {4, "#FF00FF"},
{5, "#00FFFF"}, {6, "#0000FF"}, {7, "#FF34B3"}, {8, "#FF0000"},
{9, "#00FF00"}, {10, "#FF6200"}, {11, "#882657"}, {12, "#CD919E"},
{13, "#CD2626"}, {14, "#BD2626"}, {15, "#A4D3EE"}, {16, "#9F79EE"},
{17, "#9B30FF"}, {18, "#9A32CD"}, {19, "#8B4C39"}, {20, "#8B4513"},
{21, "#8B3A3A"}, {22, "#8B2252"}, {23, "#8B008B"}, {24, "#838B8B"},
{25, "#f7acbc"}, {26, "#ef5b9c"}, {27, "#f05b72"}, {28, "#f8aba6"},
{29, "#f69c9f"}, {30, "#f58f98"}, {31, "#ca8687"}, {32, "#f391a9"},
{33, "#bd6758"}, {34, "#d64f44"}, {35, "#d93a49"}, {36, "#b3424a"},
{37, "#deab8a"}, {38, "#fedcbd"}, {39, "#f47920"}, {40, "#905a3d"},
{41, "#8f4b2e"}, {42, "#87481f"}, {43, "#5f3c23"}, {44, "#6b473c"},
{45, "#faa755"}, {46, "#fab27b"}, {47, "#f58220"}, {48, "#905d1d"},
{49, "#8a5d19"}, {50, "#8c531b"}, {51, "#826858"}, {52, "#817936"},
{53, "#87843b"}, {54, "#726930"}, {55, "#454926"}, {56, "#2e3a1f"},
{57, "#444693"}, {58, "#2a5caa"}, {59, "#003a6c"}, {60, "#426ab3"},
{61, "#46485f"}, {62, "#181d4b"}, {63, "#6a6da9"}, {64, "#585eaa"}
}
' 检查数字是否在有效范围内
If number >= 1 AndAlso number <= 64 Then
Return colorMap(number)
Else
Throw New ArgumentException($"数字 {number} 不在有效范围内 (1-64)")
End If
End Function
'上传回路日志
Public Function UploadOLdloopLog(HotelID As String, RoomTypeID As String, ConfigVersion As String, Note As String, UploadUser As String) As Boolean
@@ -645,6 +720,32 @@ Public Class SetLoopInformation
Private Sub SetLoopInformation_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
Timer1.Stop()
End Sub
Private Sub ToolStripButton2_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
'判断按钮文本是否为“全选”
If ToolStripButton2.Text = "全选" Then
'将文本设置为取消全选
ToolStripButton2.Text = "取消全选"
'设置按钮文本颜色为 RoyalRed
ToolStripButton2.ForeColor = Color.Red
'将所有复选框选中
For i As Integer = 0 To Grid1.Rows - 1
Grid1.Cell(i, 1).Text = "True"
Next
Else
'将文本设置为全选
ToolStripButton2.Text = "全选"
'设置按钮文本颜色为 RoyalBlue
ToolStripButton2.ForeColor = Color.RoyalBlue
'将所有复选框取消选中
For i As Integer = 0 To Grid1.Rows - 1
Grid1.Cell(i, 1).Text = "False"
Next
End If
End Sub
End Class
Public Class RoomDevice
Public Property ID As Integer