/// <summary> /// 显示柱状图 /// </summary> /// <param name="itemName"></param> /// <param name="chartObject"></param> /// <param name="chartDept"></param> /// <param name="dir"></param> /// <returns></returns> public static ResultObjLst IndexContrastObjsLst(QueryContrastPeriods query, string[] chartObject, string chartDept, Dictionary <string, List <decimal> > dir) { ResultObjLst lstReult = new ResultObjLst(); ExecuteProcess execu = new ExecuteProcess(); if (chartObject.Length == 0) { execu.Success = false; execu.ExceptionMsg = "暂无数据信息"; execu.ActionName = ""; execu.ActionUser = ""; execu.ActionTime = System.DateTime.Now; } else { execu.Success = true; execu.ExceptionMsg = ""; } lstReult.Unit = chartDept; lstReult.ActionInfo = execu; string sql = " and ItemCodeNumber = '" + query.ItemCode + "'"; List <NTS.WEB.Model.Itemcode> itemList = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetItemCodeList(sql, ""); #region 数据列表 List <ObjRecord> objLst = new List <ObjRecord>(); #endregion int Index = 0; StringBuilder chartNew = new StringBuilder(); { foreach (var d in dir) { ObjRecord record = new ObjRecord(); record.ObjTime = query.PeriodLst[Index].StartTime.ToString("yyyy-MM-dd") + "~" + query.PeriodLst[Index].EndTime.ToString("yyyy-MM-dd"); //d.Key; record.MaxValue = Math.Round(d.Value.Max(), 2); record.MinValue = Math.Round(d.Value.Min(), 2); record.TotalValue = Math.Round(d.Value.Sum(), 2); record.AvgValue = Math.Round(d.Value.Average(), 2); objLst.Add(record); Index++; } } lstReult.ObjLst = objLst; return(lstReult); }
public ResultObjLst IndexContrastList() { try { ResultObjLst refResutl = new ResultObjLst(); try { int inputValue = int.Parse(_ntsPage.Request["cType"]); switch (inputValue) { case 1: refResutl = IndexContrastObjsLst(); break; case 2: refResutl = IndexContrastPeriodssLst(); break; default: break; } } catch (Exception ex) { string strEx = ex.ToString(); } return(refResutl); } catch (Exception ex) { ResultObjLst lst = new ResultObjLst(); ExecuteProcess process = new ExecuteProcess(); process.ExceptionMsg = ex.Message; process.Success = false; lst.ActionInfo = process; return(lst); } }
public ResultObjLst IndexContrastPeriodssLst() { try { var inputValue = _ntsPage.Request["inputs"];; var query = Newtonsoft.Json.JsonConvert.DeserializeObject <QueryContrastPeriods>(inputValue); var result = new ResultCompare(); string strDepName = ""; switch (query.QueryType) { case QueryOrderType.Default: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetPeriodsCompareChart(query); strDepName = result.Dept[0].ToString(); break; case QueryOrderType.UnitArea: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetPeriodsCompareChart(query); strDepName = result.Dept[0].ToString(); break; case QueryOrderType.UnitPerson: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetPersonNumPeriodsCompareChart(query); strDepName = result.Dept[0].ToString();; break; default: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetPeriodsCompareChart(query); strDepName = result.Dept[0].ToString();; break; } switch (query.QueryType) { case QueryOrderType.CarbanOut: strDepName = "T"; break; case QueryOrderType.ConvCoal: strDepName = "T"; break; case QueryOrderType.Renminbi: strDepName = "元"; break; } return(JsonForHightChartsNew.IndexContrastObjsLst(query, result.ObjectName.ToArray(), strDepName, result.Enery)); } catch (Exception ex) { ResultObjLst lst = new ResultObjLst(); ExecuteProcess process = new ExecuteProcess(); process.ExceptionMsg = ex.Message; process.Success = false; lst.ActionInfo = process; return(lst); } }
public ResultObjLst IndexContrastObjsLst() { try { var inputValue = _ntsPage.Request["inputs"];; var oderObject = Newtonsoft.Json.JsonConvert.DeserializeObject <QueryOrderObjects>(inputValue); QueryCompare query = new QueryCompare(); query.StartTime = oderObject.StartTime; query.EndTime = oderObject.EndTime; query.ObjectNum = oderObject.AreaIdLst; query.ItemCode = oderObject.ItemCode; query.ObjType = oderObject.ObjType; query.Unit = oderObject.Particle; if (oderObject.AreaIdLst.Count <= 1) { throw new Exception("请选择多个对象进行比较!"); } var result = new ResultCompare(); switch (oderObject.QueryType) { case EnergyAnalyseQueryType.Default: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetCompareChart(oderObject); break; case EnergyAnalyseQueryType.UnitArea: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetAreaCompareChart(oderObject); break; case EnergyAnalyseQueryType.UnitPerson: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetPersonNumCompareChart(oderObject);; break; default: result = Framework.Common.BaseWcf.CreateChannel <ServiceInterface.IEnergyContrastService>("EnergyContrastService") .GetCompareChart(oderObject); break; } string strDepName = ""; if (result.Dept.Count > 0) { strDepName = result.Dept[0].ToString(); } else { throw new Exception("没有数据信息"); } switch (oderObject.QueryType) { case EnergyAnalyseQueryType.Convert2Co2: strDepName = "T"; break; case EnergyAnalyseQueryType.Convert2Coal: strDepName = "T"; break; case EnergyAnalyseQueryType.Convert2Money: strDepName = "元"; break; } return(JsonForHightChartsNew.IndexContrastObjsLst(query, result.ObjectName.ToArray(), strDepName, result.Enery)); } catch (Exception ex) { ResultObjLst lst = new ResultObjLst(); ExecuteProcess process = new ExecuteProcess(); process.ExceptionMsg = ex.Message; process.Success = false; lst.ActionInfo = process; return(lst); } }