コード例 #1
0
 public ResultAlarm GetAlarmDiagnose(QueryAlarm query)
 {
     ResultAlarm result = new ResultAlarm();
     var pAction = new ExecuteProcess();
     try
     {
         var alarmdiagnoselist = new NTS.WEB.BLL.AlarmDiagnose().GetAlarmDiagnose(query);
         if (alarmdiagnoselist.Count > 0)
         {
             pAction.Success = true;
             result.Rows = alarmdiagnoselist;
             result.ActionInfo = pAction;
             return result;
         }
         else
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             result.ActionInfo = pAction;
             return result;
         }
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         result.ActionInfo = pAction;
         return result;
     }
 }
コード例 #2
0
ファイル: User.cs プロジェクト: NickQi/TianheDemo
        public ExecuteProcess AddUser(QueryUser model)
        {
            var pAction = new ExecuteProcess();
            try
            {
                if (new NTS.WEB.BLL.User().IsExistUserName(model))
                {
                    pAction.Success = false;
                    pAction.ExceptionMsg = "该用户名已存在";
                    return pAction;
                }
                else
                {

                    new NTS.WEB.BLL.User().AddUser(model);
                    pAction.Success = true;
                    pAction.ExceptionMsg = "新增用户成功";
                    return pAction;
                }

            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                return pAction;
            }
        }
コード例 #3
0
ファイル: MenuTreeService.cs プロジェクト: NickQi/TianheDemo
 public ResultMenus GetMenus(string username)
 {
     ResultMenus result = new ResultMenus();
     var pAction = new ExecuteProcess();
     try
     {
         result = new NTS.WEB.BLL.MenuTree().GetMenus(username);
         if (result != null)
         {
             pAction.Success = true;
             result.ActionInfo = pAction;
             return result;
         }
         else
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             result.ActionInfo = pAction;
             return result;
         }
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         result.ActionInfo = pAction;
         return result;
     }
 }
コード例 #4
0
ファイル: User.cs プロジェクト: NickQi/TianheDemo
 public ExecuteProcess DeleteUser(int id)
 {
     var pAction = new ExecuteProcess();
     try
     {
         new NTS.WEB.BLL.User().DeleteUser(id);
         pAction.Success = true;
         pAction.ExceptionMsg = "删除用户成功";
         return pAction;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return pAction;
     }
 }
コード例 #5
0
ファイル: QueryEnery.cs プロジェクト: NickQi/TianheDemo
 public ResultReal GetRealTime(NTS.WEB.DataContact.RealQuery query)
 {
     var pAction = new ExecuteProcess();
     try
     {
         var result = new NTS.WEB.BLL.QueryEnery().GetRealTime(query);
         if (result == null)
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             return new ResultReal() { ActionInfo = pAction };
         }
         pAction.Success = true;
         result.ActionInfo = pAction;
         return result;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new ResultReal() { ActionInfo = pAction };
     }
 }
コード例 #6
0
ファイル: Charts.cs プロジェクト: NickQi/TianheDemo
 public ResultEnergyAnalyse GetEnergyAnalyseLineChart(QueryAnalyse query)
 {
     var pAction = new ExecuteProcess();
     try
     {
         var result = new NTS.WEB.BLL.Charts().GetEnergyAnalyseLineChart(query);
         if (result == null)
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             return new ResultEnergyAnalyse() { ActionInfo = pAction };
         }
         pAction.Success = true;
         result.ActionInfo = pAction;
         return result;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new ResultEnergyAnalyse() { ActionInfo = pAction };
     }
 }
コード例 #7
0
ファイル: ObjectTree.cs プロジェクト: NickQi/TianheDemo
 public NTS.WEB.ResultView.ObjectTree GetObjectTree()
 {
     var pAction = new ExecuteProcess();
     try
     {
         var result = new NTS.WEB.BLL.BaseTree().GetObjectTree();
         if (result == null)
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             return new NTS.WEB.ResultView.ObjectTree() { ActionInfo = pAction };
         }
         pAction.Success = true;
         result.ActionInfo = pAction;
         return result;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new NTS.WEB.ResultView.ObjectTree() { ActionInfo = pAction };
     }
 }
コード例 #8
0
ファイル: QueryEnery.cs プロジェクト: NickQi/TianheDemo
 public NTS.WEB.ResultView.ShopOrderResult GetShopOrder(NTS.WEB.DataContact.QueryOrder query)
 {
     var pAction = new ExecuteProcess();
     try
     {
         var result = new NTS.WEB.BLL.QueryEnery().GetShopOrder(query);
         if (result == null)
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             return new ShopOrderResult() { ActionInfo = pAction };
         }
         pAction.Success = true;
         result.ActionInfo = pAction;
         return result;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new ShopOrderResult() { ActionInfo = pAction };
     }
 }
コード例 #9
0
ファイル: UserGroupService.cs プロジェクト: NickQi/TianheDemo
        public SingleUserGroupResult GetSingleUserGroup(int usergroupid)
        {
            SingleUserGroupResult result = new SingleUserGroupResult();
            var pAction = new ExecuteProcess();
            try
            {
                var query = new NTS.WEB.BLL.UserGroup().GetSingleUserGroup(usergroupid);

                if (query != null)
                {

                    //query.Password = DESEncrypt.Decrypt(query.Password);
                    pAction.Success = true;
                    pAction.ExceptionMsg = "获取单个用户组成功";
                    result.QueryUserGroup = query;
                    result.ActionInfo = pAction;
                    return result;
                }
                else
                {
                    pAction.Success = false;
                    pAction.ExceptionMsg = "暂无数据信息";
                    result.ActionInfo = pAction;
                    return result;

                }

            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                result.ActionInfo = pAction;
                return result;
            }
        }
コード例 #10
0
ファイル: CostQueryService.cs プロジェクト: NickQi/TianheDemo
        public ResultCostQuery GetCostQuery(QueryCost query)
        {
            var pAction = new ExecuteProcess();
            try
            {

                var result = new NTS.WEB.BLL.CostQuery().GetCostQuery(query);
                if (result == null)
                {
                    pAction.Success = false;
                    pAction.ExceptionMsg = "暂无数据信息";
                    return new ResultCostQuery() { ActionInfo = pAction };
                }
                pAction.Success = true;
                result.ActionInfo = pAction;
                return result;
            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                return new ResultCostQuery() { ActionInfo = pAction };
            }
        }
