Beispiel #1
0
 public string GetDeviceListByArea(QueryDevice query)
 {
     StringBuilder sbTree = new StringBuilder();
      //  var result = new ResultDevice();
      //  result.DeviceUnitList = new List<DeviceUnit>();
        List<Device> deviceList;
        if(query.ItemCode=="00000")
        {
        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.AreaID, " order by deviceid");
        }
        else
        {
        string itemCodeAll = query.ItemCode;
        var itemcodeList = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
        var itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ParentID, " order by itemcodeid");
        itemCodeAll = itemcodeListChild.Aggregate(itemCodeAll, (current, itemcode) => current + ("," + itemcode.ItemcodeID));
        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.AreaID, " order by deviceid");
        }
        sbTree.Append("[");
        for (var device=0; device< deviceList.Count;device++)
        {
        sbTree.Append("{\"text\": \"" + deviceList[device].DeviceName + "\",\"id\": " + deviceList[device].DeviceID + ",\"classes\": \"equip\"}");
        sbTree.Append(device == deviceList.Count - 1 ? "" : ",");
        }
        sbTree.Append("]");
     return sbTree.ToString();
 }
Beispiel #2
0
        public string GetDeviceListByArea(QueryDevice query)
        {
            StringBuilder sbTree = new StringBuilder();
            //  var result = new ResultDevice();
            //  result.DeviceUnitList = new List<DeviceUnit>();
            List <NTS.WEB.Model.Device> deviceList;

            if (query.ItemCode == "00000" || string.IsNullOrEmpty(query.ItemCode))
            {
                deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.AreaID, " order by deviceid");
            }
            else
            {
                string itemCodeAll       = query.ItemCode;
                string tempCode          = string.Empty;
                var    itemcodeList      = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
                var    itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ItemcodeID, " order by itemcodeid");
                foreach (NTS.WEB.Model.Itemcode itemcode in itemcodeListChild)
                {
                    tempCode += ",'" + itemcode.ItemCodeNumber + "'";
                }
                itemCodeAll = tempCode.Length > 0 ? tempCode.Substring(1) : "'" + itemCodeAll + "'";
                deviceList  = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.AreaID, " order by deviceid");
            }
            sbTree.Append("[");
            for (var device = 0; device < deviceList.Count; device++)
            {
                sbTree.Append("{\"text\": \"" + deviceList[device].DeviceName + "\",\"id\": " + deviceList[device].DeviceID + ",\"classes\": \"equip\"}");
                sbTree.Append(device == deviceList.Count - 1 ? "" : ",");
            }
            sbTree.Append("]");
            return(sbTree.ToString());
        }
Beispiel #3
0
        public List <Device> GetDeviceListByAreaId()
        {
            LayerObjectBll bllObjectBll;
            var            inputValue = _ntsPage.Request.Form["Inputs"];
            var            query      = Newtonsoft.Json.JsonConvert.DeserializeObject <QueryDevice>(inputValue);

            // 递归树
            if (query.treeInfo == 1)
            {
                bllObjectBll = new LayerFunObject(query.areaid);
            }
            else
            {
                bllObjectBll = new LayerBaseObject(query.areaid);
            }

            var itemcodelist = new StringBuilder();
            var list         =
                new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and (parentid=(select ItemcodeID from Becm_ItemCode where ItemCodeNumber='{0}')) or ItemCodeNumber='{0}' ", query.itemCode), string.Empty);

            foreach (var l in list)
            {
                itemcodelist.Append(string.Format(",'{0}'", l.ItemCodeNumber));
            }
            var whereStr = query.treeInfo == 1
                ? string.Format(" and areaid2 in({0}) and itemCodeID in({1})", bllObjectBll.GetTreeObjects(), itemcodelist.ToString().Substring(1))
                : string.Format(" and areaid in({0}) and itemCodeID in({1})", bllObjectBll.GetTreeObjects(), itemcodelist.ToString().Substring(1));
            var devicelist = new WEB.BLL.BaseLayerObject().GetDeviceObjectList(whereStr,
                                                                               string.Empty);

            return(devicelist);
        }
