增加无卡取电对应回路关联相应服务功能
This commit is contained in:
@@ -10,7 +10,7 @@ Public Class ServiceAttribute
|
||||
Public G_input As String
|
||||
|
||||
Private g_dicComboBox1 As Dictionary(Of String, String)
|
||||
|
||||
Public g_diaplay As Boolean
|
||||
Public G_result As String
|
||||
Enum STcolname
|
||||
<Description("Input number")>
|
||||
@@ -48,11 +48,16 @@ Public Class ServiceAttribute
|
||||
Dic_3 = New List(Of String)
|
||||
'单位
|
||||
Dic_4 = New List(Of String)
|
||||
|
||||
Dim fustr As String = "服务-"
|
||||
For Each node In G_hostNode.Nodes
|
||||
fustr = "service-" & node.LoopAddr
|
||||
'2025 12 29 CZH 增加 判断服务是否是 是在25 到48 且名称符合 "服务-服务号"的格式 符合则不 添加
|
||||
If node.LoopAddr >= 25 AndAlso node.LoopAddr <= 57 AndAlso fustr.Equals(node.Name) Then '
|
||||
Continue For
|
||||
End If
|
||||
Dic_1.Add($"{node.LoopAddr}:{node.Name }")
|
||||
Next
|
||||
Dic_2.AddRange({"2:close", "1:open"})
|
||||
Dic_2.AddRange({"2:close", "1:open", "3:Reset the initial power-on", "4:Just draw electricity"})
|
||||
For i = 0 To 255
|
||||
Dic_3.Add(i)
|
||||
Next
|
||||
@@ -65,6 +70,7 @@ Public Class ServiceAttribute
|
||||
Dim buff() As String = datastr.Split(vbLf)
|
||||
Dim isok As Boolean
|
||||
For Each index In buff
|
||||
If String.IsNullOrEmpty(index) Then Continue For
|
||||
isok = False
|
||||
|
||||
Dim buf() As String = index.Split(",")
|
||||
@@ -75,7 +81,7 @@ Public Class ServiceAttribute
|
||||
For Each node In hostNode.Nodes
|
||||
If node.LoopAddr.Equals(intbuf(0).ToString) Then
|
||||
isok = True
|
||||
If intbuf(1) = 2 OrElse intbuf(1) = 1 Then
|
||||
If intbuf(1) = 2 OrElse intbuf(1) = 1 OrElse intbuf(1) = 3 OrElse intbuf(1) = 4 Then
|
||||
If intbuf(2) >= 0 OrElse intbuf(2) <= 255 Then
|
||||
If intbuf(3) >= 1 OrElse intbuf(3) <= 5 Then
|
||||
Exit For
|
||||
@@ -111,6 +117,7 @@ Public Class ServiceAttribute
|
||||
Dim C1, C2, C3, C4 As String
|
||||
|
||||
For Each index In buff
|
||||
If String.IsNullOrEmpty(index) Then Continue For
|
||||
C1 = String.Empty
|
||||
C2 = String.Empty
|
||||
C3 = String.Empty
|
||||
@@ -185,7 +192,7 @@ Public Class ServiceAttribute
|
||||
Dim strbuf1() As String = c1.Split(":")
|
||||
Dim strbuf2() As String = c2.Split(":")
|
||||
Dim t As String = GetDelayUnit(c4)
|
||||
reslit = $"{strbuf1(0)},{strbuf2(0)},{c3},{t},{c5}"
|
||||
reslit = $"{strbuf1(0).Trim},{strbuf2(0).Trim},{c3.Trim},{t.Trim},{c5.Trim}"
|
||||
Return reslit
|
||||
End Function
|
||||
|
||||
@@ -288,6 +295,22 @@ Public Class ServiceAttribute
|
||||
|
||||
Private Sub Table_Grid1_CellChange(Sender As Object, e As Grid.CellChangeEventArgs) Handles Table_Grid1.CellChange
|
||||
If e.Row > 0 Then
|
||||
If e.Col = STcolname.服务类型 Then
|
||||
If Table_Grid1.Cell(e.Row, STcolname.服务类型).Text = "1:Check-in service" Then
|
||||
If Dic_2.Count = 2 Then
|
||||
Dic_2.Add("3:Reset the initial power-on")
|
||||
End If
|
||||
Else
|
||||
If Table_Grid1.Cell(e.Row, STcolname.打开方式).Text = "3:Reset the initial power-on" Then
|
||||
Table_Grid1.Cell(e.Row, STcolname.打开方式).Text = "1 : Open"
|
||||
End If
|
||||
If Dic_2.Count = 3 Then
|
||||
Dic_2.Remove("3:Reset the initial power-on")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If e.Col = STcolname.延时 Then
|
||||
If String.IsNullOrEmpty(Table_Grid1.Cell(e.Row, e.Col).Text) Then
|
||||
@@ -370,6 +393,20 @@ Public Class ServiceAttribute
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
If Table_Grid1.ActiveCell.Row > 0 Then
|
||||
'判断选中服务是否在25 到57区间
|
||||
|
||||
Dim tstr As String = Table_Grid1.Cell(Table_Grid1.ActiveCell.Row, STcolname.服务类型).Text.Trim
|
||||
Dim arr As String() = tstr.Split(":")
|
||||
Dim LoopAddri As Integer = Integer.Parse(arr(0).Trim)
|
||||
If LoopAddri >= 25 AndAlso LoopAddri <= 57 Then
|
||||
'弹框二次删除确认
|
||||
If MessageBox.Show("This service is a system service. Deleting it may cause system abnormalities. Do you want to proceed with the deletion?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.Yes Then
|
||||
Table_Grid1.Row(Table_Grid1.ActiveCell.Row).Delete()
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
|
||||
Table_Grid1.Row(Table_Grid1.ActiveCell.Row).Delete()
|
||||
End If
|
||||
End Sub
|
||||
@@ -386,9 +423,39 @@ Public Class ServiceAttribute
|
||||
Case STcolname.单位
|
||||
Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_4.ToArray)
|
||||
Case STcolname.打开方式
|
||||
Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_2.ToArray)
|
||||
'获取服务类型 判断是否为 1: 入住服务
|
||||
Dim tstr As String = Table_Grid1.Cell(e.Row, STcolname.服务类型).Text.Trim
|
||||
If tstr.Equals("1:Check-in service") Then
|
||||
Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_2.ToArray)
|
||||
Else
|
||||
Table_Grid1.ComboBox(e.Col).Items.Add(Dic_2(0))
|
||||
Table_Grid1.ComboBox(e.Col).Items.Add(Dic_2(1))
|
||||
End If
|
||||
|
||||
|
||||
Case STcolname.服务类型
|
||||
Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_1.ToArray)
|
||||
|
||||
For Each item In Dic_1
|
||||
'切割字符串(item) 提取LoopAddr
|
||||
Dim arr As String() = item.Split(":")
|
||||
'判斷 g_display
|
||||
If g_diaplay Then
|
||||
|
||||
Else
|
||||
'将arr(0)转为int
|
||||
Dim LoopAddri As Integer = Integer.Parse(arr(0).Trim)
|
||||
'過濾掉arr >= 25 AndAlso Node.LoopAddr <= 57
|
||||
If LoopAddri >= 25 AndAlso LoopAddri <= 57 Then
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Table_Grid1.ComboBox(e.Col).Items.Add(item)
|
||||
Next
|
||||
'Table_Grid1.ComboBox(e.Col).Items.AddRange(Dic_1.ToArray)
|
||||
|
||||
Case Else
|
||||
|
||||
End Select
|
||||
|
||||
Reference in New Issue
Block a user