コード例 #11
0
ファイル: User.cs プロジェクト: NickQi/TianheDemo
        public UserListResult GetUsers()
        {
            UserListResult result = new UserListResult();
            var pAction = new ExecuteProcess();
            try
            {
                var userlist = new NTS.WEB.BLL.User().GetUsers();

                if (userlist.Count > 0)
                {
                    pAction.Success = true;
                    result.UserList = userlist;
                    result.ActionInfo = pAction;
                    return result;
                }
                else
                {
                    pAction.Success = false;
                    pAction.ExceptionMsg = "暂无数据信息";
                    result.ActionInfo = pAction;
                    return result;

                }

            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                result.ActionInfo = pAction;
                return result;
            }
        }
コード例 #12
0
ファイル: UserGroupService.cs プロジェクト: NickQi/TianheDemo
 public ExecuteProcess UpdateUserGroup(QueryUserGroup model)
 {
     var pAction = new ExecuteProcess();
     try
     {
         if (new NTS.WEB.BLL.UserGroup().IsExistUserGroupName(model))
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "该用户组已存在";
             return pAction;
         }
         else
         {
             new NTS.WEB.BLL.UserGroup().UpdateUserGroup(model);
             pAction.Success = true;
             pAction.ExceptionMsg = "更新用户组成功";
             return pAction;
         }
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return pAction;
     }
 }
コード例 #13
0
ファイル: IndexEnery.cs プロジェクト: NickQi/TianheDemo
        public IndexCompareEnery GetIndexCompareEnery()
        {
            var indexCompany = new IndexCompareEnery
                {
                    SameCompare = "-",
                    ElectricitySameCompare = "-",
                    MonthCompare = "-",
                    ElectricityMonthCompare = "-"
                };
            var nowMonth = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1"));
            var monthMonth = nowMonth.AddMonths(-1);
            var companyMonth = nowMonth.AddYears(-1);
            var pAction = new ExecuteProcess();
            try
            {
                var result = new NTS.WEB.BLL.IndexEnery().GetIndexCompareEnery(nowMonth, nowMonth);
                var companyresult = new NTS.WEB.BLL.IndexEnery().GetIndexCompareEnery(companyMonth, companyMonth);
                var monthresult = new NTS.WEB.BLL.IndexEnery().GetIndexCompareEnery(monthMonth, monthMonth);

                if (result != null)
                {
                    indexCompany.Total = result[1];
                    indexCompany.Electricity = result[0];

                    if (companyresult != null)
                    {
                        if (companyresult[1] > 0)
                        {
                            indexCompany.SameCompare =
                                decimal.Round(100 * (result[1] - companyresult[1]) / companyresult[1], 2)
                                    .ToString(CultureInfo.InvariantCulture) + "%";
                        }
                        if (companyresult[0] > 0)
                        {
                            indexCompany.ElectricitySameCompare =
                                decimal.Round(100 * (result[0] - companyresult[0]) / companyresult[0], 2)
                                    .ToString(CultureInfo.InvariantCulture) + "%";
                        }
                    }

                    if (monthresult != null)
                    {
                        if (monthresult[1] > 0)
                        {
                            indexCompany.MonthCompare =
                                decimal.Round(100 * (result[1] - monthresult[1]) / monthresult[1], 2)
                                    .ToString(CultureInfo.InvariantCulture) + "%";
                        }
                        if (monthresult[0] > 0)
                        {
                            indexCompany.ElectricityMonthCompare =
                                decimal.Round(100 * (result[0] - monthresult[0]) / monthresult[0], 2)
                                    .ToString(CultureInfo.InvariantCulture) + "%";
                        }
                    }
                }

                pAction.Success = true;
                indexCompany.ActionInfo = pAction;
                return indexCompany;
            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                return new IndexCompareEnery() { ActionInfo = pAction };
            }
        }
コード例 #14
0
ファイル: Alarm.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取告警记录数据。
        /// </summary>
        /// <param name="alarmList"></param>
        /// <returns></returns>
        public ResultAlarmNewList GetAlarmList(QueryAlarmNew ParamAlarm, string groupId)
        {
            ResultAlarmNewList alarmList = new ResultAlarmNewList();

            ExecuteProcess process = new ExecuteProcess();
            process.ActionName = "";
            process.ActionTime = System.DateTime.Now;
            process.Success = true;
            process.ExceptionMsg = "";

            alarmList.ActionInfo = process;

            List<AlarmNewList> lstAlarm = new List<AlarmNewList>();

            DataTable dttype = new DataTable();
            int total = 0;
            if (ParamAlarm.AllAlarm == false)
            {
                dttype = _Alarm.GetAlarmList(ParamAlarm, groupId);
                total = _Alarm.GetAlarmListCount(ParamAlarm);
            }
            else
            {
                dttype = _Alarm.GetAlarmListIndex(ParamAlarm);
                total = _Alarm.GetAlarmIndexCount(ParamAlarm);
            }
            int pageCount = 0;
            if (total > 0)
            {
                pageCount = (total - 1) / ParamAlarm.PageSize + 1;
            }
            foreach (DataRow row in dttype.Rows)
            {
                AlarmNewList type = new AlarmNewList();
                type.Time = row["ALARMTIME"].ToString();
                type.Object = row["ALARMOBJNAME"].ToString();
                type.Position = ""; //row["LOCATION"].ToString();
                if (row["LOCATION"] != DBNull.Value)
                {
                    type.Position = row["LOCATION"].ToString();
                }
                type.Info = row["ALARMCONTENT"] == DBNull.Value ? "" : row["ALARMCONTENT"].ToString();
                type.AlarmItem = row["ALARMTYPENAME"] == DBNull.Value ? "" : row["ALARMTYPENAME"].ToString(); //告警类型名称
                type.Class = row["ALARMLEVEL"] == DBNull.Value ? "" : row["ALARMLEVEL"].ToString(); //告警等级
                type.AlarmStatus = "未知"; //告警类型
                if (row["STATUS"] != DBNull.Value)
                {
                    switch (row["STATUS"].ToString())
                    {
                        case "0":
                            type.AlarmStatus = "正在告警";
                            break;
                        case "1":
                            type.AlarmStatus = "已确认";
                            break;
                        case "2":
                            type.AlarmStatus = "已恢复";
                            break;
                        case "3":
                            type.AlarmStatus = "已处理";
                            break;
                        case "4":
                            type.AlarmStatus = "已取消";
                            break;
                        default:
                            type.AlarmStatus = "未知";
                            break;
                    }
                }
                lstAlarm.Add(type);
            }
            alarmList.data = lstAlarm;
            int[] intPageCount = new int[pageCount];
            for (int i = 0; i < pageCount; i++)
            {
                intPageCount[i] = i + 1;
            }
            alarmList.pages = intPageCount;
            alarmList.total = pageCount;
            alarmList.current = ParamAlarm.PageIndex;
            return alarmList;
        }