Beispiel #4
0
        public string GetDeviceListByArea(QueryDevice query)
        {
            StringBuilder sbTree = new StringBuilder();
            //  var result = new ResultDevice();
            //  result.DeviceUnitList = new List<DeviceUnit>();
            List <Device> deviceList;

            if (query.ItemCode == "00000")
            {
                deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.AreaID, " order by deviceid");
            }
            else
            {
                string itemCodeAll       = query.ItemCode;
                var    itemcodeList      = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
                var    itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ParentID, " order by itemcodeid");
                itemCodeAll = itemcodeListChild.Aggregate(itemCodeAll, (current, itemcode) => current + ("," + itemcode.ItemcodeID));
                deviceList  = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.AreaID, " order by deviceid");
            }
            sbTree.Append("[");
            for (var device = 0; device < deviceList.Count; device++)
            {
                sbTree.Append("{\"text\": \"" + deviceList[device].DeviceName + "\",\"id\": " + deviceList[device].DeviceID + ",\"classes\": \"equip\"}");
                sbTree.Append(device == deviceList.Count - 1 ? "" : ",");
            }
            sbTree.Append("]");
            return(sbTree.ToString());
        }
Beispiel #5
0
        /// <summary>
        /// 首页电分类占比图
        /// </summary>
        /// <returns></returns>
        public ResultIndexPieChart IndexElectricityPieChart()
        {
            var result = new ResultIndexPieChart {
                ItemCode = new List <Itemcode>(), ItemCodeEnery = new List <decimal>()
            };

            var itemList = new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and ParentID=(select itemcodeid from Becm_ItemCode where ItemCodeNumber='{0}')", "01000"), " order by ItemcodeID");

            result.ItemCode = itemList;

            var eneryList = new NTS.WEB.BLL.Charts().GetIndexPieChart();

            result.ItemCodeEnery = eneryList;
            return(result);
        }
