/// <summary>
        /// 获得容量
        /// </summary>
        /// <param name="typ">1风场 2工期 3全部</param>
        /// <param name="id">id</param>
        /// <returns></returns>
        private double GetRl(string typ, string id)
        {
            if (typ == "1")
            {
                sql = @"SELECT SUM(double(容量)) FROM            
                (select t.T_ORGID T_PERIODID,(select p.T_ORGID from ADMINISTRATOR.T_BASE_PERIOD p where p.T_PERIODID=t.T_ORGID) T_ORGID,t.容量
                from ADMINISTRATOR.T_INFO_RL t )
                where T_ORGID='" + id + "'";
            }
            else if (typ == "2")
            {
                sql = "select sum(double(容量)) from ADMINISTRATOR.T_INFO_RL  where T_ORGID='" + id + "'";
            }
            else if (typ == "3")
            {
                sql = "select sum(double(容量)) from ADMINISTRATOR.T_INFO_RL where T_ORGID in('MGYYQ-YQ','FLDFDC-QB','MGYEQ-EQ','SDFDC-QB')";
            }

            object obj = dl.RunSingle(sql, out errMsg);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(double.Parse(obj.ToString()));
            }
        }
Beispiel #2
0
        /// <summary>
        /// 执行SQL语句
        /// </summary>
        /// <param name="name"></param>
        public object GetOrder(string name, string tableName)
        {
            sql = "select max(I_SHOWID) from " + tableName + " where T_DCNAME='" + name + "'";
            object obj = dl.RunSingle(sql, out errMsg); sql = "";

            return(obj);
        }
Beispiel #3
0
        /// <summary>
        /// 统计小时
        /// </summary>
        /// <param name="qsrq"></param>
        /// <param name="jsrq"></param>
        /// <param name="unit"></param>
        /// <returns></returns>
        public string tjxs(string qsrq, string jsrq, int unit)
        {
            object obj = null;

            //this.init();
            sql = " SELECT sum(运行小时) FROM 参数运行小时统计表 where 统计参数='统计时间' and 机组=" + unit + " and 时间>='" + qsrq + "' and 时间<'" + jsrq + "'";
            obj = dl.RunSingle(sql, out errMsg);
            //if (rtDBType == "SQL")
            //{
            //    sql = " SELECT sum(运行小时) FROM 参数运行小时统计表 where 统计参数='统计时间' and 机组=" + unit + " and 时间>='" + qsrq + "' and 时间<'" + jsrq + "'";
            //    obj = DBsql.RunSingle(sql, out errMsg);
            //}
            //else if (rtDBType == "DB2")
            //{
            //    sql = " SELECT sum(运行小时) FROM 参数运行小时统计表 where 统计参数='统计时间' and 机组=" + unit + " and 时间>='" + qsrq + "' and 时间<'" + jsrq + "'";
            //}

            if (obj != null && obj != "" && obj != " ")
            {
                if (obj.ToString() != "")
                {
                    return(obj.ToString());
                }
                else
                {
                    return("0");
                }
            }
            else
            {
                return("0");
            }
        }
        /// <summary>
        /// 获得容量
        /// </summary>
        /// <param name="typ">1风场 2工期 3全部</param>
        /// <param name="id">id</param>
        /// <returns></returns>
        private double GetRl(string typ, string id)
        {
            if (typ == "1")
            {
                sql = @"SELECT SUM(INT(容量)) FROM            
                (select t.T_ORGID T_PERIODID,(select p.T_ORGID from ADMINISTRATOR.T_BASE_PERIOD p where p.T_PERIODID=t.T_ORGID) T_ORGID,t.容量
                from ADMINISTRATOR.T_INFO_RL t )
                where T_ORGID='" + id + "'";
            }
            else if (typ == "2")
            {
                sql = "select sum(int(容量)) from ADMINISTRATOR.T_INFO_RL  where T_ORGID='" + id + "'";
            }
            else if (typ == "3")
            {
                sql = "select sum(int(容量)) from ADMINISTRATOR.T_INFO_RL where T_ORGID='FDRL'";
            }
            else if (typ == "all")
            {
                sql = "select sum(int(容量)) from ADMINISTRATOR.T_INFO_RL where T_ORGID in ('FDRL','HDRL','SDRL','TYNRL','FBSRL','SRZRL')";
            }


            object obj = dl.RunSingle(sql, out errMsg);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(double.Parse(obj.ToString()));
            }
        }