コード例 #15
0
ファイル: IndexEnery.cs プロジェクト: NickQi/TianheDemo
 public IndexLimit GetIndexLimit()
 {
     var pAction = new ExecuteProcess();
     var nowDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
     try
     {
         var indexLimit = new NTS.WEB.BLL.IndexEnery().GetIndexLimit(nowDate, nowDate.AddDays(1).AddHours(-1));
         pAction.Success = true;
         indexLimit.ActionInfo = pAction;
         return indexLimit;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new IndexLimit() { ActionInfo = pAction };
     }
 }
コード例 #16
0
        /// <summary>
        /// 显示柱状图
        /// </summary>
        /// <param name="itemName"></param>
        /// <param name="chartObject"></param>
        /// <param name="chartDept"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        public static ResultObjLst IndexContrastObjsLst(QueryCompare 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 = 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);
                }
            }
            lstReult.ObjLst = objLst;
            return lstReult;
        }
コード例 #17
0
ファイル: Charts.cs プロジェクト: NickQi/TianheDemo
        public ResultRealLine IndexElectricityRealLine(DateTime startTime, DateTime endTime)
        {
            var pAction = new ExecuteProcess();
            try
            {
                var result = new ResultRealLine { series = new List<EneryAnalyseSeries>(), Unit = "kwh" };
                var eneryDataList = new Dictionary<string, decimal>();
                var model = new BaseQueryModel();
                var objectList = new NTS.WEB.BLL.BaseLayerObject().GetBaseFuncLayerObjectList(string.Format(" and LayerObjectParentID={0}", 0), " order by LayerObjectID");
                model.IsDevice = 0;
                model.ObjectList = (from p in objectList select p.LayerObjectID).ToList<int>();
                model.ItemCode = "01000";
                model.Unit = ChartUnit.unit_hour;
                model.Starttime = startTime;
                model.Endtime = endTime;
                var resList = _reportBll.GetBaseEneryDataList(model,true);
                foreach (var d in objectList.SelectMany(o => resList.BaseLayerObjectResults[o.LayerObjectID.ToString(CultureInfo.InvariantCulture)].Datas))
                {
                    if (!eneryDataList.ContainsKey(d.DatePick))
                    {
                        eneryDataList.Add(d.DatePick, d.DataValue);
                    }
                    else
                    {
                        eneryDataList[d.DatePick] += d.DataValue;
                    }
                }

                List<decimal> dat = new List<decimal>(24);//modified by wxy
                for (int i = 0; i < 24; i++)
                    dat.Add(0);
                foreach (var e in eneryDataList)
                {
                    DateTime dt = DateTime.Parse(e.Key);//dat.Add(e.Value);
                    dat[dt.Hour] = e.Value;

                }
                List<decimal> dat1 = new List<decimal>();
                EneryAnalyseSeries eas = new EneryAnalyseSeries();
                decimal rightValue = 0;//modified by wxy
                decimal leftValue = 0;
                for (int i = 0; i <= DateTime.Now.Hour; i++)
                {
                    if (dat[i].CompareTo(-1) == 0)
                    {
                        int tempIndex = i;
                        while (--i >= 0)
                        {
                            if (dat[i].CompareTo(-1) >= 0)
                            {
                                rightValue = dat[i];
                                break;
                            }
                        }
                        i = tempIndex;
                        while (++i < 24)
                        {
                            if (dat[i].CompareTo(-1) >= 0)
                            {
                                leftValue = dat[i];
                                break;
                            }
                        }
                        i = tempIndex;
                        decimal meanValue = (rightValue + leftValue)/2;
                        dat1.Add( Math.Round(meanValue, 2) );
                    }
                    else
                        dat1.Add(dat[i]);
                }
                eas.data = dat1;

                result.series.Add(eas);
                pAction.Success = true;
                result.ActionInfo = pAction;
                return result;
            }
            catch (Exception ex)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = ex.Message;
                return new ResultRealLine() { ActionInfo = pAction };
            }
        }
コード例 #18
0
ファイル: Charts.cs プロジェクト: NickQi/TianheDemo
        public ResultIndexLineChart IndexElectricityLineChart(DateTime startTime, DateTime endTime)
        {
            var pAction = new ExecuteProcess();
            try
            {
                var result = new ResultIndexLineChart { DatePick = new List<string>(), DatePickEnery = new List<decimal>() };
                var eneryDataList = new Dictionary<string, decimal>();
                var model = new BaseQueryModel();
                var objectList = new NTS.WEB.BLL.BaseLayerObject().GetBaseLayerObjectList(string.Format(" and LayerObjectParentID={0}", 0), " order by LayerObjectID");
                model.IsDevice = 0;
                model.ObjectList = (from p in objectList select p.LayerObjectID).ToList<int>();
                model.ItemCode = "01000";
                model.Unit = ChartUnit.unit_hour;
                model.Starttime = startTime;
                model.Endtime = endTime;
                var resList = _reportBll.GetBaseEneryDataList(model);
                foreach (var d in objectList.SelectMany(o => resList.BaseLayerObjectResults[o.LayerObjectID.ToString(CultureInfo.InvariantCulture)].Datas))
                {
                    if (!eneryDataList.ContainsKey(d.DatePick))
                    {
                        eneryDataList.Add(d.DatePick, d.DataValue);
                    }
                    else
                    {
                        eneryDataList[d.DatePick] += d.DataValue;
                    }
                }

                foreach (var e in eneryDataList)
                {
                    result.DatePick.Add(e.Key);
                    result.DatePickEnery.Add(e.Value);
                }
                pAction.Success = true;
                result.ActionInfo = pAction;
                return result;
            }
            catch (Exception ex)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = ex.Message;
                return new ResultIndexLineChart() { ActionInfo = pAction };
            }
        }