Beispiel #6
0
        public override string FormateContent(object primaryKey)
        {
            try
            {
                #region 变量

                string          content      = string.Empty;
                int             id           = (int)primaryKey;
                string          itemCodeName = string.Empty;
                string          objectDes    = string.Empty;
                string          editTime     = string.Empty;
                string          quotaDate    = string.Empty;
                string          type         = string.Empty;
                string          oldValue     = string.Empty;
                string          newValue     = string.Empty;
                string          objectUnit   = string.Empty;
                OperateQuotaBll quotaOper    = new OperateQuotaBll();
                #endregion

                #region 数据来源

                var      quotaInfo    = quotaOper.GetQuotaInfoById(id);
                var      itemCodeInfo = new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and itemcodenumber='{0}'", quotaInfo.QuotaData.ItemCode), "")[0];
                QuotaLog newQoutaLog  = quotaInfo.QuotaLogList[0];

                #endregion

                #region 组织数据

                itemCodeName = itemCodeInfo.ItemCodeName;
                objectUnit   = itemCodeInfo.Unit;
                objectDes    = quotaInfo.QuotaData.ObjectDesc;
                newValue     = quotaInfo.QuotaData.QuotaValue.ToString();
                editTime     = newQoutaLog.LogTime.ToString("yyyy年MM月dd日HH时mm分ss秒");
                type         = quotaInfo.QuotaData.QuotaType == QuotaType.Month ? "月" : "年";
                if (quotaInfo.QuotaData.QuotaType == QuotaType.Month)
                {
                    quotaDate = string.Format("{0}年{1}月", quotaInfo.QuotaData.QuotaTime.Year, quotaInfo.QuotaData.QuotaTime.Month);
                }
                else if (quotaInfo.QuotaData.QuotaType == QuotaType.Year)
                {
                    quotaDate = string.Format("{0}年", quotaInfo.QuotaData.QuotaTime.Year);
                }

                if (quotaInfo.QuotaLogList.Count > 1)
                {
                    QuotaLog oldQUotaLog = quotaInfo.QuotaLogList[1];
                    oldValue = oldQUotaLog.QuotaValue.ToString();
                    content  = string.Format("{0}用户于{1}修改\"{2}-{3}-{4}定额\":修改前为{5}kwh,修改后为{6}{7}。", _userName, editTime, objectDes, itemCodeName, type, oldValue, newValue, objectUnit);
                }
                else if (quotaInfo.QuotaLogList.Count == 1)
                {
                    content = string.Format("{0}用户于{1}添加\"{2}-{3}-{4}定额\":{5}{6}。", _userName, editTime, objectDes, itemCodeName, type, newValue, objectUnit);
                }
                return(content);

                #endregion
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public override string FormateContent(object primaryKey)
        {
            try
            {
                #region 变量

                string content = string.Empty;
                int id = (int)primaryKey;
                string itemCodeName = string.Empty;
                string objectDes = string.Empty;
                string editTime = string.Empty;
                string quotaDate = string.Empty;
                string type = string.Empty;
                string oldValue = string.Empty;
                string newValue = string.Empty;
                string objectUnit = string.Empty;
                OperateQuotaBll quotaOper = new OperateQuotaBll();
                #endregion

                #region 数据来源

                var quotaInfo = quotaOper.GetQuotaInfoById(id);
                var itemCodeInfo = new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and itemcodenumber='{0}'", quotaInfo.QuotaData.ItemCode), "")[0];
                QuotaLog newQoutaLog = quotaInfo.QuotaLogList[0];

                #endregion

                #region 组织数据

                itemCodeName = itemCodeInfo.ItemCodeName;
                objectUnit = itemCodeInfo.Unit;
                objectDes = quotaInfo.QuotaData.ObjectDesc;
                newValue = quotaInfo.QuotaData.QuotaValue.ToString();
                editTime = newQoutaLog.LogTime.ToString("yyyy年MM月dd日HH时mm分ss秒");
                type = quotaInfo.QuotaData.QuotaType == QuotaType.Month ? "月" : "年";
                if (quotaInfo.QuotaData.QuotaType == QuotaType.Month)
                {
                    quotaDate = string.Format("{0}年{1}月", quotaInfo.QuotaData.QuotaTime.Year, quotaInfo.QuotaData.QuotaTime.Month);
                }
                else if (quotaInfo.QuotaData.QuotaType == QuotaType.Year)
                {
                    quotaDate = string.Format("{0}年", quotaInfo.QuotaData.QuotaTime.Year);
                }

                if (quotaInfo.QuotaLogList.Count > 1)
                {
                    QuotaLog oldQUotaLog = quotaInfo.QuotaLogList[1];
                    oldValue = oldQUotaLog.QuotaValue.ToString();
                    content = string.Format("{0}用户于{1}修改\"{2}-{3}-{4}定额\":修改前为{5}kwh,修改后为{6}{7}。", _userName, editTime, objectDes, itemCodeName, type, oldValue, newValue, objectUnit);
                }
                else if (quotaInfo.QuotaLogList.Count == 1)
                {
                    content = string.Format("{0}用户于{1}添加\"{2}-{3}-{4}定额\":{5}{6}。", _userName, editTime, objectDes, itemCodeName, type, newValue, objectUnit);
                }
                return content;

                #endregion
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
Beispiel #8
0
 public string GetDeviceListByArea(QueryDevice query)
 {
     StringBuilder sbTree = new StringBuilder();
     //  var result = new ResultDevice();
     //  result.DeviceUnitList = new List<DeviceUnit>();
     List<Device> deviceList;
     if (query.ItemCode == "00000" || string.IsNullOrEmpty(query.ItemCode))
     {
         deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.AreaID, " order by deviceid");
     }
     else
     {
         string itemCodeAll = query.ItemCode;
         string tempCode = string.Empty;
         var itemcodeList = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
         var itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ItemcodeID, " order by itemcodeid");
         foreach (Model.Itemcode itemcode in itemcodeListChild)
             tempCode += ",'" + itemcode.ItemCodeNumber + "'";
         itemCodeAll = tempCode.Length > 0 ? tempCode.Substring(1) : "'" + itemCodeAll + "'";
         deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.AreaID, " order by deviceid");
     }
     sbTree.Append("[");
     for (var device = 0; device < deviceList.Count; device++)
     {
         sbTree.Append("{\"text\": \"" + deviceList[device].DeviceName + "\",\"id\": " + deviceList[device].DeviceID + ",\"classes\": \"equip\"}");
         sbTree.Append(device == deviceList.Count - 1 ? "" : ",");
     }
     sbTree.Append("]");
     return sbTree.ToString();
 }
Beispiel #9
0
        public ItemList IndexItems(QueryEnergyIterm qery)
        {
            var pAction = new ExecuteProcess();
            try
            {
                Itemcode itcode = new NTS.WEB.BLL.Itemcode();

                List<Model.Itemcode> itemList = new List<Model.Itemcode>();
                if (qery.ItemCode != "00000")
                {
                    var itemParent = itcode.GetItemcodeList(
                      string.Format(" and  ItemCodeNumber='{0}'", qery.ItemCode),
                      " order by ItemcodeID");
                    if (itemParent.Count > 0)
                    {
                        itemList = itcode.GetItemcodeList(
                            string.Format("and  PARENTID= {0} ", itemParent[0].ItemcodeID.ToString()),
                            " order by ItemcodeID");

                    }
                }
                else
                {

                    itemList = itcode.GetItemcodeList(
                           string.Format("and  PARENTID= {0} ", 0),
                           " order by ItemcodeID");

                }
                ItemList result = new ItemList();
                result.ItemLst = new List<ItemSet>();
                foreach (Model.Itemcode ic in itemList)
                {
                    ItemSet its = new ItemSet();
                    its.ItemCode = ic.ItemCodeNumber;
                    its.ItemName = ic.ItemCodeName;
                    result.ItemLst.Add(its);

                }
                pAction.Success = true;
                result.ActionInfo = pAction;

                return result;
            }
            catch (Exception ex)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = ex.Message;
                return new ItemList() { ActionInfo = pAction };
            }
        }
