Beispiel #1
0
        /// <summary>
        /// 根据时间获取五大集团最优机组供电煤耗信息。
        /// </summary>
        /// <param name="times"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public List<BestUnitConsumeInfo> GetInfoByTime(string times, out string errMsg)
        {
            DataTable dts=dt.GetInfoByTime(times, out errMsg);
            List<BestUnitConsumeInfo> infoList = new List<BestUnitConsumeInfo>();
            //转化为list,筛选。
            if (dts.Rows.Count > 0)
            {
                for (int i = 0; i < dts.Rows.Count; i++)
                {
                    BestUnitConsumeInfo info = new BestUnitConsumeInfo();

                    info.T_COMPANY = String.IsNullOrEmpty(dts.Rows[i]["T_COMPANY"].ToString()) ? String.Empty : dts.Rows[i]["T_COMPANY"].ToString();
                    info.T_900_SL = String.IsNullOrEmpty(dts.Rows[i]["T_900_SL"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["T_900_SL"].ToString());
                    info.T_600_HJ = String.IsNullOrEmpty(dts.Rows[i]["T_600_HJ"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["T_600_HJ"].ToString());
                    info.T_300_HJ = String.IsNullOrEmpty(dts.Rows[i]["T_300_HJ"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["T_300_HJ"].ToString());
                    info.T_200_HJ = String.IsNullOrEmpty(dts.Rows[i]["T_200_HJ"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["T_200_HJ"].ToString());
                    info.T_120_HJ = String.IsNullOrEmpty(dts.Rows[i]["T_120_HJ"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["T_120_HJ"].ToString());

                    infoList.Add(info);
                }
            }
            return infoList;
        }
Beispiel #2
0
        public void ProcessRequest(HttpContext context)
        {
            string time = context.Request["beginTime"].ToString() != "undefined" ? context.Request["beginTime"].ToString() : string.Empty;

            string times = string.Empty;
            AllInfo aInfo = new AllInfo();
            //时间
            //times += String.IsNullOrEmpty(time) ? string.Empty : time + "-01 00:00:00.0";
            //times = "2013-05-01 00:00:00.0";

            //五大集团供电煤耗
            List<BestUnitConsumeInfo> info = new List<BestUnitConsumeInfo>();
            info = bt.GetInfoByTime(time, out errMsg);
            List<BestUnitConsumeInfo> saveInfo = new List<BestUnitConsumeInfo>();
            BestUnitConsumeInfo tmp = new BestUnitConsumeInfo();
            if (info.Count > 0)
            {
                tmp = info.Where(infos => infos.T_COMPANY.Trim() == "华电").FirstOrDefault();
                saveInfo.Add(tmp);
                tmp = info.Where(infos => infos.T_COMPANY.Trim() == "华能").FirstOrDefault();
                saveInfo.Add(tmp);
                tmp = info.Where(infos => infos.T_COMPANY.Trim() == "大唐").FirstOrDefault();
                saveInfo.Add(tmp);
                tmp = info.Where(infos => infos.T_COMPANY.Trim() == "国电").FirstOrDefault();
                saveInfo.Add(tmp);
                tmp = info.Where(infos => infos.T_COMPANY.Trim() == "中电投").FirstOrDefault();
                saveInfo.Add(tmp);
            }
            else
            {
                for (int i = 0; i < 4; i++)
                { saveInfo.Add(tmp); }
            }
            aInfo.SInfo = saveInfo;
            saveInfo = null;

            //供电煤耗月线
            List<MonthConsumeInfo> mTmp = bc.GetMonthConsume(out errMsg);
            List<MonthConsumeInfo> m = new List<MonthConsumeInfo>();
            aInfo.Minfo = new List<ArrayList>();

            //2011年
            ArrayList al = new ArrayList();
            m = mTmp.Where(tinfo => tinfo.year == 2011).OrderBy(infos => infos.month).ToList();
            foreach (MonthConsumeInfo ts in m)
            {
                al.Add(ts.values);
            }
            aInfo.Minfo.Add(al);
            //2012年
            al = new ArrayList();
            m = mTmp.Where(tinfo => tinfo.year == 2012).OrderBy(infos => infos.month).ToList();
            foreach (MonthConsumeInfo ts in m)
            {
                al.Add(ts.values);
            }
            aInfo.Minfo.Add(al);
            //2013年
            al = new ArrayList();
            m = mTmp.Where(tinfo => tinfo.year == 2013).OrderBy(infos => infos.month).ToList();
            foreach (MonthConsumeInfo ts in m)
            {
                al.Add(ts.values);
            }
            aInfo.Minfo.Add(al);

            string content = aInfo.ToJsonItem();
            context.Response.ContentType = "text/json;charset=gb2312;";
            context.Response.Write(content);
        }