Example #1
0
        public Report PgReport(string name, Dictionary <string, dynamic> parameters)
        {
            var report = new Report();
            var rez    = new List <List <string> >();
            var date   = DateTime.Now;

            foreach (var parameter in parameters)
            {
                if (parameter.Key == "StartDate")
                {
                    date = Convert.ToDateTime(Convert.ToString(parameter.Value));
                }
            }
            try
            {
                using (_context)
                {
                    var d = new DateTime(date.Year, date.Month, date.Day, 2, 0, 0);
                    for (DateTime n = d; n <= d.AddDays(1); n = n.AddHours(2))
                    {
                        DateTime n2  = n.AddHours(2);
                        var      row = new List <string>();



                        string q1 = "select top 1 Value from SignalsAnalogs where TagId= 624  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        /*_tempOut = */
                        string q2 = "select top 1 Value from SignalsAnalogs where TagId=625  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        /*_level = ""*/
                        string q3 = "select top 1 Value from SignalsAnalogs where TagId=626  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        /*_gasPress =*/
                        string q4 = "select top 1 Value from SignalsAnalogs where TagId=627  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        /*_razr = "";*/
                        string q5 = "select top 1 Value from SignalsAnalogs where TagId=628  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        /*_Pperepad =*/
                        string q6 = "select top 1 Value from SignalsAnalogs where TagId=629  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        /*_flame = ""*/
                        string q7 = "select top 1 Value from SignalsAnalogs where TagId=630  and Datetime between '" +
                                    n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";


                        var tempTN   = MyDB.sql_query_local(q1);
                        var tempOut  = MyDB.sql_query_local(q2);
                        var level    = MyDB.sql_query_local(q3);
                        var gasPress = MyDB.sql_query_local(q4);
                        var razr     = MyDB.sql_query_local(q5);
                        var Pperepad = MyDB.sql_query_local(q6);
                        var flame    = MyDB.sql_query_local(q7);

                        var t = 1;
                        var p = 2;
                        var e = 3;

                        row.Add(n.TimeOfDay.ToString());
                        row.Add((tempTN.count_rows > 0) ? ProcFl(tempTN.GetValue(0, 0), t) : "");
                        row.Add((tempOut.count_rows > 0) ? ProcFl(tempOut.GetValue(0, 0), t) : "");
                        row.Add((level.count_rows > 0) ? ProcFl(level.GetValue(0, 0), t) : "");
                        row.Add((gasPress.count_rows > 0) ? ProcFl(gasPress.GetValue(0, 0), p) : "");
                        row.Add((razr.count_rows > 0) ? ProcFl(razr.GetValue(0, 0), p) : "");
                        row.Add((Pperepad.count_rows > 0) ? ProcFl(Pperepad.GetValue(0, 0), p) : "");
                        row.Add((flame.count_rows > 0) ? ProcFl(flame.GetValue(0, 0), t) : "");

                        rez.Add(row);
                    }
                }
                logger.Logged("Info", " Report loaded..." + name, "ReportServer", "Rep2");
                report.Name = name;
                report.Head = new List <string>
                {
                    "Время чч:мм",
                    "Температура теплоносителя С",
                    "Температура подогреваемой среды С ",
                    "Уровень теплоносителя  ",
                    "Давление топливного газа мПа",
                    "Разряжение ",
                    "Перепад давления на фильтре мПа",
                    "Датчик пламени %"
                };
                report.Rows = rez;
            }
            catch (Exception ex)
            {
                return(report);
            }
            return(report);
        }