コード例 #19
0
ファイル: Fee_Apportion.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ResultFeeapportion GetFeeApportionData(Queryfeeapportion query)
        {
            try
            {
                ExecuteProcess process = new ExecuteProcess();
                process.ActionName = "";
                process.ActionTime = System.DateTime.Now;
                process.Success = true;
                process.ExceptionMsg = "";

                ResultFeeapportion feeApption = new ResultFeeapportion();
                feeApption.FeeApportionType = "按比例分摊";

                List<TB_Alloction_Config> config = GetAlloctionConfig(query);
                if (config.Count == 0)
                {
                    process.Success = false;
                    process.ExceptionMsg = "此区域费用分摊没有配置";

                    ResultFeeapportion feeApptionReturn = new ResultFeeapportion();
                    feeApption.ActionInfo = process;
                    return feeApption;
                }

                Queryfeeapportion queryLastMonth = new Queryfeeapportion();
                queryLastMonth.ItemCode = query.ItemCode;
                queryLastMonth.ObjType = query.ObjType;
                queryLastMonth.ObjectId = query.ObjectId;
                queryLastMonth.StartTime = query.StartTime.AddMonths(-1);

                List<TB_Alloction_Config> configLast = GetAlloctionConfig(queryLastMonth);

                FeeApportionValClass feeappVal = new FeeApportionValClass();

                FeeApportionChartsClass chartClass = new FeeApportionChartsClass();

                // 数据。
                List<SeriesClass> serialClass = new List<SeriesClass>();

                if (config.Count > 0)
                {
                    DateTime dtBegin = config[0].ALLoction_StartDate;
                    DateTime dtEnd = config[0].ALLoction_EndDate;

                    double feeDai = config[0].ALLoction_Fee;
                    feeappVal.ApportionVal = config[0].ALLoction_Fee;

                    //List<CostQueryModel> refModel = _feeApportion.GetCostQuery(query, dtBegin, dtEnd);

                    EnergyContrast energy = new EnergyContrast();
                    BasicQuery query2 = new BasicQuery();
                    query2.AreaType = query.ObjType;
                    query2.StartTime = config[0].ALLoction_StartDate;
                    query2.EndTime = config[0].ALLoction_EndDate;
                    query2.ObjectNum = query.ObjectId;
                    query2.QueryType = EnergyAnalyseQueryType.Default;
                    query2.Unit = 1;
                    var lineChart = energy.GetSingleItemCodeByObject(query2, query.ItemCode);
                    double befVal = 0;
                    befVal = (double)lineChart.Values.Sum();
                    AccessCommon acess= new AccessCommon();
                    decimal flPrice = acess.GetFeePrice(query.ItemCode);
                    befVal = befVal*(double)flPrice;
                    //foreach (var costQueryModel in refModel)
                    //{
                    //    befVal += costQueryModel.TOTAL_COST;
                    //}
                    feeappVal.BeforeVal = Math.Round(befVal,2);
                    feeappVal.TotalVal = Math.Round((befVal + feeappVal.ApportionVal),2);
                }

                List<SeriesData> sidatas = new List<SeriesData>();
                SeriesData seri = new SeriesData();
                // 统计明细数据

                SeriesData data1 = new SeriesData();
                SeriesData data2 = new SeriesData();
                List<SeriesClass> serClass1 = new List<SeriesClass>();
                List<SeriesClass> serClass2 = new List<SeriesClass>();

                int iCout = 0;
                // 列表
                List<FeeApportionListClass> appList = new List<FeeApportionListClass>();
                foreach (TB_Alloction_Config conf in config)
                {
                    FeeApportionListClass listClass = new FeeApportionListClass();

                    SeriesClass serial1 = new SeriesClass();
                    SeriesClass serial2 = new SeriesClass();
                    int objectId = conf.AreaID;
                    List<Model.BaseLayerObject> objectList;
                    string objectName = "";
                    TB_AreaInfo info = _accssCommon.GetAreaInfo(conf.AreaID);
                    if (info != null)
                    {
                        objectName = info.CName;
                    }

                    //Queryfeeapportion queryItem = new Queryfeeapportion();
                    //queryItem = query;
                    //queryItem.ObjectId = conf.AreaID;
                    //List<CostQueryModel> refModel = _feeApportion.GetCostQuery(queryItem, conf.ALLoction_StartDate, conf.ALLoction_EndDate);
                    double BefFee = 0;
                    //if (refModel.Count > 0)
                    //{
                    //    for (int jCount = 0; jCount < refModel.Count; jCount++)
                    //    {
                    //        BefFee += refModel[jCount].TOTAL_COST;
                    //    }
                    //}
                    EnergyContrast energy = new EnergyContrast();
                    BasicQuery query2 = new BasicQuery();
                    query2.AreaType = query.ObjType;
                    query2.StartTime = config[0].ALLoction_StartDate;
                    query2.EndTime = config[0].ALLoction_EndDate;
                    query2.ObjectNum = conf.AreaID;
                    query2.QueryType = EnergyAnalyseQueryType.Default;
                    query2.Unit = 1;
                    var lineChart2 = energy.GetSingleItemCodeByObject(query2, query.ItemCode);
                    BefFee = (double)lineChart2.Values.Sum();
                    AccessCommon acess = new AccessCommon();
                    decimal flPrice = acess.GetFeePrice(query.ItemCode);
                    BefFee = BefFee * (double)flPrice;

                    serial1.name = objectName;
                    serial2.name = objectName;
                    serial1.y = Math.Round(BefFee);
                    serial2.y = Math.Round((conf.ALLoction_Fee * conf.CfgPercent),2);

                    serClass1.Add(serial1);
                    serClass2.Add(serial2);

                    FeeApportionListClass list1 = new FeeApportionListClass();
                    list1.Id = iCout + 1;
                    list1.Obj = objectName;
                    list1.Tm = query.StartTime.ToString("yyyy-MM");
                    list1.BeforeVal = Math.Round(BefFee,2);
                    list1.ApportionVal = Math.Round((conf.ALLoction_Fee * conf.CfgPercent),2);
                    list1.TotalVal = list1.BeforeVal + list1.ApportionVal;
                    appList.Add(list1);
                    iCout++;

                }
                data1.name = "分摊前费用";
                data1.data = serClass1;

                data2.name = "分摊费用";
                data2.data = serClass2;
                sidatas.Add(data1);
                sidatas.Add(data2);
                chartClass.series = sidatas;
                feeApption.FeeApportionCharts = chartClass;

                if (configLast.Count > 0)
                {
                    DateTime dtBegin2 = configLast[0].ALLoction_StartDate;
                    DateTime dtEnd2 = configLast[0].ALLoction_EndDate;

                    double feeDai = configLast[0].ALLoction_Fee;
                    feeappVal.ApportionValLastMonth = configLast[0].ALLoction_Fee;

                    //List<CostQueryModel> refModel = _feeApportion.GetCostQuery(query, dtBegin2, dtEnd2);
                    double beforeApportionVal = 0;
                    //foreach (var costQueryModel in refModel)
                    //{
                    //    beforeApportionVal += costQueryModel.TOTAL_COST;
                    //}
                    EnergyContrast energy = new EnergyContrast();
                    BasicQuery query2 = new BasicQuery();
                    query2.AreaType = query.ObjType;
                    query2.StartTime = configLast[0].ALLoction_StartDate;
                    query2.EndTime = configLast[0].ALLoction_EndDate;
                    query2.ObjectNum = query.ObjectId;
                    query2.QueryType = EnergyAnalyseQueryType.Default;
                    query2.Unit = 1;
                    var lineChart2 = energy.GetSingleItemCodeByObject(query2, query.ItemCode);
                    beforeApportionVal = (double)lineChart2.Values.Sum();
                    AccessCommon acess = new AccessCommon();
                    decimal flPrice = acess.GetFeePrice(query.ItemCode);
                    beforeApportionVal = Math.Round(beforeApportionVal * (double)flPrice,2);

                    feeappVal.BeforeValLastMonth = beforeApportionVal;
                    feeappVal.TotalValLastMonth = beforeApportionVal + feeappVal.ApportionValLastMonth;

                }
                if (feeappVal.ApportionValLastMonth > 0)
                {
                    double compare = (feeappVal.ApportionVal-feeappVal.ApportionValLastMonth)*100/
                                     feeappVal.ApportionValLastMonth;
                    feeappVal.ApportionValCompare =Math.Round(compare,2).ToString();
                }
                else
                {
                    feeappVal.ApportionValCompare = "-";
                }

                if (feeappVal.BeforeValLastMonth > 0)
                {
                    double compare = (feeappVal.BeforeVal-feeappVal.BeforeValLastMonth) * 100 / feeappVal.BeforeValLastMonth;
                    feeappVal.BeforeValCompare = Math.Round(compare, 2).ToString();
                }
                else
                {
                    feeappVal.BeforeValCompare = "-";
                }

                if (feeappVal.TotalValLastMonth > 0)
                {
                    double compare = (feeappVal.TotalVal-feeappVal.TotalValLastMonth)*100/feeappVal.TotalValLastMonth;
                    feeappVal.TotalValCompare = Math.Round(compare, 2).ToString();
                }
                else
                {
                    feeappVal.TotalValCompare = "-";
                }
                FeeApportionTblClass tblClass = new FeeApportionTblClass();

                tblClass.FeeApportionList = appList;
                feeApption.FeeApportionTbl = tblClass;
                feeApption.FeeApportionVal = feeappVal;
                feeApption.ActionInfo = process;

                return feeApption;
            }
            catch (Exception ex)
            {
                ExecuteProcess process = new ExecuteProcess();
                process.ActionName = "";
                process.ActionTime = System.DateTime.Now;
                process.Success = false;
                process.ExceptionMsg = ex.Message;
                ResultFeeapportion feeApption = new ResultFeeapportion();
                feeApption.ActionInfo = process;
                return feeApption;
            }
        }
