Beispiel #1
0
        public int addCounters()
        {
            try
            {
                ClientOPCTRK.ClientTRK        client  = new ClientOPCTRK.ClientTRK();
                EFAZS.Concrete.EFTRK_Counters ef_trkc = new EFAZS.Concrete.EFTRK_Counters();

                int res = 0;
                List <ClientOPCTRK.Gun>       guns = client.ReadTagOPCOfGun();
                List <ClientOPCTRK.DIORisers> dios = client.ReadTagOPCOfDIORisers();

                if (guns != null)
                {
                    EFAZS.Concrete.EFUsersActions efua = new EFAZS.Concrete.EFUsersActions();
                    UsersActions user_action           = efua.GetCurrentUsersActions();
                    if (user_action != null)
                    {
                        TRK_Counters counters = new TRK_Counters()
                        {
                            ID        = 0,
                            Operator  = user_action.UserName,
                            SmenaID   = user_action.SessionID,
                            TimeStamp = DateTime.Now,
                            note      = "AZSController"
                        };
                        foreach (ClientOPCTRK.Gun g in guns)
                        {
                            switch (g.num_gun)
                            {
                            case 1: counters.C1_1 = (int?)g.total_volume; break;

                            case 2: counters.C1_2 = (int?)g.total_volume;  break;

                            case 3: counters.C2_1 = (int?)g.total_volume; break;

                            case 4: counters.C2_2 = (int?)g.total_volume; break;

                            case 5: counters.C3_1 = (int?)g.total_volume; break;

                            case 6: counters.C3_2 = (int?)g.total_volume; break;

                            case 7: counters.C4_1 = (int?)g.total_volume; break;

                            case 8: counters.C4_2 = (int?)g.total_volume; break;

                            case 9: counters.C5_1 = (int?)g.total_volume; break;

                            case 10: counters.C5_2 = (int?)g.total_volume; break;

                            case 11: counters.C6_1 = (int?)g.total_volume; break;

                            case 12: counters.C6_2 = (int?)g.total_volume; break;

                            case 13: counters.C7_1 = (int?)g.total_volume; break;

                            case 14: counters.C7_2 = (int?)g.total_volume; break;

                            case 15: counters.C7_3 = (int?)g.total_volume; break;

                            case 16: counters.C7_4 = (int?)g.total_volume; break;

                            case 17: counters.C7_5 = (int?)g.total_volume; break;

                            case 18: counters.C7_6 = (int?)g.total_volume; break;

                            case 19: counters.C7_7 = (int?)g.total_volume; break;

                            case 20: counters.C7_8 = (int?)g.total_volume; break;

                            case 21: counters.C8_1 = (int?)g.total_volume; break;

                            case 22: counters.C8_2 = (int?)g.total_volume; break;

                            case 23: counters.C8_3 = (int?)g.total_volume; break;

                            case 24: counters.C8_4 = (int?)g.total_volume; break;

                            case 25: counters.C8_5 = (int?)g.total_volume; break;

                            case 26: counters.C8_6 = (int?)g.total_volume; break;

                            case 27: counters.C8_7 = (int?)g.total_volume; break;

                            case 28: counters.C8_8 = (int?)g.total_volume; break;

                            case 29: counters.C9_1 = (int?)g.total_volume; break;
                            }
                        }
                        if (dios != null)
                        {
                            foreach (ClientOPCTRK.DIORisers dio in dios)
                            {
                                switch (dio.num)
                                {
                                case 1: counters.as1 = (long?)dio.Counter; break;

                                case 2: counters.as2 = (long?)dio.Counter; break;

                                case 3: counters.as3 = (long?)dio.Counter; break;
                                }
                            }
                        }

                        ef_trkc.Add(counters);

                        //String.Format("AZSController - Отработал метод addCounters - counters.Operator:{0}", counters.Operator).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.SmenaID:{0}", counters.SmenaID).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.TimeStamp:{0}", counters.TimeStamp).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C1_1:{0}", counters.C1_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C1_2:{0}", counters.C1_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C2_1:{0}", counters.C2_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C2_2:{0}", counters.C2_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C3_1:{0}", counters.C3_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C3_2:{0}", counters.C3_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C4_1:{0}", counters.C4_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C4_2:{0}", counters.C4_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C5_1:{0}", counters.C5_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C5_2:{0}", counters.C5_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C6_1:{0}", counters.C6_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C6_2:{0}", counters.C6_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_1:{0}", counters.C7_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_2:{0}", counters.C7_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_3:{0}", counters.C7_3).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_4:{0}", counters.C7_4).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_5:{0}", counters.C7_5).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_6:{0}", counters.C7_6).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_7:{0}", counters.C7_7).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C7_8:{0}", counters.C7_8).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_1:{0}", counters.C8_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_2:{0}", counters.C8_2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_3:{0}", counters.C8_3).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_4:{0}", counters.C8_4).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_5:{0}", counters.C8_5).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_6:{0}", counters.C8_6).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_7:{0}", counters.C8_7).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C8_8:{0}", counters.C8_8).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.C9_1:{0}", counters.C9_1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.as1:{0}", counters.as1).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.as2:{0}", counters.as2).SaveInformation();
                        //String.Format("AZSController - Отработал метод addCounters - counters.as3:{0}", counters.as3).SaveInformation();

                        res = ef_trkc.Save();
                    }
                }
                String.Format("AZSController - Отработал метод addCounters - Код выполнения-1:{0}", res).SaveInformation();
                return(res);
            }
            catch (Exception e)
            {
                String.Format("addCounters()").SaveError(e);
                return(-1);
            }
        }
