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

📄 dlgbarscreen.frm

📁 排队分诊管理系统源代码!该代码使用VB6开发环境
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form dlgBarScreen 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "窗口条屏参数设置"
   ClientHeight    =   3225
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4560
   Icon            =   "dlgBarScreen.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3225
   ScaleWidth      =   4560
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.TextBox txtMode 
      Height          =   270
      Left            =   1320
      TabIndex        =   2
      Top             =   1080
      Width           =   3015
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消(&C)"
      Height          =   375
      Left            =   3360
      TabIndex        =   5
      Top             =   2760
      Width           =   975
   End
   Begin VB.TextBox txtCode 
      Enabled         =   0   'False
      Height          =   270
      Left            =   1320
      TabIndex        =   0
      Top             =   120
      Width           =   3015
   End
   Begin VB.TextBox txtName 
      Height          =   270
      Left            =   1320
      TabIndex        =   1
      Top             =   600
      Width           =   3015
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定(&O)"
      Height          =   375
      Left            =   2400
      TabIndex        =   4
      Top             =   2760
      Width           =   975
   End
   Begin MSComctlLib.ListView lsvWindows 
      Height          =   855
      Left            =   240
      TabIndex        =   3
      Top             =   1800
      Width           =   4095
      _ExtentX        =   7223
      _ExtentY        =   1508
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   0   'False
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      Appearance      =   1
      NumItems        =   2
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "服务编号"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Alignment       =   2
         SubItemIndex    =   1
         Text            =   "服务名称"
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.Label lblInfo 
      Caption         =   "条屏编号:"
      Height          =   195
      Index           =   0
      Left            =   240
      TabIndex        =   9
      Top             =   165
      Width           =   975
   End
   Begin VB.Label lblInfo 
      Caption         =   "条屏说明:"
      Height          =   195
      Index           =   1
      Left            =   240
      TabIndex        =   8
      Top             =   645
      Width           =   975
   End
   Begin VB.Label lblInfo 
      Caption         =   "条屏型号:"
      Height          =   195
      Index           =   2
      Left            =   240
      TabIndex        =   7
      Top             =   1155
      Width           =   975
   End
   Begin VB.Label lblInfo 
      Caption         =   "对应相关服务:"
      Height          =   195
      Index           =   3
      Left            =   240
      TabIndex        =   6
      Top             =   1560
      Width           =   1335
   End
End
Attribute VB_Name = "dlgBarScreen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim m_tagErrInfo    As TYPE_ERRORINFO

Dim m_sCode         As String
Dim m_bChange       As Boolean
Dim m_iChoice       As Integer

Private Sub cmdCancel_Click()
    On Error Resume Next
    Unload Me
End Sub

Private Sub cmdOK_Click()
    On Error GoTo ERROR_EXIT
    Dim iTrans As Integer, i As Integer
    
    If Not IsNumeric(txtCode.Text) Then
        MsgBox "请输入正确的窗口条屏编号!", vbOKOnly, "系统提示"
        Exit Sub
    End If
    If m_iChoice = 0 Then
        MsgBox "请选择对应的条屏服务信息!", vbOKOnly, "系统提示"
        Exit Sub
    End If
        
    '修改数据库
    iTrans = dbMyDB.BeginTrans
    
    If m_bChange = False Then
        dbMyDB.Execute "INSERT INTO Style([st_code],[st_type],[st_name],[st_mode],[note],[nouse_yesno])" _
                & "VALUES( '" & txtCode.Text & "', '3', '" & txtName.Text & "', '" & txtMode.Text & "', 'NULL', '0')"
        dbMyDB.Execute "INSERT INTO StyleRelation([sr_type],[st_code],[st_type],[rt_code],[rt_type])" _
                & "VALUES( '2', '" & txtCode.Text & "', '3', '" & lsvWindows.ListItems(m_iChoice).Text & "', '1')"
    Else
        dbMyDB.Execute "UPDATE Style SET st_name = '" & txtName.Text & "', st_mode = '" & txtMode.Text & "' " & _
                "WHERE st_code = '" & txtCode.Text & "' AND st_type = 3"
        dbMyDB.Execute "UPDATE StyleRelation SET rt_code = '" & lsvWindows.ListItems(m_iChoice).Text & "' ," & _
                "rt_type = 1 WHERE sr_type = 2 AND st_code = '" & txtCode.Text & "' AND st_type = 3"
    End If
    
    If iTrans > 0 Then
        dbMyDB.CommitTrans
        iTrans = 0
    End If
    
    Unload Me
    
    Exit Sub
