📄 publicclass.vb
字号:
Dim str As String
'如A1(-表示10号切换器的光纤信号有无)
'切换器编号对应发射机表
'1-20CH-
'2-45CH
'3-10CH
'4-15CH
'5-8CH
'6-97.7MHz
'7-94.9 MHz
'8-91 MHz
'9-107MHz
'A-100.8MHz
'B-105.2MHz
'C-备机
Dim A1(11), A2(11), A3(11), A4(11), B(11) As Integer
'Try
strsql = "select * from gatherToSignal where gatType=1"
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
If IsDBNull(ds.Tables(0).Rows(i).Item("paraType")) Then Exit Sub
'''对应切换器编号
id = Val("&H" + Mid(ds.Tables(0).Rows(i).Item("paraType"), 1, 1))
'''对应切换器端口(1-卫星,2-微波,3-光缆,4-预留)
no = Val(Mid(ds.Tables(0).Rows(i).Item("paraType"), 2, 1))
'''端口号
str = ds.Tables(0).Rows(i).Item("gatComNumber")
aCom = Int(IIf(Len(str) = 2, Mid(str, 2, 1), Mid(str, 2, 2)))
gatID = ds.Tables(0).Rows(i).Item("equNum")
strsql = "select * from gather where equNum=" & Trim(gatID)
ds1 = search.query(strsql)
If ds1.Tables(0).Rows.Count > 0 Then
Select Case no
Case 1
' A1(id - 1) = ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom)))
If ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom))) = False Then
A1(id - 1) = 0
Else
A1(id - 1) = 1
End If
Case 2
'A2(id - 1) = ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom)))
If ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom))) = False Then
A2(id - 1) = 0
Else
A2(id - 1) = 1
End If
Case 3
'A3(id - 1) = ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom)))
If ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom))) = False Then
A3(id - 1) = 0
Else
A3(id - 1) = 1
End If
Case 4
' A4(id - 1) = ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom)))
If ds1.Tables(0).Rows(0).Item("aCom" & Trim(CStr(aCom))) = False Then
A4(id - 1) = 0
Else
A4(id - 1) = 1
End If
End Select
End If
Next
End If
For i = 0 To 11
strsql = "select * from sourceTotrans where Num= " & Trim(i + 1)
ds2 = search.query(strsql)
If ds2.Tables(0).Rows.Count > 0 Then
B(i) = ds2.Tables(0).Rows(0).Item("sourceNum")
End If
Next
For i = 0 To 11
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
strsql = "select * from sourceToPort where equNum=" & Trim(B(i))
ds3 = search.query(strsql)
If ds3.Tables(0).Rows.Count > 0 Then
strsql = "update sourceToPort set equNum=" & Trim(B(i)) & ", recTime=" & Now & ",port1=" & A1(i) & ",port1=" & A2(i) & ",port1=" & A3(i) & ",port1=" & A4(i) & ",isTempFlag=0) "
search.update(strsql)
Else
strsql = "insert into sourceToPort values(" & B(i) & ",'" _
& Now & "' ," & A1(i) & "," & A2(i) & "," & A3(i) & "," & A4(i) & "," & iTempflag & ") "
search.insert(strsql)
End If
Next i
'Catch ex As Exception
' ' MessageBox.Show(ex.Message, "系统提示!", MessageBoxButtons.OK)
'End Try
End Sub
'''判断N+1切换状态
Public Shared Function bNand1Swith(ByVal dev As OtherEqu, ByVal controlType As Integer, ByVal cmdType As String, ByVal cmdCode As String) As Boolean
If dev.Nand1Switch.istate = 0 Then
Select Case Val(cmdType)
Case 1
If cmdCode = "B" And dev.Nand1Switch.iPort1 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort1 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 2
If cmdCode = "B" And dev.Nand1Switch.iPort2 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort2 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 3
If cmdCode = "B" And dev.Nand1Switch.iPort3 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort3 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 4
If cmdCode = "B" And dev.Nand1Switch.iPort4 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort4 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 5
If cmdCode = "B" And dev.Nand1Switch.iPort5 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort5 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 6
If cmdCode = "B" And dev.Nand1Switch.iPort6 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort6 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 7
If cmdCode = "B" And dev.Nand1Switch.iPort7 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort7 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
Case 8
If cmdCode = "B" And dev.Nand1Switch.iPort8 = 0 Then
bNand1Swith = True
ElseIf cmdCode = "M" And dev.Nand1Switch.iPort8 = 1 Then
bNand1Swith = True
Else
bNand1Swith = False
End If
End Select
Else
End If
End Function
Public Shared Sub SaveAlarmLog(ByVal equNum As Integer, ByVal AlarmInfo As String, ByVal opPerson As String)
'Try
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.insert("insert into alarmLog values (" & equNum & ",'" & AlarmInfo & "','" & Now & "','" & opPerson & "')")
'Catch ex As Exception
' MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'End Try
End Sub
Public Shared Sub SaveSMSAlarmLog(ByVal equNum As Integer, ByVal alarmType As Integer)
'Try
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.insert("insert into SMS_Alarm values (" & equNum & ",'" & Now & "'," & alarmType & ",0,'发射机故障报警',0,'1',1)")
'Catch ex As Exception
' MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'End Try
End Sub
'''根据发射机功率等级得到发射机的额定功率输出
Public Shared Function power(ByVal strPower As String) As Integer
Select Case Trim(strPower)
Case "1KW"
power = 1000
Case "3KW"
power = 3000
Case "5KW"
power = 5000
Case "10KW"
power = 10000
End Select
End Function
Public Shared Function isOffTime(ByVal starttime As String, ByVal endtime As String) As Boolean
If DateTime.Now.Hour > CDate(endtime).Hour And DateTime.Now.Hour < CDate(starttime).Hour Then
isOffTime = True
ElseIf DateTime.Now.Hour = CDate(starttime).Hour And DateTime.Now.Minute < (CDate(starttime).Minute + 5) _
And DateTime.Now.Hour = CDate(endtime).Hour And DateTime.Now.Minute > (CDate(endtime).Minute + 5) Then
isOffTime = True
Else
isOffTime = False
End If
End Function
Public Shared Function isNotRun(ByVal trans As Object) As Boolean 'TransmitKTD
Select Case Today.DayOfWeek
Case DayOfWeek.Monday
If trans.Monday(0) Is Nothing And trans.Monday(1) Is Nothing Then
Else
If isOffTime(trans.Monday(0), trans.Monday(1)) = True Then
isNotRun = True
Else
isNotRun = False
End If
End If
Case DayOfWeek.Tuesday
If trans.Tuesday(0) Is Nothing And trans.Tuesday(1) Is Nothing Then
Else
If isOffTime(trans.Tuesday(0), trans.Tuesday(1)) = True Then
isNotRun = True
Else
isNotRun = False
End If
End If
If trans.Tuesday(2) Is Nothing And trans.Tuesday(3) Is Nothing Then
Else
If isOffTime(trans.Tuesday(2), trans.Tuesday(3)) = True Then
isNotRun = True
Else
isNotRun = False
End If
End If
Case DayOfWeek.Wednesday
If trans.Wednesday(0) Is Nothing And trans.Wednesday(1) Is Nothing Then
Else
If isOffTime(trans.Wednesday(0), trans.Wednesday(1)) = True Then
isNotRun = True
Else
isNotRun = False
End If
End If
Case DayOfWeek.Thursday
If trans.Thursday(0) Is Nothing And trans.Thursday(1) Is Nothing Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -