www.pudn.com > VB-KAOQINXITONG.zip > frmPubRemoveControl.frm


VERSION 5.00 
Object = "{B9D938CE-50EE-40B2-9FA2-79A3112F4788}#4.0#0"; "BNCtrlGroup.ocx" 
Begin VB.Form frmPubRemoveControl  
   ClientHeight    =   3825 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   6090 
   Icon            =   "frmPubRemoveControl.frx":0000 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   ScaleHeight     =   3825 
   ScaleWidth      =   6090 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.Frame Frame1  
      Appearance      =   0  'Flat 
      ForeColor       =   &H80000008& 
      Height          =   1860 
      Left            =   2880 
      TabIndex        =   10 
      Top             =   1785 
      Width           =   3105 
      Begin VB.OptionButton optAuto  
         Appearance      =   0  'Flat 
         Caption         =   "下载权限" 
         ForeColor       =   &H80000008& 
         Height          =   180 
         Index           =   1 
         Left            =   255 
         TabIndex        =   5 
         Top             =   1365 
         Width           =   1170 
      End 
      Begin VB.OptionButton optAuto  
         Appearance      =   0  'Flat 
         Caption         =   "采集数据" 
         ForeColor       =   &H80000008& 
         Height          =   180 
         Index           =   0 
         Left            =   270 
         TabIndex        =   4 
         Top             =   930 
         Width           =   1170 
      End 
      Begin VB.OptionButton optAuto  
         Appearance      =   0  'Flat 
         Caption         =   "待命" 
         ForeColor       =   &H80000008& 
         Height          =   180 
         Index           =   2 
         Left            =   285 
         TabIndex        =   3 
         Top             =   450 
         Value           =   -1  'True 
         Width           =   1170 
      End 
      Begin BNCtrlGroup.BNButton cmdExecute  
         Default         =   -1  'True 
         Height          =   435 
         Left            =   1875 
         TabIndex        =   6 
         Tag             =   "Excute" 
         Top             =   720 
         Width           =   1035 
         _ExtentX        =   1826 
         _ExtentY        =   767 
         Caption         =   "执 行" 
         CapAlign        =   2 
         BackStyle       =   2 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Mode            =   0 
         Value           =   0   'False 
         cBack           =   -2147483633 
      End 
      Begin BNCtrlGroup.BNButton cmdExit  
         Cancel          =   -1  'True 
         Height          =   375 
         Left            =   1875 
         TabIndex        =   7 
         Tag             =   "Exit" 
         Top             =   1245 
         Width           =   1035 
         _ExtentX        =   1826 
         _ExtentY        =   661 
         Caption         =   "退 出" 
         CapAlign        =   2 
         BackStyle       =   2 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   10.5 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Mode            =   0 
         Value           =   0   'False 
         cBack           =   -2147483633 
      End 
   End 
   Begin VB.ListBox lstStatus  
      Appearance      =   0  'Flat 
      BackColor       =   &H00E0E0E0& 
      Columns         =   1 
      Height          =   1110 
      Left            =   2865 
      TabIndex        =   2 
      Top             =   465 
      Width           =   3135 
   End 
   Begin VB.Timer tmrCheck  
      Enabled         =   0   'False 
      Interval        =   1000 
      Left            =   1575 
      Top             =   3000 
   End 
   Begin VB.ListBox lstHost  
      Appearance      =   0  'Flat 
      BackColor       =   &H00E0E0E0& 
      Columns         =   1 
      Height          =   3180 
      Left            =   150 
      Style           =   1  'Checkbox 
      TabIndex        =   1 
      Top             =   465 
      Width           =   2610 
   End 
   Begin BNCtrlGroup.BNButton cmdRefresh  
      Height          =   345 
      Left            =   4815 
      TabIndex        =   8 
      Tag             =   "Refresh" 
      Top             =   75 
      Width           =   1125 
      _ExtentX        =   1984 
      _ExtentY        =   609 
      Caption         =   "刷 新" 
      CapAlign        =   2 
      BackStyle       =   2 
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Mode            =   0 
      Value           =   0   'False 
      cBack           =   -2147483633 
   End 
   Begin VB.Label lblList  
      AutoSize        =   -1  'True 
      Caption         =   "上位机状态:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   1 
      Left            =   2910 
      TabIndex        =   9 
      Top             =   135 
      Width           =   1155 
   End 
   Begin VB.Label lblList  
      AutoSize        =   -1  'True 
      Caption         =   "上位机列表:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.5 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   210 
      Index           =   0 
      Left            =   135 
      TabIndex        =   0 
      Top             =   135 
      Width           =   1155 
   End 