Example #2
0
        public Report MgbbReport(string name, Dictionary <string, dynamic> parameters)
        {
            var t      = 1;
            var p      = 2;
            var e      = 3;
            var report = new Report();
            var rez    = new List <List <string> >();
            var date   = DateTime.Now;

            foreach (var parameter in parameters)
            {
                if (parameter.Key == "StartDate")
                {
                    date = Convert.ToDateTime(Convert.ToString(parameter.Value));
                }
            }
            try
            {
                using (_context)
                {
                    var    d            = new DateTime(date.Year, date.Month, date.Day, 2, 0, 0);
                    double sum_nrsg_day = 0;
                    double sum_nrpg_day = 0;


                    //string f1_sum = GetTop1ValBeforeDatesById(720,d);
                    //string f1_sumN = GetTop1ValBeforeDatesById(721, d);
                    //string f2_sum = GetTop1ValBeforeDatesById(717, d);
                    //string f2_sumN = GetTop1ValBeforeDatesById(716, d);

                    var f1_sum  = Convert.ToDouble(ProcFl(MyDB.sql_query_local(GetTop1ValBeforeDatesById(720, d)).GetValue(0, 0), 1));
                    var f1_sumN = Convert.ToDouble(ProcFl(MyDB.sql_query_local(GetTop1ValBeforeDatesById(721, d)).GetValue(0, 0), 1));
                    var f2_sum  = Convert.ToDouble(ProcFl(MyDB.sql_query_local(GetTop1ValBeforeDatesById(717, d)).GetValue(0, 0), 1));
                    var f2_sumN = Convert.ToDouble(ProcFl(MyDB.sql_query_local(GetTop1ValBeforeDatesById(716, d)).GetValue(0, 0), 1));
                    for (DateTime n = d; n <= d.AddDays(1); n = n.AddHours(2))
                    {
                        if (n > DateTime.Now)
                        {
                            break;
                        }
                        DateTime n2  = n.AddHours(2);
                        var      row = new List <string>();

                        //string q3 = "select top 1 Value from SignalsAnalogs where TagId=718  and Datetime between '" +
                        //            n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        //string q4 = "select top 1 Value from SignalsAnalogs where TagId=719  and Datetime between '" +
                        //            n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";


                        //string q9 = "select top 1 Value from SignalsAnalogs where TagId=714  and Datetime between '" +
                        //            n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";
                        //string q10 = "select top 1 Value from SignalsAnalogs where TagId=715  and Datetime between '" +
                        //             n.ToString() + "' and '" + n2.ToString() + "' order by Datetime desc";



                        var pit05 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(642, n, n2));
                        var tt02  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(662, n, n2));

                        var pit06 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(643, n, n2));
                        var tt03  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(663, n, n2));

                        //var rsg = MyDB.sql_query_local(q3);
                        //var Nrsg = MyDB.sql_query_local(q4);
                        var SUMrsg   = MyDB.sql_query_local(GetTop1ValBetweenDatesById(720, n, n2));
                        var SUMNrsg  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(721, n, n2));
                        var _SUMrsg  = ((SUMrsg.count_rows > 0) ? Convert.ToDouble(ProcFl(SUMrsg.GetValue(0, 0), e)) :f1_sum);
                        var _SUMNrsg = ((SUMNrsg.count_rows > 0) ? Convert.ToDouble(ProcFl(SUMNrsg.GetValue(0, 0), e)) : f1_sumN);
                        var _rsg     = (_SUMrsg - f1_sum);
                        var _Nrsg    = (_SUMNrsg - f1_sumN);
                        f1_sum  = _SUMrsg;
                        f1_sumN = _SUMNrsg;
                        //var rpg = MyDB.sql_query_local(q9);
                        //var Nrpg = MyDB.sql_query_local(q10);
                        var SUMrpg   = MyDB.sql_query_local(GetTop1ValBetweenDatesById(717, n, n2));
                        var SUMNrpg  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(716, n, n2));
                        var _SUMrpg  = ((SUMrpg.count_rows > 0) ? Convert.ToDouble(ProcFl(SUMrpg.GetValue(0, 0), e)) : f2_sum);
                        var _SUMNrpg = ((SUMNrpg.count_rows > 0) ? Convert.ToDouble(ProcFl(SUMNrpg.GetValue(0, 0), e)) : f2_sumN);
                        var _rpg     = (_SUMrpg - f2_sum);
                        var _Nrpg    = (_SUMNrpg - f2_sumN);

                        f2_sum  = _SUMrpg;
                        f2_sumN = _SUMNrpg;

                        row.Add(n.TimeOfDay.ToString());

                        row.Add((pit05.count_rows > 0) ? ProcFl(pit05.GetValue(0, 0), p) : "");
                        row.Add((tt02.count_rows > 0) ? ProcFl(tt02.GetValue(0, 0), t) : "");
                        row.Add(Convert.ToString(_rsg));
                        row.Add(Convert.ToString(_Nrsg));
                        sum_nrsg_day = sum_nrsg_day + _Nrsg;
                        row.Add(Convert.ToString(sum_nrsg_day));
                        row.Add(Convert.ToString(_SUMrsg));
                        row.Add(Convert.ToString(_SUMNrsg));

                        row.Add((pit06.count_rows > 0) ? ProcFl(pit06.GetValue(0, 0), p) : "");
                        row.Add((tt03.count_rows > 0) ? ProcFl(tt03.GetValue(0, 0), t) : "");
                        row.Add(Convert.ToString(_rpg));
                        row.Add(Convert.ToString(_Nrpg));
                        sum_nrpg_day = sum_nrpg_day + _Nrpg;
                        row.Add(Convert.ToString(sum_nrpg_day));
                        row.Add(Convert.ToString(_SUMrpg));
                        row.Add(Convert.ToString(_SUMNrpg));

                        rez.Add(row);
                    }
                }
                logger.Logged("Info", " Report loaded..." + name, "ReportServer", "Rep2");
                report.Name = name;
                report.Head = new List <string>
                {
                    "Время чч:мм",
                    "Cыр. газ. Давление мПа",
                    "Сыр. газ. Температура С",
                    "Сыр. газ. Расход  2-часовой м3/ч ",
                    "Сыр. газ. Расход  2-часовой нм3/ч ",
                    "Сыр. газ. Нак. расход с начала суток нм3",
                    "Сыр. газ. Суммарный расход  РУ м3/ч ",
                    "Сыр. газ. Суммарный расход  НУ нм3/ч ",

                    "Подг. газ. Давление мПа",
                    "Подг. газ. Температура С",
                    "Подг. газ. Расход 2-часовой м3/ч ",
                    "Подг. газ. Расход 2-часовой нм3/ч ",
                    "Подг. газ. Нак. расход с начала суток нм3",
                    "Подг. газ. Суммарный расход РУ нм3/ч ",
                    "Подг. газ. Суммарный расход НУ нм3/ч "
                };
                report.Rows = rez;
            }
            catch (Exception ex)
            {
                return(report);
            }
            return(report);
        }