Beispiel #2
0
        public int addCounters()
        {
            try
            {
                int              res  = 0;
                List <Gun>       guns = client.ReadTagOPCOfGun();
                List <DIORisers> dios = client.ReadTagOPCOfDIORisers();
                if (guns != null)
                {
                    EFUsersActions efua        = new EFUsersActions();
                    UsersActions   user_action = efua.GetCurrentUsersActions();
                    if (user_action != null)
                    {
                        TRK_Counters counters = new TRK_Counters()
                        {
                            ID        = 0,
                            Operator  = user_action.UserName,
                            SmenaID   = user_action.SessionID,
                            TimeStamp = DateTime.Now,
                            note      = "Services"
                        };
                        foreach (Gun g in guns)
                        {
                            switch (g.num_gun)
                            {
                            case 1: counters.C1_1 = (int?)g.total_volume; break;

                            case 2: counters.C1_2 = (int?)g.total_volume; break;

                            case 3: counters.C2_1 = (int?)g.total_volume; break;

                            case 4: counters.C2_2 = (int?)g.total_volume; break;

                            case 5: counters.C3_1 = (int?)g.total_volume; break;

                            case 6: counters.C3_2 = (int?)g.total_volume; break;

                            case 7: counters.C4_1 = (int?)g.total_volume; break;

                            case 8: counters.C4_2 = (int?)g.total_volume; break;

                            case 9: counters.C5_1 = (int?)g.total_volume; break;

                            case 10: counters.C5_2 = (int?)g.total_volume; break;

                            case 11: counters.C6_1 = (int?)g.total_volume; break;

                            case 12: counters.C6_2 = (int?)g.total_volume; break;

                            case 13: counters.C7_1 = (int?)g.total_volume; break;

                            case 14: counters.C7_2 = (int?)g.total_volume; break;

                            case 15: counters.C7_3 = (int?)g.total_volume; break;

                            case 16: counters.C7_4 = (int?)g.total_volume; break;

                            case 17: counters.C7_5 = (int?)g.total_volume; break;

                            case 18: counters.C7_6 = (int?)g.total_volume; break;

                            case 19: counters.C7_7 = (int?)g.total_volume; break;

                            case 20: counters.C7_8 = (int?)g.total_volume; break;

                            case 21: counters.C8_1 = (int?)g.total_volume; break;

                            case 22: counters.C8_2 = (int?)g.total_volume; break;

                            case 23: counters.C8_3 = (int?)g.total_volume; break;

                            case 24: counters.C8_4 = (int?)g.total_volume; break;

                            case 25: counters.C8_5 = (int?)g.total_volume; break;

                            case 26: counters.C8_6 = (int?)g.total_volume; break;

                            case 27: counters.C8_7 = (int?)g.total_volume; break;

                            case 28: counters.C8_8 = (int?)g.total_volume; break;

                            case 29: counters.C9_1 = (int?)g.total_volume; break;
                            }
                        }
                        if (dios != null)
                        {
                            foreach (DIORisers dio in dios)
                            {
                                switch (dio.num)
                                {
                                case 1: counters.as1 = (long?)dio.Counter; break;

                                case 2: counters.as2 = (long?)dio.Counter; break;

                                case 3: counters.as3 = (long?)dio.Counter; break;
                                }
                            }
                        }

                        ef_trkc.Add(counters);
                        res = ef_trkc.Save();
                    }
                }
                String.Format("Сервис ReportTRKServices - Отработал метод addCounters - Код выполнения-1:{0}", res).SaveInformation();
                return(res);
            }
            catch (Exception e)
            {
                String.Format("addCounters()").SaveError(e);
                return(-1);
            }
        }