Exemplo n.º 1
0
        public static GraphVyrabAnswer getAnswer(DateTime date, bool calcTables = true, bool steppedPBR=true)
        {
            DateTime dateStart=date.Date;
            DateTime dateEnd=date.Date.AddHours(24);
            date = calcTables ? date : dateEnd;

            GraphVyrabAnswer answer=new GraphVyrabAnswer();

            PBRData ges=new PBRData(dateStart, dateEnd, date, GTPEnum.ges);
            PBRData gtp1=new PBRData(dateStart, dateEnd, date, GTPEnum.gtp1);
            PBRData gtp2=new PBRData(dateStart, dateEnd, date, GTPEnum.gtp2);
            ges.IsSteppedPBR = steppedPBR;
            gtp1.IsSteppedPBR = steppedPBR;
            gtp2.IsSteppedPBR = steppedPBR;

            answer.Chart = new ChartAnswer();
            answer.Chart.Properties = getChartProperties(steppedPBR);
            answer.Chart.Data = new ChartData();

            gtp1.InitData();
            gtp2.InitData();
            ges.InitData();

            answer.ActualDate = gtp1.Date < gtp2.Date ? gtp1.Date : gtp2.Date;
            answer.ActualDate = ges.Date < answer.ActualDate ? ges.Date : answer.ActualDate;

            DateTime lastDate=answer.ActualDate;
            answer.VyrabPlan = ges.IntegratedPBR[lastDate];
            answer.VyrabFakt = ges.IntegratedP[lastDate];
            answer.VyrabDiff = ges.IntegratedP[lastDate] - ges.IntegratedPBR[lastDate];
            answer.VyrabDiffProc = PBRData.getDiffProc(ges.IntegratedP[lastDate], ges.IntegratedPBR[lastDate]);

            if (calcTables) {
                answer.TableCurrent.Add(new GraphVyrabTableRow("P план", Math.Round(gtp1.MinutesPBR[lastDate]), Math.Round(gtp2.MinutesPBR[lastDate]), Math.Round(ges.MinutesPBR[lastDate])));
                answer.TableCurrent.Add(new GraphVyrabTableRow("P факт", Math.Round(gtp1.RealP[lastDate]), Math.Round(gtp2.RealP[lastDate]), Math.Round(ges.RealP[lastDate])));
                answer.TableCurrent.Add(new GraphVyrabTableRow("P откл", gtp1.getDiff(lastDate), gtp2.getDiff(lastDate), ges.getDiff(lastDate)));
                answer.TableCurrent.Add(new GraphVyrabTableRow("P откл %", gtp1.getDiffProc(lastDate), gtp2.getDiffProc(lastDate), ges.getDiffProc(lastDate)));

                SortedList<string,double> gtp1Hour=gtp1.getHourVals(lastDate);
                SortedList<string,double> gtp2Hour=gtp2.getHourVals(lastDate);
                SortedList<string,double> gesHour=ges.getHourVals(lastDate);

                answer.TableHour.Add(new GraphVyrabTableRow("P план", Math.Round(gtp1Hour["plan"]), Math.Round(gtp2Hour["plan"]), Math.Round(gesHour["plan"])));
                answer.TableHour.Add(new GraphVyrabTableRow("P факт", Math.Round(gtp1Hour["fakt"]), Math.Round(gtp2Hour["fakt"]), Math.Round(gesHour["fakt"])));
                answer.TableHour.Add(new GraphVyrabTableRow("P откл", gtp1Hour["diff"], gtp2Hour["diff"], gesHour["diff"]));
                answer.TableHour.Add(new GraphVyrabTableRow("P откл %", gtp1Hour["diffProc"], gtp2Hour["diffProc"], gesHour["diffProc"]));
                answer.TableHour.Add(new GraphVyrabTableRow("P рек", Math.Round(gtp1Hour["recP"]), Math.Round(gtp2Hour["recP"]), Math.Round(gesHour["recP"])));
            }

            answer.Chart.Data.addSerie(getDataSerie("gtp1Fakt", gtp1.RealP, -1));
            answer.Chart.Data.addSerie(getDataSerie("gtp2Fakt", gtp2.RealP, -1));
            answer.Chart.Data.addSerie(getDataSerie("gesFakt", ges.RealP, -1));

            answer.Chart.Data.addSerie(getDataSerie("gtp1Plan", steppedPBR?gtp1.SteppedPBR:gtp1.RealPBR, 0));
            answer.Chart.Data.addSerie(getDataSerie("gtp2Plan", steppedPBR?gtp2.SteppedPBR:gtp2.RealPBR, 0));
            answer.Chart.Data.addSerie(getDataSerie("gesPlan", steppedPBR?ges.SteppedPBR:ges.RealPBR, 0));

            answer.Chart.Data.addSerie(getDataSerie("vyrabPlan", ges.IntegratedPBR, -1));
            answer.Chart.Data.addSerie(getDataSerie("vyrabFakt", ges.IntegratedP, -1));

            return answer;
        }
