Exemple #1
0
        public ResultCompare GetAreaPeriodsCompareChart(QueryContrastPeriods query)
        {
            #region 定义区

            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List <string>(),
                Enery      = new Dictionary <string, List <decimal> >(),
                Dept       = new List <string>()
            };

            #endregion


            if (query.PeriodLst.Count > 0)
            {
                resultList.ObjectName.Clear();
                for (int iCount = 0; iCount < query.PeriodLst.Count; iCount++)
                {
                    //QueryContrastPeriods basicQuery = new QueryContrastPeriods();
                    //basicQuery.PeriodLst = query.PeriodLst;
                    //basicQuery.ItemCode = query.ItemCode;
                    //basicQuery.AreaId = query.AreaId;
                    //basicQuery.ObjectNum = o.LayerObjectID;
                    var result = GetPeriodsQueryLineChart(query, query.PeriodLst[iCount]);
                    resultList.ObjectName.Add(query.PeriodLst[iCount].StartTime.ToString("yyyy-MM-dd") + "~" + query.PeriodLst[iCount].EndTime.ToString("yyyy-MM-dd"));
                    if (query.ItemCode != "00000")
                    {
                        var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'", " order by ItemcodeID")[0];
                        resultList.Enery.Add((iCount + 1).ToString(), result.Enery[itemList.ItemCodeName]);
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add(itemList.Unit);
                        }
                    }
                    else
                    {
                        var tempValue = new decimal[result.Enery[result.Enery.Keys.First <string>()].Count];
                        foreach (var re in result.Enery)
                        {
                            for (var i = 0; i < re.Value.Count; i++)
                            {
                                tempValue[i] += re.Value[i];
                            }
                        }
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add("T");
                        }
                        resultList.Enery.Add(iCount.ToString(), tempValue.ToList());
                        //resultList.Enery.Add(o.LayerObjectName, tempValue.ToList().Select(p => p / decimal.Parse(o.PersonNum.ToString())).ToList());
                    }
                }
                return(resultList);
            }
            return(null);
        }
Exemple #2
0
        /// <summary>
        /// 根据查询条件获取数据。
        /// </summary>
        /// <param name="basicQuery"></param>
        /// <returns></returns>
        public ResultCompare GetDateTongJiData(BasicQuery basicQuery)
        {
            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List <string>(),
                Enery      = new Dictionary <string, List <decimal> >(),
                Dept       = new List <string>()
            };

            List <Model.BaseLayerObject> objectList;

            if (basicQuery.AreaType == AreaType.Area)
            {
                objectList = new BLL.BaseLayerObject().GetBaseLayerObjectList(
                    string.Format(" and layerobjectid = {0}", basicQuery.ObjectNum), "");
            }
            else
            {
                objectList = new BLL.BaseLayerObject().GetBaseFuncLayerObjectList(
                    string.Format(" and layerobjectid = {0}", basicQuery.ObjectNum), "");
            }

            EnergyContrast contst = new EnergyContrast();
            var            result = contst.GetQueryLineChart(basicQuery);

            resultList.ObjectName = result.ObjectName;
            if (basicQuery.ItemCode != "00000")
            {
                var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + basicQuery.ItemCode + "'", " order by ItemcodeID")[0];
                resultList.Enery.Add(objectList[0].LayerObjectName, result.Enery[itemList.ItemCodeName]);
                for (int i = 0; i < result.Dept.Count; i++)
                {
                    resultList.Dept.Add(itemList.Unit);
                }
            }
            else
            {
                var tempValue = new decimal[result.Enery[result.Enery.Keys.First <string>()].Count];
                foreach (var re in result.Enery)
                {
                    for (var i = 0; i < re.Value.Count; i++)
                    {
                        tempValue[i] += re.Value[i];
                    }
                }
                for (int i = 0; i < result.Dept.Count; i++)
                {
                    resultList.Dept.Add("T");
                }
                resultList.Enery.Add(objectList[0].LayerObjectName, tempValue.ToList());
            }

            return(resultList);
        }
