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

📄 frmsendchart.frm

📁 采用面向负荷控制技术
💻 FRM
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form frmSendChart 
   Caption         =   "投放后负荷曲线模拟"
   ClientHeight    =   6945
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9360
   LinkTopic       =   "Form1"
   ScaleHeight     =   6945
   ScaleWidth      =   9360
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmd_ok 
      Caption         =   "确认"
      Height          =   495
      Left            =   6000
      TabIndex        =   7
      Top             =   6240
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Height          =   1335
      Left            =   720
      TabIndex        =   4
      Top             =   0
      Width           =   2655
      Begin VB.ComboBox cmb_group 
         Height          =   300
         Left            =   360
         TabIndex        =   5
         Text            =   " "
         Top             =   600
         Width           =   1815
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "选择班组"
         Height          =   180
         Left            =   360
         TabIndex        =   6
         Top             =   240
         Width           =   720
      End
   End
   Begin VB.Frame Frame2 
      Height          =   1335
      Left            =   4200
      TabIndex        =   1
      Top             =   0
      Width           =   2655
      Begin VB.OptionButton opt_curve 
         Caption         =   "曲线图"
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   240
         Width           =   1575
      End
      Begin VB.OptionButton opt_col 
         Caption         =   "柱状图"
         Height          =   255
         Left            =   240
         TabIndex        =   2
         Top             =   600
         Width           =   1335
      End
   End
   Begin VB.CommandButton cmd_exit 
      Caption         =   "退出"
      Height          =   495
      Left            =   7440
      TabIndex        =   0
      Top             =   6240
      Width           =   1095
   End
   Begin MSChart20Lib.MSChart MSChart1 
      Height          =   4695
      Left            =   0
      OleObjectBlob   =   "frmSendChart.frx":0000
      TabIndex        =   8
      Top             =   1440
      Width           =   9375
   End
End
Attribute VB_Name = "frmSendChart"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Dim mconn As New ADODB.Connection
'Dim gname As String

Private Sub cmd_ok_Click()
If opt_curve.Value = True Then
    MSChart1.chartType = VtChChartType2dLine
ElseIf opt_col.Value = True Then
    MSChart1.chartType = VtChChartType2dBar
End If
Call send_showChartGroup(cmb_group.Text)
End Sub

Private Sub Form_Load()
Dim gname As String, str0
Dim rs As New ADODB.Recordset
'mconn.Open "DSN=dlrwdb;uid=scl"mconn.Open "DSN=dbw;uid=scl"
gname = "select distinct location from device"
'gname = "select distinct locationname from t_subpmreference"
rs.CursorLocation = adUseClient
rs.Open gname, mconn, adOpenKeyset, adLockPessimistic
rs.MoveFirst
While Not rs.EOF
    If Not IsNull(rs(0)) Then
     cmb_group.AddItem rs(0)
    End If
    rs.MoveNext
Wend
rs.Close
gname = getpara()
str0 = Split(gname, ":")
If (str0(1) = "未选班组") Then
    'MsgBox "请选择班组", vbOKOnly
End If
opt_col.Value = True
If str0(0) = "班组" Then
    cmb_group.Text = str0(1)
End If
End Sub
Sub send_showChartGroup(gn As String)
Dim sql As String, rs As New ADODB.Recordset
Dim dd As String, i As Integer, peri As Integer
Dim arr(), dt As Date
If (gn = "未选班组") Then
    MsgBox "请选择班组", vbOKOnly
    Exit Sub
End If

peri = getperiod()
ReDim arr(peri)
dd = Date
arr(1) = gn

For i = 2 To peri
    dt = Date
    dt = dt + i - 2
    dd = dt
    sql = "select sum(timeoccupy) from deviceload where plandate='" & dd & "' "
    sql = sql & " and deviceno='" & gn & "' or deviceno in (select deviceno from "
    sql = sql & " device where location='" & gn & "')"
    rs.CursorLocation = adUseClient
    rs.Open sql, mconn, adOpenKeyset, adLockPessimistic
    rs.MoveFirst
    arr(i) = rs(0)
    rs.Close
Next i
MSChart1.ChartData = arr
End Sub



Private Sub Form_Unload(Cancel As Integer)
Call cmd_exit_Click
End Sub
Sub cmd_exit_Click()
Set mconn = Nothing
Unload Me
End Sub
Function getperiod() As Integer
Dim sql As String, rs1 As New ADODB.Recordset
sql = "select * from t_ctrl"
rs1.CursorLocation = adUseClient
rs1.Open sql, mconn, adOpenKeyset, adLockPessimistic
rs1.MoveFirst
getperiod = rs1("period")
rs1.Close
End Function

⌨️ 快捷键说明

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