Exemplo n.º 2
0
        public static GraphVyrabRGEAnswer getAnswer(DateTime date, bool calcTables = true, bool steppedPBR=true)
        {
            DateTime dateStart=date.Date;
            DateTime dateEnd=date.Date.AddHours(24);
            date = calcTables ? date : dateEnd;

            GraphVyrabRGEAnswer answer=new GraphVyrabRGEAnswer();

            PBRData rge1=new PBRData(dateStart, dateEnd, date, GTPEnum.rge1);
            PBRData rge2=new PBRData(dateStart, dateEnd, date, GTPEnum.rge2);
            PBRData rge3=new PBRData(dateStart, dateEnd, date, GTPEnum.rge3);
            PBRData rge4=new PBRData(dateStart, dateEnd, date, GTPEnum.rge4);
            rge1.IsSteppedPBR = steppedPBR;
            rge2.IsSteppedPBR = steppedPBR;
            rge3.IsSteppedPBR = steppedPBR;
            rge4.IsSteppedPBR = steppedPBR;

            answer.ChartRGE1 = new ChartAnswer();
            answer.ChartRGE1.Properties = getChartProperties(220, steppedPBR);
            answer.ChartRGE1.Data = new ChartData();

            answer.ChartRGE2 = new ChartAnswer();
            answer.ChartRGE2.Properties = getChartProperties(200, steppedPBR);
            answer.ChartRGE2.Data = new ChartData();

            answer.ChartRGE3 = new ChartAnswer();
            answer.ChartRGE3.Properties = getChartProperties(200, steppedPBR);
            answer.ChartRGE3.Data = new ChartData();

            answer.ChartRGE4 = new ChartAnswer();
            answer.ChartRGE4.Properties = getChartProperties(400, steppedPBR);
            answer.ChartRGE4.Data = new ChartData();

            rge1.InitData();
            rge2.InitData();
            rge3.InitData();
            rge4.InitData();

            DateTime[] dates=new DateTime[] { rge1.Date, rge2.Date, rge3.Date, rge4.Date };
            answer.ActualDate = dates.ToList().Min(); ;

            DateTime lastDate=answer.ActualDate;

            if (calcTables) {
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P план", Math.Round(rge1.MinutesPBR[lastDate]), Math.Round(rge2.MinutesPBR[lastDate]), Math.Round(rge3.MinutesPBR[lastDate]), Math.Round(rge4.MinutesPBR[lastDate])));
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P факт", Math.Round(rge1.RealP[lastDate]), Math.Round(rge2.RealP[lastDate]), Math.Round(rge3.RealP[lastDate]), Math.Round(rge4.RealP[lastDate])));
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P откл", rge1.getDiff(lastDate), rge2.getDiff(lastDate), rge3.getDiff(lastDate), rge4.getDiff(lastDate)));
                answer.TableCurrent.Add(new GraphVyrabRGETableRow("P откл %", rge1.getDiffProc(lastDate), rge2.getDiffProc(lastDate), rge3.getDiffProc(lastDate), rge4.getDiffProc(lastDate)));

                SortedList<string,double> rge1Hour=rge1.getHourVals(lastDate);
                SortedList<string,double> rge2Hour=rge2.getHourVals(lastDate);
                SortedList<string,double> rge3Hour=rge3.getHourVals(lastDate);
                SortedList<string,double> rge4Hour=rge4.getHourVals(lastDate);

                answer.TableHour.Add(new GraphVyrabRGETableRow("P план", Math.Round(rge1Hour["plan"]), Math.Round(rge2Hour["plan"]), Math.Round(rge3Hour["plan"]), Math.Round(rge4Hour["plan"])));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P факт", Math.Round(rge1Hour["fakt"]), Math.Round(rge2Hour["fakt"]), Math.Round(rge3Hour["fakt"]), Math.Round(rge4Hour["fakt"])));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P откл", rge1Hour["diff"], rge2Hour["diff"], rge3Hour["diff"], rge4Hour["diff"]));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P откл %", rge1Hour["diffProc"], rge2Hour["diffProc"], rge3Hour["diffProc"], rge4Hour["diffProc"]));
                answer.TableHour.Add(new GraphVyrabRGETableRow("P рек", Math.Round(rge1Hour["recP"]), Math.Round(rge2Hour["recP"]), Math.Round(rge3Hour["recP"]), Math.Round(rge4Hour["recP"])));

            }

            answer.ChartRGE1.Data.addSerie(getDataSerie("Fakt", rge1.RealP, -1));
            answer.ChartRGE1.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge1.SteppedPBR : rge1.RealPBR, 0));

            answer.ChartRGE2.Data.addSerie(getDataSerie("Fakt", rge2.RealP, -1));
            answer.ChartRGE2.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge2.SteppedPBR : rge2.RealPBR, 0));

            answer.ChartRGE3.Data.addSerie(getDataSerie("Fakt", rge3.RealP, -1));
            answer.ChartRGE3.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge3.SteppedPBR : rge3.RealPBR, 0));

            answer.ChartRGE4.Data.addSerie(getDataSerie("Fakt", rge4.RealP, -1));
            answer.ChartRGE4.Data.addSerie(getDataSerie("Plan", steppedPBR ? rge4.SteppedPBR : rge4.RealPBR, 0));

            answer.ChartRGE1.processAxes();
            answer.ChartRGE2.processAxes();
            answer.ChartRGE3.processAxes();
            answer.ChartRGE4.processAxes();

            return answer;
        }