Exemple #3
0
        /// <summary>
        /// 根据查询条件获取数据。
        /// </summary>
        /// <param name="basicQuery"></param>
        /// <returns></returns>
        public ResultCompare GetDateTongJiData(BasicQuery basicQuery)
        {
            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List<string>(),
                Enery = new Dictionary<string, List<decimal>>(),
                Dept = new List<string>()
            };

            List<Model.BaseLayerObject> objectList;
            if (basicQuery.AreaType == AreaType.Area)
            {
                objectList = new BLL.BaseLayerObject().GetBaseLayerObjectList(
                       string.Format(" and layerobjectid = {0}", basicQuery.ObjectNum), "");
            }
            else
            {
                objectList = new BLL.BaseLayerObject().GetBaseFuncLayerObjectList(
                string.Format(" and layerobjectid = {0}", basicQuery.ObjectNum), "");
            }

            EnergyContrast contst = new EnergyContrast();
            var result = contst.GetQueryLineChart(basicQuery);
            resultList.ObjectName = result.ObjectName;
            if (basicQuery.ItemCode != "00000")
            {
                var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + basicQuery.ItemCode + "'", " order by ItemcodeID")[0];
                resultList.Enery.Add(objectList[0].LayerObjectName, result.Enery[itemList.ItemCodeName]);
                for (int i = 0; i < result.Dept.Count; i++)
                {
                    resultList.Dept.Add(itemList.Unit);
                }
            }
            else
            {
                var tempValue = new decimal[result.Enery[result.Enery.Keys.First<string>()].Count];
                foreach (var re in result.Enery)
                {
                    for (var i = 0; i < re.Value.Count; i++)
                    {
                        tempValue[i] += re.Value[i];
                    }
                }
                for (int i = 0; i < result.Dept.Count; i++)
                {
                    resultList.Dept.Add("T");
                }
                resultList.Enery.Add(objectList[0].LayerObjectName, tempValue.ToList());
            }

            return resultList;
        }
Exemple #4
0
        public ResultCompare GetAreaCompareChart(QueryOrderObjects queryObject)
        {
            #region 定义区


            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List <string>(),
                Enery      = new Dictionary <string, List <decimal> >(),
                Dept       = new List <string>()
            };

            #endregion


            var olist = queryObject.AreaIdLst.Aggregate(string.Empty, (current, q) => current + ("," + q.ToString()));

            if (olist.Length > 0)
            {
                List <Model.BaseLayerObject> objectList;
                if (queryObject.ObjType == AreaType.Area)
                {
                    objectList =
                        new BLL.BaseLayerObject().GetBaseLayerObjectList(
                            string.Format(" and layerobjectid in ({0})", olist.Substring(1)), " order by LayerObjectID");
                }
                else
                {
                    objectList =
                        new BLL.BaseLayerObject().GetBaseFuncLayerObjectList(
                            string.Format(" and layerobjectid in ({0})", olist.Substring(1)), " order by LayerObjectID");
                }



                foreach (var o in objectList)
                {
                    var basicQuery = new BasicQuery
                    {
                        EndTime   = queryObject.EndTime,
                        StartTime = queryObject.StartTime,
                        ItemCode  = queryObject.ItemCode,
                        Unit      = queryObject.Particle,
                        AreaType  = queryObject.ObjType,
                        QueryType = queryObject.QueryType
                    };
                    basicQuery.ObjectNum = o.LayerObjectID;
                    var result = GetQueryLineChart(basicQuery);
                    //resultList.Dept = result.Dept;
                    resultList.ObjectName = result.ObjectName;
                    if (queryObject.ItemCode != "00000")
                    {
                        var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + queryObject.ItemCode + "'", " order by ItemcodeID")[0];
                        //resultList.Enery.Add(o.LayerObjectName, result.Enery[itemList.ItemCodeName]);
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add(itemList.Unit);
                        }

                        resultList.Enery.Add(o.LayerObjectName, result.Enery[itemList.ItemCodeName].Select(p => p / decimal.Parse(o.AreaNum.ToString())).ToList());
                    }
                    else
                    {
                        var tempValue = new decimal[result.Enery[result.Enery.Keys.First <string>()].Count];
                        foreach (var re in result.Enery)
                        {
                            for (var i = 0; i < re.Value.Count; i++)
                            {
                                tempValue[i] += re.Value[i];
                            }
                        }
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add("T");
                        }
                        resultList.Enery.Add(o.LayerObjectName, tempValue.ToList().Select(p => p / decimal.Parse(o.AreaNum.ToString())).ToList());
                    }
                }
                return(resultList);
            }
            return(null);
        }