ERROR_EXIT:
    If iTrans > 0 Then dbMyDB.RollbackTrans
    m_tagErrInfo.strErrDate = Format(Now, "yyyy-mm-dd hh:mm:ss")
    m_tagErrInfo.strErrFile = "dlgBarScreen"
    m_tagErrInfo.strErrFunc = "cmdOK_Click"
    m_tagErrInfo.nErrNum = Err.Number
    m_tagErrInfo.strErrDesc = Error(Err.Number)
    If Err.Number <> 0 Then Err.Clear
    modErrorInfo.WriteErrLog m_tagErrInfo
End Sub

Private Sub Form_Load()
    On Error GoTo ERROR_EXIT
    Dim rs As New ADODB.Recordset, cmd As New ADODB.Command
    Dim strSQL As String, i As Integer
    Dim itmX As ListItem
    
    m_bChange = False
    m_iChoice = 0
    
    '连接数据库
    cmd.ActiveConnection = dbMyDB
    cmd.CommandType = adCmdText
    
    '查询数据库
    strSQL = "SELECT TOP 1 * FROM Style WHERE st_type = 3 ORDER BY st_id DESC"
    cmd.CommandText = strSQL
    rs.CursorLocation = adUseClient
    rs.Open cmd, , adOpenStatic, adLockReadOnly
    If Not rs.EOF And rs.RecordCount > 0 Then
        rs.MoveFirst
        If Not IsNumeric(rs!st_code) Then GoTo ERROR_EXIT
        i = CInt(rs!st_code) + 1
        m_sCode = CStr(i)
    Else
        m_sCode = "1"
    End If
    rs.Close
    
    strSQL = "SELECT * FROM Style WHERE st_type = 1 "
    cmd.CommandText = strSQL
    rs.CursorLocation = adUseClient
    rs.Open cmd, , adOpenStatic, adLockReadOnly
    If Not rs.EOF And rs.RecordCount > 0 Then
        rs.MoveFirst
        For i = 1 To rs.RecordCount
            Set itmX = lsvWindows.ListItems.Add(, , rs!st_code)
            itmX.SubItems(1) = rs!st_name
            rs.MoveNext
        Next i
    End If
    rs.Close
    
    If rs.State = adStateOpen Then rs.Close
    Set rs = Nothing
    Set cmd = Nothing
    
    Exit Sub
ERROR_EXIT:
    m_tagErrInfo.strErrDate = Format(Now, "yyyy-mm-dd hh:mm:ss")
    m_tagErrInfo.strErrFile = "dlgBarScreen"
    m_tagErrInfo.strErrFunc = "Form_Load"
    m_tagErrInfo.nErrNum = Err.Number
    m_tagErrInfo.strErrDesc = Error(Err.Number)
    If Err.Number <> 0 Then Err.Clear
    modErrorInfo.WriteErrLog m_tagErrInfo
End Sub

Private Sub Form_Terminate()
    On Error Resume Next
    Set dlgBarScreen = Nothing
End Sub

Private Sub lstWindows_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = 13 Then  '是回车键?
    KeyAscii = 0 '0取消输入
    SendKeys "{tab}"
    End If
End Sub

Private Sub lsvWindows_ItemClick(ByVal Item As MSComctlLib.ListItem)
    On Error Resume Next
    m_iChoice = Item.Index
End Sub

Private Sub txtCode_GotFocus()
    On Error Resume Next
    txtCode.BackColor = &H80000018
End Sub

