Files
Desktop_BLVStudio/BLV_Studio/Test/GridTest/PowerSupply.vb

2480 lines
111 KiB
VB.net
Raw Normal View History

2025-12-11 10:06:44 +08:00
Imports BLV_Studio.TableInteraction
Imports FlexCell
Imports Newtonsoft.Json
Public Class PowerSupply
''' <summary>
''' 设备键值对 设备名-设备信息集合 主机=主机名 外设=外设名+播马地址
''' </summary>
Private Dic_Devicemodel As Dictionary(Of String DeviceModel
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Not UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
Dim msgid As Integer = ConditionCheck()
If msgid > 0 Then
Select Case msgid
Case 1
MsgBox("最后一个条件组必须为'有人至无人'")
'Case 2
' MsgBox("不能有多组'短暂离开'的条件组!")
Case 3
MsgBox("'短暂离开'的条件组至少包含两组条件!")
Case 4
MsgBox("不能有多组'长期离开'的条件组!")
End Select
Return
End If
End If
GetPortTable()
GetIfTable()
SetDevDescription()
If Not IsCheckBox5 = CheckBox5.Checked Then
If CheckBox5.Checked Then
g_TableGrid.Cell(0, 0).Tag = 1
Else
g_TableGrid.Cell(0, 0).Tag = 0
End If
'250903 CZH 将设置按键条件 控制取电服务注释,改用设置标志位到无卡取电中
'CheckBox5_CheckedChanged(Nothing, Nothing)
'改用设置标志位到无卡取电中
End If
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
Return
End Sub
Public Sub SetDevDescription()
If IsNothing(UniqueDevice) Then Return
Dim rstr = String.Empty
Dim C1 As String
If CheckBox4.Checked Then
rstr = $"1,"
Else
rstr = $"0,"
End If
If CheckBox6.Checked Then
C1 = "1"
Else
C1 = "0"
End If
rstr = $"{rstr}{NR_TextBox2.Text.Trim },{NR_ComboBox1.SelectedIndex + 1},{C1},{TextBox2.Text.Trim},{ComboBox1.SelectedIndex + 1}"
UniqueDevice.Desc.ProtocolData = rstr
End Sub
Public Sub GetDevDescription()
If IsNothing(UniqueDevice) Then Return
If String.IsNullOrEmpty(UniqueDevice.Desc.ProtocolData) Then Return
Dim rstr() As String = UniqueDevice.Desc.ProtocolData.Split(",")
If rstr(0) = "1" Then
CheckBox4.Checked = True
NR_TextBox2.Text = rstr(1)
NR_ComboBox1.SelectedIndex = CInt(rstr(2)) - 1
Else
CheckBox4.Checked = False
NR_TextBox2.Text = rstr(1)
NR_ComboBox1.SelectedIndex = CInt(rstr(2)) - 1
End If
If rstr.Length > 5 Then
If rstr(3).Equals("1") Then
CheckBox6.Checked = True
Else
CheckBox6.Checked = False
End If
TextBox2.Text = rstr(4)
ComboBox1.SelectedIndex = CInt(rstr(5)) - 1
End If
End Sub
Public Function GetPortTable() As Boolean
If IsNothing(NoCardNode) Then Return False
Dim rstr As String = String.Empty
If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
For i = 1 To PortTable.Rows - 1
rstr = String.Empty
'For j = 1 To PortTable.Cols - 1
' rstr = $"{rstr},{PortTable.Cell(i, j).Text}"
'Next
'rstr = $"{rstr},{PortTable.Cell(i, 4).Tag}"
rstr = $"{PortTable.Cell(i, 2).Text}"
If ParseDevDic.ContainsKey(rstr) Then
Dim indexd = ParseDevDic.Item(rstr)
rstr = $"{PortTable.Cell(i, 1).Text},{rstr},{PortTable.Cell(i, 3).Text},{PortTable.Cell(i, 4).Text},{indexd.Keys(0)},{indexd.Values(0).Keys(0)},{indexd.Values(0).Values(0).Item(0).Item1 }"
Else
' Continue For
End If
'rstr = rstr.Remove(0, 1)
NoCardNode.Nodes(i - 1).Description = rstr
Next
Else
For i = 1 To PortTable.Rows - 1
rstr = String.Empty
'For j = 1 To PortTable.Cols - 1
' rstr = $"{rstr},{PortTable.Cell(i, j).Text}"
'Next
'rstr = $"{rstr},{PortTable.Cell(i, 4).Tag}"
rstr = $"{PortTable.Cell(i, 2).Text}"
If ParseDevDic.ContainsKey(rstr) Then
Dim indexd = ParseDevDic.Item(rstr)
rstr = $"{PortTable.Cell(i, 1).Text},{rstr},{PortTable.Cell(i, 3).Text},{PortTable.Cell(i, 4).Text},{PortTable.Cell(i, 5).Text},{PortTable.Cell(i, 6).Text},{PortTable.Cell(i, 7).Text},{indexd.Keys(0)},{indexd.Values(0).Keys(0)},{indexd.Values(0).Values(0).Item(0).Item1 }"
Else
' Continue For
End If
'rstr = rstr.Remove(0, 1)
NoCardNode.Nodes(i - 1).Description = rstr
Next
End If
Return True
End Function
Public Function GetIfTable() As Boolean
If IsNothing(UniqueDevice) Then Return False
Dim rstr As Dictionary(Of String, List(Of String)) = New Dictionary(Of String, List(Of String))
Dim headname As CtabRange
Dim keystr As String = String.Empty
Dim li As List(Of String)
Dim cra As CtabRange
For i = 1 To IfGrid.Rows - 1
headname = New CtabRange(IfGrid, i, 1) ' IfGrid.Cell(i, 1).Tag
If rstr.ContainsKey(headname.devname) Then
li = rstr.Item(headname.devname)
Else
li = New List(Of String)
rstr.Add(headname.devname, li)
End If
For j = 2 To IfGrid.Cols - 1
'If IfGrid.Column(j).Locked Then
' Continue For
'End If
If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
keystr = $"{keystr},{IfGrid.Cell(i, j).Text}"
Else
If j > 17 Then
cra = New CtabRange(IfGrid, i, j)
keystr = $"{keystr},{cra.devname}"
Else
keystr = $"{keystr},{IfGrid.Cell(i, j).Text}"
End If
End If
Next
keystr = keystr.Remove(0, 1)
li.Add(keystr)
keystr = String.Empty
Next
Dim str As String = JsonConvert.SerializeObject(rstr)
UniqueDevice.Desc.DevDescription = str
Return True
End Function
'条件检查
Public Function ConditionCheck() As Integer
'Console.WriteLine(IfGrid.Cell(IfGrid.Rows - 1, 3).Text)
If Not IfGrid.Cell(IfGrid.Rows - 1, 3).Text.Trim.Equals("有人至无人") Then
Return 1
End If
Dim headname As CtabRange
Dim duanli duanliindex As Integer
'判断短暂离开是否只有一组且条件数据量大于1
For i = 1 To IfGrid.Rows - 1
headname = New CtabRange(IfGrid, i, 1)
If IfGrid.Cell(headname.fr, 3).Text.Trim.Equals("短暂离开") Then
duanli = duanli + 1
'If duanli > 1 Then
' Return 2
'End If
'If headname.lr - headname.fr < 1 Then
' Return 3
'End If
End If
'If IfGrid.Cell(headname.fr, 3).Text.Trim.Equals("长期离开") Then
' duanli = duanli + 1
' If duanli > 1 Then
' Return 4
' End If
'End If
i = headname.lr
Next
Return 0
End Function
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
'数字0~9所对应的keychar为48~57
e.Handled = True
'输入0-9
If e.KeyChar = vbBack OrElse (Asc(e.KeyChar) >= 47 AndAlso Asc(e.KeyChar) <= 58) Then
e.Handled = False
End If
End Sub
Public Isoneload As Boolean = False
Private Sub PowerSupply_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If IsNothing(NoCardNode) Then
Else
If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
InitIfGrid(UniqueDevice.Desc.DevDescription)
InitPortTable(NoCardNode)
NR_ComboBox1.SelectedIndex = 1
ComboBox1.SelectedIndex = 1
GetDevDescription()
SetControlHiding(True)
Else
Isoneload = False
SetControlHiding(False)
InitIfGrid1(UniqueDevice.Desc.DevDescription)
InitPortTable1(NoCardNode)
Isoneload = True
End If
End If
End Sub
'设置控件隐藏或显示
Public Sub SetControlHiding(ishide As Boolean)
CheckBox3.Visible = ishide
CheckBox5.Visible = ishide
CheckBox6.Visible = ishide
CheckBox4.Visible = ishide
NR_label3.Visible = ishide
Label5.Visible = ishide
TextBox2.Visible = ishide
NR_TextBox2.Visible = ishide
NR_ComboBox1.Visible = ishide
ComboBox1.Visible = ishide
End Sub
#Region “初始化表格“
Private UniqueDevice As DeviceModel
Private NoCardNode As DeviceChildNodeClass
Private ParseDevDic As Dictionary(Of String Dictionary(Of String, Dictionary(Of String, List(Of (String, String)))))
'Public Sub ParseDeviceList(TableGrid As FlexCell.Grid)
' ParseDevDic = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, List(Of (String, String)))))
' If IsNothing(TableGrid) Then
' Return
' End If
' Dim keyname As String = String.Empty
' Dim loopval As String = String.Empty
' For i = TableRowNumber.Max To TableGrid.Rows - 1
' keyname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})"
' loopval = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}"
' Next
'End Sub
Public g_TableGrid As FlexCell.Grid
Public G_ActionConfiguration As List(Of TableRowTag)
Public IsCheckBox5 As Boolean
Public Sub ParseDeviceList(Devicemodel As Dictionary(Of String DeviceModel, TableGrid As FlexCell.Grid)
Dic_Devicemodel = Devicemodel
ParseDevDic = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, List(Of (String, String)))))
Dim typename As String
If Not IsNothing(TableGrid.Cell(0, 0).Tag) Then
Dim sss As String = TableGrid.Cell(0, 0).Tag.ToString
If TableGrid.Cell(0, 0).Tag.ToString.Equals("1") Then
CheckBox5.Checked = 1
IsCheckBox5 = True
Else
CheckBox5.Checked = 0
IsCheckBox5 = False
End If
End If
g_TableGrid = TableGrid
Dim keyname As String = String.Empty
Dim loopval As String = String.Empty
For i = TableRowNumber.Max To TableGrid.Rows - 1
keyname = $"{ TableGrid.Cell(i, TableColNumber.KeyName).Text}({TableGrid.Cell(i, TableColNumber.SceneID).Text})"
loopval = $"{ TableGrid.Cell(i, TableColNumber.KeyVal).Text}"
If keyname.Contains("雷达") OrElse keyname.Contains("红外") OrElse keyname.Contains("插卡") OrElse keyname.Contains("拔卡") OrElse keyname.Contains("门磁") Then
Dim griddev As CtabRange = New CtabRange(TableGrid, i, TableColNumber.DeviceName)
If griddev.devname.Equals("HOSTSERVICE") Then Continue For
If Dic_Devicemodel.ContainsKey(griddev.devname) Then
Dim index As DeviceModel = Dic_Devicemodel.Item(griddev.devname)
For Each node In index.Nodes
If node.Name.Equals("Virtual_Card") Then
UniqueDevice = index
NoCardNode = node
Exit For
Else
If node.Interface.Equals("DI") Then
For Each subnode In node.Nodes
If subnode.LoopAddr.Equals(loopval) Then
Dim loopli = New List(Of (String, String))
Dim loopdic = New Dictionary(Of String, List(Of (String, String)))
Dim addressdic = New Dictionary(Of String, Dictionary(Of String, List(Of (String, String))))
Dim addr As String
If index.Desc.Name.Equals("BLV_C12") Then
addr = 0
Else
addr = FindAttributeValueUnderModel(index, "设备存在", "拨码地址")
End If
ParseDevDic.Add(keyname, addressdic)
addressdic.Add(loopval, loopdic)
loopli.Add((addr, ""))
loopdic.Add(node.DEV_TYPE_DATA, loopli)
End If
Next
End If
End If
Next
Else
Continue For
End If
End If
Next
For Each index In Dic_Devicemodel.Values
For Each node In index.Nodes
If node.Name.Equals("Virtual_Card") Then
UniqueDevice = index
NoCardNode = node
Exit For
End If
' If node.Interface.Equals("DI") Then
' typename = GetAnotherName(node.Name)
' typename = $"{node.Name}"
' If String.IsNullOrEmpty(typename) Then
' Continue For
' Else
' Dim addressdic As Dictionary(Of String, Dictionary(Of String, List(Of (String, String))))
' If ParseDevDic.ContainsKey(typename) Then
' addressdic = ParseDevDic.Item(typename)
' Else
' addressdic = New Dictionary(Of String, Dictionary(Of String, List(Of (String, String))))
' ParseDevDic.Add(typename, addressdic)
' End If
' Dim addr As String
' Dim loopdic As Dictionary(Of String, List(Of (String, String)))
' Dim loopli As List(Of (String, String))
' If index.Desc.Name.Equals("BLV_C12") Then
' addr = 0
' Else
' addr = FindAttributeValueUnderModel(index, "设备存在", "拨码地址")
' End If
' If addressdic.ContainsKey(addr) Then
' loopdic = addressdic.Item(addr)
' Else
' loopdic = New Dictionary(Of String, List(Of (String, String)))
' addressdic.Add(addr, loopdic)
' End If
' If loopdic.ContainsKey(node.DEV_TYPE_DATA) Then
' loopli = loopdic.Item(node.DEV_TYPE_DATA)
' Else
' loopli = New List(Of (String, String))
' loopdic.Add(node.DEV_TYPE_DATA, loopli)
' End If
' For Each liindex In node.Nodes
' loopli.Add((liindex.LoopAddr, liindex.DefaultAliasName))
' Next
' End If
' Else
' Continue For
' End If
Next
Next
End Sub
Private Function FindAttributeValueUnderModel(pNode As DeviceModel, groupName As String, attributeName As String) As String
For Each cnode In pNode.Config
If cnode.Name.Equals(groupName) Then
For Each ccnode In cnode.Attributes
If ccnode.Name.Equals(attributeName) Then
Return ccnode.Value
End If
Next
End If
Next
End Function
Public Shared Function GetAnotherName(str As String) As String
Dim result As String = String.Empty
If String.IsNullOrEmpty(str) Then
Return result
Else
Select Case str
Case "CLED_FRESHAIR"
result = "CLED新风"
Case "CLEDFLOORHEAT"
result = "CLED地暖"
Case "485FloorHeat"
result = "地暖"
Case "485FreshAir"
result = "新风"
Case "485MUSIC"
result = "485音乐"
Case "CURTAIN"
result = "干接点窗帘"
Case "INFRARED_FORWARD"
result = "红外"
Case "RS485_Curtain"
result = "485窗帘"
Case "RELAY"
result = "继电器"
Case "MUSIC"
result = "音乐"
Case "Dimming"
result = "调光"
Case "DO"
result = "输出"
Case "Temp"
result = "空调"
Case "PB_LINE_CONTROL"
result = "主机恒压调光"
Case "PB_STRIP_DEVICE"
result = "PLC恒压调光"
Case "PB_RELAY_DEVICE"
result = "PLC继电器"
'Case "KEY"
' result = "普通按键"
Case Else
result = $"{str}"
End Select
End If
Return result
End Function
Public isxiugai1 As Boolean = False
Public Sub InitPortTable(Node As DeviceChildNodeClass)
PortTable.NewFile()
PortTable.ExtendLastCol = False
PortTable.Cols = 5
PortTable.Rows = Node.Nodes.Count + 1
PortTable.Cell(0, 0).Text = "端口"
PortTable.Cell(0, 1).Text = "别名"
PortTable.Cell(0, 2).Text = "输入端口(需要先在主页设置输入回路别名)"
PortTable.Cell(0, 3).Text = "触发时间(百分比)阈值"
PortTable.Cell(0, 4).Text = "是否参与持续无人判断"
PortTable.Row(0).Locked = True
PortTable.Column(0).Width = 100
PortTable.Column(2).Width = 280
PortTable.Column(3).Width = 150
PortTable.Column(4).Width = 80
PortTable.Column(1).Width = 100
' PortTable.Column(1).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(2).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(3).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(4).CellType = FlexCell.CellTypeEnum.CheckBox
'PortTable.Column(1).Locked = True
PortTable.ComboBox(2).Locked = True
PortTable.ComboBox(3).Locked = True
PortTable.Column(0).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(1).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(2).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(3).Alignment = FlexCell.AlignmentEnum.CenterCenter
isxiugai1 = False
Dim sbuf() As String
For i = 1 To Node.Nodes.Count
PortTable.Cell(i, 1).Text = " "
PortTable.Cell(i, 0).Text = Node.Nodes(i - 1).Name
sbuf = Node.Nodes(i - 1).Description.Split(",")
If sbuf.Length = 7 Then
If String.IsNullOrEmpty(sbuf(0).Trim) Then
PortTable.Cell(i, 1).Text = GetPortName(i)
Else
PortTable.Cell(i, 1).Text = sbuf(0)
End If
PortTable.Cell(i, 2).Text = sbuf(1)
PortTable.Cell(i, 3).Text = sbuf(2)
PortTable.Cell(i, 4).Text = sbuf(3)
If i = 2 Or i = 3 Then
PortTable.Cell(i, 4).Locked = True
PortTable.Cell(i, 3).Locked = True
End If
Else
PortTable.Cell(i, 1).Text = GetPortName(i)
If i < 4 Then
PortTable.Cell(i, 3).Text = 0
If i = 2 Or i = 3 Then
PortTable.Cell(i, 4).Locked = True
PortTable.Cell(i, 3).Locked = True
End If
Else
PortTable.Cell(i, 3).Text = 50
If i = 6 Then
PortTable.Cell(i, 3).Text = 10
End If
End If
End If
Next
isxiugai1 = True
End Sub
Public Sub InitPortTable1(Node As DeviceChildNodeClass)
PortTable.NewFile()
PortTable.ExtendLastCol = False
PortTable.Cols = 8
PortTable.Rows = Node.Nodes.Count + 1
PortTable.Cell(0, 0).Text = "端口"
PortTable.Cell(0, 1).Text = "别名"
PortTable.Cell(0, 2).Text = "输入端口(需要先在主页设置输入回路别名)"
PortTable.Cell(0, 3).Text = "无人->有人阈值(百分比)"
PortTable.Cell(0, 4).Text = "有人->无人阈值(百分比)"
PortTable.Cell(0, 5).Text = "启用"
PortTable.Cell(0, 6).Text = "检测时间"
PortTable.Cell(0, 7).Text = "检测时间单位"
PortTable.Row(0).Locked = True
PortTable.Column(0).Width = 100
PortTable.Column(1).Width = 80
PortTable.Column(2).Width = 250
PortTable.Column(3).Width = 150
PortTable.Column(4).Width = 150
PortTable.Column(5).Width = 30
PortTable.Column(6).Width = 60
PortTable.Column(7).Width = 80
' PortTable.Column(1).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(2).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(3).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(4).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(5).CellType = FlexCell.CellTypeEnum.CheckBox
PortTable.Column(6).CellType = FlexCell.CellTypeEnum.ComboBox
PortTable.Column(7).CellType = FlexCell.CellTypeEnum.ComboBox
''PortTable.Column(1).Locked = True
'PortTable.ComboBox(2).Locked = True
'PortTable.ComboBox(3).Locked = True
'PortTable.ComboBox(4).Locked = True
''PortTable.ComboBox(5).Locked = True
'PortTable.ComboBox(6).Locked = True
'PortTable.ComboBox(7).Locked = True
PortTable.Column(0).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(1).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(2).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(3).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(7).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(4).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(5).Alignment = FlexCell.AlignmentEnum.CenterCenter
PortTable.Column(6).Alignment = FlexCell.AlignmentEnum.CenterCenter
isxiugai1 = False
Dim sbuf() As String
For i = 1 To Node.Nodes.Count
PortTable.Cell(i, 1).Text = " "
PortTable.Cell(i, 0).Text = Node.Nodes(i - 1).Name
sbuf = Node.Nodes(i - 1).Description.Split(",")
If sbuf.Length = 10 Then
If String.IsNullOrEmpty(sbuf(0).Trim) Then
PortTable.Cell(i, 1).Text = GetPortName(i)
Else
PortTable.Cell(i, 1).Text = sbuf(0)
End If
PortTable.Cell(i, 2).Text = sbuf(1)
PortTable.Cell(i, 3).Text = sbuf(2)
PortTable.Cell(i, 4).Text = sbuf(3)
PortTable.Cell(i, 5).Text = sbuf(4)
PortTable.Cell(i, 6).Text = sbuf(5)
PortTable.Cell(i, 7).Text = sbuf(6)
'If i = 2 Or i = 3 Then
' PortTable.Cell(i, 4).Locked = True
' PortTable.Cell(i, 3).Locked = True
'End If
Else
PortTable.Cell(i, 1).Text = GetPortName(i)
PortTable.Cell(i, 3).Text = 0
PortTable.Cell(i, 4).Text = 0
PortTable.Cell(i, 5).Text = 0
PortTable.Cell(i, 6).Text = 0
PortTable.Cell(i, 7).Text = ""
'If i < 4 Then
' PortTable.Cell(i, 3).Text = 0
' If i = 2 Or i = 3 Then
' PortTable.Cell(i, 4).Locked = True
' PortTable.Cell(i, 3).Locked = True
' End If
'Else
'PortTable.Cell(i, 3).Text = 50
'If i = 6 Then
' PortTable.Cell(i, 3).Text = 10
' End If
'End If
End If
Next
isxiugai1 = True
End Sub
Public Function GetPortName(rowindex As Integer)
Dim result As String = String.Empty
Select Case rowindex
Case 1
result = "有卡取电"
Case 2
result = "开门磁"
Case 3
result = "门口红外"
Case 4
result = "卫红外"
Case 5
result = "浴红外"
Case 6
result = "床头红外"
Case 7
result = "镜前红外"
Case 8
result = "休闲红外"
Case 9
result = "客厅红外"
Case 10
result = "厅卫红外"
Case 11
result = "浴缸红外"
End Select
Return result
End Function
Private IfGridRowdic As Dictionary(Of String, List(Of String))
Public Sub InitIfGrid(jsonstr As String, Optional ifbn As Boolean = True)
IfGrid.NewFile()
IfGrid.ExtendLastCol = False
IfGrid.Cols = 17
IfGrid.Rows = 1
IfGrid.Cell(0, 1).Text = "条件组"
IfGrid.Cell(0, 2).Text = "条件序号"
IfGrid.Cell(0, 3).Text = "有无人标记"
IfGrid.Cell(0, 4).Text = "端口1"
IfGrid.Cell(0, 5).Text = "端口2"
IfGrid.Cell(0, 6).Text = "端口3"
IfGrid.Cell(0, 7).Text = "端口4"
IfGrid.Cell(0, 8).Text = "端口5"
IfGrid.Cell(0, 9).Text = "端口6"
IfGrid.Cell(0, 10).Text = "端口7"
IfGrid.Cell(0, 11).Text = "端口8"
IfGrid.Cell(0, 12).Text = "端口9"
IfGrid.Cell(0, 13).Text = "端口10"
IfGrid.Cell(0, 14).Text = "端口11"
IfGrid.Cell(0, 15).Text = "延时时间"
IfGrid.Cell(0, 16).Text = "延时单位"
IfGrid.Column(3).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(4).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(5).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(6).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(7).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(8).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(9).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(10).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(11).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(12).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(13).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(14).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(15).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(16).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(0).Width = 0
IfGrid.Column(1).Width = 50
IfGrid.Column(2).Width = 60
IfGrid.Column(3).Width = 60
IfGrid.Column(4).Width = 60
IfGrid.Column(5).Width = 60
IfGrid.Column(6).Width = 60
IfGrid.Column(7).Width = 60
IfGrid.Column(8).Width = 60
IfGrid.Column(9).Width = 60
IfGrid.Column(10).Width = 60
IfGrid.Column(11).Width = 60
IfGrid.Column(12).Width = 60
IfGrid.Column(13).Width = 60
IfGrid.Column(14).Width = 60
IfGrid.Column(15).Width = 60
IfGrid.Column(16).Width = 60
IfGrid.Column(0).Visible = True
IfGrid.Column(1).Locked = True
IfGrid.Column(2).Locked = True
IfGrid.ComboBox(3).Locked = True
IfGrid.ComboBox(5).Locked = True
IfGrid.ComboBox(6).Locked = True
IfGrid.ComboBox(7).Locked = True
IfGrid.ComboBox(11).Locked = True
IfGrid.ComboBox(12).Locked = True
IfGrid.ComboBox(4).Locked = True
IfGrid.ComboBox(8).Locked = True
IfGrid.ComboBox(9).Locked = True
IfGrid.ComboBox(10).Locked = True
IfGrid.ComboBox(13).Locked = True
IfGrid.ComboBox(14).Locked = True
IfGrid.ComboBox(15).Locked = True
IfGrid.ComboBox(16).Locked = True
IfGrid.Column(0).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(1).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(2).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(3).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(4).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(5).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(6).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(7).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(8).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(9).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(10).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(11).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(12).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(13).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(14).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(15).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(16).Alignment = FlexCell.AlignmentEnum.CenterCenter
Try
Dim startrow As Integer = 0
IfGridRowdic = JsonConvert.DeserializeObject(Of Dictionary(Of String, List(Of String)))(jsonstr)
If IsNothing(IfGridRowdic) OrElse IfGridRowdic.Count < 1 Then
BuildTableRow()
'IfGridRowdic = New Dictionary(Of String, List(Of String))
''Dim li As List(Of String) = New List(Of String)
'For i = 1 To 3
' Dim li As List(Of String) = New List(Of String)
' IfGrid.AddItem("")
' IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{i}"
' IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{i}"
' IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
' IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
' IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"0"
' IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"秒"
' li.Add($"{i},1,1,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
' IfGridRowdic.Add(i, li)
'Next
Else
Dim headrow As Integer
For Each node In IfGridRowdic
IfGrid.AddItem("")
headrow = IfGrid.Rows - 1
For i = 0 To node.Value.Count - 1
If i = 0 Then
Else
IfGrid.AddItem("")
End If
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{node.Key}"
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{node.Key}"
Dim rowstr() As String = node.Value(i).Split(",")
For j = 1 To rowstr.Length
If ifbn Then
IfGrid.Cell(IfGrid.Rows - 1, j + 1).Text = rowstr(j - 1)
Else
If j = rowstr.Length Then Continue For
IfGrid.Cell(IfGrid.Rows - 1, j + 1).Text = rowstr(j)
End If
Next
Next
If headrow < IfGrid.Rows - 1 Then
IfGrid.Column(1).Locked = False
IfGrid.Range(headrow, 1 IfGrid.Rows - 1, 1).Merge()
IfGrid.Column(1).Locked = True
End If
Next
End If
Catch ex As Exception
BuildTableRow()
'IfGridRowdic = New Dictionary(Of String, List(Of String))
'For i = 1 To 3
' Dim li As List(Of String) = New List(Of String)
' IfGrid.AddItem("")
' IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{i}"
' IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{i}"
' IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
' IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
' IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
' IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"0"
' IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"秒"
' li.Add($"{i},1,1,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
' IfGridRowdic.Add(i, li)
'Next
End Try
End Sub
Public Sub BuildTableRow()
IfGridRowdic = New Dictionary(Of String, List(Of String))
Dim li7 As List(Of String) = New List(Of String)
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"1"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li7.Add($"1,1,1,不判断,触发,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,1,秒")
IfGridRowdic.Add(1, li7)
Dim li1 As List(Of String) = New List(Of String)
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 2
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"1"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li1.Add($"2,1,1,不判断,释放,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,1,秒")
IfGridRowdic.Add(2, li1)
Dim li2 As List(Of String) = New List(Of String)
IfGrid.AddItem("")
Dim startR As Integer = IfGrid.Rows - 1
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,1,不判断,不判断,触发,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 2
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"2,1,2,不判断,不判断,不判断,触发,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,3,不判断,不判断,不判断,不判断,触发,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 4
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,4,不判断,不判断,不判断,不判断,不判断,触发,不判断,不判断,不判断,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 5
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,5,不判断,不判断,不判断,不判断,不判断,不判断,触发,不判断,不判断,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 6
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,6,不判断,不判断,不判断,不判断,不判断,不判断,不判断,触发,不判断,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 7
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,7,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,触发,不判断,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 8
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,8,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,触发,不判断,0,秒")
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 9
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li2.Add($"3,1,9,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,触发,0,秒")
IfGrid.Column(1).Locked = False
IfGrid.Range(startR, 1, IfGrid.Rows - 1, 1).Merge()
IfGrid.Column(1).Locked = True
IfGridRowdic.Add(3, li2)
Dim li3 As List(Of String) = New List(Of String)
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 4
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"秒"
'li1.Add($"4,1,2,不判断,不判断,触发,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
'IfGridRowdic.Add(4, li3)
Dim li4 As List(Of String) = New List(Of String)
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 4
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li1.Add($"4,1,2,不判断,释放,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
IfGridRowdic.Add(4, li4)
Dim li5 As List(Of String) = New List(Of String)
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 5
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"20"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li1.Add($"5,1,2,不判断,触发,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,20,秒")
IfGridRowdic.Add(5, li5)
Dim li6 As List(Of String) = New List(Of String)
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 6
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"触发"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"5"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li1.Add($"6,1,2,不判断,,触发,释放,释放,释放,释放,释放,释放,释放,释放,释放,5,分")
IfGridRowdic.Add(6, li6)
End Sub
Public Sub InitIfGrid1(jsonstr As String, Optional ifbn As Boolean = True)
IfGrid.NewFile()
IfGrid.ExtendLastCol = False
IfGrid.Cols = 20
IfGrid.Rows = 1
IfGrid.Cell(0, 1).Text = "条件组"
IfGrid.Cell(0, 2).Text = "条件序号"
IfGrid.Cell(0, 3).Text = "有无人标记"
IfGrid.Cell(0, 4).Text = "端口1"
IfGrid.Cell(0, 5).Text = "端口2"
IfGrid.Cell(0, 6).Text = "端口3"
IfGrid.Cell(0, 7).Text = "端口4"
IfGrid.Cell(0, 8).Text = "端口5"
IfGrid.Cell(0, 9).Text = "端口6"
IfGrid.Cell(0, 10).Text = "端口7"
IfGrid.Cell(0, 11).Text = "端口8"
IfGrid.Cell(0, 12).Text = "端口9"
IfGrid.Cell(0, 13).Text = "端口10"
IfGrid.Cell(0, 14).Text = "端口11"
IfGrid.Cell(0, 15).Text = "触发阈值"
IfGrid.Cell(0, 16).Text = "持续判定时间"
IfGrid.Cell(0, 17).Text = "持续判定时间单位"
IfGrid.Cell(0, 18).Text = "条件组超时时间"
IfGrid.Cell(0, 19).Text = "条件组超时时间单位"
IfGrid.Column(3).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(4).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(5).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(6).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(7).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(8).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(9).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(10).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(11).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(12).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(13).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(14).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(15).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(16).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(17).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(18).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(19).CellType = FlexCell.CellTypeEnum.ComboBox
IfGrid.Column(0).Width = 0
IfGrid.Column(1).Width = 50
IfGrid.Column(2).Width = 60
IfGrid.Column(3).Width = 60
IfGrid.Column(4).Width = 60
IfGrid.Column(5).Width = 60
IfGrid.Column(6).Width = 60
IfGrid.Column(7).Width = 60
IfGrid.Column(8).Width = 60
IfGrid.Column(9).Width = 60
IfGrid.Column(10).Width = 60
IfGrid.Column(11).Width = 60
IfGrid.Column(12).Width = 60
IfGrid.Column(13).Width = 60
IfGrid.Column(14).Width = 60
IfGrid.Column(15).Width = 60
IfGrid.Column(16).Width = 60
IfGrid.Column(17).Width = 60
IfGrid.Column(18).Width = 60
IfGrid.Column(19).Width = 60
IfGrid.Column(0).Visible = True
'IfGrid.Column(1).Locked = True
'IfGrid.Column(2).Locked = True
'IfGrid.ComboBox(3).Locked = True
'IfGrid.ComboBox(5).Locked = True
'IfGrid.ComboBox(6).Locked = True
'IfGrid.ComboBox(7).Locked = True
'IfGrid.ComboBox(11).Locked = True
'IfGrid.ComboBox(12).Locked = True
'IfGrid.ComboBox(4).Locked = True
'IfGrid.ComboBox(8).Locked = True
'IfGrid.ComboBox(9).Locked = True
'IfGrid.ComboBox(10).Locked = True
'IfGrid.ComboBox(13).Locked = True
'IfGrid.ComboBox(14).Locked = True
'IfGrid.ComboBox(15).Locked = True
'IfGrid.ComboBox(16).Locked = True
'IfGrid.ComboBox(17).Locked = True
'IfGrid.ComboBox(18).Locked = True
'IfGrid.ComboBox(19).Locked = True
IfGrid.Column(0).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(1).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(2).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(3).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(4).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(5).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(6).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(7).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(8).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(9).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(10).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(11).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(12).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(13).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(14).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(15).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(16).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(17).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(18).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(19).Alignment = FlexCell.AlignmentEnum.CenterCenter
IfGrid.Column(15).Visible = False
' IfGrid.Column(18).Visible = False
Try
Dim startrow As Integer = 0
IfGridRowdic = JsonConvert.DeserializeObject(Of Dictionary(Of String, List(Of String)))(jsonstr)
If IsNothing(IfGridRowdic) OrElse IfGridRowdic.Count < 1 Then
BuildTableRow1()
Else
Dim headrow As Integer
For Each node In IfGridRowdic
IfGrid.AddItem("")
headrow = IfGrid.Rows - 1
For i = 0 To node.Value.Count - 1
If i = 0 Then
Else
IfGrid.AddItem("")
End If
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{node.Key}"
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{node.Key}"
Dim rowstr() As String = node.Value(i).Split(",")
For j = 1 To rowstr.Length
If ifbn Then
IfGrid.Cell(IfGrid.Rows - 1, j + 1).Text = rowstr(j - 1)
Else
If j = rowstr.Length Then Continue For
IfGrid.Cell(IfGrid.Rows - 1, j + 1).Text = rowstr(j)
End If
Next
Next
If headrow < IfGrid.Rows - 1 Then
IfGrid.Column(1).Locked = False
IfGrid.Range(headrow, 1 IfGrid.Rows - 1, 1).Merge()
IfGrid.Range(headrow, 18 IfGrid.Rows - 1, 18).Merge()
IfGrid.Range(headrow, 19 IfGrid.Rows - 1, 19).Merge()
IfGrid.Column(1).Locked = True
End If
Next
End If
Catch ex As Exception
BuildTableRow1()
End Try
End Sub
Public Sub BuildTableRow1()
IfGridRowdic = New Dictionary(Of String, List(Of String))
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"关至开"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $""
IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"2"
IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $""
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 2
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"开至关"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $""
IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"2"
IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $""
IfGrid.AddItem("")
Dim startR As Integer = IfGrid.Rows - 1
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"关门"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"释放"
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"5"
IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $""
IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $""
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 2
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 4
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 5
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 6
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 7
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 8
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 3
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 9
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "无人至有人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"触发"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.Column(1).Locked = False
'IfGrid.Range(startR, 1, IfGrid.Rows - 1, 1).Merge()
'IfGrid.Range(startR, 18, IfGrid.Rows - 1, 18).Merge()
'IfGrid.Range(startR, 19, IfGrid.Rows - 1, 19).Merge()
'IfGrid.Column(1).Locked = True
'IfGrid.AddItem("")
'startR = IfGrid.Rows - 1
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 4
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "短暂离开"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"开至关"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 5
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 2
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "短暂离开"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"关门"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
''IfGrid.Column(1).Locked = False
''IfGrid.Range(startR, 1, IfGrid.Rows - 1, 1).Merge()
''IfGrid.Range(startR, 18, IfGrid.Rows - 1, 18).Merge()
''IfGrid.Range(startR, 19, IfGrid.Rows - 1, 19).Merge()
''IfGrid.Column(1).Locked = True
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 6
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "长期离开"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"开门"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
'IfGrid.AddItem("")
'IfGrid.Cell(IfGrid.Rows - 1, 1).Text = 7
'IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = 1
'IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
'IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
'IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
'IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"开门"
'IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"释放"
'IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
'IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $"秒"
'IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
'IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $"分"
IfGridRowdic.Clear()
Dim headname As CtabRange
Dim keystr As String = String.Empty
Dim li As List(Of String)
For i = 1 To IfGrid.Rows - 1
headname = New CtabRange(IfGrid, i, 1) ' IfGrid.Cell(i, 1).Tag
If IfGridRowdic.ContainsKey(headname.devname) Then
li = IfGridRowdic.Item(headname.devname)
Else
li = New List(Of String)
IfGridRowdic.Add(headname.devname, li)
End If
For j = 2 To IfGrid.Cols - 1
'If IfGrid.Column(j).Locked Then
' Continue For
'End If
keystr = $"{keystr},{IfGrid.Cell(i, j).Text}"
Next
keystr = keystr.Remove(0, 1)
li.Add(keystr)
keystr = String.Empty
Next
End Sub
Private Sub PortTable_ComboDropDown(Sender As Object, e As FlexCell.Grid.ComboDropDownEventArgs) Handles PortTable.ComboDropDown
Dim headname As String = PortTable.Cell(0, e.Col).Text
Select Case e.Col
Case 2
PortTable.ComboBox(e.Col).Items.Clear()
PortTable.ComboBox(e.Col).Items.Add(" ")
PortTable.ComboBox(e.Col).Items.AddRange(ParseDevDic.Keys.ToArray)
'Case "端口地址"
' Dim addr As String = PortTable.Cell(e.Row, e.Col - 1).Text
' If String.IsNullOrEmpty(addr) Then
' MsgBox("请先选择端口类型!")
' Return
' End If
' PortTable.ComboBox(e.Col).Items.Clear()
' PortTable.ComboBox(e.Col).Items.AddRange(ParseDevDic.Item(addr).Keys.ToArray)
'Case "端口回路"
' Dim typestr As String = PortTable.Cell(e.Row, e.Col - 2).Text
' Dim addr As String = PortTable.Cell(e.Row, e.Col - 1).Text
' If String.IsNullOrEmpty(addr) OrElse String.IsNullOrEmpty(typestr) Then
' MsgBox("请先选择端口类型!")
' Return
' End If
' PortTable.ComboBox(e.Col).Items.Clear()
' For Each index In ParseDevDic.Item(typestr).Item(addr).Values(0).ToArray
' PortTable.ComboBox(e.Col).Items.Add(index.Item1)
' Next
' 'PortTable.ComboBox(e.Col).Items.AddRange(ParseDevDic.Item(typestr).Item(addr).Values(0).ToArray)
' PortTable.Cell(e.Row, e.Col).Tag = ParseDevDic.Item(typestr).Item(addr).Keys(0)
'PortTable.Cell(e.Row, 1).Text =
Case 3, 4
PortTable.ComboBox(e.Col).Items.Clear()
For i = 0 To 100
PortTable.ComboBox(e.Col).Items.Add(i)
Next
Case 6
PortTable.ComboBox(e.Col).Items.Clear()
For i = 0 To 255
PortTable.ComboBox(e.Col).Items.Add(i)
Next
Case 7
PortTable.ComboBox(e.Col).Items.Clear()
PortTable.ComboBox(e.Col).Items.AddRange({"", "", ""})
End Select
End Sub
Private Sub IfGrid_ComboDropDown(Sender As Object, e As FlexCell.Grid.ComboDropDownEventArgs) Handles IfGrid.ComboDropDown
Dim headname As String = IfGrid.Cell(0, e.Col).Text
If e.Col = 3 Then
IfGrid.ComboBox(e.Col).Items.Clear()
IfGrid.ComboBox(e.Col).Items.AddRange({"无人至有人", "有人至无人", "短暂离开", "长期离开"})
ElseIf e.Col = 5 Then
IfGrid.ComboBox(e.Col).Items.Clear()
IfGrid.ComboBox(e.Col).Items.AddRange({"不判断", "开门", "关门", "关至开", "开至关"})
ElseIf e.Col = 4 OrElse (e.Col >= 6 AndAlso e.Col < 15) Then
IfGrid.ComboBox(e.Col).Items.Clear()
IfGrid.ComboBox(e.Col).Items.AddRange({"不判断", "触发", "释放"})
ElseIf e.Col = 15 OrElse e.Col = 16 OrElse e.Col = 18 Then
IfGrid.ComboBox(e.Col).Items.Clear()
For i = 0 To 255
IfGrid.ComboBox(e.Col).Items.Add(i)
Next
ElseIf e.Col = 17 OrElse e.Col = 19 Then
IfGrid.ComboBox(e.Col).Items.Clear()
IfGrid.ComboBox(e.Col).Items.AddRange({"", "", ""})
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim headname As String = IfGrid.Cell(IfGrid.ActiveCell.Row, 2).Text
If headname.Equals("1") Then Return
Dim inrow As Integer = IfGrid.ActiveCell.Row
Dim Number = Integer.Parse(IfGrid.Cell(inrow, 2).Text)
Dim li As List(Of String)
Dim indexstr As CtabRange = New CtabRange(IfGrid, IfGrid.ActiveCell.Row, 1)
li = IfGridRowdic.Item(indexstr.devname)
li.RemoveAt(Number - 1)
IfGrid.Row(IfGrid.ActiveCell.Row).Delete()
For i = Number To li.Count
IfGrid.Cell(inrow, 2).Text = i
inrow = inrow + 1
Next
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
AddIfGridRow()
End Sub
Public Sub AddIfGridRow()
Dim inrow As Integer = IfGrid.ActiveCell.Row
IfGrid.InsertRow(inrow 1)
Dim li As List(Of String)
Dim nodestr As String = String.Empty
Dim number As Integer
For i = 0 To IfGrid.Cols - 1
Dim indexstr As String = (New CtabRange(IfGrid, inrow + 1, 1)).devname
li = IfGridRowdic.Item(indexstr)
IfGrid.Cell(inrow, i).Text = IfGrid.Cell(inrow + 1, i).Text
If i = 1 Then
IfGrid.Cell(inrow, i).Tag = (New CtabRange(IfGrid, inrow + 1, 1)).devname
ElseIf i = 2 Then
number = Integer.Parse(IfGrid.Cell(inrow + 1, 2).Text)
End If
nodestr = $"{nodestr},{ IfGrid.Cell(inrow + 1, i).Text}"
Next
IfGrid.Column(1).Locked = False
IfGrid.Range(inrow, 1, inrow + 1, 1).Merge()
If IfGrid.Cols > 19 Then
IfGrid.Range(inrow, 18, inrow + 1, 18).Merge()
IfGrid.Range(inrow, 19, inrow + 1, 19).Merge()
End If
IfGrid.Column(1).Locked = True
nodestr = nodestr.Remove(0, 1)
li.Add(nodestr)
For i = number To li.Count
IfGrid.Cell(inrow, 2).Text = i
inrow = inrow + 1
Next
End Sub
Private Sub PortTable_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles PortTable.CellChange
If e.Row > 0 AndAlso e.Col = 1 Then
Dim headname As String = PortTable.Cell(e.Row, e.Col).Text.Trim
IfGrid.Cell(0, e.Row + 3).Text = headname
If String.IsNullOrEmpty(headname) Then
IfGrid.Column(e.Row + 3).Locked = True
Else
IfGrid.Column(e.Row + 3).Locked = False
End If
ElseIf e.Row > 0 AndAlso e.Col = 2 Then
'Dim addr As String = PortTable.Cell(e.Row, e.Col).Text
'If String.IsNullOrEmpty(addr) Then
' PortTable.Cell(e.Row, e.Col).Tag = ""
'Else
' ParseDevDic.Item(PortTable.Cell(e.Row, e.Col - 1).Text).Item(addr).Values(0).ToArray()
'End If
'ElseIf e.Row > 0 AndAlso e.Col = 4 Then
' Dim typestr As String = PortTable.Cell(e.Row, e.Col - 2).Text
' Dim addr As String = PortTable.Cell(e.Row, e.Col - 1).Text
' Dim nloop As String = PortTable.Cell(e.Row, e.Col).Text
' If String.IsNullOrEmpty(addr) OrElse String.IsNullOrEmpty(typestr) Then
' PortTable.Cell(e.Row, e.Col).Text = ""
' MsgBox("请先选择端口类型!")
' Return
' End If
' For Each index In ParseDevDic.Item(typestr).Item(addr).Values(0).ToArray
' If index.Item1.Equals(nloop) AndAlso isxiugai1 Then
' PortTable.Cell(e.Row, 1).Text = index.Item2
' End If
' Next
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
Return
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Dim i As String = (CIntNew CtabRange(IfGrid, IfGrid.Rows - 1, 1).devname + 1
Dim li As List(Of String) = New List(Of String)
IfGrid.AddItem("")
IfGrid.Cell(IfGrid.Rows - 1, 1).Text = $"{i}"
IfGrid.Cell(IfGrid.Rows - 1, 1).Tag = $"{i}"
IfGrid.Cell(IfGrid.Rows - 1, 2).Text = 1
IfGrid.Cell(IfGrid.Rows - 1, 3).Text = "有人至无人"
IfGrid.Cell(IfGrid.Rows - 1, 4).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 5).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 6).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 7).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 8).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 9).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 10).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 11).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 12).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 13).Text = $"不判断"
IfGrid.Cell(IfGrid.Rows - 1, 14).Text = $"不判断"
If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $""
li.Add($"{i},1,1,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,秒")
Else
IfGrid.Cell(IfGrid.Rows - 1, 15).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 16).Text = $"0"
IfGrid.Cell(IfGrid.Rows - 1, 17).Text = $""
IfGrid.Cell(IfGrid.Rows - 1, 18).Text = $"10"
IfGrid.Cell(IfGrid.Rows - 1, 19).Text = $""
li.Add($"{i},1,1,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,不判断,0,0,秒,10,分")
End If
IfGridRowdic.Add(i, li)
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If IfGrid.ActiveCell.Row = 1 AndAlso IfGrid.Rows = 2 Then
MsgBox("至少保留1个条件")
Return
End If
Dim headname As CtabRange = New CtabRange(IfGrid, IfGrid.ActiveCell.Row, 1)
Dim number As Integer = 0
Dim number1 As Integer = 1
Dim frow As CtabRange
Dim li As List(Of String) = New List(Of String)
For i = headname.fr To headname.lr
IfGrid.Row(headname.lr - number).Delete()
number = number + 1
Next
If IfGridRowdic.ContainsKey(headname.devname) Then
IfGridRowdic.Remove(headname.devname)
End If
If headname.fr = 1 Then
IfGrid.Cell(headname.fr, headname.fc).Text = 1
li = IfGridRowdic.Item(2)
IfGridRowdic.Remove(2)
IfGridRowdic.Add(1, li)
End If
For i = 2 To IfGrid.Rows - 1
headname = New CtabRange(IfGrid, i, 1)
frow = New CtabRange(IfGrid, i - 1, 1)
If (CInt(headname.devname) - CInt(frow.devname) > 1) Then
number1 = CInt(headname.devname)
IfGrid.Cell(headname.fr, headname.fc).Text = (CInt(frow.devname) + 1)
li = IfGridRowdic.Item(headname.devname)
'删除
IfGridRowdic.Remove(headname.devname)
'添加
IfGridRowdic.Add((CInt(frow.devname) + 1), li)
Else
End If
Next
GetIfTable()
If UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
InitIfGrid(UniqueDevice.Desc.DevDescription)
Else
Isoneload = False
InitIfGrid1(UniqueDevice.Desc.DevDescription)
Isoneload = True
End If
End Sub
Public IsnotCellChange As Boolean
Private Sub IfGrid_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles IfGrid.CellChange
If e.Row = 0 Then Return
Dim celltext As String = IfGrid.Cell(e.Row, e.Col).Text
If celltext.Contains("无人至有人") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Blue
If IsnotCellChange Then Return
IsnotCellChange = True
Dim ta As CtabRange
ta = New CtabRange(IfGrid, e.Row, 1)
For i = ta.fr To ta.lr
IfGrid.Cell(i, e.Col).Text = "无人至有人"
Next
IsnotCellChange = False
ElseIf celltext.Contains("有人至无人") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Orange
If IsnotCellChange Then Return
IsnotCellChange = True
Dim ta As CtabRange
ta = New CtabRange(IfGrid, e.Row, 1)
For i = ta.fr To ta.lr
IfGrid.Cell(i, e.Col).Text = "有人至无人"
Next
IsnotCellChange = False
ElseIf celltext.Contains("短暂离开") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Brown
If IsnotCellChange Then Return
IsnotCellChange = True
Dim ta As CtabRange
ta = New CtabRange(IfGrid, e.Row, 1)
For i = ta.fr To ta.lr
IfGrid.Cell(i, e.Col).Text = "短暂离开"
Next
'从ta.fr 行往第一行查找
For i = ta.fr To 1 Step -1
If IfGrid.Cell(i, e.Col).Text.Trim.Equals("长期离开") OrElse IfGrid.Cell(i, e.Col).Text.Trim.Equals("有人至无人") Then
IfGrid.Cell(i, e.Col).Text = "短暂离开"
End If
Next
If Isoneload Then
If ta.lr = IfGrid.Rows - 1 Then
MsgBox("短暂离开不能作为最后一行,请以'有人至无人'作为最后一行!")
Return
End If
End If
For i = ta.lr To IfGrid.Rows - 1
If IfGrid.Cell(i, e.Col).Text.Trim.Equals("无人至有人") Then
IfGrid.Cell(i, e.Col).Text = "有人至无人"
End If
Next
IsnotCellChange = False
ElseIf celltext.Contains("长期离开") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Violet
If IsnotCellChange Then Return
IsnotCellChange = True
Dim ta As CtabRange
ta = New CtabRange(IfGrid, e.Row, 1)
For i = ta.fr To ta.lr
IfGrid.Cell(i, e.Col).Text = "长期离开"
Next
'从ta.fr 行往第一行查找
For i = ta.fr To 1 Step -1
If IfGrid.Cell(i, e.Col).Text.Trim.Equals("有人至无人") Then
IfGrid.Cell(i, e.Col).Text = "长期离开"
End If
Next
If Isoneload Then
If ta.lr = IfGrid.Rows - 1 Then
MsgBox("长期离开 不能作为最后一行,请以'有人至无人'作为最后一行!")
Return
End If
End If
For i = ta.lr + 1 To IfGrid.Rows - 1
If IfGrid.Cell(i, e.Col).Text.Trim.Equals("短暂离开") OrElse IfGrid.Cell(i, e.Col).Text.Trim.Equals("无人至有人") OrElse IfGrid.Cell(i, e.Col).Text.Trim.Equals("长期离开") Then
IfGrid.Cell(i, e.Col).Text = "有人至无人"
End If
Next
IsnotCellChange = False
ElseIf celltext.Contains("释放") OrElse celltext.Contains("开门") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.Green
ElseIf celltext.Contains("不判断") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.LightGray
ElseIf celltext.Contains("触发") OrElse celltext.Contains("关门") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.OrangeRed
ElseIf celltext.Contains("关至开") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.MediumVioletRed
ElseIf celltext.Contains("开至关") Then
IfGrid.Cell(e.Row, e.Col).ForeColor = Color.LightGreen
End If
If e.Col > 15 AndAlso Not UniqueDevice.Desc.DevDataModelVer.Contains("1.0") Then
Dim na, nb As CtabRange
na = New CtabRange(IfGrid, e.Row, 18)
nb = New CtabRange(IfGrid, e.Row, 19)
If String.IsNullOrEmpty(IfGrid.Cell(e.Row, 16).Text) OrElse
String.IsNullOrEmpty(IfGrid.Cell(e.Row, 17).Text) OrElse
String.IsNullOrEmpty(na.devname) OrElse String.IsNullOrEmpty(nb.devname) Then
Else
Dim ct, nt As Double
IfGrid.Cell(e.Row, 16).BackColor = Color.White
IfGrid.Cell(e.Row, 17).BackColor = Color.White
IfGrid.Cell(e.Row, 18).BackColor = Color.White
IfGrid.Cell(e.Row, 19).BackColor = Color.White
ct = GetTableTimeUnit(IfGrid.Cell(e.Row, 16).Text, IfGrid.Cell(e.Row, 17).Text)
nt = GetTableTimeUnit(na.devname, nb.devname)
If nt = 0 Then
MsgBox("条件组超时时间不能为0")
IfGrid.Cell(e.Row, e.Col).BackColor = Color.OrangeRed
Return
End If
If ct > nt Then
MsgBox("条件延时时间不能大于条件组超时时间!")
IfGrid.Cell(e.Row, e.Col).BackColor = Color.OrangeRed
Return
End If
End If
End If
End Sub
'将时间单位转换为秒、
Public Function GetTableTimeUnit(ntime As String, timeunit As String) As Integer
If ntime.Equals("") OrElse timeunit.Equals("") Then Return 0
'判断时间单位是 时、分、秒
If timeunit.Equals("") Then
Return CInt(ntime) * 3600
ElseIf timeunit.Equals("") Then
Return CInt(ntime) * 60
ElseIf timeunit.Equals("") Then
Return CInt(ntime)
End If
End Function
Public Shared Function GetNoCarDataKeyVal(keystr As String) As Integer
If keystr.Contains("无人至有人") Then
Return 1
ElseIf keystr.Contains("有人至无人") Then
Return 2
ElseIf keystr.Contains("释放") OrElse keystr.Contains("开门") Then
Return 2
ElseIf keystr.Contains("不判断") Then
Return 0
ElseIf keystr.Contains("触发") OrElse keystr.Contains("关门") Then
Return 1
ElseIf keystr.Contains("关至开") OrElse keystr.Contains("长期离开") Then
Return 4
ElseIf keystr.Contains("开至关") OrElse keystr.Contains("短暂离开") Then
Return 3
End If
Return 0
End Function
Private Sub TextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles NR_TextBox2.KeyPress, TextBox2.KeyPress
e.Handled = Not $"0123456789{vbBack}".Contains(e.KeyChar) '如果要只允许输入数字,就把上一行字符串中的字母删除
End Sub
Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged
NR_ComboBox1.Enabled = CheckBox4.Checked
NR_label3.Enabled = CheckBox4.Checked
NR_TextBox2.Enabled = CheckBox4.Checked
End Sub
Public maxdelayed As Integer = 10
Public maxdelayed1 As Integer = 10
Private Sub NR_ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles NR_ComboBox1.SelectedIndexChanged
If NR_ComboBox1.Text.Equals("") Then
maxdelayed = 12
Else
maxdelayed = 600
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If NR_ComboBox1.Text.Equals("") Then
maxdelayed1 = 12
Else
maxdelayed1 = 600
End If
End Sub
Private Sub NR_TextBox2_TextChanged(sender As Object, e As EventArgs) Handles NR_TextBox2.TextChanged
If String.IsNullOrEmpty(NR_TextBox2.Text) Then
NR_TextBox2.Text = 10
End If
Dim tint As Integer = CInt(NR_TextBox2.Text)
If tint > maxdelayed Then
NR_TextBox2.Text = maxdelayed
End If
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
If String.IsNullOrEmpty(TextBox2.Text) Then
TextBox2.Text = 10
End If
Dim tint As Integer = CInt(TextBox2.Text)
If tint > maxdelayed1 Then
TextBox2.Text = maxdelayed1
End If
End Sub
Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs)
If IsNothing(g_TableGrid) OrElse g_TableGrid.Rows = 0 OrElse IsNothing(G_ActionConfiguration) OrElse G_ActionConfiguration.Count = 0 Then Return
Dim devmodw As DeviceModel
Dim loadtag As TableRowTag
Dim num As UInt64 = 0
Dim numbuf() As String
For i = TableRowNumber.Max To g_TableGrid.Rows - 1
Dim griddev As CtabRange = New CtabRange(g_TableGrid, i, TableColNumber.DeviceName)
i = griddev.lr
For j = griddev.fr To griddev.lr
loadtag = G_ActionConfiguration(j - 7)
If Dic_Devicemodel.ContainsKey(loadtag.G_DevModeName) Then
devmodw = Dic_Devicemodel.Item(loadtag.G_DevModeName)
For Each node In devmodw.Nodes
If node.Name.Equals(loadtag.G_DevNodeName) Then
For Each index In node.Nodes
If index.LoopAddr.Equals(loadtag.G_DevNodeIndex.ToString) Then
'selectstr = index.DefaultClass
If index.DefaultClass.Equals("KEY") AndAlso Not node.PROTOCOL_VER.Equals("003") Then
numbuf = g_TableGrid.Cell(j, TableColNumber.SceneAttribute).Text.Split(",")
If numbuf.Length < 3 Then Continue For
num = UInt64.Parse(numbuf2)
If CheckBox5.Checked Then
num = num Or (1 << 4)
Else
num = num - (1 << 4)
End If
g_TableGrid.Cell(j, TableColNumber.SceneAttribute).Text = $"{numbuf(0)},{numbuf(1)},{num}"
End If
End If
Next
End If
Next
End If
Next
Next
End Sub
Private Sub IfGrid_KeyDown(Sender As Object, e As KeyEventArgs) Handles IfGrid.KeyDown
If e.Control AndAlso e.KeyCode = Keys.C Then
e.Handled = True '抑制系统蜂鸣
CopySelectedCells()
End If
If e.Control AndAlso e.KeyCode = Keys.V Then
e.Handled = True
PasteClipboardToDGV()
End If
End Sub
Public Sub PasteClipboardToDGV()
'粘贴剪贴板内容到表格中
If Not Clipboard.ContainsText() Then Return
Dim sb As New System.Text.StringBuilder
Dim lines() As String = Clipboard.GetText().Split(ControlChars.CrLf)
Dim minRow As Integer = IfGrid.ActiveCell.Row
Dim minCol As Integer = IfGrid.ActiveCell.Col
'判断数据是否超出表格范围
If minRow + lines.Length > IfGrid.Rows OrElse minCol + lines(0).Split(ControlChars.Tab).Length > IfGrid.Cols Then
MsgBox("数据超出表格范围")
Return
End If
If minCol = 1 OrElse minCol = 2 Then
MsgBox("不能粘贴到条件组或条件序号")
Return
End If
Dim rag As Range
Dim cells() As String = lines(0).Split(ControlChars.Tab)
Dim rowint As Integer = 0
'判断首列是否是同一列
If minCol.ToString.Equals(cells(0)) Then '首列相同
For i As Integer = 1 To lines.Length - 1
cells = lines(i).Split(ControlChars.Tab)
rowint = minRow + i - 1
For j As Integer = 0 To cells.Length - 1
If IfGrid.Column(minCol + j).Visible Then
'判断是否在范围内
If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then
rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j)
'判断是否为合并单元格
IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
End If
'i = rag.LastRow - minRow
'j = rag.LastCol - minCol
End If
Next
Next
Else '首列不同
Dim vcint As Integer = 0
Integer.TryParse(cells(0), vcint)
If minCol = 4 AndAlso cells.Length = 1 AndAlso vcint > 6 AndAlso vcint < 16 Then '第二列相同
For i As Integer = 1 To lines.Length - 1
cells = lines(i).Split(ControlChars.Tab)
rowint = minRow + i - 1
For j As Integer = 0 To cells.Length - 1
If IfGrid.Column(minCol + j).Visible Then
'判断是否在范围内
If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then
rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j)
'判断是否为合并单元格
IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
End If
'i = rag.LastRow - minRow
'j = rag.LastCol - minCol
End If
Next
Next
ElseIf minCol > 6 AndAlso minCol < 16 AndAlso cells.Length = 1 AndAlso vcint = 4 Then
For i As Integer = 1 To lines.Length - 1
cells = lines(i).Split(ControlChars.Tab)
rowint = minRow + i - 1
For j As Integer = 0 To cells.Length - 1
If IfGrid.Column(minCol + j).Visible Then
'判断是否在范围内
If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then
rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j)
'判断是否为合并单元格
IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
End If
'i = rag.LastRow - minRow
'j = rag.LastCol - minCol
End If
Next
Next
ElseIf minCol > 6 AndAlso minCol < 16 AndAlso vcint + cells.Length > 6 AndAlso vcint + cells.Length < 16 Then
For i As Integer = 1 To lines.Length - 1
cells = lines(i).Split(ControlChars.Tab)
rowint = minRow + i - 1
For j As Integer = 0 To cells.Length - 1
If IfGrid.Column(minCol + j).Visible Then
'判断是否在范围内
If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then
rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j)
'判断是否为合并单元格
IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
End If
'i = rag.LastRow - minRow
'j = rag.LastCol - minCol
End If
Next
Next
ElseIf minCol = 16 AndAlso vcint = 18 Then
For i As Integer = 1 To lines.Length - 1
cells = lines(i).Split(ControlChars.Tab)
rowint = minRow + i - 1
For j As Integer = 0 To cells.Length - 1
If IfGrid.Column(minCol + j).Visible Then
'判断是否在范围内
If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then
rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j)
'判断是否为合并单元格
IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
End If
'i = rag.LastRow - minRow
'j = rag.LastCol - minCol
End If
Next
Next
ElseIf (minCol = 18 AndAlso vcint = 16) Then
For i As Integer = 1 To lines.Length - 1
cells = lines(i).Split(ControlChars.Tab)
rowint = minRow + i - 1
For j As Integer = 0 To cells.Length - 1
If IfGrid.Column(minCol + j).Visible Then
'判断是否在范围内
If rowint < IfGrid.Rows OrElse minCol + j < IfGrid.Cols Then
rag = IfGrid.Range(rowint, minCol + j, rowint, minCol + j)
'判断是否为合并单元格
IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
' IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text = cells(j)
End If
'i = rag.LastRow - minRow
'j = rag.LastCol - minCol
End If
Next
Next
Else
MsgBox("粘贴数据不符合表格数据类型!")
Return
End If
End If
'将数据粘贴到表格中
'
End Sub
Public Sub CopySelectedCells()
'获取表格中选中的单元格, 并复制到剪贴板
Dim Selectioncell As Selection = IfGrid.Selection
Dim sb As New System.Text.StringBuilder
'Dim sel = dgv.SelectedCells.Cast(Of DataGridViewCell)()
Dim minRow As Integer = Selectioncell.FirstRow
Dim maxRow As Integer = Selectioncell.LastRow
Dim minCol As Integer = Selectioncell.FirstCol
Dim maxCol As Integer = Selectioncell.LastCol
Dim includeHeader As Boolean = True
'2. 表头(可选)
If includeHeader Then
For c As Integer = minCol To maxCol
If IfGrid.Column(c).Visible Then
sb.Append(c.ToString()).Append(ControlChars.Tab)
End If
Next
sb.Length -= 1 '去掉最后一个 TAB
sb.AppendLine()
End If
Dim rag As Range
'3. 数据
For r As Integer = minRow To maxRow
If IfGrid.Row(r).Visible Then '跳过隐藏行
For c As Integer = minCol To maxCol
If IfGrid.Column(c).Visible Then '跳过隐藏列
rag = IfGrid.Range(r, c, r, c)
sb.Append(IfGrid.Cell(rag.FirstRow, rag.FirstCol).Text)
sb.Append(ControlChars.Tab)
End If
Next
sb.Length -= 1 '去掉行尾 TAB
sb.AppendLine()
End If
Next
Clipboard.SetText(sb.ToString().TrimEnd())
End Sub
#End Region
End Class