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

📄 frmykytczb.frm

📁 县级电力调度管理信息系统。VB6.0开发。 DMIS调度子系统包括以下功能模块:调度操作票管理、调度运行日志、调度交接班管理、调度值班管理、调度报表管理、调度文档、避峰拉闸限电管理等7个业务模块。
💻 FRM
📖 第 1 页 / 共 2 页
字号:
End If
 Debug.Print sql1
   Adodc1.RecordSource = sql1
   Adodc1.Refresh
   Call sx
End Sub

Private Sub Command4_Click()
     Dim sendexcel As Excel.Application
     Set sendexcel = CreateObject("Excel.Application")
     sendexcel.Visible = True
     sendexcel.Workbooks.Add
     
     sql1 = Adodc1.RecordSource
     Call Open_link
       Set RS = ZHCX.Execute(sql1, 1)
        If RS.EOF Then
        Else
            sendexcel.Cells(1, 1).Value = "遥控遥调操作记录"
            sendexcel.Cells(1, 9).Value = "TY-SJ-152"
            sendexcel.Cells(2, 1).Value = "时间"
            sendexcel.Cells(2, 2).Value = "厂站"
            sendexcel.Cells(2, 3).Value = "断路器"
            sendexcel.Cells(2, 4).Value = "原始状态"
            sendexcel.Cells(2, 5).Value = "终止状态"
            sendexcel.Cells(2, 6).Value = "失败次数"
            sendexcel.Cells(2, 7).Value = "原因"
            sendexcel.Cells(2, 8).Value = "是否成功"
            sendexcel.Cells(2, 9).Value = "操作人"
            
            sendexcel.Columns("A:A").ColumnWidth = 14
            sendexcel.Columns("B:B").ColumnWidth = 8
            sendexcel.Columns("C:C").ColumnWidth = 6
            sendexcel.Columns("D:D").ColumnWidth = 8
            sendexcel.Columns("E:E").ColumnWidth = 8
            sendexcel.Columns("F:F").ColumnWidth = 8
            sendexcel.Columns("G:G").ColumnWidth = 20
            sendexcel.Columns("H:H").ColumnWidth = 8
            sendexcel.Columns("i:i").ColumnWidth = 8
            
            
            sendexcel.Columns("A:i").Select
              With sendexcel.Selection.Font
                   .Name = "宋体"
                   .Size = 10
                   .Strikethrough = False
                   .Superscript = False
                   .Subscript = False
                   .OutlineFont = False
                   .Shadow = False
                   .Underline = xlUnderlineStyleNone
                   .ColorIndex = xlAutomatic
              End With
              
              sendexcel.Range("A2:i2").Select
    With sendexcel.Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .ShrinkToFit = False
        .MergeCells = False
    End With
 
    sendexcel.Selection.Font.ColorIndex = 11
    sendexcel.Selection.Font.Bold = True
    
    sendexcel.Range("A2:i2").Select
    With sendexcel.Selection.Interior
        .ColorIndex = 42
        .Pattern = xlSolid
    End With
    sendexcel.Selection.Font.ColorIndex = 11
    sendexcel.Selection.Font.Bold = True
         j = 3
        Do While Not RS.EOF
            For i = 1 To RS.Fields.Count - 2
                If IsNull(RS(i)) Then
                    sendexcel.Cells(j, i).Value = ""
                Else
                    sendexcel.Cells(j, i).Value = CStr(Trim(RS(i)))
                                
                End If
            Next i
            RS.MoveNext
            j = j + 1
       Loop
s_a = "A2:i" & CStr(j - 1)
        sendexcel.Range(s_a).Select
    sendexcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    sendexcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With sendexcel.Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    sendexcel.Rows("1:1").RowHeight = 27
    sendexcel.Range("A1:H1").Select
    sendexcel.ActiveWindow.SmallScroll ToRight:=1
    With sendexcel.Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .ShrinkToFit = False
        .MergeCells = False
    End With
    sendexcel.Selection.Merge
    With sendexcel.Selection.Font
        .Name = "楷体_GB2312"
        .FontStyle = "加粗"
        .Size = 24
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    sendexcel.Range("I1").Select
    sendexcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    sendexcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    sendexcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    sendexcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
    With sendexcel.Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    sendexcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone
     sendexcel.Range("D5").Select
    End If
     Call Close_link
End Sub

Private Sub Command5_Click()
    Dim sendexcel As Excel.Application
    Set sendexcel = CreateObject("Excel.Application")
    sendexcel.Visible = True
    sendexcel.Workbooks.Add
  Sql = Adodc1.RecordSource
 sql1 = "select count(bdz) from xdgl_ykytczb where sj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd ") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd ") & "' "
 sql2 = "select sum(sbcs) from xdgl_ykytczb where sj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd ") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd ") & "' and sfcg='否' "
 sql3 = "select count(bdz) from xdgl_ykytczb where sj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd ") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd ") & "' and sfcg='是' "
 Debug.Print sql1
 Debug.Print sql2
 Debug.Print sql3
 Call Open_link
       Set RS = ZHCX.Execute(sql1, 1)
       Debug.Print sql1
       If Not RS.EOF Then
         temp1 = RS(0)
        Else
         temp1 = 0
       End If
       If RS.State Then
        RS.Close
       End If
       
       Set RS = ZHCX.Execute(sql2, 0)
       If Not RS.EOF Then
         If IsNull(RS(0)) Then
            temp2 = 0
         Else
            temp2 = RS(0)
        End If
      End If
      
        If RS.State Then
        RS.Close
       End If
              
       Set RS = ZHCX.Execute(sql3, 0)
       If Not RS.EOF Then
         temp3 = RS(0)
         Else
         temp3 = 0
       End If
       If RS.State Then
        RS.Close
       End If
           
           

 Sql = Adodc1.RecordSource
     Call Open_link
       Set RS = ZHCX.Execute(Sql, 1)
        If RS.EOF Then
        Else
            sendexcel.Cells(1, 1).Value = "时间"
            sendexcel.Cells(1, 2).Value = "厂站"
            sendexcel.Cells(1, 3).Value = "断路器"
            sendexcel.Cells(1, 4).Value = "原始状态"
            sendexcel.Cells(1, 5).Value = "终止状态"
            sendexcel.Cells(1, 6).Value = "失败次数"
            sendexcel.Cells(1, 7).Value = "原因"
            sendexcel.Cells(1, 8).Value = "是否成功"
            sendexcel.Cells(1, 9).Value = "操作人"
            
            sendexcel.Columns("A:A").ColumnWidth = 14
            sendexcel.Columns("B:B").ColumnWidth = 8
            sendexcel.Columns("C:C").ColumnWidth = 6
            sendexcel.Columns("D:D").ColumnWidth = 6
            sendexcel.Columns("E:E").ColumnWidth = 8
            sendexcel.Columns("F:F").ColumnWidth = 8
            sendexcel.Columns("G:G").ColumnWidth = 20
            sendexcel.Columns("H:H").ColumnWidth = 8
            sendexcel.Columns("I:I").ColumnWidth = 8
            
            sendexcel.Columns("A:I").Select
              With sendexcel.Selection.Font
                   .Name = "宋体"
                   .Size = 10
                   .Strikethrough = False
                   .Superscript = False
                   .Subscript = False
                   .OutlineFont = False
                   .Shadow = False
                   .Underline = xlUnderlineStyleNone
                   .ColorIndex = xlAutomatic
              End With
              
              sendexcel.Range("A1:I1").Select
    With sendexcel.Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .ShrinkToFit = False
        .MergeCells = False
    End With
 
    sendexcel.Selection.Font.ColorIndex = 11
    sendexcel.Selection.Font.Bold = True
    
    sendexcel.Range("A1:i1").Select
    With sendexcel.Selection.Interior
        .ColorIndex = 42
        .Pattern = xlSolid
    End With
    sendexcel.Selection.Font.ColorIndex = 11
    sendexcel.Selection.Font.Bold = True
         j = 2
        Do While Not RS.EOF
            For i = 1 To RS.Fields.Count - 2
                If IsNull(RS(i)) Then
                    sendexcel.Cells(j, i).Value = ""
                Else
                    sendexcel.Cells(j, i).Value = CStr(Trim(RS(i)))
                                
                End If
            Next i
            RS.MoveNext
            j = j + 1
       Loop
       If RS.State Then
         RS.Close
        End If
    sendexcel.Cells(j + 1, 1).Value = "遥控共计" + CStr(temp1) + "次"
    sendexcel.Cells(j + 2, 1).Value = "遥控失败" + CStr(temp2) + "次"
    sendexcel.Cells(j + 3, 1).Value = "遥控成功" + CStr(temp3) + "次"
      'sendexcel.Cells(j, i).Value
s_a = "A1:i" & CStr(j - 1)
        sendexcel.Range(s_a).Select
    sendexcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    sendexcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With sendexcel.Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With sendexcel.Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    
     sendexcel.Range("D5").Select
  End If
      Call Close_link
End Sub

Private Sub Form_Load()
 On Error Resume Next
 DTPicker1.Value = Format(Now, "yyyy-mm-01")
 DTPicker2.Value = DateAdd("d", -1, DateAdd("m", 1, DTPicker1.Value))
sql1 = "select sbmc from XDGL_sblx where sblx='厂站'"
 List1.Clear
 Call Open_link
  Set RS = ZHCX.Execute(sql1, 0)
  Do While Not RS.EOF
   If IsNull(RS(0)) Then
   Else
       List1.AddItem RS(0)
   End If
    RS.MoveNext
  Loop
  If RS.State Then
   RS.Close
  End If
   
  sql2 = "select sbmc from xdgl_sb_sbcsb where sbxl='断路器' and sbdl='" & Trim(List1.Text) & "'"
  List2.Clear
   Set RS = ZHCX.Execute(sql2, 0)
  Do While Not RS.EOF
   If IsNull(RS(0)) Then
   Else
    List2.AddItem RS(0)
   End If
    RS.MoveNext
  Loop
  If RS.State Then
   RS.Close
  End If
 Call Close_link
 If List1.ListCount > 0 Then
   List1.ListIndex = 0
 Else
   A = MsgBox("厂站数据没有录入", vbDefaultButton2)
 End If
' Adodc1.ConnectionString = "PROVIDER=MSDASQL;dsn=ddmis;uid=mis;pwd=mis005;database=zhcx"
' Adodc1.RecordSource = "select * from xdgl_sb_sbcsb"
 Adodc1.Refresh
 DataGrid1.Refresh
Call sx
End Sub

Private Sub List1_Click()

Call Open_link
  sql2 = "select sbmc from xdgl_sb_sbcsb where sbxl='断路器' and sbdl='" & Trim(List1.Text) & "'"
  List2.Clear
   Set RS = ZHCX.Execute(sql2, 0)
  Do While Not RS.EOF
   If IsNull(RS(0)) Then
   Else
    List2.AddItem RS(0)
    End If
    RS.MoveNext
  Loop
  If RS.State Then
   RS.Close
  End If
 Call Close_link
If List2.ListCount = 0 Then
Else
    List2.ListIndex = 0
End If
If Check2.Value Then
sql2 = "select * from xdgl_ykytczb where sj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by sj"
Else
   If Check1.Value Then
     sql2 = "select * from xdgl_ykytczb where bdz='" & Trim(List1.Text) & "' and sj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by sj"
   Else
     sql2 = "select * from xdgl_ykytczb where bdz='" & Trim(List1.Text) & "' and dlq='" & Trim(List2.Text) & "' and sj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by sj"
   End If
End If
         Adodc1.RecordSource = sql2
       Adodc1.Refresh
  Call sx
End Sub

Private Sub List2_Click()
If Check1.Value Then
 sql3 = "select * from xdgl_ykytczb where bdz='" & Trim(List1.Text) & "' and sj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by sj"
Else
 sql3 = "select * from xdgl_ykytczb where bdz='" & Trim(List1.Text) & "' and dlq='" & Trim(List2.Text) & "' and sj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by sj"
End If
 Adodc1.RecordSource = sql3
 Adodc1.Refresh
 Call sx
End Sub
Sub sx()
DataGrid1.Columns(0).Caption = "序号"
DataGrid1.Columns(0).Width = 500
DataGrid1.Columns(1).Caption = "时间"
DataGrid1.Columns(1).Width = 1000
DataGrid1.Columns(2).Caption = "变电站"
DataGrid1.Columns(3).Caption = "断路器"
DataGrid1.Columns(4).Caption = "原始状态"
DataGrid1.Columns(5).Caption = "终止状态"
DataGrid1.Columns(6).Caption = "失败次数"
DataGrid1.Columns(7).Caption = "原因"
DataGrid1.Columns(8).Caption = "是否成功"
DataGrid1.Columns(9).Caption = "操作人员"
DataGrid1.Columns(10).Visible = False
End Sub

⌨️ 快捷键说明

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