/// <summary> /// 得到绑定汽机或锅炉(TargetType:耗差类型:0可控耗差,1不可控耗差。ConsumeType:指标类型:0锅炉指标,1汽机指标) /// </summary> /// <returns></returns> public List<IndicatorInfo> GetInfo(string beginTime, string endTime, string unitId, string paraId, out string errMsg) { List<IndicatorInfo> list = new List<IndicatorInfo>(); List<VerticalInfo> infos = new List<VerticalInfo>(); IndicatorInfo sb = new IndicatorInfo(); DataTable dt = new DataTable(); DataTable dtTable = new DataTable(); dtTable = GetTableName(unitId, paraId, out errMsg); string tableName =dtTable.Rows.Count==0 ? string.Empty : dtTable.Rows[0]["T_OUTTABLE"].ToString(); string unit = dtTable.Rows.Count == 0 ? string.Empty : dtTable.Rows[0]["T_UNIT"].ToString(); //得到实际值 if (!string.IsNullOrEmpty(tableName)) { dt = be.GetBase(tableName, beginTime, endTime, unitId, paraId, out errMsg); if (dt != null) { foreach (DataRow dr in dt.Rows) { sb.Name = String.IsNullOrEmpty(dr["T_DESC"].ToString()) ? String.Empty : dr["T_DESC"].ToString(); sb.RealValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); sb.Unit = unit; list.Add(sb); } } } return list; }
/// <summary> /// 得到绑定汽机或锅炉(TargetType:指标类型:0锅炉指标,1汽机指标。ConsumeType:耗差类型:0可控耗差,1不可控耗差) /// </summary> /// <returns></returns> public List<IndicatorInfo> GetInfo(string beginTime, string endTime, string companyId, string plantId, string unitId, int TargetType, int ConsumeType, out string errMsg) { List<IndicatorInfo> list = new List<IndicatorInfo>(); List<FirstInfo> infos = new List<FirstInfo>(); infos = GetFirstInfo(companyId,plantId, unitId,TargetType,ConsumeType, out errMsg); foreach (var i in infos) { IndicatorInfo sb = new IndicatorInfo(); DataTable dt = new DataTable(); //dt = be.GetBase(i.TableName, beginTime, endTime, unitId, i.ParaId + "_el_B", TargetType, ConsumeType, out errMsg); ////得到基准值和指标类型和耗差类型 //if (dt != null) //{ // foreach (DataRow dr in dt.Rows) // { // sb.Name = String.IsNullOrEmpty(dr["T_DESC"].ToString()) ? String.Empty : dr["T_DESC"].ToString(); // sb.TargetType = String.IsNullOrEmpty(dr["I_TARGETTYPE"].ToString()) ? String.Empty : dr["I_TARGETTYPE"].ToString(); // sb.ConsumeType = String.IsNullOrEmpty(dr["I_CONSUMETYPE"].ToString()) ? String.Empty : dr["I_CONSUMETYPE"].ToString(); // sb.StandardValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); // } //} //得到实际值 dt = be.GetBase(i.TableName, beginTime, endTime, unitId, i.ParaId, out errMsg); if (dt != null) { foreach (DataRow dr in dt.Rows) { sb.Name = String.IsNullOrEmpty(dr["T_DESC"].ToString()) ? String.Empty : dr["T_DESC"].ToString(); sb.TargetType = String.IsNullOrEmpty(dr["I_TARGETTYPE"].ToString()) ? String.Empty : dr["I_TARGETTYPE"].ToString(); sb.ConsumeType = String.IsNullOrEmpty(dr["I_CONSUMETYPE"].ToString()) ? String.Empty : dr["I_CONSUMETYPE"].ToString(); sb.RealValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); } } ////得到耗差值 //dt =be.GetBase(i.TableName, beginTime, endTime, unitId, i.ParaId + "_el", TargetType, ConsumeType, out errMsg); //if (dt != null) //{ // foreach (DataRow dr in dt.Rows) // { // sb.ConsumeValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); // } //} //参数单位 sb.Unit = i.Unit; list.Add(sb); } return list; }
public void ProcessRequest(HttpContext context) { string param = context.Request["param"]; if (param != "") { if (param == "seachList") { string companId = String.IsNullOrEmpty(context.Request["companId"].ToString()) ? string.Empty : context.Request["companId"].ToString(); string plantId = String.IsNullOrEmpty(context.Request["plantId"].ToString()) ? string.Empty : context.Request["plantId"].ToString(); string unit = String.IsNullOrEmpty(context.Request["unit"].ToString()) ? string.Empty : context.Request["unit"].ToString(); //string time = String.IsNullOrEmpty(context.Request["time"].ToString())? string.Empty:context.Request["time"].ToString() ; string beginTime = String.IsNullOrEmpty(context.Request["beginTime"].ToString()) ? string.Empty : context.Request["beginTime"].ToString(); string endTime = String.IsNullOrEmpty(context.Request["endTime"].ToString()) ? string.Empty : context.Request["endTime"].ToString(); List<IndicatorInfo> infoList = new List<IndicatorInfo>(); List<IndicatorInfo> saveList = new List<IndicatorInfo>(); //获取汽机和锅炉的所有耗差类型。 infoList = bi.GetInfo(beginTime, endTime, companId, plantId, unit, -1, 1, out errMsg); //上线启用 //foreach (var info in infoList) for (int i = 0; i < infoList.Count; i++) { IndicatorInfo infos = new IndicatorInfo(); //info.Name = "主汽温度(°C)"; //info.StandardValue = 333.22; //info.RealValue = 54.32; //info.ConsumeValue = 87.09; if (!string.IsNullOrEmpty(infoList[i].Name)) { infos.Name = infoList[i].Name; infos.StandardValue = Math.Round(infoList[i].StandardValue, 2); infos.RealValue = Math.Round(infoList[i].RealValue, 2); infos.ConsumeValue = Math.Round(infoList[i].ConsumeValue, 2); saveList.Add(infos); } } int count = 0; object obj = new { total = count, rows = saveList }; string result = JsonConvert.SerializeObject(obj); context.Response.ContentType = "text/json;charset=gb2312;"; context.Response.Write(result); } } }
public void ProcessRequest(HttpContext context) { string unit = context.Request["unit"]==null ? string.Empty : context.Request["unit"].ToString(); //string time = String.IsNullOrEmpty(context.Request["time"].ToString())? string.Empty:context.Request["time"].ToString() ; string beginTime = context.Request["beginTime"]==null ? string.Empty : context.Request["beginTime"].ToString(); string endTime = context.Request["endTime"]==null? string.Empty : context.Request["endTime"].ToString(); string timeType = context.Request["timeType"]==null ? string.Empty : context.Request["timeType"].ToString(); string quarterType = context.Request["quarterType"]==null ? string.Empty : context.Request["quarterType"].ToString(); //根据选择的时间段,设置开始时间和结束时间 switch (timeType) { case "0": //指定时间段 break; case "1"://月度平均值 DateTime dt1 = new DateTime(); dt1 = Convert.ToDateTime(beginTime.Substring(0,7) + "-01"); beginTime = dh.GetFirstDayOfMonth(dt1).ToString().Replace("/","-"); endTime = dh.GetLastDayOfMonth(dt1).ToString().Replace("/", "-"); break; case "2"://季度平均值 switch (quarterType) { case "0"://一季度 string ti = beginTime.Substring(0,4)+"-01-01 00:00:00"; beginTime = ti; endTime = beginTime.Substring(0, 4) + "-03-31 23:59:59"; break; case "1"://二季度 string ti1 = beginTime.Substring(0, 4) + "-04-01 00:00:00"; beginTime = ti1; endTime = beginTime.Substring(0, 4) + "-06-30 23:59:59"; break; case "2"://三季度 string ti2 = beginTime.Substring(0, 4) + "-07-01 00:00:00"; beginTime = ti2; endTime = beginTime.Substring(0, 4) + "-09-30 23:59:59"; break; case "3"://四季度 string ti3 = beginTime.Substring(0, 4) + "-10-01 00:00:00"; beginTime = ti3; endTime = beginTime.Substring(0, 4) + "-12-31 23:59:59"; break; } break; case "3"://年度平均值 string tim = beginTime.Substring(0, 4); beginTime = tim + "-01-01 00:00:00"; endTime = tim + "-12-31 23:59:59"; break; } List<IndicatorInfo> infoList = new List<IndicatorInfo>(); List<IndicatorInfo> saveList = new List<IndicatorInfo>(); //获取汽机和锅炉的所有耗差类型。 infoList = bl.GetInfo(beginTime, endTime, unit, -1, -1, out errMsg); List<IndicatorInfo> tmpList= infoList.Where(info=>info.ConsumeType=="0"||info.ConsumeType=="1").ToList(); //上线启用 //foreach (var info in infoList) for (int i = 0; i < tmpList.Count; i++) { IndicatorInfo infos = new IndicatorInfo(); //info.Name = "主汽温度(°C)"; //info.StandardValue = 333.22; //info.RealValue = 54.32; //info.ConsumeValue = 87.09; if (!string.IsNullOrEmpty(tmpList[i].Name)) { infos.Name = tmpList[i].Name; infos.StandardValue = Math.Round(tmpList[i].StandardValue, 2); infos.RealValue = Math.Round(tmpList[i].RealValue, 2); infos.ConsumeValue = Math.Round(tmpList[i].ConsumeValue, 2); saveList.Add(infos); } } //IndicatorInfo infos = new IndicatorInfo(); //infos.Name = "主汽温度(°C)"; //infos.StandardValue = 538.22; //infos.RealValue = 533.32; //infos.ConsumeValue = 0.64; //infoList.Add(infos); //infos = new IndicatorInfo(); //infos.Name = "主汽压力(Mpa)"; //infos.StandardValue = 16.70; //infos.RealValue = 16.43; //infos.ConsumeValue = 0.21; //infoList.Add(infos); int count = 0; object obj = new { total = count, rows = saveList }; string result = JsonConvert.SerializeObject(obj); context.Response.ContentType = "text/json;charset=gb2312;"; context.Response.Write(result); }
/// <summary> /// 得到绑定汽机或锅炉(TargetType:耗差类型:0可控耗差,1不可控耗差。ConsumeType:指标类型:0锅炉指标,1汽机指标) /// </summary> /// <returns></returns> public List<IndicatorInfo> GetInfo(string beginTime, string endTime, string unitId, int TargetType, int ConsumeType, out string errMsg) { List<IndicatorInfo> list = new List<IndicatorInfo>(); List<info> infos = new List<info>(); infos = GetFirstInfo(unitId, out errMsg); if (TargetType == 0 || TargetType == 1) { infos = infos.Where(info => info.TargetType == TargetType).ToList(); } if (ConsumeType == 0 || ConsumeType == 1) { infos = infos.Where(info => info.ConsumeType == ConsumeType).ToList(); } foreach (var i in infos) { IndicatorInfo sb = new IndicatorInfo(); DataTable dt = new DataTable(); dt = GetBase(i.TableName, beginTime, endTime, unitId, i.ParaId + "_el_B", TargetType, ConsumeType, out errMsg); //得到基准值和指标类型和耗差类型 if (dt != null) { foreach (DataRow dr in dt.Rows) { sb.Name = String.IsNullOrEmpty(dr["T_DESC"].ToString()) ? String.Empty : dr["T_DESC"].ToString(); sb.TargetType = String.IsNullOrEmpty(dr["I_TARGETTYPE"].ToString()) ? String.Empty : dr["I_TARGETTYPE"].ToString(); sb.ConsumeType = String.IsNullOrEmpty(dr["I_CONSUMETYPE"].ToString()) ? String.Empty : dr["I_CONSUMETYPE"].ToString(); sb.StandardValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); } } //得到实际值 dt = GetBase(i.TableName, beginTime, endTime, unitId, i.ParaId, TargetType, ConsumeType, out errMsg); if (dt != null) { foreach (DataRow dr in dt.Rows) { sb.RealValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); } } //得到耗差值 dt = GetBase(i.TableName, beginTime, endTime, unitId, i.ParaId + "_el", TargetType, ConsumeType, out errMsg); if (dt != null) { foreach (DataRow dr in dt.Rows) { sb.ConsumeValue = String.IsNullOrEmpty(dr["counts"].ToString()) ? 0 : Convert.ToDouble(dr["counts"].ToString()); } } list.Add(sb); } return list; }
public void GetBCList() { //string companyId = Request["company"].ToString(); //string plantId = Request["plant"].ToString(); //string unitId = Request["unit"].ToString(); //string beginTime = Request["beginTime"].ToString(); //string endTime = Request["endTime"].ToString(); //int page = Convert.ToInt32(Request["page"].ToString()); //int rows = Convert.ToInt32(Request["rows"].ToString()); //int sCount = (page - 1) * rows + 1; //int eCount = page * rows; ////总的行数。 //int count = 0; //DataTable dt = bl.GetInitByCondition(companyId, plantId, unitId, beginTime, endTime, sCount, eCount, out count, out errMsg); ////int count =dt.Rows.Count; //IList<Hashtable> list = new List<Hashtable>(); //foreach (DataRow item in dt.Rows) //{ // Hashtable ht = new Hashtable(); // ht.Add("T_CODE", item["T_CODE"]); // ht.Add("T_UNITDESC", item["T_UNITDESC"].ToString()); // ht.Add("D_CAPABILITY", item["D_CAPABILITY"].ToString()); // ht.Add("I_GAAG", item["I_GAAG"].ToString()); // ht.Add("I_PH", item["I_PH"].ToString()); // ht.Add("I_AH", item["I_AH"].ToString()); // ht.Add("I_SH", item["I_SH"].ToString()); // ht.Add("I_UOH", item["I_UOH"].ToString()); // ht.Add("I_FOH", item["I_FOH"].ToString()); // ht.Add("I_EUNDH", item["I_EUNDH"].ToString()); // list.Add(ht); //} //object obj = new //{ // total = count, // rows = list //}; //string result = JsonConvert.SerializeObject(obj); //Response.Write(result); //Response.End(); string unit = String.IsNullOrEmpty(Request["unit"].ToString()) ? string.Empty : Request["unit"].ToString(); string time = String.IsNullOrEmpty(Request["time"].ToString()) ? string.Empty : Request["time"].ToString(); string beginTime = String.IsNullOrEmpty(Request["beginTime"].ToString()) ? string.Empty : Request["beginTime"].ToString(); string endTime = String.IsNullOrEmpty(Request["endTime"].ToString()) ? string.Empty : Request["endTime"].ToString(); string timeType = String.IsNullOrEmpty(Request["timeType"].ToString()) ? string.Empty : Request["timeType"].ToString(); string quarterType = String.IsNullOrEmpty(Request["quarterType"].ToString()) ? string.Empty : Request["quarterType"].ToString(); //根据选择的时间段,设置开始时间和结束时间 switch (quarterType) { case "0": //指定时间段 break; case "1"://月度平均值 DateTime dt1 = new DateTime(); dt1 = Convert.ToDateTime(beginTime.Substring(0, 7) + "-01"); beginTime = dh.GetFirstDayOfMonth(dt1).ToString(); endTime = dh.GetLastDayOfMonth(dt1).ToString(); break; case "2"://季度平均值 switch (quarterType) { case "0"://一季度 string ti = beginTime.Substring(0, 4) + "-01-01"; beginTime = ti; endTime = beginTime.Substring(0, 4) + "-03-31"; break; case "1"://二季度 string ti1 = beginTime.Substring(0, 4) + "-04-01"; beginTime = ti1; endTime = beginTime.Substring(0, 4) + "-06-30"; break; case "2"://三季度 string ti2 = beginTime.Substring(0, 4) + "-07-01"; beginTime = ti2; endTime = beginTime.Substring(0, 4) + "-09-30"; break; case "3"://四季度 string ti3 = beginTime.Substring(0, 4) + "-10-01"; beginTime = ti3; endTime = beginTime.Substring(0, 4) + "-12-31"; break; } break; case "3"://年度平均值 string tim = beginTime.Substring(0, 4); beginTime = tim + "01-01"; endTime = tim + "-12-31"; break; } List<IndicatorInfo> infoList = new List<IndicatorInfo>(); //获取汽机的所有耗差类型。 //infoList = bl.GetInfo(beginTime, endTime, unit, -1, 1, out errMsg); for (int i = 0; i < 10; i++) { IndicatorInfo info = new IndicatorInfo(); info.Name = "主汽温度(°C)"; info.StandardValue = 333.22; info.RealValue = 54.32; info.ConsumeValue = 87.09; } //string content = infoList.ToJsonItem(); //int count = 0; //object obj = new //{ // total = count, // rows = infoList //}; string result = JsonConvert.SerializeObject(infoList); //Response.ContentType = "text/json;charset=gb2312;"; Response.Write(result); }
public void ProcessRequest(HttpContext context) { string unit = String.IsNullOrEmpty(context.Request["unit"].ToString()) ? string.Empty : context.Request["unit"].ToString(); //string time = String.IsNullOrEmpty(context.Request["time"].ToString())? string.Empty:context.Request["time"].ToString() ; string beginTime = String.IsNullOrEmpty(context.Request["beginTime"].ToString()) ? string.Empty : context.Request["beginTime"].ToString(); string endTime = String.IsNullOrEmpty(context.Request["endTime"].ToString()) ? string.Empty : context.Request["endTime"].ToString(); string timeType = String.IsNullOrEmpty(context.Request["timeType"].ToString()) ? string.Empty : context.Request["timeType"].ToString(); string quarterType = String.IsNullOrEmpty(context.Request["quarterType"].ToString()) ? string.Empty : context.Request["quarterType"].ToString(); //根据选择的时间段,设置开始时间和结束时间 switch (quarterType) { case "0": //指定时间段 break; case "1"://月度平均值 DateTime dt1 = new DateTime(); dt1 = Convert.ToDateTime(beginTime.Substring(0, 7) + "-01"); beginTime = dh.GetFirstDayOfMonth(dt1).ToString(); endTime = dh.GetLastDayOfMonth(dt1).ToString(); break; case "2"://季度平均值 switch (quarterType) { case "0"://一季度 string ti = beginTime.Substring(0, 4) + "-01-01"; beginTime = ti; endTime = beginTime.Substring(0, 4) + "-03-31"; break; case "1"://二季度 string ti1 = beginTime.Substring(0, 4) + "-04-01"; beginTime = ti1; endTime = beginTime.Substring(0, 4) + "-06-30"; break; case "2"://三季度 string ti2 = beginTime.Substring(0, 4) + "-07-01"; beginTime = ti2; endTime = beginTime.Substring(0, 4) + "-09-30"; break; case "3"://四季度 string ti3 = beginTime.Substring(0, 4) + "-10-01"; beginTime = ti3; endTime = beginTime.Substring(0, 4) + "-12-31"; break; } break; case "3"://年度平均值 string tim = beginTime.Substring(0, 4); beginTime = tim + "01-01"; endTime = tim + "-12-31"; break; } List<IndicatorInfo> infoList = new List<IndicatorInfo>(); //获取锅炉的所有耗差类型。 infoList = bl.GetInfo(beginTime, endTime, unit, -1, 0, out errMsg); //foreach (var info in infoList) //{ for (int i = 0; i < 10; i++) { IndicatorInfo infos = new IndicatorInfo(); infos.Name = "主汽温度(°C)"; infos.StandardValue = 333.22; infos.RealValue = 54.32; infos.ConsumeValue = 87.09; //上线启用 //infos.Name = info.Name; //infos.StandardValue = info.StandardValue; //infos.RealValue = info.RealValue; //infos.ConsumeValue = info.ConsumeValue; infoList.Add(infos); } //} string content = infoList.ToJsonItem(); int count = 0; object obj = new { total = count, rows = infoList }; string result = JsonConvert.SerializeObject(obj); context.Response.ContentType = "text/json;charset=gb2312;"; context.Response.Write(result); }