Exemple #5
0
        public ResultCompare GetPersonNumPeriodsCompareChart(QueryContrastPeriods query)
        {
            #region 定义区

            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List<string>(),
                Enery = new Dictionary<string, List<decimal>>(),
                Dept = new List<string>()
            };

            #endregion

            if (query.PeriodLst.Count > 0)
            {
                resultList.ObjectName.Clear();
                for (int iCount = 0; iCount < query.PeriodLst.Count; iCount++)
                {
                    //QueryContrastPeriods basicQuery = new QueryContrastPeriods();
                    //basicQuery.PeriodLst = query.PeriodLst;
                    //basicQuery.ItemCode = query.ItemCode;
                    //basicQuery.AreaId = query.AreaId;
                    //basicQuery.ObjectNum = o.LayerObjectID;
                    var result = GetPeriodsQueryLineChart(query, query.PeriodLst[iCount]);
                    resultList.ObjectName.Add(query.PeriodLst[iCount].StartTime.ToString("yyyy-MM-dd") + "~" + query.PeriodLst[iCount].EndTime.ToString("yyyy-MM-dd"));
                    if (query.ItemCode != "00000")
                    {
                        var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'", " order by ItemcodeID")[0];
                        resultList.Enery.Add((iCount + 1).ToString(), result.Enery[itemList.ItemCodeName]);
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add(itemList.Unit);
                        }
                    }
                    else
                    {
                        var tempValue = new decimal[result.Enery[result.Enery.Keys.First<string>()].Count];
                        foreach (var re in result.Enery)
                        {
                            for (var i = 0; i < re.Value.Count; i++)
                            {
                                tempValue[i] += re.Value[i];
                            }
                        }
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add("T");
                        }
                        resultList.Enery.Add(iCount.ToString(), tempValue.ToList());
                        //resultList.Enery.Add(o.LayerObjectName, tempValue.ToList().Select(p => p / decimal.Parse(o.PersonNum.ToString())).ToList());
                    }
                }
                return resultList;
            }
            return null;
        }