コード例 #20
0
ファイル: IndexEnery.cs プロジェクト: NickQi/TianheDemo
 public IndexShopOrder GetIndexShopOrder()
 {
     var pAction = new ExecuteProcess();
     var nowMonth = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1"));
     try
     {
         var shopOrder = new NTS.WEB.BLL.IndexEnery().GetIndexShopOrder(nowMonth, nowMonth);
         shopOrder.AreaEneryOrderList = (from o in shopOrder.AreaEneryOrderList orderby o.EneryValue select o).ToList();
         shopOrder.TotalEneryOrderList = (from o in shopOrder.TotalEneryOrderList orderby o.EneryValue select o).ToList();
         int order = 0;
         // 设置排序的序号
         foreach (var a in shopOrder.AreaEneryOrderList)
         {
             order++;
             a.OrderNum = order;
         }
         order = 0;
         foreach (var t in shopOrder.TotalEneryOrderList)
         {
             order++;
             t.OrderNum = order;
         }
         pAction.Success = true;
         shopOrder.ActionInfo = pAction;
         return shopOrder;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new IndexShopOrder() { ActionInfo = pAction };
     }
 }
コード例 #21
0
ファイル: Charts.cs プロジェクト: NickQi/TianheDemo
        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 };
            }
        }
コード例 #22
0
ファイル: Alarm.cs プロジェクト: NickQi/TianheDemo
        public ResultAlarmIndex GetAlarmIndexCount()
        {
            ExecuteProcess process = new ExecuteProcess();
            process.ActionName = "";
            process.ActionTime = System.DateTime.Now;
            process.Success = true;
            process.ExceptionMsg = "";

            ResultAlarmIndex alarmIndex = new ResultAlarmIndex();

            AlarmDayYestoDayComp allToday = new AlarmDayYestoDayComp();
            string strWhere = " and ALARMTIME between '" + System.DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "' and '" + DateTime.Now.ToString("yyyy-MM-dd 23:59:59") + "'";
            int AllTodayCount = _Alarm.GetAlarmCount(strWhere);

            allToday.Value = AllTodayCount;
            strWhere = " and ALARMTIME between '" + System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00") + "' and '" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59") + "'";
            int YesTodayCount = _Alarm.GetAlarmCount(strWhere);
            allToday.YesterdayValue = YesTodayCount;
            if (YesTodayCount != 0)
            {
                allToday.CompareValue = ((AllTodayCount - YesTodayCount) * 100 / YesTodayCount).ToString();
            }
            else
            {
                allToday.CompareValue = "-";
            }
            alarmIndex.AllAlarm = allToday;

            AlarmDayYestoDayComp UndoAlarm = new AlarmDayYestoDayComp();
            strWhere = " and STATUS=0 and ALARMTIME between '" + System.DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "' and '" + DateTime.Now.ToString("yyyy-MM-dd 23:59:59") + "'";
            int UndoTodayCount = _Alarm.GetAlarmCount(strWhere);
            UndoAlarm.Value = UndoTodayCount;
            strWhere = " and STATUS=0 and ALARMTIME between '" + System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00") + "' and '" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59") + "'";
            int UndoYesDayCount = _Alarm.GetAlarmCount(strWhere);
            UndoAlarm.YesterdayValue = UndoYesDayCount;
            if (YesTodayCount != 0)
            {
                UndoAlarm.CompareValue = ((UndoTodayCount - UndoYesDayCount) * 100 / UndoYesDayCount).ToString();
            }
            else
            {
                UndoAlarm.CompareValue = "-";
            }
            alarmIndex.UndoAlarm = UndoAlarm;

            AlarmDayYestoDayComp ProcessedAlarm = new AlarmDayYestoDayComp();
            strWhere = " and STATUS<>0 and ALARMTIME between '" + System.DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "' and '" + DateTime.Now.ToString("yyyy-MM-dd 23:59:59") + "'";
            int ProcessedTodayCount = _Alarm.GetAlarmCount(strWhere);
            ProcessedAlarm.Value = ProcessedTodayCount;
            strWhere = " and STATUS<>0 and ALARMTIME between '" + System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00") + "' and '" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59") + "'";
            int ProcessedYesDayCount = _Alarm.GetAlarmCount(strWhere);
            ProcessedAlarm.YesterdayValue = ProcessedYesDayCount;
            if (ProcessedYesDayCount != 0)
            {
                ProcessedAlarm.CompareValue =
                    ((ProcessedTodayCount - ProcessedYesDayCount) * 100 / ProcessedYesDayCount).ToString();
            }
            else
            {
                ProcessedAlarm.CompareValue = "-";
            }
            alarmIndex.ProcessedAlarm = ProcessedAlarm;

            alarmIndex.ActionInfo = process;
            //alarmIndex.AllAlarm = alarmIndex;

            return alarmIndex;
        }
