Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public ResultCompare GetAreaCompareChart(QueryOrderObjects query)
 {
     return(entBll.GetAreaCompareChart(query));
 }