Beispiel #10
0
        public ResultItemCode GetTwoQueryLineChart(BasicQuery query, BasicQuery query2, int tabId)
        {
            #region 定义区

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

            #endregion
            ResultItemCode result = GetQueryLineChart(query);
            ResultItemCode result2 = GetQueryLineChart(query2);

            resultList.Dept = result.Dept;
            foreach (var oname in result.ObjectName)
            {
                resultList.ObjectName.Add("");
            }
            // resultList.ObjectName = result.ObjectName;
            decimal[] Arr = new decimal[result.Enery[result.Enery.Keys.First<string>()].Count];
            decimal[] ArrNew = new decimal[result2.Enery[result2.Enery.Keys.First<string>()].Count];
            if (queryCode == "00000")
            {
                foreach (var re in result.Enery)
                {
                    for (int i = 0; i < re.Value.Count; i++)
                    {
                        Arr[i] += re.Value[i];
                    }
                }
                foreach (var re2 in result2.Enery)
                {
                    for (int i = 0; i < re2.Value.Count; i++)
                    {
                        ArrNew[i] += re2.Value[i];
                    }
                }
                if (tabId == 1)
                {
                    resultList.Enery.Add(query.StartTime.ToString("yyyy") + "总能耗", Arr.ToList());
                    resultList.Enery.Add(query2.StartTime.ToString("yyyy") + "总能耗", ArrNew.ToList());
                }
                else
                {
                    resultList.Enery.Add(query.StartTime.ToString("yyyy-MM") + "总能耗", Arr.ToList());
                    resultList.Enery.Add(query2.StartTime.ToString("yyyy-MM") + "总能耗", ArrNew.ToList());
                }

            }
            else
            {
                var itemcodeList = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + queryCode + "'", " order by itemcodeid")[0];

                foreach (var r1 in result.Enery)
                {
                    if (tabId == 1)
                    {
                        resultList.Enery.Add(query.StartTime.ToString("yyyy") + r1.Key, r1.Value);
                    }
                    else
                    {
                        resultList.Enery.Add(query.StartTime.ToString("yyyy-MM") + r1.Key, r1.Value);
                    }
                }
                foreach (var r2 in result2.Enery)
                {
                    if (tabId == 1)
                    {
                        resultList.Enery.Add(query2.StartTime.ToString("yyyy") + r2.Key, r2.Value);
                    }
                    else
                    {
                        resultList.Enery.Add(query2.StartTime.ToString("yyyy-MM") + r2.Key, r2.Value);
                    }
                }
            }

            return resultList;
        }