End 
Attribute VB_Name = "frmPubRemoveControl" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
 
Dim adoRS As ADODB.Recordset 
Dim mbEnabled As Boolean 
Dim mbDisabled As Boolean 
 
Private Sub cmdExecute_Click() 
  Dim i As Integer 
  Dim j As Integer 
  Dim sControl As String 
  Dim bEnabled As Boolean 
  mbDisabled = True 
  If (lstHost.SelCount > 0) And (optAuto(0) Or optAuto(1)) Then 
    For i = 1 To lstHost.ListCount 
      If lstHost.Selected(i - 1) Then 
        bEnabled = False 
        For j = 1 To lstStatus.ListCount 
          If lstStatus.List(j - 1) = lstHost.List(i - 1) Then 
            bEnabled = True 
          End If 
        Next j 
        If bEnabled Then 
          adoRS.Filter = "W1027 = '" & lstHost.List(i - 1) & "'" 
          sControl = gclsInclude.MyNz(adoRS!W1030, "00000000") 
          If optAuto(0) Then sControl = 1 & Mid(sControl, 2) 
          If optAuto(1) Then sControl = Left(sControl, 1) & 1 & Mid(sControl, 3) 
          adoRS!W1030 = sControl 
          adoRS.Update 
        End If 
      End If 
    Next i 
    adoRS.Filter = 0 
    Unload Me 
  Else 
    MsgBox "请选择远程控制命令以及待控制的下位机", vbExclamation 
  End If 
  mbDisabled = False 
End Sub 
 
Private Sub cmdRefresh_Click() 
  Dim sStatus As String 
  adoRS.MoveFirst 
  lstHost.Clear 
  Do While Not adoRS.EOF 
    lstHost.AddItem adoRS!W1027 
    sStatus = gclsInclude.MyNz(adoRS!W1031, "00000000") 
    If Mid(sStatus, 1, 1) = "1" Then gclsInclude.MyMid sStatus, 1, "0" 
    If Mid(sStatus, 2, 1) = "1" Then gclsInclude.MyMid sStatus, 2, "0" 
    If Mid(sStatus, 3, 1) = "1" Then gclsInclude.MyMid sStatus, 3, "0" 
    adoRS!W1031 = sStatus 
    adoRS.Update 
    adoRS.MoveNext 
  Loop 
  adoRS.MoveFirst 
End Sub 
 
Private Sub Form_Activate() 
  If Not mbEnabled Then 
    Unload Me 
  End If 
End Sub 
 
Private Sub Form_Load() 
  LoSetButtonTag 
  SetIcon Me 
  Me.Caption = gTAppLicInfo.SysClient & "控制机所属设备远程控制" 
  cmdExecute.Enabled = False 
  lstHost.ToolTipText = "上位机选择器" 
  lstStatus.ToolTipText = "当前正连线的有效上位机列表" 
  Set adoRS = New ADODB.Recordset 
  adoRS.Open "SELECT * FROM T0105S001 WHERE W1032='" & gTAppLicInfo.SysClient & "'", gDBRecordConn, adOpenStatic, adLockOptimistic 
  If adoRS.RecordCount > 0 Then 
    mbEnabled = True 
    cmdRefresh_Click 
    tmrCheck.Interval = 2000 
    tmrCheck.Enabled = True 
  Else 
    MsgBox "系统找不到上位机信息,请先添加上位机设备", vbExclamation 
  End If 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
  On Error Resume Next 
  adoRS.Close 
  Set adoRS = Nothing 
End Sub 
 
Private Sub tmrCheck_Timer() 
  If mbDisabled Then Exit Sub 
  Dim i As Integer 
  Dim bEnabled As Boolean 
  adoRS.Requery 
  adoRS.MoveFirst 
  lstStatus.Clear 
  bEnabled = False 
  For i = 1 To adoRS.RecordCount 
    If Mid(adoRS!W1031, 3, 1) = 1 Then 
      lstStatus.AddItem adoRS!W1027 
      bEnabled = True 
    End If 
    adoRS.MoveNext 
  Next i 
  If cmdExecute.Enabled <> bEnabled Then cmdExecute.Enabled = bEnabled 
End Sub 
 
Private Sub LoSetButtonTag() 
  cmdExecute.Tag = "IMG028" 
  cmdExit.Tag = "IMG029" 
  cmdRefresh.Tag = "IMG040" 
End Sub