コード例 #23
0
        /// <summary>
        /// 显示柱状图
        /// </summary>
        /// <param name="itemName"></param>
        /// <param name="chartObject"></param>
        /// <param name="chartDept"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        public static ResultContrast IndexPeriodsContrastObjsChart(QueryContrastPeriods query, string areaName, string[] chartObject, string chartDept, Dictionary<string, List<decimal>> dir)
        {
            //表格数据定义
            List<EnergyContrst> enerList = new List<EnergyContrst>();

            ResultContrast contrast = new ResultContrast();
            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 = "";
            }

            string sql = " and ItemCodeNumber = '" + query.ItemCode + "'";
            List<NTS.WEB.Model.Itemcode> itemList = Framework.Common.BaseWcf.CreateChannel<ServiceInterface.IEnergyContrastService>("EnergyContrastService")
                                 .GetItemCodeList(sql, "");

            contrast.ActionInfo = execu;

            #region 数据series
            LineJson lineJson = new LineJson();
            List<EneryCompare> compareList = new List<EneryCompare>();

            #endregion

            int Index = 0;
            StringBuilder chartNew = new StringBuilder();
            {
                foreach (var d in dir)
                {
                    EnergyContrst ener = new EnergyContrst();

                    EneryCompare compareItem = new EneryCompare();

                    if (itemList.Count == 0)
                    {
                        ener.EneType = "总能耗";
                    }
                    else
                    {
                        ener.EneType = itemList[0].ItemCodeName;
                    }

                    ener.Obj = areaName;

                    ener.Tm = GetTimeTitleByStartTimeAndEndTime(query.PeriodLst[Index].StartTime, query.PeriodLst[Index].EndTime);
                    ener.Val = Math.Round(d.Value.Sum(), 2);

                    // 取小数点后2位
                    List<decimal> dirValue = new List<decimal>();
                    foreach (var item in d.Value)
                    {
                        dirValue.Add(Math.Round(item, 2));
                    }
                    compareItem.name = ener.Tm;
                    compareItem.data = dirValue;

                    compareList.Add(compareItem);

                    enerList.Add(ener);
                    Index++;
                }

                lineJson.Unit = chartDept;
                contrast.Unit = chartDept;

                lineJson.CompareType = "periods";
                contrast.ContrastLst = enerList; // 表格数据。

                lineJson.series = compareList;
                contrast.lineJson = lineJson;

                //lineJson.series =
                return contrast;
            }
        }
コード例 #24
0
ファイル: Charts.cs プロジェクト: NickQi/TianheDemo
        public ResultDevice GetDeviceList(QueryDevice2 query)
        {
            var pAction = new ExecuteProcess();
            try
            {
                StringBuilder sbTree = new StringBuilder();

                List<Device> deviceList;
                if (query.ItemCode == "00000")
                {
                    if (query.ObjType == AreaType.Area)
                    {
                        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid=" + query.ObjectId, " order by deviceid");
                    }
                    else
                    {
                        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and areaid2=" + query.ObjectId, " order by deviceid");

                    }
                }
                else
                {
                    string itemCodeAll = query.ItemCode;
                    Itemcode objItem = new Itemcode();
                    var itemcodeList = objItem.GetItemcodeList("  and ItemCodeNumber='" + query.ItemCode + "'", " order by itemcodeid")[0];
                    var itemcodeListChild = objItem.GetItemcodeList("  and ParentID=" + itemcodeList.ItemcodeID, " order by itemcodeid");
                    itemCodeAll = itemcodeListChild.Aggregate("'" + itemCodeAll + "'", (current, itemcode) => current + ("," + "'" + itemcode.ItemCodeNumber + "'"));
                    if (query.ObjType == AreaType.Area)
                    {
                        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid=" + query.ObjectId, " order by deviceid");
                    }
                    else
                    {
                        deviceList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(" and ItemCodeID in (" + itemCodeAll + ") and areaid2=" + query.ObjectId, " 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("]");

                List<DeviceUnit> lstDvc = new List<DeviceUnit>();

                foreach (var device in deviceList)
                {
                    DeviceUnit du = new DeviceUnit();
                    du.DeviceID = device.DeviceID;
                    du.DeviceName = device.DeviceName;
                    lstDvc.Add(du);
                }

                ResultDevice result = new ResultDevice();
                result.DeviceUnitList = lstDvc;
                pAction.Success = true;
                result.ActionInfo = pAction;
                return result;
            }
            catch (Exception ex)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = ex.Message;
                return new ResultDevice() { ActionInfo = pAction };
            }
        }
コード例 #25
0
ファイル: IndexEnery.cs プロジェクト: NickQi/TianheDemo
 public IndexMonthEnery GetIndexMonthEneryResult()
 {
     DateTime endTime;
     var startTime = endTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1"));
     var pAction = new ExecuteProcess();
     try
     {
         var result = new NTS.WEB.BLL.IndexEnery().GetMonthItemCodeList(startTime, endTime);
         if (result == null)
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             return new IndexMonthEnery() { ActionInfo = pAction };
         }
         pAction.Success = true;
         result.ActionInfo = pAction;
         return result;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new IndexMonthEnery() { ActionInfo = pAction };
     }
 }
