|
|
|
基于VB及台达触摸屏的监控系统在纺机中的应用 |
|
|
Public Function change(inputstr, start1 As Integer, start2 As Integer) str_low = Mid(inputstr, start1, 4) '读寄存器中的数据赋给低字节 str_high = Mid(inputstr, start2, 4) '读寄存器中的数据赋给高字节 str_hex = str_high + str_low '整合高低字节数据 str_input = Val("&H" + str_hex) '将十六进制数据转换成十进制 If str_input >= -32768 And str_input <= -1 Then '将转换成十进制处于-32768~32767的数据转换为相应的正数 str_input = str_input + 65536 End If change = str_input / 1000 '返回值 取三位小数 End Function
3)信息查询
信息查询界面如下所示,可对已经保存的生产数据根据时间、班次、产量、车号进行综合查询。
 该功能的程序方面比较简单,主要是对数据库的查询操作。以单独对班次查询为例,其代码如下:
'按班次查询子函数,用于判断其搜索关键字是否有效 Private Sub Chk_team_Click() If Chk_team.Value = 1 Then Combo_team.Enabled = True Else Combo_team.Enabled = False End If End Sub '选择班次子函数,用于判断所选班次 Private Sub Combo_team_Click() Dim liner_str Select Case Combo_team.ListIndex Case 0 liner_str = "甲班" Case 1 liner_str = "乙班" Case 2 liner_str = "丙班" Case 3 liner_str = "丁班" End Select End Sub '班次查询子函数,获取查询字符串 Public Function sch_team() Dim liner_str Dim sch_str_team Select Case Combo_team.ListIndex Case 0 liner_str = "甲班" Case 1 liner_str = "乙班" Case 2 liner_str = "丙班" Case 3 liner_str = "丁班" End Select sch_str_team = "info_liner = '" + liner_str + "'" sch_team = sch_str_team End Function '产量查询函数,用于查询产量并对其进行显示 Private Sub cmd_search_Click() Dim sch_str '按班次查询 If Chk_team.Value = 1 Then |
|
|
|
| |
|
|
|
|
|
|
|
|