Example #3
0
        public Report MgbbReport2(string name, Dictionary <string, dynamic> parameters)
        {
            var report = new Report();
            var rez    = new List <List <string> >();
            var date   = DateTime.Now;

            foreach (var parameter in parameters)
            {
                if (parameter.Key == "StartDate")
                {
                    date = Convert.ToDateTime(Convert.ToString(parameter.Value));
                }
            }
            try
            {
                using (_context)
                {
                    var d = new DateTime(date.Year, date.Month, date.Day, 2, 0, 0);
                    for (DateTime n = d; n <= d.AddDays(1); n = n.AddHours(2))
                    {
                        DateTime n2  = n.AddHours(2);
                        var      row = new List <string>();


                        var q1  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(632, n, n2)); //"AT01. З
                        var q2  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(633, n, n2)); //"AT02. З
                        var q3  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(661, n, n2)); //"TT01H.
                        var q4  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(636, n, n2)); //"PDIT01.
                        var q5  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(637, n, n2)); //"PDIT101
                        var q6  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(638, n, n2)); //"PIT01.
                        var q7  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(660, n, n2)); //"TT01. С
                        var q8  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(648, n, n2)); //"PIT11.
                        var q9  = MyDB.sql_query_local(GetTop1ValBetweenDatesById(667, n, n2)); //"TT07. П
                        var q10 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(639, n, n2)); //"PIT02.С
                        var q11 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(640, n, n2)); //"PIT03.С
                        var q12 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(641, n, n2)); //"PIT04.С
                        var q13 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(668, n, n2)); //"TT08. С
                        var q14 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(642, n, n2)); //"PIT05.
                        var q15 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(662, n, n2)); //"TT02. С
                        var q16 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(643, n, n2)); //"PIT06.
                        var q17 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(663, n, n2)); //"TT03. П
                        var q18 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(644, n, n2)); //"PIT07.
                        var q19 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(664, n, n2)); //"TT04. С
                        var q20 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(649, n, n2)); //"PIT12.
                        var q21 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(665, n, n2)); //"TT05.
                        var q22 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(645, n, n2)); //"PIT08.
                        var q23 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(646, n, n2)); //"PIT09.
                        var q24 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(647, n, n2)); //"PIT10.
                        var q25 = MyDB.sql_query_local(GetTop1ValBetweenDatesById(666, n, n2)); //"TT06. Т

                        row.Add(n.TimeOfDay.ToString());
                        var t = 1;
                        var p = 2;
                        var e = 3;


                        row.Add((q1.count_rows > 0) ? ProcFl(q1.GetValue(0, 0), 2) : "");
                        row.Add((q2.count_rows > 0) ? ProcFl(q2.GetValue(0, 0), 2) : "");
                        row.Add((q3.count_rows > 0) ? ProcFl(q3.GetValue(0, 0), 2) : "");
                        row.Add((q4.count_rows > 0) ? ProcFl(q4.GetValue(0, 0), 2) : "");
                        row.Add((q5.count_rows > 0) ? ProcFl(q5.GetValue(0, 0), 2) : "");
                        row.Add((q6.count_rows > 0) ? ProcFl(q6.GetValue(0, 0), 2) : "");
                        row.Add((q7.count_rows > 0) ? ProcFl(q7.GetValue(0, 0), 2) : "");
                        row.Add((q8.count_rows > 0) ? ProcFl(q8.GetValue(0, 0), 2) : "");
                        row.Add((q9.count_rows > 0) ? ProcFl(q9.GetValue(0, 0), 2) : "");
                        row.Add((q10.count_rows > 0) ? ProcFl(q10.GetValue(0, 0), 2) : "");
                        row.Add((q11.count_rows > 0) ? ProcFl(q11.GetValue(0, 0), 2) : "");
                        row.Add((q12.count_rows > 0) ? ProcFl(q12.GetValue(0, 0), 2) : "");
                        row.Add((q13.count_rows > 0) ? ProcFl(q13.GetValue(0, 0), 2) : "");
                        row.Add((q14.count_rows > 0) ? ProcFl(q14.GetValue(0, 0), 2) : "");
                        row.Add((q15.count_rows > 0) ? ProcFl(q15.GetValue(0, 0), 2) : "");
                        row.Add((q16.count_rows > 0) ? ProcFl(q16.GetValue(0, 0), 2) : "");
                        row.Add((q17.count_rows > 0) ? ProcFl(q17.GetValue(0, 0), 2) : "");
                        row.Add((q18.count_rows > 0) ? ProcFl(q18.GetValue(0, 0), 2) : "");
                        row.Add((q19.count_rows > 0) ? ProcFl(q19.GetValue(0, 0), 2) : "");
                        row.Add((q20.count_rows > 0) ? ProcFl(q20.GetValue(0, 0), 2) : "");
                        row.Add((q21.count_rows > 0) ? ProcFl(q21.GetValue(0, 0), 2) : "");
                        row.Add((q22.count_rows > 0) ? ProcFl(q22.GetValue(0, 0), 2) : "");
                        row.Add((q23.count_rows > 0) ? ProcFl(q23.GetValue(0, 0), 2) : "");
                        row.Add((q24.count_rows > 0) ? ProcFl(q24.GetValue(0, 0), 2) : "");
                        row.Add((q25.count_rows > 0) ? ProcFl(q25.GetValue(0, 0), 2) : "");
                        rez.Add(row);
                    }
                }
                logger.Logged("Info", " Report loaded..." + name, "ReportServer", "Rep2");
                report.Name = name;
                report.Head = new List <string>
                {
                    "Время",
                    "AT01. Загазованность в блок-боксе %",
                    "AT02. Загазованность в блок-боксе %",
                    "TT01H. Температура воздуха в блок-боксе °С",
                    "PDIT01. Перепад давления на БФ-101 МПа",
                    "PDIT101. Перепад давления на МГБ-101 МПа ",
                    "PIT01. Сыр. газ. Давление  на входе в установку МПа",
                    "TT01. Сыр. газ. Температура с на входе в установку °С",
                    "PIT11. Подг. газ.Давление на выходе установки МПа",
                    "TT07. Подг. газ.Температура на выходе установки °С",
                    "PIT02.Сыр. газ. Давление в верхней секции БФ-101 МПа",
                    "PIT03.Сыр. газ. Давление на выходе УРГ №1 МПа",
                    "PIT04.Сыр. газ. Давление на выходе УРГ №1 МПа",
                    "TT08. Сыр. газ.Температура после УРГ №1  ",
                    "PIT05. Сыр. газ. Давление МПа",
                    "TT02. Сыр. газ. Температура °С",
                    "PIT06. Подг. газ. Давление  МПа",
                    "TT03. Подг. газ.Температура  °С",
                    "PIT07. Сыр. газ. Давление на входе МГБ-101 МПа ",
                    "TT04. Сыр. газ. Температура на входе МГБ-101 °С",
                    "PIT12. Подг. газ.Давление на выходе МГБ-101 МПа",
                    "TT05.  Подг. газ.Температура на выходе МГБ-101 °С",
                    "PIT08. Подг. газ.Давление  после УРГ №2 МПа",
                    "PIT09. Подг. газ.Давление после УРГ №2 МПа ",
                    "PIT10. Давление газа в пермеатном коллекторе МПа ",
                    "TT06. Температура газа в пермеатном коллекторе °С"
                };
                report.Rows = rez;
            }
            catch (Exception ex)
            {
                return(report);
            }
            return(report);
        }