Beispiel #11
0
        public ResultQueryPie GetQueryPieChart(DataContact.BasicQuery query)
        {
            #region 定义区

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

            #endregion

            var objectList =
                new BLL.BaseLayerObject().GetBaseLayerObjectList(
                    string.Format(" and layerobjectparentid={0}", query.ObjectNum), " order by LayerObjectID");
            if (objectList.Count > 0)
            {
                decimal eTotal = 0;
                for (var i = 0; i < objectList.Count; i++)
                {
                    var querynew = new BasicQuery
                        {
                            StartTime = query.StartTime,
                            EndTime = query.EndTime,
                            ItemCode = query.ItemCode,
                            ObjectNum = objectList[i].LayerObjectID,
                            ObjectType = query.ObjectType,
                            Unit = query.Unit
                        };
                    //if (i < 5)
                    //{
                    if (query.ItemCode != "00000")
                    {
                        var item =
                            new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'",
                                                               " order by ItemcodeID")[0];

                        resultList.Dept.Add(item.Unit);
                    }
                    else
                    {
                        resultList.Dept.Add("T");
                    }
                    resultList.ObjectName.Add(objectList[i].LayerObjectName);

                    resultList.Enery.Add(new QueryEnery().GetQueryEneryTotal(querynew).TotalEnergy);
                    //}
                    //else
                    //{
                    //    eTotal += new QueryEnery().GetQueryEneryTotal(querynew).TotalEnergy;
                    //    if (i == objectList.Count - 1)
                    //    {
                    //        if (query.ItemCode != "00000")
                    //        {
                    //            var item =
                    //                new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'",
                    //                                                   " order by ItemcodeID")[0];
                    //            resultList.Dept.Add(item.Unit);
                    //        }
                    //        else
                    //        {
                    //            resultList.Dept.Add("T");
                    //        }
                    //        resultList.ObjectName.Add("其他");
                    //        resultList.Enery.Add(eTotal);
                    //    }
                    //}
                }
                if (resultList.Enery.Count > 5)
                {
                    //resultList.ObjectName[5] = "其他";
                    List<EnergyRank> lstEnergy = new List<EnergyRank>();

                    for (var i = 0; i < resultList.Enery.Count; i++)
                    {
                        EnergyRank er = new EnergyRank();
                        er.ObjName = resultList.ObjectName[i];
                        er.Energy = resultList.Enery[i];
                        lstEnergy.Add(er);

                    }
                    lstEnergy = lstEnergy.OrderByDescending(p => p.Energy).ToList();
                    resultList.Dept.Clear();
                    resultList.ObjectName.Clear();
                    resultList.Enery.Clear();

                    if (lstEnergy.Count < 6)
                    {
                        foreach (EnergyRank er in lstEnergy)
                        {
                            resultList.Dept.Add("T");
                            resultList.ObjectName.Add(er.ObjName);
                            resultList.Enery.Add(er.Energy);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            resultList.Dept.Add("T");
                            resultList.ObjectName.Add(lstEnergy[i].ObjName);
                            resultList.Enery.Add(lstEnergy[i].Energy);
                        }
                        resultList.Dept.Add("T");
                        resultList.ObjectName.Add("其他");
                        //统计排名第五以后的能耗总和。
                        resultList.Enery.Add(lstEnergy.GetRange(5, lstEnergy.Count - 5).Sum(p => p.Energy));
                    }
                }
                return resultList;
            }
            else
            {
                var deviceList = new List<Device>();
                if (query.ItemCode == "00000")
                {
                    deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.ObjectNum, " order by deviceid");
                }
                else
                {
                    string itemCodeAll = query.ItemCode;
                    string tempCode = string.Empty;
                    var itemcodeList = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
                    var itemcodeListChild = new NTS.WEB.BLL.Itemcode().GetItemcodeList("  and ParentID=" + itemcodeList.ParentID, " order by itemcodeid");
                    foreach (Model.Itemcode itemcode in itemcodeListChild)
                        tempCode += ",'" + itemcode.ItemCodeNumber + "'";
                    itemCodeAll = itemCodeAll.Length > 0 ? "'" + itemCodeAll + "'" : itemCodeAll.Substring(1);
                    deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.ObjectNum, " order by deviceid");
                }
                if (deviceList.Count > 0)
                {
                    decimal eTotal = 0;
                    for (var i = 0; i < deviceList.Count; i++)
                    {
                        var querynew = new BasicQuery
                        {
                            StartTime = query.StartTime,
                            EndTime = query.EndTime,
                            ItemCode = query.ItemCode,
                            ObjectNum = deviceList[i].DeviceID,
                            ObjectType = query.ObjectType,
                            Unit = query.Unit
                        };
                        if (i < 5)
                        {
                            if (query.ItemCode != "00000")
                            {
                                var item =
                                    new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'",
                                                                       " order by ItemcodeID")[0];

                                resultList.Dept.Add(item.Unit);
                            }
                            else
                            {
                                resultList.Dept.Add("T");
                            }
                            resultList.ObjectName.Add(deviceList[i].DeviceName);
                            resultList.Enery.Add(new QueryEnery().GetDeviceQueryEneryTotal(querynew).TotalEnergy);
                        }
                        else
                        {
                            eTotal += new QueryEnery().GetDeviceQueryEneryTotal(querynew).TotalEnergy;
                            if (i == deviceList.Count - 1)
                            {
                                if (query.ItemCode != "00000")
                                {
                                    var item =
                                        new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + query.ItemCode + "'",
                                                                           " order by ItemcodeID")[0];
                                    resultList.Dept.Add(item.Unit);
                                }
                                else
                                {
                                    resultList.Dept.Add("T");
                                }
                                resultList.ObjectName.Add("其他");
                                resultList.Enery.Add(eTotal);
                            }
                        }
                    }
                    return resultList;
                }
            }
            return null;
        }