Exemple #6
0
        /// <summary>
        /// add by: jy
        /// add at: 2014-3-24
        /// note  : 人均能耗对比
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ResultCompare GetPersonNumCompareChart(QueryOrderObjects queryObject)
        {
            #region 定义区

            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List<string>(),
                Enery = new Dictionary<string, List<decimal>>(),
                Dept = new List<string>()
            };

            #endregion

            var olist = queryObject.AreaIdLst.Aggregate(string.Empty, (current, q) => current + ("," + q.ToString()));

            if (olist.Length > 0)
            {
                List<Model.BaseLayerObject> objectList;
                if (queryObject.ObjType == AreaType.Area)
                {
                    objectList =
                      new BLL.BaseLayerObject().GetBaseLayerObjectList(
                           string.Format(" and layerobjectid in ({0})", olist.Substring(1)), " order by LayerObjectID");
                }
                else
                {
                    objectList =
              new BLL.BaseLayerObject().GetBaseFuncLayerObjectList(
               string.Format(" and layerobjectid in ({0})", olist.Substring(1)), " order by LayerObjectID");
                }

                foreach (var o in objectList)
                {
                    var basicQuery = new BasicQuery
                    {
                        EndTime = queryObject.EndTime,
                        StartTime = queryObject.StartTime,
                        ItemCode = queryObject.ItemCode,
                        Unit = queryObject.Particle,
                        AreaType = queryObject.ObjType,
                        QueryType = queryObject.QueryType
                    };
                    basicQuery.ObjectNum = o.LayerObjectID;
                    var result = GetQueryLineChart(basicQuery);
                    //resultList.Dept = result.Dept;
                    resultList.ObjectName = result.ObjectName;
                    if (queryObject.ItemCode != "00000")
                    {
                        var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + queryObject.ItemCode + "'", " order by ItemcodeID")[0];
                        //resultList.Enery.Add(o.LayerObjectName, result.Enery[itemList.ItemCodeName]);
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add(itemList.Unit);
                        }

                        resultList.Enery.Add(o.LayerObjectName, result.Enery[itemList.ItemCodeName].Select(p => p / decimal.Parse(o.PersonNum.ToString())).ToList());
                    }
                    else
                    {
                        var tempValue = new decimal[result.Enery[result.Enery.Keys.First<string>()].Count];
                        foreach (var re in result.Enery)
                        {
                            for (var i = 0; i < re.Value.Count; i++)
                            {
                                tempValue[i] += re.Value[i];
                            }
                        }
                        for (int i = 0; i < result.Dept.Count; i++)
                        {
                            resultList.Dept.Add("T");
                        }
                        resultList.Enery.Add(o.LayerObjectName, tempValue.ToList().Select(p => p / decimal.Parse(o.PersonNum.ToString())).ToList());
                    }
                }
                return resultList;
            }
            return null;
        }
Exemple #7
0
        public ResultCompare GetCompareChartNew(QueryOrderObjects query)
        {
            #region 定义区

            query.ObjType = AreaType.Area;  // 给区域分类

            var resultList = new ResultView.ResultCompare
            {
                ObjectName = new List<string>(),
                Enery = new Dictionary<string, List<decimal>>(),
                Dept = new List<string>()
            };

            #endregion

            //var olist = query.ObjectNum.Aggregate(string.Empty, (current, q) => current + ("," + q.ToString()));
            //if (olist.Length > 0)
            //{
            //    List<Model.BaseLayerObject> objectList;
            //    if (query.ClassId == 1)
            //    {
            //        objectList = new BLL.BaseLayerObject().GetBaseLayerObjectList(
            //               string.Format(" and layerobjectid in ({0})", olist.Substring(1)), " order by LayerObjectID");
            //    }
            //    else
            //    {
            //        objectList = new BLL.BaseLayerObject().GetBaseFuncLayerObjectList(
            //        string.Format(" and layerobjectid in ({0})", olist.Substring(1)), " order by LayerObjectID");
            //    }

            //    foreach (var o in objectList)
            //    {
            //        var basicQuery = new BasicQuery
            //        {
            //            EndTime = query.EndTime,
            //            StartTime = query.StartTime,
            //            ItemCode = query.ItemCode,
            //            Unit = query.Unit
            //        };
            //        basicQuery.ObjectNum = o.LayerObjectID;
            //        var result = GetQueryLineChart(basicQuery);
            //        resultList.ObjectName = result.ObjectName;
            //        if (query.ItemCode != "00000")
            //        {
            //            var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'", " order by ItemcodeID")[0];
            //            resultList.Enery.Add(o.LayerObjectName, result.Enery[itemList.ItemCodeName]);
            //            for (int i = 0; i < result.Dept.Count; i++)
            //            {
            //                resultList.Dept.Add(itemList.Unit);
            //            }
            //        }
            //        else
            //        {
            //            var tempValue = new decimal[result.Enery[result.Enery.Keys.First<string>()].Count];
            //            foreach (var re in result.Enery)
            //            {
            //                for (var i = 0; i < re.Value.Count; i++)
            //                {
            //                    tempValue[i] += re.Value[i];
            //                }
            //            }
            //            for (int i = 0; i < result.Dept.Count; i++)
            //            {
            //                resultList.Dept.Add("T");
            //            }
            //            resultList.Enery.Add(o.LayerObjectName, tempValue.ToList());
            //        }
            //    }
            //    return resultList;
            //}
            return null;
        }