Imports System.ComponentModel Imports Newtonsoft.Json Public Class SetLoopInformation Public Enum DeviceType Relay = 1 LVout = 3 ServiceInfo = 4 Curtain = 5 SwitchExpand = 6 AirConditioner = 7 InFrared = 8 AirDetect = 9 CardPower = 10 FloorHot = 11 Expand = 14 TV = 15 Dimmer = 16 Traic = 17 Strip = 18 PWMDimmer = 23 PWMExpand = 24 Music = 21 WXLock = 20 PBLED = 25 A9IORelay = 28 PB20 = 30 PB20_LD = 31 PB20_LS = 32 PB20_RELAY = 33 ColorTemp = 34 CarbonVIP = 54 End Enum Public G_ReportingScenario As ReportingScenario Public G_loopNameAddr As Dictionary(Of String, String) Public G_roomtypeid As Integer Public G_Hotelid As Integer Public G_Uploaduser As String Public IsLoadServer As Integer = 0 Public g_Oldloopinfo As String = "" Public DbConnString As String = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Port=3307;Database=blv_rcu_db;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;" Sub New(nReportingScenario As ReportingScenario, roomtypeid As Integer, hotelid As Integer, uploaduser As String) ' 此调用是设计器所必需的。 InitializeComponent() G_roomtypeid = roomtypeid G_Hotelid = hotelid G_Uploaduser = uploaduser G_loopNameAddr = New Dictionary(Of String, String) 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 '判断类型为 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() 调用之后添加任何初始化。 End Sub Private Sub SetLoopInformation_Load(sender As Object, e As EventArgs) Handles MyBase.Load initTable() End Sub '初始化表格 Private Sub initTable() Grid1.Cols = 21 Grid1.Rows = 1 Grid1.Column(0).Locked = True Grid1.Cell(0, 0).Text = "序号" Grid1.Cell(0, 1).Text = "启用" Grid1.Cell(0, 2).Text = "类型" Grid1.Cell(0, 3).Text = "回路地址" Grid1.Column(3).Locked = True Grid1.Column(4).Locked = True Grid1.Cell(0, 4).Text = "本地回路名称" Grid1.Cell(0, 5).Text = "云端回路地址" Grid1.Cell(0, 6).Text = "云端回路名称" Grid1.Cell(0, 7).Text = "英文名称" Grid1.Cell(0, 8).Text = "繁体名称" Grid1.Cell(0, 9).Text = "别名" Grid1.Cell(0, 10).Text = "功率" Grid1.Cell(0, 11).Text = "低电值" Grid1.Cell(0, 12).Text = "显示" Grid1.Cell(0, 13).Text = "离线" Grid1.Cell(0, 14).Text = "低电" Grid1.Cell(0, 15).Text = "声报" Grid1.Cell(0, 16).Text = "异常" Grid1.Cell(0, 17).Text = "排序" Grid1.Cell(0, 18).Text = "TCL设备名" Grid1.Cell(0, 19).Text = "组设备编号" Grid1.Cell(0, 20).Text = "组设备名" Grid1.Column(1).CellType = FlexCell.CellTypeEnum.CheckBox Grid1.Column(1).Width = 25 Grid1.Column(12).CellType = FlexCell.CellTypeEnum.CheckBox Grid1.Column(12).Width = 45 Grid1.Column(13).CellType = FlexCell.CellTypeEnum.CheckBox Grid1.Column(13).Width = 45 Grid1.Column(14).CellType = FlexCell.CellTypeEnum.CheckBox Grid1.Column(14).Width = 45 Grid1.Column(15).CellType = FlexCell.CellTypeEnum.CheckBox Grid1.Column(15).Width = 45 Grid1.Column(16).CellType = FlexCell.CellTypeEnum.CheckBox Grid1.Column(16).Width = 45 Grid1.Column(18).CellType = FlexCell.CellTypeEnum.ComboBox Grid1.Column(18).Width = 45 For i As Integer = 0 To 20 Grid1.Column(i).Alignment = FlexCell.AlignmentEnum.CenterCenter Next Grid1.SelectionMode = FlexCell.SelectionModeEnum.ByRow 'LoadTheLocalLoop(G_loopNameAddr) End Sub Private Sub Grid1_ComboDropDown(Sender As Object, e As FlexCell.Grid.ComboDropDownEventArgs) Handles Grid1.ComboDropDown If e.Row > 0 Then Grid1.ComboBox(18).Items.Clear() Grid1.ComboBox(18).Items.Add("R-红") Grid1.ComboBox(18).Items.Add("G-绿") Grid1.ComboBox(18).Items.Add("B-蓝") End If End Sub Private Sub AddRowGrid1(bufarry As String(), Optional istag As Boolean = False) If bufarry.Length <> 19 Then MsgBox("数据不完整") Return End If Dim LoopType As String = bufarry(0) If istag Then LoopType = GetLoopType(bufarry(1)) End If With Grid1 .AddItem("") .Cell(.Rows - 1, 0).Text = .Rows - 1 .Cell(.Rows - 1, 2).Text = LoopType For i As Integer = 3 To .Cols - 1 .Cell(.Rows - 1, i).Text = bufarry(i - 2) If istag Then .Cell(.Rows - 1, i).Tag = bufarry(i - 2) Else .Range(.Rows - 1, 1, .Rows - 1, .Cols - 1).ForeColor = Color.Red End If Next End With End Sub Public Function GetLoopType1(addr As String) As String Dim result As String If addr.Length > 2 Then Dim typestr As String = addr.Substring(0, 3) Dim type As Integer = Convert.ToInt32(typestr) ' "Relay", '"LVout", '"ServiceInfo", '"Curtain", '"SwitchExpand", '"AirConditioner", '"InFrared", '"AirDetect", '"CardPower", '"FloorHot", '"Expand", '"TV", '"Dimmer", '"Traic", '"Strip", '"WXLock", '"Music", '"PWMDimmer", '"PWMExpand", '"PBLED", '"A9IORelay", '"PB20", '"PB20_LD", '"PB20_LS", '"PB20_RELAY", '"ColorTemp", '"CarbonVIP", '"Curtain485" Select Case type Case DeviceType.Relay result = "Relay" Case DeviceType.LVout result = "LVout" Case DeviceType.ServiceInfo result = "ServiceInfo" Case DeviceType.Curtain result = "Curtain" Case DeviceType.SwitchExpand result = "SwitchExpand" Case DeviceType.AirConditioner result = "AirConditioner" Case DeviceType.InFrared result = "InFrared" Case DeviceType.AirDetect result = "AirDetect" Case DeviceType.CardPower result = "CardPower" Case DeviceType.FloorHot result = "FloorHot" Case DeviceType.Expand result = "Expand" Case DeviceType.TV result = "TV" Case DeviceType.Dimmer result = "Dimmer" Case DeviceType.Traic result = "Traic" Case DeviceType.Strip result = "Strip" Case DeviceType.PWMDimmer result = "PWMDimmer" Case DeviceType.PWMExpand result = "PWMExpand" Case DeviceType.Music result = "Music" Case DeviceType.WXLock result = "微信锁" Case DeviceType.PBLED result = "PB LED" Case DeviceType.A9IORelay result = "485A9IO继电器" Case DeviceType.PB20 result = "PB20" Case DeviceType.PB20_LD result = "PB20-LD" Case DeviceType.PB20_LS result = "PB20-LS" Case DeviceType.PB20_RELAY result = "PB20-RELAY" Case DeviceType.ColorTemp result = "ColorTemp" Case DeviceType.CarbonVIP result = "CarbonVIP" Case Else result = "Curtain485" End Select Return result Else Return result End If End Function Public Function GetLoopType(addr As String) As String Dim result As String If addr.Length > 2 Then Dim typestr As String = addr.Substring(0, 3) Dim type As Integer = Convert.ToInt32(typestr) Select Case type Case DeviceType.Relay result = "主机继电器" Case DeviceType.LVout result = "弱电输出" Case DeviceType.ServiceInfo result = "服务信息" Case DeviceType.Curtain result = "窗帘" Case DeviceType.SwitchExpand result = "开关扩展" Case DeviceType.AirConditioner result = "空调" Case DeviceType.InFrared result = "红外感应" Case DeviceType.AirDetect result = "空气质量检测" Case DeviceType.CardPower result = "插卡取电" Case DeviceType.FloorHot result = "地暖" Case DeviceType.Expand result = "扩展继电器" Case DeviceType.TV result = "电视" Case DeviceType.Dimmer result = "LED调光" Case DeviceType.Traic result = "可控硅调光" Case DeviceType.Strip result = "灯带调光" Case DeviceType.PWMDimmer result = "PWM调光" Case DeviceType.PWMExpand result = "PWM扩展" Case DeviceType.Music result = "音乐" Case DeviceType.WXLock result = "微信锁" Case DeviceType.PBLED result = "PB LED" Case DeviceType.A9IORelay result = "485A9IO继电器" Case DeviceType.PB20 result = "PB20" Case DeviceType.PB20_LD result = "PB20-LD" Case DeviceType.PB20_LS result = "PB20-LS" Case DeviceType.PB20_RELAY result = "PB20-RELAY" Case DeviceType.ColorTemp result = "色温" Case DeviceType.CarbonVIP result = "碳达人" Case Else result = "未知设备" End Select Return result Else Return result End If End Function Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs) Handles ToolStripButton5.Click Dim ew As Integer = Grid1.ActiveCell.Row If ew > 0 Then If MsgBox("是否删除第" & ew & "行", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then Grid1.RemoveItem(ew) End If End If End Sub Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Handles ToolStripButton4.Click Dim Nfrom As AddLoopInfo = New AddLoopInfo() If Nfrom.ShowDialog() = DialogResult.OK Then AddRowGrid1(Nfrom.LoopInfodic.ToArray, True) End If End Sub Private Sub ToolStripButton7_Click(sender As Object, e As EventArgs) Handles ToolStripButton7.Click If IsNothing(G_loopNameAddr) OrElse G_loopNameAddr.Count = 0 Then MsgBox("本地配置没有回路信息!") Return End If Dim isaddrow As Boolean = True Grid1.AutoRedraw = False Dim name As String initTable() For Each item In G_loopNameAddr isaddrow = True 'For i = 1 To Grid1.Rows - 1 ' If item.Key.Equals(Grid1.Cell(i, 2).Text) Then ' isaddrow = False ' name = Grid1.Cell(i, 3).Text ' If item.Value.Equals(name) Then ' Else ' Console.WriteLine($"{i}——{item.Value}——{name}") ' Grid1.Cell(i, 3).Text = item.Value ' Grid1.Cell(i, 3).ForeColor = Color.Red ' End If ' Exit For ' End If 'Next 'If isaddrow Then AddRowGrid1({"", item.Key, item.Value, "", "", "", "", "", "0", "0", "1", "0", "0", "0", "0", "1", "", "0", ""}, True) 'End If Next Grid1.AutoRedraw = True Grid1.Refresh() IsLoadServer = 1 End Sub Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click If IsLoadServer = 1 Then g_Oldloopinfo = "" Dim jsonString As String = HttpMothod.PostData("https://www.boonlive-rcu.com/api/LoadRoomTypeModalsWithPage", $"roomTypeID={G_roomtypeid}") If String.IsNullOrWhiteSpace(jsonString) Then MsgBox("获取服务器回路信息失败!") Return End If Dim login As RoomDeviceResponse = JsonConvert.DeserializeObject(Of RoomDeviceResponse)(jsonString) If login Is Nothing Then MsgBox("获取服务器回路信息异常!") Return End If g_Oldloopinfo = jsonString If login.total > 0 Then Dim bufarry As String() Grid1.AutoRedraw = False Dim isaddrow As Boolean = True For Each row As RoomDevice In login.rows isaddrow = True For i = 1 To Grid1.Rows - 1 If row.ModalAddress.Equals(Grid1.Cell(i, 3).Text) Then isaddrow = False Name = Grid1.Cell(i, 4).Text If row.Name.Equals(Name) Then If row.IsUploadBaoJing Then Grid1.Cell(i, 1).Text = 1 Else Grid1.Cell(i, 1).Text = 0 End If Grid1.Cell(i, 5).Text = row.ModalAddress Grid1.Cell(i, 6).Text = row.Name Grid1.Cell(i, 6).ForeColor = Color.Black Grid1.Cell(i, 4).ForeColor = Color.Black Grid1.Cell(i, 7).Text = row.EnglishName Grid1.Cell(i, 8).Text = row.TWName Grid1.Cell(i, 9).Text = row.AliasName Grid1.Cell(i, 10).Text = row.Power Grid1.Cell(i, 11).Text = row.LowPower Grid1.Cell(i, 12).Text = row.ActiveIndicator Grid1.Cell(i, 13).Text = row.OfflineDisplay Grid1.Cell(i, 14).Text = row.LowPowerDisplay Grid1.Cell(i, 15).Text = row.Beep Grid1.Cell(i, 16).Text = row.Abnormal Grid1.Cell(i, 17).Text = row.Sort Grid1.Cell(i, 18).Text = row.TCLDeviceName Grid1.Cell(i, 19).Text = row.MultipleGroupID Grid1.Cell(i, 20).Text = row.MultipleTCLName Else Console.WriteLine($"{i}——{row.Name}——{Name}") Grid1.Cell(i, 5).Text = row.ModalAddress Grid1.Cell(i, 6).Text = row.Name Grid1.Cell(i, 7).ForeColor = Color.Red Grid1.Cell(i, 3).ForeColor = Color.Red End If Exit For End If Next If isaddrow Then Dim LoopType = GetLoopType(row.ModalAddress) bufarry = {LoopType, "", "", row.ModalAddress, row.Name, row.EnglishName, row.TWName, row.AliasName, row.Power, row.LowPower, row.ActiveIndicator, row.OfflineDisplay, row.LowPowerDisplay, row.Beep, row.Abnormal, row.Sort, row.TCLDeviceName, row.MultipleGroupID, row.MultipleTCLName} AddRowGrid1(bufarry) End If Next Grid1.AutoRedraw = True Grid1.Refresh() IsLoadServer = 2 Else MsgBox("获取服务器回路信息为空!") Return End If ElseIf IsLoadServer = 2 Then MsgBox("已加载服务器回路信息,请勿重复加载!") Else MsgBox("请先加载本地回路信息!") End If End Sub Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) End Sub Private Sub Grid1_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles Grid1.CellChange If e.Row = 0 OrElse e.Col = 0 Then Return If String.IsNullOrEmpty(Grid1.Cell(e.Row, e.Col).Tag) Then Return Else If Grid1.Cell(e.Row, e.Col).Tag.Equals(Grid1.Cell(e.Row, e.Col).Text) Then Grid1.Cell(e.Row, e.Col).ForeColor = Color.Black Else Grid1.Cell(e.Row, e.Col).ForeColor = Color.Red End If End If End Sub Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs) Handles ToolStripButton6.Click If IsLoadServer = 2 Then '判断当前时间是否超过9月15号超过则禁止保存并弹窗 提示 'Dim now As DateTime = DateTime.Now 'If now.Month = 9 AndAlso now.Day >= 15 Then ' MsgBox("本功能为测试功能,当前已禁用!") ' Return 'End If If MsgBox("保存本地回路信息将覆盖云端回路信息,这将导致云端回路信息永久丢失,请确定是否要保存修改?", MsgBoxStyle.YesNo, "提示") = MsgBoxResult.Yes Then Dim strInputMsg As String = InputBox("请输入回路发布密码", "密码确认") If strInputMsg <> "123456" Then Return ToolStripButton6.Enabled = False Dim mSaveRoomTypeModal As SaveRoomTypeModal Dim mSaveRoomTypeModalList As New List(Of SaveRoomTypeModal) For i = 1 To Grid1.Rows - 1 If String.IsNullOrEmpty(Grid1.Cell(i, 3).Text) Then Continue For mSaveRoomTypeModal = New SaveRoomTypeModal mSaveRoomTypeModal.id = 0 mSaveRoomTypeModal.roomTypeID = G_roomtypeid mSaveRoomTypeModal.modalAddress = Grid1.Cell(i, 3).Text mSaveRoomTypeModal.name = Grid1.Cell(i, 4).Text mSaveRoomTypeModal.englishName = Grid1.Cell(i, 7).Text mSaveRoomTypeModal.twName = Grid1.Cell(i, 8).Text mSaveRoomTypeModal.aliasName = Grid1.Cell(i, 9).Text mSaveRoomTypeModal.power = CInt(Grid1.Cell(i, 10).Text) mSaveRoomTypeModal.LowPower = CInt(Grid1.Cell(i, 11).Text) mSaveRoomTypeModal.ActiveIndicator = CBool(Grid1.Cell(i, 12).Text) mSaveRoomTypeModal.OfflineDisplay = CBool(Grid1.Cell(i, 13).Text) mSaveRoomTypeModal.LowPowerDisplay = CBool(Grid1.Cell(i, 14).Text) mSaveRoomTypeModal.Beep = CBool(Grid1.Cell(i, 15).Text) mSaveRoomTypeModal.Abnormal = CBool(Grid1.Cell(i, 16).Text) mSaveRoomTypeModal.sort = CInt(Grid1.Cell(i, 17).Text) 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) If str.Equals("True") OrElse str.Equals("1") Then mSaveRoomTypeModal.IsUploadBaoJing = True Else mSaveRoomTypeModal.IsUploadBaoJing = False End If mSaveRoomTypeModal.outlet = "" mSaveRoomTypeModal.type = GetLoopType1(mSaveRoomTypeModal.modalAddress) mSaveRoomTypeModal.color = "" mSaveRoomTypeModalList.Add(mSaveRoomTypeModal) Next Dim Data As String = JsonConvert.SerializeObject(mSaveRoomTypeModalList) Dim url As String = "http://www.boonlive-rcu.com:7000/api/BaoYi/SaveRoomTypeModal" Dim jsonString As String = HttpMothod.PostData2(url, Data) If String.IsNullOrWhiteSpace(jsonString) OrElse jsonString.ToUpper.Contains("False".ToUpper) Then MsgBox("保存失败!") Else UploadOLdloopLog(G_Hotelid, G_roomtypeid, 0, g_Oldloopinfo, G_Uploaduser) MsgBox("保存成功!") End If Updatatime = Now Timer1.Start() 'Return True Else MsgBox("保存失败!") End If Else MsgBox("请先加载服务器回路信息!") 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 Dim result As Boolean = False Dim dbstr As String = $"INSERT INTO `blv_rcu_db`.`tbl_loopupdata_log` (`HotelID` ,`RoomTypeID` ,`ConfigVersion` ,`UploadUser`) VALUES ('{HotelID}' ,'{RoomTypeID}' ,'{ConfigVersion}' ,'{UploadUser}')" Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, DbConnString) db.Open() Try db.ExecuteDataTable(dbstr) Catch ex As Exception db.Close() result = False End Try db.Close() ' Return True End Using result = True Return result End Function Public Updatatime As DateTime Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If Now - Updatatime < TimeSpan.FromSeconds(60) Then ToolStripButton6.Text = $"上传回路{60 - (Now - Updatatime).Seconds}" ToolStripButton6.Enabled = False Else ToolStripButton6.Text = "上传回路" ToolStripButton6.Enabled = True Timer1.Stop() End If End Sub 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 Public Property RoomTypeID As Integer Public Property ModalAddress As String Public Property Outlet As String Public Property Name As String Public Property EnglishName As String Public Property TWName As String Public Property AliasName As String Public Property Power As Integer Public Property LowPower As Integer Public Property [Default] As Boolean Public Property Type As Integer Public Property TypeName As String Public Property Sort As Integer Public Property ActiveIndicator As Boolean Public Property OfflineDisplay As Boolean Public Property LowPowerDisplay As Boolean Public Property Beep As Boolean Public Property Abnormal As Boolean Public Property Color As String Public Property TCLDeviceName As String Public Property MultipleTCLName As String Public Property MultipleGroupID As Integer Public Property IsUploadBaoJing As Boolean End Class Public Class RoomDeviceResponse Public Property total As Integer Public Property rows As List(Of RoomDevice) End Class Public Class SaveRoomTypeModal 'id 更新的时候, 传入ID号 。如果是新增,id 写成0 'roomTypeID 房型编号 'modalAddress 设备地址 'outlet 输出口 'name 名字 'englishName 英文名字 'power 功率 单位瓦 数字Int 'twName 繁体名 'aliasName 别名 'type 类型 举例:Reply 是主机继电器 。类型数据 从接口4 来获取。 'sort 排序 'color 显示的时候的颜色值 RGB值,如:#FFFFFF 'WXActiveIndicator 微信启用 'ActiveIndicator 启用 'LowPower 低电值判断值 数字 'OfflineDisplay 离线保存显示 bool值 'LowPowerDisplay 是否低电保存显示 bool值 'Beep 是否声音报警 bool值 'Abnormal 是否异常判断 bool值 'MultipleGroupID TCL设备组ID Int 数字 'MultipleTCLName TCL设备组名字 'TCLDeviceName TCL设备组具体名字 22 Public Property id As Integer Public Property roomTypeID As Integer Public Property modalAddress As String Public Property outlet As String Public Property name As String Public Property englishName As String Public Property power As Integer Public Property twName As String Public Property aliasName As String Public Property type As String Public Property sort As Integer Public Property color As String Public Property WXActiveIndicator As Boolean Public Property ActiveIndicator As Boolean Public Property LowPower As Integer Public Property OfflineDisplay As Boolean Public Property LowPowerDisplay As Boolean Public Property Beep As Boolean Public Property Abnormal As Boolean Public Property MultipleGroupID As Integer Public Property MultipleTCLName As String Public Property TCLDeviceName As String Public Property IsUploadBaoJing As Boolean End Class