Beispiel #1
0
        public void Test_ClientTRK_ReadTagOPCOfDIORisers()
        {
            try
            {
                ClientTRK client = new ClientTRK();

                List <DIORisers> list = client.ReadTagOPCOfDIORisers();
                if (list == null)
                {
                    Console.WriteLine("List<DIORisers> list =null");
                    return;
                }
                foreach (DIORisers riser in list)
                {
                    Console.WriteLine("riser.Counter - {0}", riser.Counter);
                    Console.WriteLine("riser.CounterResetable - {0}", riser.CounterResetable);
                    Console.WriteLine("riser.CountOn - {0}", riser.CountOn);
                    Console.WriteLine("riser.Error - {0}", riser.Error);
                    Console.WriteLine("riser.Flow - {0}", riser.Flow);
                    Console.WriteLine("riser.Flow2 - {0}", riser.Flow2);
                    Console.WriteLine("riser.Freq - {0}", riser.Freq);
                    Console.WriteLine("riser.PiontsCount - {0}", riser.PiontsCount);
                    Console.WriteLine("riser.Status - {0}", riser.Status);
                    Console.WriteLine("riser.Temp - {0}", riser.Temp);
                    Console.WriteLine("riser.TimerLiveOn - {0}", riser.TimerLiveOn);
                    Console.WriteLine("riser.TimerOn - {0}", riser.TimerOn);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #2
0
 public IHttpActionResult GetReadTagOPCOfDIORisers()
 {
     try
     {
         List <DIORisers> list = client.ReadTagOPCOfDIORisers();
         if (list == null)
         {
             return(NotFound());
         }
         return(Ok(list));
     }
     catch (Exception e)
     {
         String.Format("Ошибка выполнения метода API:GetReadTagOPCOfDIORisers()").SaveError(e);
         return(NotFound());
     }
 }
Beispiel #3
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);
            }
        }