⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_erdwsj.frm

📁 远程控制水表的系统。基于无线传输技术对水表远程进行操作
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Begin VB.Label Label5 
         Caption         =   "单    价:"
         ForeColor       =   &H00000040&
         Height          =   255
         Left            =   3000
         TabIndex        =   20
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label6 
         Caption         =   "所余钱数:"
         ForeColor       =   &H00000040&
         Height          =   255
         Left            =   5640
         TabIndex        =   19
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label7 
         Caption         =   "剩余水量:"
         ForeColor       =   &H00000040&
         Height          =   255
         Left            =   360
         TabIndex        =   18
         Top             =   1440
         Width           =   975
      End
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Height          =   3615
      Left            =   120
      TabIndex        =   0
      Top             =   2760
      Width           =   8295
      _ExtentX        =   14631
      _ExtentY        =   6376
      _Version        =   393216
      BackColor       =   -2147483624
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   9
      BeginProperty Column00 
         DataField       =   "时间"
         Caption         =   "采集时间"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "单价"
         Caption         =   "单    价"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "当前吨数"
         Caption         =   "当前吨数"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "剩余水量"
         Caption         =   "剩余水量"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "剩余钱数"
         Caption         =   "剩余钱数"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "当月吨数"
         Caption         =   "当月吨数"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "总水量"
         Caption         =   "总累计水量"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "阀门状态"
         Caption         =   "阀门状态"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "是否窃水"
         Caption         =   "是否窃水"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   854.929
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   794.835
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   870.236
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   840.189
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   840.189
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   870.236
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   1019.906
         EndProperty
         BeginProperty Column07 
            ColumnWidth     =   900.284
         EndProperty
         BeginProperty Column08 
            ColumnWidth     =   959.811
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frm_erdwsj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim shijian As Integer
Dim Strdata As String
Dim danjia As Single
Dim rq As String

Private Sub Command5_Click()
Dim p As Integer
Dim h As Integer
If shijian = 0 Then
If MsgBox("是否确定执行该操作", vbYesNo, "确定") = vbYes Then
If tcpserver.State = sckConnected Then
tcpserver.SendData "#010000" & vbCr
shijian = 1
Timer1.Enabled = True
Else
MsgBox "通信处于异常状态.请从新运行程序"
End If
End If
For p = 0 To 20
h = h + 1
If h > 18 Then
h = 0
End If
Next p
Else
MsgBox "已有数据传输中.请等待"
End If
End Sub

Private Sub Form_Load()
tcpserver.Close
tcpserver.LocalPort = 2009
tcpserver.Listen
Adodc1.ConnectionString = PublicStr
rq = Date
Adodc1.RecordSource = "select * from sjcj where 日期 like '%" & rq & "%'and 点位编号=2"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub tcpserver_ConnectionRequest(ByVal requestID As Long)
 If tcpserver.State <> sckClosed Then _
 tcpserver.Close
 tcpserver.Accept requestID
 Text8.Text = tcpserver.RemoteHostIP
 End Sub

Private Sub tcpserver_DataArrival(ByVal bytesTotal As Long)
tcpserver.GetData Strdata
Dim a(15) As Single
Dim b(15) As String
Dim X As String
If Len(Strdata) > 6 Then
X = Mid(Strdata, 2, 1)
If X = "v" Or X = "V" Then
Label8.Caption = "通信成功"
Command5.Enabled = True
Else
b(0) = Mid(Strdata, 5, 1)
b(1) = Mid(Strdata, 6, 1)
b(2) = Mid(Strdata, 7, 1)
b(3) = Mid(Strdata, 8, 1)
b(4) = Mid(Strdata, 9, 1)
b(5) = Mid(Strdata, 10, 1)
b(6) = Mid(Strdata, 11, 1)
b(7) = Mid(Strdata, 12, 1)
b(8) = Mid(Strdata, 13, 1)
b(9) = Mid(Strdata, 14, 1)
b(10) = Mid(Strdata, 15, 1)
b(11) = Mid(Strdata, 16, 1)
b(12) = Mid(Strdata, 17, 1)
b(13) = Mid(Strdata, 18, 1)
b(14) = Mid(Strdata, 19, 1)
a(0) = Asc(b(0))
a(1) = Asc(b(1))
a(2) = Asc(b(2))
a(3) = Asc(b(3))
a(4) = Asc(b(4))
a(5) = Asc(b(5))
a(6) = Asc(b(6))
a(7) = Asc(b(7))
a(8) = Asc(b(8))
a(9) = Asc(b(9))
a(10) = Asc(b(10))
a(11) = Asc(b(11))
a(12) = Asc(b(12))
a(13) = Asc(b(13))
a(14) = Asc(b(14))
Text1.Text = (a(0) * 128 + a(1)) / 10 '当前吨数
Text2.Text = a(2) * 128 + a(3) '当月吨数
Text3.Text = ((a(12) * 128 * 128) + (a(13) * 128) + a(14)) / 10 '总累计水量
Text4.Text = (a(6) * 128 + a(7)) / 10 '当前流量
danjia = (a(8) * 128 + a(9)) / 100 '单价
Text5.Text = danjia
Text6.Text = a(4) * 128 + a(5) '所余钱数
Text7.Text = (a(4) * 128 + a(5)) / ((a(8) * 128 + a(9)) / 100) '剩余水量
If a(10) = 0 Then
Option1.Value = True
Else
Option2.Value = True
End If
If a(11) = 0 Then
Option3.Value = True
Else
Option4.Value = True
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("点位编号") = 2
Adodc1.Recordset.Fields("单价") = Text5.Text
Adodc1.Recordset.Fields("当前吨数") = Text1.Text
Adodc1.Recordset.Fields("当前流量") = Text4.Text
Adodc1.Recordset.Fields("当月吨数") = Text2.Text
Adodc1.Recordset.Fields("总水量") = Text3.Text
Adodc1.Recordset.Fields("剩余水量") = Text7.Text
Adodc1.Recordset.Fields("剩余钱数") = Text6.Text
Adodc1.Recordset.Fields("时间") = Now()
Adodc1.Recordset.Fields("日期") = rq
If Option1.Value = True Then
Adodc1.Recordset.Fields("阀门状态") = "开"
Else
Adodc1.Recordset.Fields("阀门状态") = "关"
End If
If Option3.Value = True Then
Adodc1.Recordset.Fields("是否窃水") = "是"
Else
Adodc1.Recordset.Fields("是否窃水") = "否"
End If
Adodc1.Recordset.Update
Adodc1.Refresh
End If
End If
End Sub

Private Sub Timer1_Timer()
shijian = 0
Timer1.Enabled = False
End Sub

Private Sub Timer2_Timer()
If tcpserver.State <> sckConnected Then
tcpserver.Close
tcpserver.LocalPort = 2009
tcpserver.Listen
End If
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -