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

📄 frmdlqtzb.frm

📁 县级电力调度管理信息系统。VB6.0开发。 DMIS调度子系统包括以下功能模块:调度操作票管理、调度运行日志、调度交接班管理、调度值班管理、调度报表管理、调度文档、避峰拉闸限电管理等7个业务模块。
💻 FRM
📖 第 1 页 / 共 3 页
字号:
                    sendexcel.Selection.Merge
                        j = j + 1
                End If
                If RS2.State Then
                   RS2.Close
                End If
                    temp = 0
                    Sql = "select * from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "'  and dlq='" & Trim(RS(1)) & "' and dydj='35kV'"
                    Set RS2 = ZHCX.Execute(Sql, 1)
                   If Not RS2.EOF Then
                    Do While Not RS2.EOF
                        'Sql = "select * from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "' and dlq='" & Trim(RS(1)) & "' and dydj='110kV' "
                        'Set RS1 = ZHCX.Execute(Sql, 1)
                        'Do While Not RS1.EOF
                            If IsDate(RS2("fdsj")) Then
                                temp = temp + CDbl(Abs((DateDiff("n", RS2("tzsj"), RS2("fdsj")))))
                            End If
                        '    RS1.MoveNext
                        'Loop
                        'If RS1.State Then
                        'RS1.Close
                        'End If
                        RS2.MoveNext
                    Loop
                      Sql = "select count(dlq),ssfh,TZSJ,FDSJ from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "'  and dlq='" & Trim(RS(1)) & "' and dydj='35kV' GROUP BY SSFH,TZSJ,FDSJ"
                      If RS3.State Then
                         RS3.Close
                      End If
                      Set RS3 = ZHCX.Execute(Sql, 1)
                        sendexcel.Cells(j, 4).Value = Trim(RS(0))
                        sendexcel.Cells(j, 5).Value = Trim(RS(1))
                        sendexcel.Cells(j, 6).Value = CStr("35kV")
                        Sql = "select count(dlq) from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "'  and dlq='" & Trim(RS(1)) & "' and dydj='35kV' "
                        If RS4.State Then
                           RS4.Close
                        End If
                        Set RS4 = ZHCX.Execute(Sql, 1)
                           
                        sendexcel.Cells(j, 7).Value = CStr(RS4(0))
                        If RS4.State Then
                           RS4.Close
                        End If
                        sendexcel.Cells(j, 8).Value = CStr(temp)
                        temp_DL = 0
                        Do While Not RS3.EOF
                            temp1 = CDbl(Abs((DateDiff("n", RS3("tzsj"), RS3("fdsj")))))
                            temp_DL = temp_DL + ((RS3(1)) * temp1) / 60 * 1000
                            RS3.MoveNext
                        Loop
                        sendexcel.Cells(j, 10).Value = CStr(temp_DL)
                        If RS3.State Then
                         RS3.Close
                        End If
                      s_a = "h" & CStr(j) & ":i" & CStr(j)
                        sendexcel.Range(s_a).Select
                        With sendexcel.Selection
                            .HorizontalAlignment = xlCenter
                            .VerticalAlignment = xlBottom
                            .WrapText = False
                            .Orientation = 0
                            .AddIndent = False
                            .ShrinkToFit = False
                            .MergeCells = False
                    End With
                    sendexcel.Selection.Merge
                        
                        j = j + 1
                 End If
                If RS2.State Then
                   RS2.Close
                End If
                    temp = 0
                    Sql = "select * from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "'  and dlq='" & Trim(RS(1)) & "' and dydj='10kV'"
                    Debug.Print Sql
                    Set RS2 = ZHCX.Execute(Sql, 1)
                If Not RS2.EOF Then
                    Do While Not RS2.EOF
                        'Sql = "select * from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "' and dlq='" & Trim(RS(1)) & "' and dydj='110kV' "
                        'Set RS1 = ZHCX.Execute(Sql, 1)
                        'Do While Not RS1.EOF
                            If IsDate(RS2("fdsj")) Then
                                temp = temp + CDbl(Abs((DateDiff("n", RS2("tzsj"), RS2("fdsj")))))
                            End If
                        '    RS1.MoveNext
                        'Loop
                        'If RS1.State Then
                        'RS1.Close
                        'End If
                        RS2.MoveNext
                    Loop
                    If RS2.State Then
                        RS2.Close
                    End If
                      Sql = "select count(dlq),ssfh,TZSJ,FDSJ from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "'  and dlq='" & Trim(RS(1)) & "' and dydj='10kV' GROUP BY SSFH,TZSJ,FDSJ"
                      If RS3.State Then
                         RS3.Close
                      End If
                      Set RS3 = ZHCX.Execute(Sql, 1)
                        sendexcel.Cells(j, 4).Value = Trim(RS(0))
                        sendexcel.Cells(j, 5).Value = Trim(RS(1))
                        sendexcel.Cells(j, 6).Value = CStr("10kV")
                        Sql = "select count(dlq) from xdgl_dlqtzb where tzsj between  '" & Format(DTPicker1.Value, "yyyy-mm-dd") & "' and '" & Format(DTPicker2.Value, "yyyy-mm-dd 23:59:59") & "' and bdz='" & Trim(RS(0)) & "'  and dlq='" & Trim(RS(1)) & "' and dydj='10kV' "
                        If RS4.State Then
                           RS4.Close
                        End If
                        Set RS4 = ZHCX.Execute(Sql, 1)
                           
                        sendexcel.Cells(j, 7).Value = CStr(RS4(0))
                        If RS4.State Then
                           RS4.Close
                        End If
                        sendexcel.Cells(j, 8).Value = CStr(temp)
                        temp_DL = 0
                        Do While Not RS3.EOF
                            If Not IsNull(RS3("FDSJ")) Then
                                temp1 = CDbl(Abs((DateDiff("n", RS3("tzsj"), RS3("fdsj")))))
                           
                            End If
                            temp_DL = temp_DL + ((RS3(1)) * temp1) / 60 * 1000
                            RS3.MoveNext
                        Loop
                        sendexcel.Cells(j, 10).Value = CStr(temp_DL)
                        If RS3.State Then
                         RS3.Close
                        End If
                s_a = "h" & CStr(j) & ":i" & CStr(j)
                        sendexcel.Range(s_a).Select
                        With sendexcel.Selection
                            .HorizontalAlignment = xlCenter
                            .VerticalAlignment = xlBottom
                            .WrapText = False
                            .Orientation = 0
                            .AddIndent = False
                            .ShrinkToFit = False
                            .MergeCells = False
                    End With
                    sendexcel.Selection.Merge
                        j = j + 1
             End If
                End If
                RS.MoveNext
            Loop
        End If
        If RS.State Then
        RS.Close
       End If

End If
If RS.State Then
    RS.Close
 End If

   s_a = "h3:h" & CStr(j - 1)
    sendexcel.Range(s_a).Select
    sendexcel.Selection.NumberFormatLocal = "0.000_ "
   s_a = "A1:j" & 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:I1").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("J1").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
    
  Call Close_link
End Sub

Private Sub Form_Load()
 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 Check1.Value Then
sql2 = "select * from xdgl_dlqtzb"
Else
   If Check2.Value Then
     sql2 = "select * from xdgl_dlqtzb where bdz='" & Trim(List1.Text) & "' and tzsj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by tzsj"
   Else
     sql2 = "select * from xdgl_dlqtzb where bdz='" & Trim(List1.Text) & "' and dlq='" & Trim(List2.Text) & "' and tzsj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by tzsj"
   End If
End If
  Debug.Print sql2
  Adodc1.RecordSource = sql2
  Adodc1.Refresh
  Call sx
End Sub

Private Sub List2_Click()
If Check1.Value Then
 sql3 = "select * from xdgl_dlqtzb where bdz='" & Trim(List1.Text) & "' and tzsj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by tzsj"
Else
 sql3 = "select * from xdgl_dlqtzb where bdz='" & Trim(List1.Text) & "' and dlq='" & Trim(List2.Text) & "' and tzsj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by tzsj"
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).Visible = False
DataGrid1.Columns(9).Visible = False
DataGrid1.Columns(10).Caption = "电压等级"
DataGrid1.Columns(11).Caption = "损失负荷"
End Sub

⌨️ 快捷键说明

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