Beispiel #1
0
        public ActionResult YearMMChart(int plantId)
        {
            string reportCode = string.Empty;

            if (plantId > 0)
            {
                string unit  = "kWh";
                Plant  plant = PlantService.GetInstance().GetPlantInfoById(plantId);
                //ChartData chartData = PlantChartService.GetInstance().YearMMChartByPlant(plant, DateTime.Now.Year, ChartType.column, unit);
                string chartName = LanguageUtil.getDesc("CHART_TITLE_YEARLYENERGYCHART");
                //if (startYearMM.Substring(0, 4).Equals(endYearMM.Substring(0, 4)) && startYearMM.Substring(4, 2).Equals("01") && endYearMM.Substring(4, 2).Equals("12")) {
                //chartName = startYearMM.Substring(0, 4) + chartName;
                //}
                string    startYearMM = DateTime.Now.Year + "01";
                string    endYearMM   = DateTime.Now.Year + "12";
                ChartData chartData   = PlantChartService.GetInstance().YearMMChartBypList(new List <Plant> {
                    plant
                }, 1.0F, chartName, null, startYearMM, endYearMM, ChartType.column, unit, true);
                foreach (YData yd in chartData.series)
                {
                    if (yd.max == 0)
                    {
                        yd.max = 10;
                    }
                }
                reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            else
            {
                return(Content("error:" + Resources.SunResource.NODATA));
            }
            return(Content(reportCode));
        }
Beispiel #2
0
        public ActionResult MonthDDChart(int plantId)
        {
            string reportCode = string.Empty;
            Plant  plant      = PlantService.GetInstance().GetPlantInfoById(plantId);

            if (plant != null)
            {
                string unit          = "kWh";
                string startYYYYMMDD = DateTime.Now.ToString("yyyyMM01");
                string endYYYYMMDD   = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1).AddDays(-1).ToString("yyyyMMdd");
                //ChartData chartData = PlantChartService.GetInstance().MMDDChartBypList(new List<Plant> { plant }, startYYYYMMDD, endYYYYMMDD, "column", unit);
                ChartData chartData = PlantChartService.GetInstance().MonthDDChartBypList(new List <Plant> {
                    plant
                }, 1.0F, LanguageUtil.getDesc("CHART_TITLE_MONTH_ENERGY"), null, startYYYYMMDD, endYYYYMMDD, ChartType.column, unit, false);
                foreach (YData yd in chartData.series)
                {
                    if (yd.max == 0)
                    {
                        yd.max = 10;
                    }
                }
                reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            else
            {
                return(Content("error:" + Resources.SunResource.NODATA));
            }
            return(Content(reportCode));
        }
Beispiel #3
0
        /// <summary>
        /// 电站的月天数据
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult PlantMonthDayChart(int pid, string startYYYYMMDD, string endYYYYMMDD, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Plant  plant      = PlantService.GetInstance().GetPlantInfoById(pid);
            string reportData = string.Empty;

            if (plant != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string      unit     = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetInstance().MMDDChartBypList(new List <Plant> {
                    plant
                }, startYYYYMMDD, endYYYYMMDD, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Beispiel #4
0
        /// <summary>
        /// 取得用户所有电站跨小时的功率图表
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="startYYYYMMDDHH"></param>
        /// <param name="endYYYYMMDDHH"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult AllPlantDayChart(int userId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            User user = UserService.GetInstance().Get(userId);

            //获得报表业务逻辑类
            PlantChartService reportService = PlantChartService.GetInstance();
            //获得报表js代码
            int         monitorCode = MonitorType.PLANT_MONITORITEM_POWER_CODE;//发电量测点
            MonitorType Mt          = MonitorType.getMonitorTypeByCode(monitorCode);
            string      unit        = Mt.unit;
            string      chartName   = LanguageUtil.getDesc("CHART_DAY_POWER_CHART");
            string      reportData  = string.Empty;

            if (user != null && user.plants != null)
            {
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = reportService.PlantDayChart(user.plants, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Beispiel #5
0
        /// <summary>
        /// 用户所有电站的年度发电量图表数据
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult AllPlantYearChart(int userId, string chartType, string lan)
        {
            setlan(lan);

            string reportData = string.Empty;

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            User user = UserService.GetInstance().Get(userId);

            if (user != null && user.plants != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string      unit     = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetInstance().YearChartBypList(user.plants, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }