Example #1
0
        /// <summary>
        /// 取得某个设备跨小时的某测点图表
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <returns></returns>
        public ActionResult MonitorDayChart(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, int monitorCode, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device = DeviceService.GetInstance().get(dId);
            //获得报表js代码
            MonitorType energyMt   = MonitorType.getMonitorTypeByCode(monitorCode);
            string      unit       = energyMt.unit;
            string      chartName  = device.fullName + " " + LanguageUtil.getDesc("CHART_DAY_CHART");
            string      reportData = string.Empty;

            if (device != null)
            {
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().DayChart(device, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #2
0
        /// <summary>
        /// 逆变器设备的月天数据
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult DeviceMonthDayChart(int dId, string startYYYYMMDD, string endYYYYMMDD, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device     = DeviceService.GetInstance().get(dId);
            string reportData = string.Empty;

            if (device != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TODAYENERGY);
                string      unit     = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().MonthDDChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEMONTHCHART_NAME"), device.fullName), startYYYYMMDD, endYYYYMMDD, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #3
0
        /// <summary>
        /// 单个设备的年月发电量图表数据
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="startYM">开始年月</param>
        /// <param name="endYM">截止年月</param>
        /// <param name="chartType">图表类型</param>
        /// <returns></returns>
        public ActionResult DeviceYearMMChart(int dId, string startYM, string endYM, string chartType, string lan)
        {
            setlan(lan);

            string reportData = string.Empty;

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device = DeviceService.GetInstance().get(dId);

            if (device != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string      unit     = energyMt.unit;
                //取得用户年度发电量图表数据
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().YearMMChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEYEAR_CHART_NAME"), device.fullName), startYM, endYM, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #4
0
        /// <summary>
        /// 取得某个设备跨小时的功率图表
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <returns></returns>
        public ActionResult DeviceDayChart(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string lan)
        {
            setlan(lan);

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device      = DeviceService.GetInstance().get(dId);
            int    monitorCode = MonitorType.MIC_INVERTER_TOTALYGPOWER;//功率

            switch (device.deviceTypeCode)
            {
            case DeviceData.HUILIUXIANG_CODE:
                monitorCode = MonitorType.MIC_BUSBAR_TOTALCURRENT;
                break;

            case DeviceData.CABINET_CODE:
                monitorCode = MonitorType.MIC_BUSBAR_TOTALCURRENT;
                break;

            case DeviceData.ENVRIOMENTMONITOR_CODE:
                monitorCode = MonitorType.MIC_DETECTOR_SUNLINGHT;
                break;

            case DeviceData.AMMETER_CODE:
                monitorCode = MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE;
                break;

            default:
                monitorCode = MonitorType.MIC_INVERTER_TOTALYGPOWER;    //功率
                break;
            }

            MonitorType Mt         = MonitorType.getMonitorTypeByCode(monitorCode);
            string      unit       = Mt.unit;
            string      chartName  = device.fullName + " " + LanguageUtil.getDesc("CHART_DAY_CHART");
            string      reportData = string.Empty;

            if (device != null)
            {
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().DayChart(device, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(AppError));
            }
            return(Content(reportData));
        }
Example #5
0
        /// <summary>
        /// 日功率和日照散列图
        /// 此类型图表和其他取数方式有点不一样,其他都是多位测点数据公用一个时间坐标
        /// 这个是两个测点先按照同样的时间间隔取得数据后(同样的时间间隔取数是为了保证取得数据数组长度一致,能最终合并成对应的散列点)
        /// 将日照作为x轴,功率作为y轴数据,生成散列图表数据
        /// add by hbqian in 2013-03-23 for 生成设备功率和日照散列图
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDDHH"></param>
        /// <param name="endYYYYMMDDHH"></param>
        /// <param name="chartType">只能有一个,其实是固定为scatter类型的</param>
        /// <param name="intervalMins">只能有一个</param>
        /// <returns></returns>
        public ActionResult PowerSunScatterCompare(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string intervalMins)
        {
            string reportCode = string.Empty;
            Device device     = DeviceService.GetInstance().get(dId);

            string[] intervals = intervalMins.Split(',');
            if (device != null)
            {
                //判断该测点是否有数据,有数据则增加关照对比
                Hashtable powerDataHash = DeviceDayDataService.GetInstance().GetDaydataList(device, startYYYYMMDDHH, endYYYYMMDDHH, int.Parse(intervals[0]), MonitorType.MIC_INVERTER_TOTALYGPOWER);
                if (powerDataHash.Count > 0 && device.plantUnit != null)
                {
                    string chartName = LanguageUtil.getDesc("PLANT_CHART_DAY_POWER_SUNLIGHT_COMPARE_CHART") + "(" + LanguageUtil.getDesc("CUSTOM_CHART_MONTH") + ")";

                    Plant  plant     = PlantService.GetInstance().GetPlantInfoById(device.plantUnit.plantID);
                    Device sundevice = plant.getFirstDetector();
                    //设备所属电站是否有环境检测仪
                    if (sundevice != null)
                    {
                        //取得日照数据
                        Hashtable sunDataHash = DeviceDayDataService.GetInstance().GetDaydataList(null, sundevice, startYYYYMMDDHH, endYYYYMMDDHH, int.Parse(intervals[0]), MonitorType.MIC_DETECTOR_SUNLINGHT);
                        if (sunDataHash.Keys.Count > 0)//有日照数据,则合并数据,将日照作为x,功率作为y,形成新的x.y散列点
                        {
                            MonitorType smt       = MonitorType.getMonitorTypeByCode(MonitorType.MIC_DETECTOR_SUNLINGHT);
                            MonitorType pmt       = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TOTALYGPOWER);
                            ChartData   chartData = DeviceChartService.GetInstance().genNewScatter(smt, pmt, chartName, startYYYYMMDDHH, endYYYYMMDDHH, int.Parse(intervals[0]), sunDataHash, powerDataHash, "kW", chartType);
                            reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData));
                        }
                        else
                        { //没有日照无法生成散列点则,返回无数据提示
                            return(Content("error:" + Resources.SunResource.NODATA));
                        }
                    }
                    else
                    {
                        return(Content("error:" + Resources.SunResource.NODATA));
                    }
                }
                else
                {
                    return(Content("error:" + Resources.SunResource.NODATA));
                }
            }
            else
            {
                return(Content("error:" + Resources.SunResource.NODATA));
            }
            return(Content(reportCode));
        }
Example #6
0
        /// <summary>
        /// 设备的月天数据
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="startYYYYMMDD"></param>
        /// <param name="endYYYYMMDD"></param>
        /// <param name="chartType"></param>
        /// <returns></returns>
        public ActionResult DeviceMonthDayChart(int dId, string startYYYYMMDD, string endYYYYMMDD, string chartType)
        {
            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device     = DeviceService.GetInstance().get(dId);
            string reportData = string.Empty;

            if (device != null)
            {
                string    unit      = "kWh";
                ChartData chartData = DeviceChartService.GetInstance().MonthDDChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEMONTHCHART_NAME"), device.fullName), startYYYYMMDD, endYYYYMMDD, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            return(Content(reportData));
        }
Example #7
0
        /// <summary>
        /// 单个设备的年月发电量图表数据
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="startYM">开始年月</param>
        /// <param name="endYM">截止年月</param>
        /// <param name="chartType">图表类型</param>
        /// <returns></returns>
        public ActionResult DeviceYearMMChart(int dId, string startYM, string endYM, string chartType)
        {
            string reportData = string.Empty;

            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device = DeviceService.GetInstance().get(dId);

            if (device != null)
            {
                string unit = "kWh";
                //取得用户年度发电量图表数据
                ChartData chartData = DeviceChartService.GetInstance().YearMMChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEYEAR_CHART_NAME"), device.fullName), startYM, endYM, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            return(Content(reportData));
        }
Example #8
0
        public ActionResult PRMonthDDChart(int dId, int pId, string startYYYYMMDD, string endYYYYMMDD)
        {
            String reportCode = "";

            if (dId > 0)
            {
                Plant  plant        = PlantService.GetInstance().GetPlantInfoById(pId);
                Device invertDevice = DeviceService.GetInstance().get(dId);
                //取得环境监测仪
                Device    detetorDevice = plant.getDetectorWithRenderSunshine();
                ChartData chartData     = DeviceChartService.GetInstance().MonthDDRPChartBypList(invertDevice, detetorDevice, LanguageUtil.getDesc("MONTHLY_PR_PERFORMANCE_CHART_NAME"), startYYYYMMDD, endYYYYMMDD, ChartType.column);
                reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData));
            }
            else
            {
                return(Content("Error:"));
            }

            return(Content(reportCode));
        }
Example #9
0
        /// <summary>
        /// 取得设备某个测点的日变化曲线
        /// </summary>
        /// <param name="dId"></param>
        /// <param name="startYYYYMMDDHH"></param>
        /// <param name="endYYYYMMDDHH"></param>
        /// <param name="chartType"></param>
        /// <param name="monitorCode"></param>
        /// <returns></returns>
        public ActionResult MonitorDayChart(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, int monitorCode, int intervalMins)
        {
            if (string.IsNullOrEmpty(chartType))
            {
                chartType = ChartType.column;
            }
            Device device = DeviceService.GetInstance().get(dId);
            //获得报表js代码
            MonitorType mt         = MonitorType.getMonitorTypeByCode(monitorCode);
            string      unit       = mt.getMonitorFirstUnitByCode();
            string      chartName  = string.Format(LanguageUtil.getDesc("MONITOR_DAY_CHAR_NAME"), mt.name);
            string      reportCode = string.Empty;

            if (device != null)
            {
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetInstance().DayChart(device, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalMins);
                reportCode = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            return(Content(reportCode));
        }