同步无卡取电功能

This commit is contained in:
2026-02-27 14:45:16 +08:00
parent 4243e3e4d8
commit 2dbe9dda95
23 changed files with 1824 additions and 269 deletions

View File

@@ -2823,7 +2823,8 @@ Public Class TableInteraction
For Each node In index.Nodes
If node.Name.Equals("Virtual_Card") Then
UniqueDevice = index
NoCardNode = node
NoCardNode = node
If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
vli = PortInformation(NoCardNode)
nli = ConditionalInformation(UniqueDevice)
mli = EquipmentCommonStats(UniqueDevice)
@@ -2834,6 +2835,18 @@ Public Class TableInteraction
result.Add(mli)
End If
End If
else
vli = PortInformation1(NoCardNode)
nli = ConditionalInformation1(UniqueDevice)
If Not IsNothing(vli) AndAlso vli.Count > 0 AndAlso Not IsNothing(vli) AndAlso vli.Count > 0 Then
result.AddRange(vli)
result.AddRange(nli)
End If
End If
End If
Next
@@ -2864,6 +2877,7 @@ Public Class TableInteraction
Dim sbuf() As String
Dim isport As Boolean
For Each node In NoCardNode.Nodes
'If node.LoopAddr.Equals("1") Then Continue For '增加了跳过端口1的判断
sbuf = node.Description.Split(",")
isport = True
For i = 0 To sbuf.Length - 1
@@ -2873,7 +2887,28 @@ Public Class TableInteraction
Next
If isport AndAlso sbuf.Length > 4 Then
result.Add(GetPortInformation(node.LoopAddr, node.Description))
Else
Continue For
End If
Next
Return result
End Function
Public Function PortInformation1(NoCardNode As DeviceChildNodeClass) As List(Of Byte())
Dim result As New List(Of Byte())
Dim sbuf() As String
Dim isport As Boolean
For Each node In NoCardNode.Nodes
'If node.LoopAddr.Equals("1") Then Continue For '增加了跳过端口1的判断
sbuf = node.Description.Split(",")
isport = True
For i = 0 To sbuf.Length - 1
If String.IsNullOrEmpty(sbuf(i)) AndAlso (i <> 2 AndAlso i <> 3) Then
isport = False
End If
Next
If isport AndAlso sbuf.Length > 4 Then
result.Add(GetPortInformation1(node.LoopAddr, node.Description))
Else
Continue For
End If
@@ -2901,6 +2936,38 @@ Public Class TableInteraction
Data.Add(1)
End If
Return Data.ToArray
End Function
Public Function GetPortInformation1(LoopAddr As String nStr As String) As Byte()
Dim cmd As Byte = &H9
Dim Data = New List(Of Byte)
Dim strbuf() As String = nStr.Split(",")
Data.Add(cmd)
Data.Add(CInt(strbuf(8)))
Data.Add(CInt(strbuf(9)))
Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(7)))))
If String.IsNullOrEmpty(strbuf(2)) Then
Data.Add(0)
Else
Data.Add(CInt(strbuf(2)))
End If
Data.Add(CInt(LoopAddr)) '- 1) '增加了减1
If String.IsNullOrEmpty(strbuf(4)) OrElse strbuf(4).Equals("0") Then
Data.Add(0)
Else
Data.Add(1)
End If
if String.IsNullOrEmpty(strbuf(5)) OrElse strbuf(5).Equals("0") Then
Data.AddRange(BitConverter.GetBytes(CShort(0)))
Else
Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(5)))))
End If
Data.Add(GetGlossary8(strbuf(6)))
If String.IsNullOrEmpty(strbuf(3)) Then
Data.Add(0)
Else
Data.Add(CInt(strbuf(3)))
End If
Return Data.ToArray
End Function
Public Function ConditionalInformation(UniqueDevice As DeviceModel) As List(Of Byte())
Dim result As New List(Of Byte())
@@ -2931,6 +2998,56 @@ Public Class TableInteraction
Next
Next
Return result
End Function
Public Function ConditionalInformation1(UniqueDevice As DeviceModel) As List(Of Byte())
Dim result As New List(Of Byte())
Dim sbuf() As String
Dim isport As Boolean
Dim IfGridRowdic As Dictionary(Of String, List(Of String))
Try
IfGridRowdic = JsonConvert.DeserializeObject(Of Dictionary(Of String, List(Of String)))(UniqueDevice.Desc.DevDescription)
Catch ex As Exception
Return Nothing
End Try
If IsNothing(IfGridRowdic) Then Return result
For Each index In IfGridRowdic
For Each node In index.Value
sbuf = node.Split(",")
isport = True
For Each nStr In sbuf
If String.IsNullOrEmpty(nStr) Then
isport = False
End If
Next
If isport AndAlso sbuf.Length > 3 Then
result.Add(GetConditionalInformation1(index.Key, node))
Else
Continue For
End If
Next
Next
Return result
End Function
Public Function GetConditionalInformation1(key As String, nStr As String) As Byte()
Dim cmd As Byte = &H8
Dim Data = New List(Of Byte)
Dim strbuf() As String = nStr.Split(",")
Dim nbbuf() As String
Data.Add(cmd)
nbbuf = strbuf(1).Split(":")
Data.Add(PowerSupply.GetNoCarDataKeyVal(nbbuf(0)))
Data.Add(CInt(key))
Data.Add(strbuf(0))
Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(14)))))
Data.Add(GetGlossary8(strbuf(15)))
For i = 1 To 11 '11变成10
'nbbuf = strbuf(i + 1).Split(":")
Data.Add(PowerSupply.GetNoCarDataKeyVal(strbuf(i + 1))) 'i 加 1 编程 i+2
Next
Data.AddRange(BitConverter.GetBytes(CShort(CInt(strbuf(16)))))
Data.Add(GetGlossary8(strbuf(17)))
Return Data.ToArray
End Function
'条件信息
Public Function GetConditionalInformation(key As String, nStr As String) As Byte()
@@ -2955,7 +3072,7 @@ Public Class TableInteraction
Public Function GetGlossary8(sb As String) As Byte
Dim result As Byte = 0
Select Case sb
Case "S"
Case "S","s"
result = 1
Case "m"
result = 2
@@ -3297,7 +3414,7 @@ Public Class TableInteraction
End Select
Next
If Not String.IsNullOrEmpty(onecelltag.Item("7 Set music volume")) Then
Musicdic.Add(7, onecelltag.Item("7 Set music volume"))
End If
@@ -3358,7 +3475,7 @@ Public Class TableInteraction
End If
If String.IsNullOrEmpty(partime) AndAlso String.IsNullOrEmpty(partime1) Then Continue For
'If String.IsNullOrEmpty(partime) AndAlso String.IsNullOrEmpty(partime1) Then Continue For
If Rdic.ContainsKey("Dimming".ToUpper) OrElse Rdic.ContainsKey("PB_LINE_CONTROL".ToUpper) Then
For Each devRKEYnode In devRKEY
If Not String.IsNullOrEmpty(partime2) Then
@@ -5980,7 +6097,7 @@ Public Class TableInteraction
Air485ment.Add(Fnode)
Case "485FloorHeat", "CLEDFLOORHEAT"
Heat485ment.Add(Fnode)
Case "语音"
Case "Voice"
Voicement.Add(Fnode)
Case "Virtual_Card"
VirtualCard.Add(Fnode)
@@ -6245,6 +6362,7 @@ Public Class TableInteraction
If outputGroupNode Is Nothing Then
outputCount = 0
Else
If not outputGroupNode.DEV_TYPE_DATA.Equals("4") Then
For Each node In outputGroupNode.Nodes
'If node.RowType <> RowNode.RowTypeEnum.DeviceObject Then Continue For
'If node.Compile = False Then Continue For
@@ -6259,7 +6377,10 @@ Public Class TableInteraction
Console.WriteLine($"{node.DefaultAliasName}{vbCrLf}")
Next
Console.WriteLine($"{outputGroupNode.Name}:{outputGroupNode.Nodes.Count }:{outputAliases.Count }{vbCrLf}")
End If
End If
End If
buf.AddRange(BitConverter.GetBytes(inputCount)) '输入回路数(2字节)
buf.AddRange(BitConverter.GetBytes(outputCount)) '输出回路数(2字节)