//根据产业获得总电量和负荷(机组累加) private double GetDlFh(string cye, string cName, string time) { string searchTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"); string[] zfh = new string[] { "HDXN:00CC0001" }; if (time != "") { searchTime = time; } sql = "SELECT DISTINCT " + cName + " FROM ADMINISTRATOR.T_INFO_UNIT where data_type in (" + cye + ")"; DataTable dt = dl.RunDataTable(sql, out errMsg); string[] tags = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { tags[i] = dt.Rows[i][0].ToString(); } double[] tagValues = null; if (cye == "'总负荷'") { tagValues = pbll.GetPointVal(zfh, searchTime); } else { tagValues = GetPointVal(tags, searchTime); } if (tagValues.Length < 1) { return(0); } return(Math.Round(tagValues.Where(a => a > 0).Sum(), 2)); }
private void GetTreeList(string type, string areaId) { dt = new DataTable(); GetTreeList(); string x = ""; string y = ""; string title = ""; string id = ""; DataRow[] dr = dt.Select("TYPE='" + type + "' and PID='" + areaId + "'"); for (int i = 0; i < dr.Length; i++) { if (i == 0) { PTreeNodes += "{id:'" + dr[i][0] + "',pId:'" + dr[i][2] + "',name:'" + dr[i][1] + "',t:'" + dr[i][4] + "',open:true},"; if (dr[i][5].ToString() != "") { x += dr[i][5] + ","; y += dr[i][6] + ","; title += "'" + dr[i][1] + "',"; id += "'" + dr[i][0] + "',"; } } else { PTreeNodes += "{id:'" + dr[i][0] + "',pId:'" + dr[i][2] + "',name:'" + dr[i][1] + "',t:'" + dr[i][4] + "'},"; if (dr[i][5].ToString() != "") { x += dr[i][5] + ","; y += dr[i][6] + ","; title += "'" + dr[i][1] + "',"; id += "'" + dr[i][0] + "',"; } } } PTreeNodes = PTreeNodes.TrimEnd(','); x = x.TrimEnd(','); y = y.TrimEnd(','); title = title.TrimEnd(','); id = id.TrimEnd(','); DataTable dtp = fbll.GetPointCompanyByPeriodID(id); x = "[" + x + "]"; y = "[" + y + "]"; title = "[" + title + "]"; double[] winval = null; double[] powerval = null; string[] winpoint = null; string[] powerpoint = null; PointBLL po = new PointBLL(); if (dtp != null && dtp.Rows.Count > 0) { winval = new double[dtp.Rows.Count]; powerval = new double[dtp.Rows.Count]; winpoint = new string[dtp.Rows.Count]; powerpoint = new string[dtp.Rows.Count]; for (int i = 0; i < dtp.Rows.Count; i++) { winpoint[i] = dtp.Rows[i][0].ToString(); powerpoint[i] = dtp.Rows[i][1].ToString(); } winval = po.GetPointVal(winpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); powerval = po.GetPointVal(powerpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); } object obj = new { treeNode = PTreeNodes, x = x, y = y, win = winval, power = powerval, title = title }; string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); Response.Write(result); Response.End(); }
/// <summary> /// 获取电量 时实测点 /// </summary> /// <param name="id"></param> /// <param name="typ">1:风场 2:工期</param> /// <param name="p">1:日 2:月 3:年</param> /// <returns></returns> private double GetDl(string id, string typ, int p, string time) { string where = ""; if (typ == "1") { where = "tt.T_ORGID='" + id + "'"; } else if (typ == "2") { where = "tt.T_PERIODID='" + id + "'"; } else if (typ == "3") { where = "1=1"; } sql = @"select t.T_WINDTAG,t.T_POWERTAG, t.T_ORGID,t.T_DAYDL, t.T_MONTHDL, t.T_YEARDL from ADMINISTRATOR.T_BASE_POINTS_ORG t where t.T_ORGID in (select T_PERIODID from ADMINISTRATOR.T_BASE_PERIOD tt where " + where + ")"; DataTable SSDl = dl.RunDataTable(sql, out errMsg); string dlTyp = ""; string searchTime = ""; if (p == 1) { dlTyp = "T_DAYDL"; searchTime = DateTime.Now.ToString("yyyy-MM-dd 0:00:00"); } if (p == 2) { dlTyp = "T_MONTHDL"; searchTime = DateTime.Now.ToString("yyyy-MM-1 0:00:00"); } if (p == 3) { dlTyp = "T_YEARDL"; searchTime = DateTime.Now.ToString("yyyy-1-1 0:00:00"); } if (p == 4) { dlTyp = "T_POWERTAG"; if (time != "") { searchTime = time; } else { searchTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"); } } if (p == 5) { dlTyp = "T_WINDTAG"; searchTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"); } string[] tag = new string[SSDl.Rows.Count]; for (int aa = 0; aa < SSDl.Rows.Count; aa++) { tag[aa] = SSDl.Rows[aa][dlTyp].ToString(); } double[] tagValues = null; if (searchTime == "yyyy-MM-dd HH:mm:00") { tagValues = GetPointVal(tag, searchTime); } else { tagValues = pbll.GetPointVal(tag, searchTime); } double v = 0; for (int bb = 0; bb < tagValues.Length; bb++) { v = v + tagValues[bb]; } if (tagValues.Length < 1) { return(0); } else { return(v); } }
private void GetMap(string id) { DataTable dtmap = new DataTable(); dtmap = fbll.GetPointByPeriodID(id); double[] winval = null; double[] powerval = null; double[] stateval = null; string[] winpoint = null; string[] powerpoint = null; string[] statepoint = null; //标杆 int[] flag = null; string x = ""; string y = ""; string title = ""; //场站名称 string periodName = string.Empty; if (dtmap != null && dtmap.Rows.Count > 0) { winval = new double[dtmap.Rows.Count]; powerval = new double[dtmap.Rows.Count]; stateval = new double[dtmap.Rows.Count]; winpoint = new string[dtmap.Rows.Count]; powerpoint = new string[dtmap.Rows.Count]; statepoint = new string[dtmap.Rows.Count]; flag = new int[dtmap.Rows.Count]; if (dtmap.Rows[0]["T_PERIODDESC"] != DBNull.Value) { string name = dtmap.Rows[0]["T_PERIODDESC"].ToString(); if (name != "全部") { periodName = dtmap.Rows[0]["T_PERIODDESC"].ToString(); } else { periodName = dtmap.Rows[0]["T_ORGDESC"] != DBNull.Value ? dtmap.Rows[0]["T_ORGDESC"].ToString() : string.Empty; } } else { periodName = dtmap.Rows[0]["T_ORGDESC"] != DBNull.Value ? dtmap.Rows[0]["T_ORGDESC"].ToString() : string.Empty; } for (int i = 0; i < dtmap.Rows.Count; i++) { winpoint[i] = dtmap.Rows[i][2].ToString(); powerpoint[i] = dtmap.Rows[i][1].ToString(); statepoint[i] = dtmap.Rows[i][3].ToString(); flag[i] = dtmap.Rows[i][6] != DBNull.Value?int.Parse(dtmap.Rows[i][6].ToString()):0; x += dtmap.Rows[i][4] + ","; y += dtmap.Rows[i][5] + ","; title += dtmap.Rows[i][0] != DBNull.Value ? "'" + dtmap.Rows[i][0] + "'," : "' ',"; } x = x.TrimEnd(','); y = y.TrimEnd(','); title = title.TrimEnd(','); x = "[" + x + "]"; y = "[" + y + "]"; title = "[" + title + "]"; PointBLL po = new PointBLL(); winval = po.GetPointVal(winpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); powerval = po.GetPointVal(powerpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); stateval = po.GetPointVal(statepoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); } object obj = new { id = ids, x = x, y = y, win = winval, power = powerval, state = stateval, title = title, flag = flag, periodName = periodName }; string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); Response.Write(result); Response.End(); }
private void init() { //获得总容量和产业容量 double FDRL = GetRl("2", "FDRL"); double HDRL = GetRl("2", "HDRL"); double SDRL = GetRl("2", "SDRL"); double TYNRL = GetRl("2", "TYNRL"); double FBSRL = GetRl("2", "FBSRL"); double SRZRL = GetRl("2", "SRZRL"); double ZRL = FDRL + HDRL + SDRL + TYNRL + FBSRL + SRZRL; //总负荷 产业负荷 //double FDFH = GetDlFh("'风电'", "PERIOD_TAG",""); double HDFH = GetDlFh("'火电'", "PERIOD_TAG", ""); double SDFH = GetDlFh("'水电'", "PERIOD_TAG", ""); double TYNFH = GetDlFh("'太阳能'", "PERIOD_TAG", ""); double FBSFH = GetDlFh("'分布式'", "PERIOD_TAG", ""); double SRZFH = GetDlFh("'生物质'", "PERIOD_TAG", ""); double ZFH = pbll.GetPointVal(new string[] { "HDXN:00CC0001" }, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"))[0] * 10; ZFH = Math.Round(ZFH, 2); //日发电量 产业日电量 double FDDDL = GetDlFh("'风电'", "DAYDL", ""); double HDDDL = GetDlFh("'火电'", "DAYDL", ""); double SDDDL = GetDlFh("'水电'", "DAYDL", ""); double TYNDDL = GetDlFh("'太阳能'", "DAYDL", ""); double FBSDDL = GetDlFh("'分布式'", "DAYDL", ""); double SRZDDL = GetDlFh("'生物质'", "DAYDL", ""); double DDL = pbll.GetPointVal(new string[] { "HDXN:00CE4000.1.1D" }, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"))[0]; DDL = Math.Round(DDL, 2); // 月发电量 double MDL = pbll.GetPointVal(new string[] { "HDXN:00CE4000.1.1M" }, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"))[0]; double HDMDL = GetDlFh("'火电'", "MONTHDL", ""); double SDMDL = GetDlFh("'水电'", "MONTHDL", ""); MDL = Math.Round(MDL, 2); // 年发电量 产业年发电量 double FDYDL = GetDlFh("'风电'", "YEARDL", ""); double HDYDL = GetDlFh("'火电'", "YEARDL", ""); double SDYDL = GetDlFh("'水电'", "YEARDL", ""); double TYNYDL = GetDlFh("'太阳能'", "YEARDL", ""); double FBSYDL = GetDlFh("'分布式'", "YEARDL", ""); double SRZYDL = GetDlFh("'生物质'", "YEARDL", ""); double YDL = pbll.GetPointVal(new string[] { "HDXN:00CE4000.1.1Y" }, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"))[0]; YDL = Math.Round(YDL, 2); //产业发电计划 double FDJHDL = GetJHDl("'FDRL'", DateTime.Now.ToString("yyyy-01-01 0:00:00")); double HDJHDL = GetJHDl("'HDRL'", DateTime.Now.ToString("yyyy-01-01 0:00:00")); double SDJHDL = GetJHDl("'SDRL'", DateTime.Now.ToString("yyyy-01-01 0:00:00")); double TYNJHDL = GetJHDl("'TYNRL'", DateTime.Now.ToString("yyyy-01-01 0:00:00")); double FBSJHDL = GetJHDl("'FBSRL'", DateTime.Now.ToString("yyyy-01-01 0:00:00")); double SRZJHDL = GetJHDl("'SWZRL'", DateTime.Now.ToString("yyyy-01-01 0:00:00")); object _obj = new { //总容量和产业容量 ZRL = ZRL, FDRL = FDRL, HDRL = HDRL, SDRL = SDRL, TYNRL = TYNRL, FBSRL = FBSRL, SRZRL = SRZRL, //总负荷产业负荷 ZFH = ZFH, //FDFH = FDFH, HDFH = HDFH, SDFH = SDFH, TYNFH = TYNFH, FBSFH = FBSFH, SRZFH = SRZFH, //日月电量 DDL = DDL, FDDDL = FDDDL, HDDDL = HDDDL, SDDDL = SDDDL, TYNDDL = TYNDDL, FBSDDL = FBSDDL, SRZDDL = SRZDDL, //月电量 MDL = MDL, HDMDL = HDMDL, SDMDL = SDMDL, //年电量 YDL = YDL, FDYDL = FDYDL, HDYDL = HDYDL, SDYDL = SDYDL, TYNYDL = TYNYDL, FBSYDL = FBSYDL, SRZYDL = SRZYDL, //产业年完成率 FDWCL = Math.Round(FDYDL / FDJHDL * 100, 2), HDWCL = Math.Round(HDYDL / HDJHDL * 100, 2), SDWCL = Math.Round(SDYDL / SDJHDL * 100, 2), TYNWCL = Math.Round(TYNYDL / TYNJHDL * 100, 2), FBSWCL = Math.Round(FBSYDL / FBSJHDL * 100, 2), SRZWCL = Math.Round(SRZYDL / SRZJHDL * 100, 2) }; string result = JsonConvert.SerializeObject(_obj); Response.Write(result); Response.End(); }
/// <summary> /// 初始化数据 /// </summary> public void Initialize(string type, string area, string periodName, string name) { //在输出结果之前 重置,防止本页使用原来的session Session["type"] = null; Session["area"] = null; Session["periodName"] = null; //标题 //风电或场站总负荷(取场站或机组的功率值之和) double FDFH = GetFDFHValueByTime(area, periodName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); //风电或场站日发电量(取场站或机组的日发电量之和) double FDDDL = GetDlFh("'风电'", "DAYDL", area, periodName, ""); //风电或场站月发电量(取场站或机组的月发电量之和) double MDLL = 0; string MDL = string.Empty; //风电或场站年发电量(取场站或机组的年发电量之和) double FDYDLL = GetDlFh("'风电'", "YEARDL", area, periodName, ""); string FDYDL = string.Empty; if (type != "1") { MDLL = GetDlFh("'风电'", "MONTHDL", area, periodName, ""); MDL = MDLL.ToString() + "MWh"; FDYDL = FDYDLL.ToString() + "MWh"; } else { FDYDL = Math.Round(FDYDLL / 10000, 2).ToString() + "亿kWh"; } //拼接表格字符串 StringBuilder sb1 = new StringBuilder(); //图的标题 string mapTitle = string.Empty; //数据赋值->表格赋值->输出图 //总的 if (type == "1") { //标题 name = "风电"; #region 数据赋值 //月发电量(总的月发电量 单独计算) MDLL = pbll.GetPointVal(new string[] { "HDXN:00CE4000.1.1M" }, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"))[0]; MDL = Math.Round(MDLL / 10000, 2).ToString() + "亿kWh"; #endregion mapTitle = "风电"; #region 表格赋值 List <ArrayList> info = new List <ArrayList>(); info = bc.GetProject("风电", area, periodName, "1"); List <Info> p = new List <Info>(); p = Handle(info, "1"); sb1.Append("<table style='width: 500px;font-size:11px;height:700px;' cellspacing='0'>"); //sb.Append(" <tr >"); sb1.Append("<tbody><tr style='width: 500px;' bgcolor='#CFE6FC'><td> 区 域 </td><td class='t'>场站</td><td>风速</td><td>实时负荷(MW)</td><td>负荷率</td><td>日发电量<br>(万kWh)</td></tr></tbody>"); List <Info> fd = new List <Info>(); fd = p.Where(o => o.type == "风电").ToList(); //风电实时负荷累计 double fdCount = fd.Sum(d => d.cl); double fdlCount = fd.Sum(d => d.dr); sb1.Append("<tr >"); sb1.Append("<td colspan='6' align='center' style='width: 500px; background-color:#FCD209;font-size:11px;'>"); sb1.Append("风电" + " ( 实时负荷:" + fdCount.ToString() + " 日发电量:" + fdlCount + " )"); sb1.Append("</td>"); sb1.Append("</tr>"); //fd = fd.OrderBy(o => o.dr).ToList(); //区域数 List <string> areaName = fd.Select(d => d.area).Distinct().ToList(); foreach (var n in areaName) { List <Info> tmp = new List <Info>(); tmp = fd.Where(inf => inf.area == n).OrderBy(c => c.order).ToList(); int count = tmp.Count; sb1.Append("<tr>"); sb1.Append("<td rowspan=\"" + count + "\" style='width: 100px;text-align:left; font-size:15px;font-weight:bolder; ' >"); sb1.Append("<a type='2' href='#' onclick='next(this)'>" + tmp[0].area.ToString() + "</a>"); sb1.Append("</td>"); sb1.Append("<td style='width: 150px;text-align:left; font-size:11px;' >"); sb1.Append("<a type='3' area='" + tmp[0].area.ToString() + "' href='#' onclick='next(this)'>" + tmp[0].name.ToString() + "</a>"); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(tmp[0].wind.ToString()), 3).ToString()); //sb1.Append(" "); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(tmp[0].cl.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(tmp[0].zb.ToString()) / 10, 2).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(tmp[0].dr.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("</tr>"); tmp.Remove(tmp[0]); //分割行1_2,1_3... foreach (var t in tmp) { sb1.Append("<tr>"); sb1.Append("<td style='width: 150px;text-align:left; font-size:11px;' >"); sb1.Append("<a type='3' area='" + t.area.ToString() + "' href='#' onclick='next(this)'>" + t.name.ToString() + "</a>"); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.wind.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.cl.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.zb.ToString()) / 10, 2).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.dr.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("</tr>"); } } sb1.Append("</table>"); #endregion } else if (type == "2") { //标题 name = area; #region 表格赋值 //区域 List <ArrayList> info = new List <ArrayList>(); info = bc.GetProject("风电", area, periodName, "1"); List <Info> p = new List <Info>(); p = Handle(info, "1"); //区域实时负荷累计 double fdCount = p.Sum(d => d.cl); double fdlCount = p.Sum(d => d.dr); int count = p.Count; sb1.Append("<table style='width: 500px;font-size:11px;height:" + (count + 2) * 35 + "px;' cellspacing='0'>"); //sb.Append(" <tr >"); sb1.Append("<tbody><tr style='width: 500px;' bgcolor='#CFE6FC'><td class='t'>场站</td><td>风速</td><td>实时负荷(MW)</td><td>负荷率</td><td>日发电量<br>(万kWh)</td></tr></tbody>"); sb1.Append("<tr style='height:35px;'>"); sb1.Append("<td colspan='6' align='center' style='width: 500px; background-color:#FCD209;font-size:11px;'>"); sb1.Append(area + " ( 实时负荷:" + fdCount.ToString() + " 日发电量:" + fdlCount + " )"); sb1.Append("</td>"); sb1.Append("</tr>"); foreach (var t in p) { sb1.Append("<tr style='height:35px;'>"); sb1.Append("<td style='width: 150px;text-align:left; font-size:11px;' >"); sb1.Append("<a type='3' area='" + t.area.ToString() + "' href='#' onclick='next(this)'>" + t.name.ToString() + "</a>"); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.wind.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.cl.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.zb.ToString()) / 10, 2).ToString()); sb1.Append("</td>"); sb1.Append("<td style='width: 100px;text-align:right;font-size:10px;' >"); sb1.Append(getDouble(double.Parse(t.dr.ToString()), 3).ToString()); sb1.Append("</td>"); sb1.Append("</tr>"); } sb1.Append("</table>"); #endregion mapTitle = area; } else if (type == "3") { //标题 name = periodName; //场站 获取机组信息 List <ArrayList> info = new List <ArrayList>(); info = bc.GetProject("风电", area, periodName, "2"); List <Info> p = new List <Info>(); p = Handle(info, "2"); //场站实时负荷累计 double fdCount = p.Sum(d => d.cl); double fdlCount = p.Sum(d => d.dr); int count = p.Count; int c = count / 10; //一行排10个 sb1.Append("<table style='width: 500px;font-size:11px;height:" + (c + 2) * 35 + "px;' cellspacing='0'>"); //sb.Append(" <tr >"); sb1.Append("<tr style='height:35px;'>"); sb1.Append("<td colspan='11' align='center' style='width: 500px; background-color:#FCD209;font-size:11px;'>"); sb1.Append(periodName + " ( 实时负荷:" + fdCount.ToString() + " 日发电量:" + fdlCount + " )"); sb1.Append("</td>"); sb1.Append("</tr>"); for (int aa = 0; aa <= c; aa++) { StringBuilder sb2 = new StringBuilder(); StringBuilder sb3 = new StringBuilder(); int b = aa * 10; int cc = (aa + 1) * 10; for (; b < cc; b++) { if (b < count) { //机组名 if (b % 10 == 0) { sb2.Append("<tr style='height:30px;'>"); } sb2.Append("<td>"); sb2.Append("<a type='4' idkey='" + p[b].idKey.ToString() + "' href='#' onclick='tc(this)'>" + "#" + p[b].unitId + "</a>");//添加超链接 sb2.Append("</td>"); //实时负荷 if (b % 10 == 0) { sb3.Append("<tr style='height:30px;'>"); } sb3.Append("<td>"); sb3.Append(p[b].cl.ToString()); sb3.Append("</td>"); } else { break; } } sb2.Append("</tr>"); sb3.Append("</tr>"); sb1.Append(sb2); sb1.Append(sb3); } sb1.Append("</table>"); mapTitle = periodName; } //输出图 List <Hashtable> listData = new List <Hashtable>(); Hashtable ht = new Hashtable(); ht.Add("name", "风电"); ht.Add("data", GetChartsValues("'风电'", area, periodName)); listData.Add(ht); ArrayList list1 = new ArrayList(); string[] str2 = new string[9] { "#058DC7", "#50B432", "#ED561B", "#DDDF00", "#24CBE5", "#64E572", "#FF9655", "#FFF263", "#6AF9C4" }; int num1 = 0; foreach (Hashtable _ht in listData) { Hashtable _dv1 = new Hashtable(); _dv1.Add("lineColor", str2[num1]); _dv1.Add("maxPadding", "1"); Hashtable hy1 = new Hashtable(); if (num1 == 0) { hy1.Add("text", "负荷(万千瓦)"); _dv1.Add("title", hy1); } else if (num1 == 2) { } _dv1.Add("lineWidth", 1); if (num1 != 2) { list1.Add(_dv1); } num1++; } object obj = new { topTitle = name, zss = FDFH, dayDl = FDDDL, monthDl = MDL, yearDl = FDYDL, tables = sb1.ToString(), title = mapTitle, y_data = list1, list = listData }; string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); Response.Write(result); Response.End(); }
private void GetMap(string id) { DataTable dtmap = new DataTable(); dtmap = fbll.GetPointByPeriodID(id); double[] winval = null; double[] powerval = null; double[] stateval = null; string[] winpoint = null; string[] powerpoint = null; string[] statepoint = null; string x = ""; string y = ""; string title = ""; if (dtmap != null && dtmap.Rows.Count > 0) { winval = new double[dtmap.Rows.Count]; powerval = new double[dtmap.Rows.Count]; stateval = new double[dtmap.Rows.Count]; winpoint = new string[dtmap.Rows.Count]; powerpoint = new string[dtmap.Rows.Count]; statepoint = new string[dtmap.Rows.Count]; for (int i = 0; i < dtmap.Rows.Count; i++) { winpoint[i] = dtmap.Rows[i][2].ToString(); powerpoint[i] = dtmap.Rows[i][1].ToString(); statepoint[i] = dtmap.Rows[i][3].ToString(); x += dtmap.Rows[i][4] + ","; y += dtmap.Rows[i][5] + ","; title += "'" + dtmap.Rows[i][0] + "',"; } x = x.TrimEnd(','); y = y.TrimEnd(','); title = title.TrimEnd(','); x = "[" + x + "]"; y = "[" + y + "]"; title = "[" + title + "]"; PointBLL po = new PointBLL(); winval = po.GetPointVal(winpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); powerval = po.GetPointVal(powerpoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); stateval = po.GetPointVal(statepoint, DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")); } object obj = new { x = x, y = y, win = winval, power = powerval, state = stateval, title = title }; string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); Response.Write(result); Response.End(); }