修复xml设备链表上传缺失设备类型问题
This commit is contained in:
@@ -5397,7 +5397,7 @@ Public Class FrmMain
|
||||
updataDevnode.DevName = node.Text
|
||||
|
||||
updataDevnode.DevAttr = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, String)))
|
||||
updataDevnode.DevFunc = New Dictionary(Of String, (String, Dictionary(Of String, (String, String))))
|
||||
updataDevnode.DevFunc = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, (String, String)))))
|
||||
|
||||
''遍历节点默认第一个节点为设备属性
|
||||
For i As Integer = 0 To node.Nodes.Count - 1
|
||||
@@ -5406,10 +5406,10 @@ Public Class FrmMain
|
||||
updataDevnode.DevAttr.Add(node.Nodes(i).Text, attr)
|
||||
For j As Integer = 0 To node.Nodes(i).Nodes.Count - 1
|
||||
Dim attr2 As Dictionary(Of String, String) = New Dictionary(Of String, String)
|
||||
attr.Add(node.Nodes(i).Nodes(j).Text, attr2)
|
||||
attr.Add(node.Nodes(i).Nodes(j).name, attr2)
|
||||
'继续遍历子节点
|
||||
For k As Integer = 0 To node.Nodes(i).Nodes(j).Nodes.Count - 1
|
||||
attr2.Add(node.Nodes(i).Nodes(j).Nodes(k).Text, node.Nodes(i).Nodes(j).Nodes(k).devicetype.ToString)
|
||||
attr2.Add(node.Nodes(i).Nodes(j).Nodes(k).name, node.Nodes(i).Nodes(j).Nodes(k).devicetype.ToString)
|
||||
Next
|
||||
Next
|
||||
Else
|
||||
@@ -5417,31 +5417,44 @@ Public Class FrmMain
|
||||
If node.Nodes(i).name <> "RS485" AndAlso node.Nodes(i).name <> "VirtualObject" Then
|
||||
'遍历节点的子节点
|
||||
Dim devtype As String = "0"
|
||||
Dim tnodename As String
|
||||
Dim addr As String = "0"
|
||||
Dim tnodename As String
|
||||
If isRoot Then
|
||||
'"设备存在组:DO设备组信息"
|
||||
tnodename = $"设备存在组:{node.Nodes(i).name}设备组信息"
|
||||
tnodename = $"{node.Nodes(i).name}设备组信息"
|
||||
If updataDevnode.DevAttr.Values(0).ContainsKey(tnodename) Then
|
||||
|
||||
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("存在:DeviceType") Then
|
||||
devtype = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("存在:DeviceType")
|
||||
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("DeviceType") Then
|
||||
devtype = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("DeviceType")
|
||||
End If
|
||||
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("DeviceAddr") Then
|
||||
addr = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("DeviceAddr")
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
devtype = node.Nodes(i).DEV_TYPE_DATA
|
||||
tnodename = "设备存在"
|
||||
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("拨码地址") Then
|
||||
addr = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("拨码地址")
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim func As Dictionary(Of String, (String, String)) = New Dictionary(Of String, (String, String))
|
||||
' 功能块名 ,类型值 ,别名,序号
|
||||
' Dictionary(Of String, (String, Dictionary(Of String, String)))
|
||||
updataDevnode.DevFunc.Add(node.Nodes(i).Text, (devtype, func))
|
||||
Dim func1 As New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, (String, String))))
|
||||
Dim func2 As New Dictionary(Of String, Dictionary(Of String, (String, String)))
|
||||
Dim func As New Dictionary(Of String, (String, String))
|
||||
' 功能块名 , 类型值 , 功能块地址 别名,序号
|
||||
' Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, String)))
|
||||
func2.Add(addr, func)
|
||||
func1.Add(devtype, func2)
|
||||
updataDevnode.DevFunc.Add(node.Nodes(i).Text, func1) ' (devtype, func))
|
||||
|
||||
'Dim tag As AttributeRowNodeTag = node.Tag
|
||||
|
||||
For j As Integer = 0 To node.Nodes(i).Nodes.Count - 1
|
||||
|
||||
func.Add(node.Nodes(i).Nodes(j).Text, (node.Nodes(i).Nodes(j).index + 1, node.Nodes(i).Nodes(j).deviceAlias))
|
||||
func.Add(node.Nodes(i).Nodes(j).index + 1, (node.Nodes(i).Nodes(j).Text, node.Nodes(i).Nodes(j).deviceAlias))
|
||||
|
||||
Next
|
||||
End If
|
||||
@@ -5549,8 +5562,8 @@ Public Class UpdataDevnode
|
||||
Public Property DevName As String
|
||||
'设备属性列表
|
||||
Public Property DevAttr As Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, String)))
|
||||
'设备功能模块列表 功能模块名称,功能模块回路别名和回路序号 《设备功能名称,《设备类型 ,设备回路集合《回路名称,回路序号》》》
|
||||
Public Property DevFunc As Dictionary(Of String, (String, Dictionary(Of String, (String, String))))
|
||||
' 功能块名 , 类型值 , 功能块地址 序号 回路名 别名
|
||||
Public Property DevFunc As Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, (String, String)))))
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user