Private Sub txtCode_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = 13 Then  '是回车键?
    KeyAscii = 0 '0取消输入
    SendKeys "{tab}"
    End If
End Sub

Private Sub txtCode_LostFocus()
    On Error Resume Next
    txtCode.BackColor = &H80000005
End Sub

Private Sub txtMode_GotFocus()
    On Error Resume Next
    txtMode.BackColor = &H80000018
End Sub

Private Sub txtMode_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = 13 Then  '是回车键?
    KeyAscii = 0 '0取消输入
    SendKeys "{tab}"
    End If
End Sub

Private Sub txtMode_LostFocus()
    On Error Resume Next
    txtMode.BackColor = &H80000005
End Sub

Private Sub txtName_GotFocus()
    On Error Resume Next
    txtName.BackColor = &H80000018
End Sub

Private Sub txtName_KeyPress(KeyAscii As Integer)
    On Error Resume Next
    If KeyAscii = 13 Then  '是回车键?
    KeyAscii = 0 '0取消输入
    SendKeys "{tab}"
    End If
End Sub

Private Sub txtName_LostFocus()
    On Error Resume Next
    txtName.BackColor = &H80000005
End Sub

'//////////////////////////////////////////////////////////////////////////////////////////
'/设定条屏编号
Public Property Let ScreenCode(ByVal vNewValue As String)
    On Error Resume Next
    m_sCode = vNewValue
    m_bChange = True
End Property

'初始化对话框
Public Function InitSet() As Boolean
    On Error GoTo ERROR_EXIT
    Dim rs As New ADODB.Recordset, cmd As New ADODB.Command
    Dim strSQL As String, i As Integer
    Dim sCode As String
    
    If m_bChange = False Then
        txtCode.Text = m_sCode
    Else
        '连接数据库
        cmd.ActiveConnection = dbMyDB
        cmd.CommandType = adCmdText
        
        '查询数据库
        strSQL = "SELECT  * FROM Style WHERE st_type = 3 AND st_code = '" & m_sCode & "'"
        cmd.CommandText = strSQL
        rs.CursorLocation = adUseClient
        rs.Open cmd, , adOpenStatic, adLockReadOnly
        If Not rs.EOF And rs.RecordCount > 0 Then
            txtCode.Text = m_sCode
            If Not IsNull(rs!st_name) Then txtName.Text = rs!st_name
            If Not IsNull(rs!st_mode) Then txtMode.Text = rs!st_mode
        Else
            GoTo ERROR_EXIT
        End If
        rs.Close

        '查询数据库
        strSQL = "SELECT  * FROM StyleRelation WHERE sr_type = 2 AND st_type = 3 AND st_code = '" & m_sCode & "'"
        cmd.CommandText = strSQL
        rs.CursorLocation = adUseClient
        rs.Open cmd, , adOpenStatic, adLockReadOnly
        If Not rs.EOF And rs.RecordCount > 0 Then
            sCode = rs!rt_code
        Else
            sCode = ""
        End If
        rs.Close
    End If
    
    If Trim$(sCode) <> "" And lsvWindows.ListItems.Count > 0 Then
        For i = 1 To lsvWindows.ListItems.Count
            If Trim$(sCode) = Trim$(lsvWindows.ListItems(i).Text) Then
                Exit For
            End If
        Next i
        m_iChoice = i
        lsvWindows.ListItems(i).Selected = True
    End If
    
    If rs.State = adStateOpen Then rs.Close
    Set rs = Nothing
    Set cmd = Nothing
    
    InitSet = True
    Exit Function
ERROR_EXIT:
    m_tagErrInfo.strErrDate = Format(Now, "yyyy-mm-dd hh:mm:ss")
    m_tagErrInfo.strErrFile = "dlgBarScreen"
    m_tagErrInfo.strErrFunc = "InitSet"
    m_tagErrInfo.nErrNum = Err.Number
    m_tagErrInfo.strErrDesc = Error(Err.Number)
    If Err.Number <> 0 Then Err.Clear
    modErrorInfo.WriteErrLog m_tagErrInfo
End Function

⌨️ 快捷键说明

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