Beispiel #5
0
        /// <summary>
        /// 创建数据表
        /// </summary>
        /// <param name="tableName">数据表名称</param>
        /// <returns></returns>
        public string createTable(string tableName)
        {
            sql = "if object_id(N'" + tableName + "',N'U') is not null print '存在' else print '不存在'";
            obj = db.RunSingle(sql, out errMsg);

            return(obj.ToString());
        }
Beispiel #6
0
        /// <summary>
        /// 获得班值信息
        /// </summary>
        /// <returns></returns>
        public string[] DutyValue(string date)
        {
            object obj = null;

            string[] args = new string[3];
            string[] sqls = new string[3];

            sqls[0] = "SELECT 班组编号 FROM 排班表 WHERE (结束时间 = '" + date + " 7:59:59')";

            sqls[1] = "SELECT 班组编号 FROM 排班表 WHERE (结束时间 = '" + date + " 15:59:59')";

            sqls[2] = "SELECT 班组编号 FROM 排班表 WHERE (结束时间 = '" + date + " 23:59:59')";

            for (int i = 0; i < 3; i++)
            {
                //if (rlDBType == "SQL")
                //    obj = DBsql.RunSingle(sqls[i], out errMsg);
                //else if (rlDBType == "DB2")
                //    obj = DBdb2.RunSingle(sqls[i], out errMsg);
                obj = dl.RunSingle(sqls[i], out errMsg);
                if (obj != null)
                {
                    args[i] = obj.ToString();
                }
            }

            return(args);
        }
Beispiel #7
0
        /// <summary>
        /// 获取机组实时负荷
        /// </summary>
        /// <param name="unitId"></param>
        /// <returns></returns>
        public double GetPower()
        {
            sql = "select T_POWERTAG from T_BASE_POINT_UNIT where T_UNITID='0'";
            obj = db.RunSingle(sql, out errMsg);

            if (obj != null)
            {
                val = GetPointVal(obj.ToString());
            }
            return(val);
        }
Beispiel #8
0
        /// <summary>
        /// 最近容量
        /// </summary>
        /// <param name="unitId">机组编号</param>
        /// <param name="sTime">最近时间</param>
        /// <returns>最近时间点容量</returns>
        public double GetNewestRL(string id, string time)
        {
            sql = "select 容量 from T_INFO_RL where T_ORGID='" + id + "' order by T_TIME desc fetch first 1 rows only";
            obj = dl.RunSingle(sql, out errMsg);

            if (obj != null)
            {
                val = Convert.ToDouble(obj);
            }
            return(val);
        }
Beispiel #9
0
        /// <summary>
        /// 获取机组实时负荷
        /// </summary>
        /// <param name="unitId">机组编号</param>
        /// <param name="sTime">开始时间</param>
        /// <param name="eTime">结束时间</param>
        /// <returns>最大负荷</returns>
        public double GetTJPowerMax(string unitId, string sTime, string eTime)
        {
            sql = "select max(T_VALUE) from T_INFO_STATISCS where T_UNITID='" + unitId + "' and (T_TIME between '" + sTime + "' and '" + eTime + "')";
            obj = db.RunSingle(sql, out errMsg);

            if (obj != null)
            {
                val = Convert.ToDouble(obj);
            }
            return(val);
        }
Beispiel #10
0
 /// <summary>
 /// 获取电量
 /// </summary>
 /// <param name="point"></param>
 /// <param name="st"></param>
 /// <param name="et"></param>
 /// <returns></returns>
 public object GetDLAll(string point, string st, string et)
 {
     sql = "select sum(VALUE) value from DAYDATA where PARAID='" + point + "' and (STATCALTIME between '" + st + "' and '" + et + "')";
     obj = dl.RunSingle(sql, out errMsg);
     return(obj);
 }