增加对 设备 无线锁_杨格无线锁_(RS485-主动) 的支持
This commit is contained in:
754
BLV_Studio/SetLoopInformation.vb
Normal file
754
BLV_Studio/SetLoopInformation.vb
Normal file
@@ -0,0 +1,754 @@
|
||||
Imports System.ComponentModel
|
||||
Imports Newtonsoft.Json
|
||||
|
||||
Public Class SetLoopInformation
|
||||
Public Enum DeviceType
|
||||
<Description("主机继电器")>
|
||||
Relay = 1
|
||||
<Description("弱电输出")>
|
||||
LVout = 3
|
||||
<Description("服务信息")>
|
||||
ServiceInfo = 4
|
||||
<Description("窗帘")>
|
||||
Curtain = 5
|
||||
<Description("开关扩展")>
|
||||
SwitchExpand = 6
|
||||
<Description("空调")>
|
||||
AirConditioner = 7
|
||||
<Description("红外感应")>
|
||||
InFrared = 8
|
||||
<Description("空气质量检测")>
|
||||
AirDetect = 9
|
||||
<Description("插卡取电")>
|
||||
CardPower = 10
|
||||
<Description("地暖")>
|
||||
FloorHot = 11
|
||||
<Description("扩展继电器")>
|
||||
Expand = 14
|
||||
<Description("电视")>
|
||||
TV = 15
|
||||
<Description("LED调光")>
|
||||
Dimmer = 16
|
||||
<Description("可控硅调光")>
|
||||
Traic = 17
|
||||
<Description("灯带调光")>
|
||||
Strip = 18
|
||||
<Description("PWM调光")>
|
||||
PWMDimmer = 23
|
||||
<Description("PWM扩展")>
|
||||
PWMExpand = 24
|
||||
<Description("音乐")>
|
||||
Music = 21
|
||||
<Description("微信锁")>
|
||||
WXLock = 20
|
||||
<Description("PB LED")>
|
||||
PBLED = 25
|
||||
<Description("485A9IO继电器")>
|
||||
A9IORelay = 28
|
||||
<Description("PB20")>
|
||||
PB20 = 30
|
||||
<Description("PB20-LD")>
|
||||
PB20_LD = 31
|
||||
<Description("PB20-LS")>
|
||||
PB20_LS = 32
|
||||
<Description("PB20-RELAY")>
|
||||
PB20_RELAY = 33
|
||||
<Description("色温")>
|
||||
ColorTemp = 34
|
||||
<Description("碳达人")>
|
||||
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
|
||||
For Each item In li
|
||||
If G_loopNameAddr.ContainsKey(item.ModalAddress) Then
|
||||
Continue For
|
||||
Else
|
||||
G_loopNameAddr.Add(item.ModalAddress, item.Name)
|
||||
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 <> "Cc2022OK" 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
|
||||
|
||||
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 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
|
||||
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
|
||||
Reference in New Issue
Block a user