Beispiel #12
0
 /// <summary>
 /// 返回首页的电分类占比图
 /// </summary>
 /// <returns></returns>
 public List<decimal> GetIndexPieChart()
 {
     var objectList = new BLL.BaseLayerObject().GetBaseLayerObjectList(string.Format(" and layerobjectparentid={0}", 0), " order by LayerObjectID");
     var itemList = new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and ParentID=(select itemcodeid from Becm_ItemCode where ItemCodeNumber='{0}')", "01000"), " order by ItemcodeID");
     var list = (from item in itemList
                 select new BaseQueryModel
                     {
                         IsDevice = 0,
                         ObjectList = (from p in objectList select p.LayerObjectID).ToList<int>(),
                         ItemCode = item.ItemCodeNumber,
                         Unit = ChartUnit.unit_month,
                         Starttime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1")),
                         Endtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1"))
                     }
                     into model
                     select _reportBll.GetBaseEneryDataList(model)
                         into resList
                         select objectList.Sum(o => resList.BaseLayerObjectResults[o.LayerObjectID.ToString()].Total)).ToList();
     return list;
 }
Beispiel #13
0
        /// <summary>
        /// 首页电分类占比图
        /// </summary>
        /// <returns></returns>
        public ResultIndexPieChart IndexElectricityPieChart()
        {
            var result = new ResultIndexPieChart {ItemCode = new List<Itemcode>(), ItemCodeEnery = new List<decimal>()};

            var itemList = new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and ParentID=(select itemcodeid from Becm_ItemCode where ItemCodeNumber='{0}')", "01000"), " order by ItemcodeID");
            result.ItemCode = itemList;

            var eneryList = new NTS.WEB.BLL.Charts().GetIndexPieChart();
            result.ItemCodeEnery = eneryList;
            return result;
        }
Beispiel #14
0
        public List<Device> GetDeviceListByAreaId()
        {
            LayerObjectBll bllObjectBll;
            var inputValue = _ntsPage.Request.Form["Inputs"];
            var query = Newtonsoft.Json.JsonConvert.DeserializeObject<QueryDevice>(inputValue);

            // 递归树
            if (query.treeInfo == 1)
            {
                bllObjectBll = new LayerFunObject(query.areaid);
            }
            else
            {
                bllObjectBll = new LayerBaseObject(query.areaid);
            }

            var itemcodelist = new StringBuilder();
            var list =
                new NTS.WEB.BLL.Itemcode().GetItemcodeList(string.Format(" and (parentid=(select ItemcodeID from Becm_ItemCode where ItemCodeNumber='{0}')) or ItemCodeNumber='{0}' ", query.itemCode), string.Empty);
            foreach (var l in list)
            {
                itemcodelist.Append(string.Format(",'{0}'", l.ItemCodeNumber));
            }
            var whereStr = query.treeInfo == 1
                ? string.Format(" and areaid2 in({0}) and itemCodeID in({1})", bllObjectBll.GetTreeObjects(), itemcodelist.ToString().Substring(1))
                : string.Format(" and areaid in({0}) and itemCodeID in({1})", bllObjectBll.GetTreeObjects(), itemcodelist.ToString().Substring(1));
            var devicelist = new WEB.BLL.BaseLayerObject().GetDeviceObjectList(whereStr,
                string.Empty);
            return devicelist;
        }