コード例 #26
0
ファイル: Charts.cs プロジェクト: NickQi/TianheDemo
        public ResultRealLine DeviceRealChart(RealQuery query)
        {
            var pAction = new ExecuteProcess();
            try
            {
                var result = new ResultRealLine { series = new List<EneryAnalyseSeries>(), Unit = "kwh" };
                //ResultItemCode result = new ResultItemCode();
                //result.Dept = new List<string>();
                //result.Enery = new Dictionary<string, List<decimal>>();
                //result.ObjectName = new List<string>();
                // var result = new ResultIndexLineChart { DatePick = new List<string>(), DatePickEnery = new List<decimal>() };
                var eneryDataList = new Dictionary<string, decimal>();
                var model = new BaseQueryModel();
                var objectList = new NTS.WEB.BLL.BaseLayerObject().GetDeviceObjectList(string.Format(" and deviceid={0}", query.ObjectId), " order by deviceid");
                model.IsDevice = 1;
                model.ObjectList = (from p in objectList select p.DeviceID).ToList<int>();
                model.ItemCode = objectList[0].ItemCodeID;
                model.Unit = ChartUnit.unit_hour;
                if (query.QueryType == EnergyAnalyseQueryType.Default)
                {
                    model.Starttime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd"));
                    model.Endtime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else if (query.QueryType == EnergyAnalyseQueryType.MonthCompare)
                {
                    model.Starttime = Convert.ToDateTime(System.DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"));
                    model.Endtime = Convert.ToDateTime(System.DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"));
                }
                else if (query.QueryType == EnergyAnalyseQueryType.YearCompare)
                {
                    model.Starttime = Convert.ToDateTime(System.DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd"));
                    model.Endtime = Convert.ToDateTime(System.DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd"));
                }
                var itemList = new BLL.Itemcode().GetItemcodeList(" and ItemCodeNumber='" + model.ItemCode + "'", " order by ItemcodeID")[0];
                result.Unit = itemList.Unit;//by added wxy
                var resList = _reportBll.GetBaseEneryDataList(model);
                foreach (var d in objectList.SelectMany(o => resList.BaseLayerObjectResults[o.DeviceID.ToString(CultureInfo.InvariantCulture)].Datas))
                {
                    if (!eneryDataList.ContainsKey(d.DatePick))
                    {
                        eneryDataList.Add(d.DatePick, d.DataValue);
                    }
                    else
                    {
                        eneryDataList[d.DatePick] += d.DataValue;
                    }
                }

                List<decimal> dat = new List<decimal>();
                foreach (var e in eneryDataList)
                {
                    dat.Add(e.Value);

                }
                EneryAnalyseSeries eas = new EneryAnalyseSeries();
                eas.data = dat;

                result.series.Add(eas);

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

            }
            catch (Exception ex)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = ex.Message;
                return new ResultRealLine() { ActionInfo = pAction };

            }
        }
コード例 #27
0
ファイル: IndexEnery.cs プロジェクト: NickQi/TianheDemo
 public IndexWindowResult GetIndexWindowResult(QueryIndexWindow query)
 {
     var pAction = new ExecuteProcess();
     try
     {
         var result = new NTS.WEB.BLL.IndexEnery().GetItemCodeListByObjectID(query);
         if (result == null)
         {
             pAction.Success = false;
             pAction.ExceptionMsg = "暂无数据信息";
             return new IndexWindowResult() { ActionInfo = pAction };
         }
         pAction.Success = true;
         result.ActionInfo = pAction;
         return result;
     }
     catch (Exception e)
     {
         pAction.Success = false;
         pAction.ExceptionMsg = e.Message;
         return new IndexWindowResult() { ActionInfo = pAction };
     }
 }
コード例 #28
0
ファイル: LoadForecast.cs プロジェクト: NickQi/TianheDemo
        public ResultLoadForecastMap GetLoadForecastChart(QueryLoadForecast loadCast)
        {
            try
            {
                ResultLoadForecastMap mapNew = new ResultLoadForecastMap();
                ExecuteProcess proc = new ExecuteProcess();
                proc.ActionName = "";
                proc.ActionTime = DateTime.Now;
                proc.ActionUser = "";
                proc.ExceptionMsg = "";
                proc.Success = true;
                var basicQuery = new BasicQuery
                {
                    EndTime = loadCast.EndTime,
                    StartTime = loadCast.StartTime,
                    ItemCode = loadCast.ItemCode,
                    Unit = loadCast.Particle,
                    AreaType = loadCast.ObjType,
                    ObjectNum = loadCast.ObjectId
                };

                // 获取数据
                var resultList = GetDateTongJiData(basicQuery);

                List<decimal> lstDecAvg = GetYuceData(basicQuery, loadCast);

                List<SerialData> serData = new List<SerialData>();

                foreach (var d in resultList.Enery)
                {
                    SerialData ser1 = new SerialData();
                    ser1.name = "负荷预测值";
                    ser1.data = lstDecAvg;
                    serData.Add(ser1);
                    ser1 = new SerialData();
                    ser1.name = "能耗实际值";
                    TimeSpan ts = DateTime.Parse(System.DateTime.Now.ToString("yyyy-MM-dd")) - loadCast.StartTime;
                    int DayChas = ts.Days;
                    List<decimal> lstNew = d.Value;
                    if (DayChas == 0)
                    {
                        for (int iCount = 0; iCount < lstNew.Count; iCount++)
                        {
                            lstNew[iCount] = Math.Round(lstNew[iCount], 2);
                        }
                    }
                    else if (DayChas > 0)
                    {
                        for (int iCount = 0; iCount < lstNew.Count; iCount++)
                        {
                            if (iCount > DayChas)
                            {
                                lstNew[iCount] = 0;
                            }
                            else
                            {
                                lstNew[iCount] = Math.Round(lstNew[iCount], 2);
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < lstNew.Count; i++)
                        {
                            lstNew[i] = -9999;
                        }
                    }

                    ser1.data = lstNew;

                    serData.Add(ser1);

                }
                mapNew.ActionInfo = proc;
                // 判断是否是将来当天数据。
                if (loadCast.StartTime.CompareTo(DateTime.Now) > 0)
                {
                    List<SerialData> serDataNew = new List<SerialData>();
                    serDataNew.Add(serData[0]);
                    mapNew.series = serDataNew;
                }
                else
                {
                    mapNew.series = serData;
                }

                if (resultList.Dept.Count > 0)
                {
                    mapNew.Unit = resultList.Dept[0].ToString();
                }

                List<ResultLoadForecastList> listFore = new List<ResultLoadForecastList>();
                for (int i = 0; i < serData[0].data.Count; i++)
                {
                    ResultLoadForecastList list = new ResultLoadForecastList();
                    list.Id = i + 1;
                    if (loadCast.StartTime.Date == loadCast.EndTime.Date)
                    {
                        string hour = "";
                        if (i < 10)
                        {
                            hour = "0" + i.ToString();
                        }
                        else
                        {
                            hour = i.ToString();
                        }
                        list.TimeArea = loadCast.StartTime.ToString("yyyy-MM-dd" + " " + hour + ":00:00");
                    }
                    else
                    {
                        list.TimeArea = loadCast.StartTime.AddDays(i).ToString("yyyy-MM-dd");
                    }
                    if (i < serData[1].data.Count)
                    {
                        list.History = Math.Round(serData[1].data[i], 2);
                    }
                    else
                    {
                        list.History = -9999;
                    }

                    list.ForeCast = Math.Round(serData[0].data[i], 2);
                    if (list.History == -9999)
                    {
                        list.Deviation = -9999;
                    }
                    else
                    {
                        list.Deviation = Math.Round((serData[0].data[i] - serData[1].data[i]), 2);
                    }

                    if (list.History == -9999)
                    {
                        list.Pecent = "--";
                        listFore.Add(list);
                    }
                    else
                    {
                        decimal dec1 = (serData[0].data[i] - serData[1].data[i]) * 100;
                        decimal dec2 = serData[1].data[i];
                        if (dec1 != 0 && dec2 != 0)
                        {
                            decimal pec = (serData[0].data[i] - serData[1].data[i]) * 100 / serData[1].data[i];
                            list.Pecent = Math.Round(pec, 2).ToString() + "%";
                            listFore.Add(list);
                        }
                        else
                        {
                            list.Pecent = "--";
                            listFore.Add(list);
                        }
                    }
                }
                mapNew.LoadForecast = listFore;

                mapNew.HistoryTotal = 0;
                Math.Round(serData[1].data.Sum(), 2);
                for (int rCount = 0; rCount < serData[1].data.Count; rCount++)
                {
                    if (serData[1].data[rCount] != -9999)
                    {
                        mapNew.HistoryTotal = mapNew.HistoryTotal + serData[1].data[rCount];
                    }
                }
                mapNew.ForeCastTotal = Math.Round(lstDecAvg.Sum(), 2);
                return mapNew;
            }
            catch (Exception ex)
            {
                ResultLoadForecastMap map2 = new ResultLoadForecastMap();
                ExecuteProcess proc = new ExecuteProcess();
                proc.ActionName = "";
                proc.ActionTime = DateTime.Now;
                proc.ActionUser = "";
                proc.ExceptionMsg = ex.Message;
                proc.Success = false;

                map2.ActionInfo = proc;
                return map2;
            }
        }
コード例 #29
0
ファイル: IndexEnery.cs プロジェクト: NickQi/TianheDemo
        public MainInfo GetIndexCompareEneryNew()
        {
            //string username= HttpContext.Current.Session["userid"].ToString() ;
            MainInfo mainInfo = new MainInfo();
            var nowMonth = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1"));
            var endTime = DateTime.Now;
            var pAction = new ExecuteProcess();

            try
            {
                mainInfo = new NTS.WEB.BLL.IndexEnery().GetIndexCompareEneryNew(nowMonth, endTime);
                pAction.Success = true;
                mainInfo.ActionInfo = pAction;
                return mainInfo;
            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                return new MainInfo() { ActionInfo = pAction };
            }
        }
コード例 #30
0
ファイル: UserGroupService.cs プロジェクト: NickQi/TianheDemo
        public UserGroupListResult GetUserGroups()
        {
            UserGroupListResult result = new UserGroupListResult();
               // List<QueryUserGroup> list = new List<QueryUserGroup>();
            var pAction = new ExecuteProcess();
            try
            {
                var usergrouplist = new NTS.WEB.BLL.UserGroup().GetUserGroups();

                if (usergrouplist.Count > 0)
                {
                    pAction.Success = true;
                    //foreach (var item in usergrouplist)
                    //{
                    //    QueryUserGroup query = new QueryUserGroup() { UserGroupID=item.UserGroupID,
                    //    UserGroupName=item.UserGroupName,
                    //     Description=item.Description
                    //    };

                    //    foreach (var right in item.UserGroupMenuRights.Split(','))
                    //    {
                    //        query.UserGroupMenuRights.Add(Convert.ToInt32(right));
                    //    }
                    //    foreach (var right in item.UserGroupLiquidRights.Split(','))
                    //    {
                    //        query.UserGroupLiquidRights.Add(Convert.ToInt32(right));
                    //    }
                    //    foreach (var right in item.UserGroupAreaRights.Split(','))
                    //    {
                    //        query.UserGroupAreaRights.Add(Convert.ToInt32(right));
                    //    }
                    //    list.Add(query);
                    //}
                    result.UserGroupList = usergrouplist;
                    result.ActionInfo = pAction;
                    return result;
                }
                else
                {
                    pAction.Success = false;
                    pAction.ExceptionMsg = "暂无数据信息";
                    result.ActionInfo = pAction;
                    return result;

                }

            }
            catch (Exception e)
            {
                pAction.Success = false;
                pAction.ExceptionMsg = e.Message;
                result.ActionInfo = pAction;
                return result;
            }
        }