📄 form1.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form FrmMain
Caption = "老化房监控系统MBSC"
ClientHeight = 7185
ClientLeft = 165
ClientTop = 450
ClientWidth = 9960
LinkTopic = "Form1"
ScaleHeight = 7185
ScaleWidth = 9960
StartUpPosition = 3 '窗口缺省
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 3000
TabIndex = 12
Top = 6960
Width = 4095
_ExtentX = 7223
_ExtentY = 450
_Version = 393216
Appearance = 1
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 10
Top = 6930
Width = 9960
_ExtentX = 17568
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 3
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 5292
MinWidth = 5292
Text = "温度"
TextSave = "温度"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 7056
MinWidth = 7056
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 5292
MinWidth = 5292
EndProperty
EndProperty
End
Begin VB.TextBox Text3
Height = 1455
Left = 8640
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 13
Top = 360
Width = 735
End
Begin VB.Frame Frame2
Caption = "读取设备状态:"
Height = 4815
Left = 3120
TabIndex = 2
Top = 2160
Width = 6735
Begin VB.CommandButton CmdtestAll
Caption = "全部读取"
Height = 375
Left = 120
TabIndex = 14
Top = 240
Width = 1215
End
Begin VB.CommandButton ComStop
Caption = "停止读取"
Height = 375
Left = 5520
TabIndex = 11
Top = 240
Width = 1095
End
Begin VB.Timer TimerAlm
Enabled = 0 'False
Interval = 100
Left = 5400
Top = 4320
End
Begin VB.Timer TimerMsg
Enabled = 0 'False
Interval = 100
Left = 6120
Top = 4320
End
Begin VB.Timer Timer1
Interval = 1000
Left = 5760
Top = 4320
End
Begin VB.CommandButton CmdReadAlm
Caption = "读取告警信息"
Height = 375
Left = 2760
TabIndex = 9
Top = 240
Width = 1215
End
Begin VB.CommandButton CmdReadMsg
Caption = "读取当前信息"
Height = 375
Left = 1440
TabIndex = 8
Top = 240
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 4095
Left = 120
TabIndex = 7
Top = 720
Width = 6615
_ExtentX = 11668
_ExtentY = 7223
_Version = 393216
FixedCols = 0
End
End
Begin VB.Frame Frame1
Caption = "设备信息:"
Height = 1935
Left = 3120
TabIndex = 1
Top = 120
Width = 6735
Begin VB.Timer Timer2
Left = 6120
Top = 1560
End
Begin MSWinsockLib.Winsock Winsock1
Left = 6360
Top = 120
_ExtentX = 741
_ExtentY = 741
_Version = 393216
Protocol = 1
End
Begin VB.TextBox txtSiteNo
Height = 375
Left = 2040
TabIndex = 5
Top = 1080
Width = 2415
End
Begin VB.TextBox txtDevice
Height = 375
Left = 2040
TabIndex = 4
Top = 360
Width = 2415
End
Begin VB.Label Label2
Caption = "站点编号:"
Height = 375
Left = 840
TabIndex = 6
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "设备生产序列号:"
Height = 375
Left = 360
TabIndex = 3
Top = 480
Width = 1575
End
End
Begin MSComctlLib.TreeView TVMonitor
Height = 6615
Left = 120
TabIndex = 0
Top = 360
Width = 2895
_ExtentX = 5106
_ExtentY = 11668
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Style = 7
Checkboxes = -1 'True
Appearance = 1
End
Begin VB.Menu menuLocation
Caption = "增加老化位"
Visible = 0 'False
Begin VB.Menu addLocation
Caption = "增加老化位"
End
Begin VB.Menu delLocation
Caption = "删除老化位"
End
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rootNode As Node
Public curNode As Node
Public LasNode As Node
Dim CtrlIndex As Integer
Dim PassStr As Long '通讯标识
Dim CRCStrH As Byte, CRCStrL As Byte 'CRC效验值
Dim StartStr As String '起始标识
Dim ProtocolStr As String, LeadprotocolStr As String '协议类型,承载协议类型
Dim AddDeviceStr As Long, AddDeviceStr2 As String, AddDeviceStr3 As String, AddDeviceStr4 As String, AddSiteNoStr As String '站点编号,设备编号
Dim NPPassStr As String 'NP交互标识
Dim UseProtocolStr As String '应用协议标识
Dim CommandStr As String '命令标识
Dim AnswerStr As String '应答标识
Dim OLStr As Long, OIDStr As String, OCStr As String '监控对象长度,监控对象标号,监控对象内容
Dim curRemoteHostIP As String
Dim curRemoteHostPort As String
Dim Maxnstep As Integer
Dim strdata1 As String
Dim AllTextFlag As Boolean
Private Sub CmdReadAlm_Click()
If TimerAlm.Enabled = True Then
TimerAlm.Enabled = False
End If
If AllTextFlag = False Then
ResetMSF
MSFlexGrid1.Rows = 1
End If
With MSFlexGrid1
.ColWidth(0) = 3000
.ColWidth(1) = 3000
.Row = 0
.Col = 0
.Text = "参数名称"
.Col = 1
.Text = "当前状态"
End With
nstep = 0
tmpnstepData = ""
' AllTextFlag = False
TimerMsg.Enabled = False
TimerAlm.Enabled = True
Maxnstep = 30
ProgressBar1.Visible = True
ProgressBar1.Max = Maxnstep
End Sub
Private Sub CmdReadMsg_Click()
If TimerMsg.Enabled = True Then
TimerMsg.Enabled = False
End If
'FrmAutoAlm.Show
If AllTextFlag = False Then
ResetMSF
End If
With MSFlexGrid1
MSFlexGrid1.Rows = 1
.ColWidth(0) = 3000
.ColWidth(1) = 3000
.Row = 0
.Col = 0
.Text = "参数名称"
.Col = 1
.Text = "当前状态"
End With
nstep = 0
tmpnstepData = ""
' AllTextFlag = False
TimerAlm.Enabled = False
TimerMsg.Enabled = True
Maxnstep = 41
ProgressBar1.Visible = True
ProgressBar1.Max = Maxnstep
End Sub
Private Sub CmdtestAll_Click()
Dim tmpTextNodes As String
Dim var As Variant
AllTextFlag = True
tmpTextNodes = getCheckNodes
If Trim(tmpTextNodes) = "" Then
MsgBox "请在复选框前打勾!!"
Else
var = Split(tmpTextNodes, ",")
For i = 0 To UBound(var)
Connect Locations(i + 2).IP, Locations(i + 2).Port
CmdReadMsg_Click
Do While AllTextFlag = True
DoEvents
Loop
Next
End If
End Sub
Private Function getCheckNodes()
Dim tmpNode As Node
Dim strdata As String
strdata = ""
For Each tmpNode In TVMonitor.Nodes
If tmpNode.Tag = 1 And tmpNode.Checked = True Then
strdata = strdata & "," & Mid(tmpNode.Key, 4)
End If
Next
getCheckNodes = Mid(strdata, 2)
End Function
Private Sub ComStop_Click()
TimerAlm.Enabled = False
TimerMsg.Enabled = False
End Sub
Private Sub Form_Load()
With Winsock1
.LocalPort = 8192
' .RemoteHost = "128.0.2.0"
' .RemotePort = 8192
' .Bind
End With
Set LasNode = Nothing
ProgressBar1.Visible = False
AutoAlmflag = False
nstep = 0
InitMonitorTV
End Sub
Private Sub InitMonitorTV()
If Not (rootLaoHua Is Nothing) Then
ReadNodeToTV rootNode, rootLaoHua
rootNode.Expanded = True
End If
End Sub
Private Sub ReadNodeToTV(ByRef ParentNode As Node, ByRef ParentEle As IXMLDOMElement)
Dim Obj As IXMLDOMElement
Dim tmpNode As Node
Dim tmpEle As IXMLDOMElement
If Not IsNull(ParentEle.getAttribute("name")) Then
If ParentNode Is Nothing Then
Set tmpNode = TVMonitor.Nodes.Add(, , , ParentEle.getAttribute("name"))
tmpNode.Key = sPrefix & tmpNode.Index
tmpNode.Tag = "0"
Set rootNode = tmpNode
If ReadEleValue(ParentEle, "CheckFlag", "0") = "1" Then
ReDim Locations(rootNode.Index)
'Locations(rootNode.Index).bCheck = True
rootNode.Checked = True
End If
Else
Set tmpNode = AddMonitorNode2(ParentNode, "", ParentEle.getAttribute("name"))
tmpNode.Tag = CStr(ParentNode.Tag + 1)
If tmpNode.Tag = "1" Then
Locations(tmpNode.Index).IP = ReadEleValue(ParentEle, "IP", "127.0.0.1")
Locations(tmpNode.Index).Port = ReadEleValue(ParentEle, "Port", "8000")
End If
End If
End If
If ParentEle.childNodes.length > 1 Then
For Each Obj In ParentEle.childNodes
ReadNodeToTV tmpNode, Obj
Next
End If
Set tmpEle = ParentEle.selectSingleNode("key")
If Not (tmpEle Is Nothing) Then
nKey = nKey + 1
tmpEle.Text = tmpNode.Key
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set XMLObj = Nothing
End Sub
Private Sub Timer1_Timer()
StatusBar1.Panels(3).Text = "时间" & ":" & Now
End Sub
Private Sub TimerAlm_Timer()
OLStr = 4
Select Case nstep
Case 0
OIDStr = &H302 '电源故障告警
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 1
OIDStr = &H328 '门禁告警
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 2
OIDStr = &H330 '下行输入过功率告警(通道1)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 3
OIDStr = &H332 '下行输出过功率告警(通道1)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 4
OIDStr = &H334 '上行输出过功率告警(通道1)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 5
OIDStr = &H335 '下行驻波比告警(通道1)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 6
OIDStr = &H336 '下行输入过功率告警(通道2)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 7
OIDStr = &H338 '下行输出过功率告警(通道2)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 8
OIDStr = &H33A '上行输出过功率告警(通道2)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 9
OIDStr = &H33B '下行驻波比告警(通道2)
GetDeviceData
If tmpnstepData = "" Then
Delay (3000)
End If
Case 10
OIDStr = &H33C '下行输入过功率告警(通道3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -