📄 otherequ.vb
字号:
Case "M" '''4D
Collection.bDinPort(i * 4) = True
Collection.bDinPort(i * 4 + 2) = True
Collection.bDinPort(i * 4 + 3) = True
Case "N" '''4E
Collection.bDinPort(i * 4 + 1) = True
Collection.bDinPort(i * 4 + 2) = True
Collection.bDinPort(i * 4 + 3) = True
Case "O" '''4F
' Collection.bDinPort(i * 4 + 1) = True
Collection.bDinPort(i * 4 + 2) = True
Collection.bDinPort(i * 4 + 3) = True
Collection.bDinPort(i * 4 + 4) = True
End Select
Next
saveCollection()
End Sub
Public Sub saveNand1()
Dim strsql As String
Dim ds As DataSet
Dim i As Integer
For i = 1 To 8
Select Case i
Case 1
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort1) + " where equNum =" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
Case 2
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort2) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
Case 3
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort3) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort3 & "," & iTempflag & ")"
End If
Case 4
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort4) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
Case 5
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort5) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
Case 6
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort6) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
Case 7
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort7) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
Case 8
strsql = "select * from n1State where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
strsql = "update n1State set switchState= " & Trim(Nand1Switch.iPort8) + " where equNum=" & Trim(TransmitID) + " and portNum=" & Trim(i)
'Else
' strsql = "insert into n1State values(" & TransmitID & "," & i & "," & Nand1Switch.iPort1 & "," & iTempflag & ")"
End If
End Select
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.update(strsql)
ds = Nothing
Next
End Sub
Public Sub saveDieselmotor()
Dim strsql As String
strsql = "insert into powerDynamo values(" & TransmitID & ",'" & Now & "'," & Dieselmotor.dFixPower & "," _
& Dieselmotor.dStandbyPower & "," & Dieselmotor.dFixVol & "," & Dieselmotor.dFixCur & "," & Dieselmotor.dOil & "," & iTempflag & ")"
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.insert(strsql)
End Sub
Public Sub saveRecepDevice()
Dim strsql As String
strsql = "insert into preventSignal values(" & TransmitID & ",'" & Now & "','" & RecepDevice.strAffairType & "'," _
& RecepDevice.dSafetyGrade & "," & RecepDevice.dIntensity & "," _
& RecepDevice.dReQuality & "," & RecepDevice.dQuality & "," & iTempflag & ")"
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.insert(strsql)
End Sub
Public Sub saveCollection()
'''1、环境参数采集器
'''8个模拟量对应2个温度传感器
'''1号传感器温度表示11,1号传感器湿度表示12
'''2号传感器温度表示21,1号传感器湿度表示22
'''1--温度传感器1(D111/D112)
'''2--温度传感器2(D121/D122)
'''16个开关量对应2个烟雾感应器、2个明火感应器、2个红外感应器、2个门磁、2个水侵,
'''1--烟雾感应器(A111/A121),
'''2--明火探测器(A211/A221)
'''3--红外探测器(A311/A321)
'''4--侵水探测器(A411/A421)
'''5--门磁感应器(A511/A521)
'''1号感应器开关量表示11,1号感应器开关量表示21,依此类推,n号表示n1
'''2、信号源采集器
'''16路开关量,用格式 切换器编号+信号类型编号
'''如A1-表示10号切换器的光纤信号有无
Dim strsql As String
Dim ds As DataSet
Dim strtemp As String
Dim i As Integer
'CommStatus = 0
'Try
strsql = "select * from gather where equNum=" & Trim(TransmitID)
ds = search.query(strsql)
If ds.Tables(0).Rows.Count > 0 Then
For i = 0 To Collection.dAinPort.Length - 1
strtemp = strtemp + " ,dCom" & Trim(CStr(i) + 1) & " = " & Collection.dAinPort(i)
Next
For i = 0 To Collection.bDinPort.Length - 1
strtemp = strtemp + " ,aCom" & Trim(CStr(i) + 1) & " = " & Collection.bDinPort(i).GetHashCode
Next
strsql = "update gather set equNum= " & Trim(TransmitID) + strtemp & " where equNum=" & Trim(TransmitID)
search.update(strsql)
Else
For i = 0 To Collection.dAinPort.Length - 1
strtemp = strtemp + "," + CStr(Collection.dAinPort(i))
Next
For i = 0 To Collection.bDinPort.Length - 1
strtemp = strtemp + "," + CStr(Collection.bDinPort(i).GetHashCode)
Next
strsql = "insert into gather values(" & TransmitID & strtemp & ")"
search.insert(strsql)
End If
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
ds = Nothing
If TransmitType = 0 Then
saveDPara()
saveAPara()
End If
'Catch ex As Exception
'End Try
End Sub
Private Sub saveDPara()
Dim strsql As String
Dim ds As DataSet
Dim dCom As String
Dim aCom As String
Dim i As Integer
strsql = "select * from gatherToSignal where equNum=" & Trim(TransmitID)
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
Select Case Trim(ds.Tables(0).Rows(i).Item("paraType"))
Case "D111"
a1 = Int(Mid(ds.Tables(0).Rows(i).Item("gatComNumber"), 2, 1))
Case "D112"
b1 = Int(Mid(ds.Tables(0).Rows(i).Item("gatComNumber"), 2, 1))
Case "D121"
a2 = Int(Mid(ds.Tables(0).Rows(i).Item("gatComNumber"), 2, 1))
Case "D122"
b2 = Int(Mid(ds.Tables(0).Rows(i).Item("gatComNumber"), 2, 1))
End Select
Next
dPara(a1, b1, 1)
dPara(a2, b2, 2)
End If
End Sub
Private Sub dPara(ByVal a As Integer, ByVal b As String, ByVal no As Integer)
Dim strsql As String
Dim ds As DataSet
strsql = "insert into environment values(" & TransmitID & "," & no & ",'" _
& Now & "' ," & Collection.dAinPort(a - 1) & " ," & Collection.dAinPort(b - 1) & " ," & iTempflag & ") "
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.insert(strsql)
End Sub
Private Sub saveAPara()
Dim strsql As String
Dim ds As DataSet
Dim aCom As Integer
Dim i As Integer
Dim tableName As String
Dim no As Integer
Dim str As String
'''1--明火探测器(A111/A121),
'''2--烟雾感应器(A211/A221)
'''3--红外探测器(A311/A321)
'''4--侵水探测器(A411/A421)
'''5--门磁感应器(A511/A521)
strsql = "select * from gatherToSignal where equNum=" & Trim(TransmitID)
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
If Trim(ds.Tables(0).Rows(i).Item("paraType")) = "0" Then
Else
no = Int(Mid(ds.Tables(0).Rows(i).Item("paraType"), 3, 1))
str = ds.Tables(0).Rows(i).Item("gatComNumber")
aCom = Int(IIf(Len(str) = 2, Mid(str, 2, 1), Mid(str, 2, 2))) - 1
Select Case Trim(ds.Tables(0).Rows(i).Item("paraType"))
Case "A111", "A121"
tableName = "protectionFog"
Case "A211", "A221"
tableName = "protectionFire"
Case "A311", "A321"
tableName = "protectionInfrared"
Case "A411", "A421"
tableName = "protectionWater"
Case "A511", "A521"
tableName = "accessControlRec"
End Select
If Len(tableName) > 0 Then
strsql = "insert into " + tableName + " values(" & TransmitID & "," & no & ",'" _
& Now & "' ," & Collection.bDinPort(aCom).GetHashCode & "," & iTempflag & ") "
If search.con.State = ConnectionState.Open Then
search.con.Close()
End If
search.insert(strsql)
End If
End If
Next
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -