protected override bool Execute(CodeActivityContext context)
        {
            if (TIList.Get(context) == null)
            {
                Error.Set(context, "Не определен список идентификаторов ТИ");
                return(false);
            }

            List <int> InList = TIList.Get(context);

            if (InList.Count == 0)
            {
                Error.Set(context, "Список идентификаторов ТИ не должен быть пустым");
                return(false);
            }

            if (TechParamTypes == null || TechParamTypes.Count == 0)
            {
                Error.Set(context, "Список параметров мгновенных значений не должен быть пустым");
                return(false);
            }

            if (RequestType == enumEnrgyQualityRequestType.Archive)
            {
                if (ServerFromLook.Get(context) == null || ServerToLook.Get(context) == null)
                {
                    Error.Set(context, "Для архивных значений начальная и конечная дата должна быть определена");
                    return(false);
                }
            }

            try
            {
                var dt  = ServerFromLook.Get(context);
                var tis = InList.ToDictionary(k => k, v => dt);

                var res = ARM_Service.DS_GetArchTech_Quality_LastValues(tis, ServerToLook.Get(context), TechParamTypes, false);
                if (res != null)
                {
                    if (res.Errors != null)
                    {
                        Error.Set(context, res.Errors);
                    }

                    Values.Set(context, res.LastValues);
                }
            }
            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Пример #2
0
        protected override bool Execute(CodeActivityContext context)
        {
            if (TIList.Get(context) == null)
            {
                Error.Set(context, "Не определен список идентификаторов ТИ");
                return(false);
            }

            var inList = TIList.Get(context);

            if (inList.Count == 0)
            {
                Error.Set(context, "Список идентификаторов ТИ не должен быть пустым");
                return(false);
            }

            var result = new List <EventsJournalTI>();

            try
            {
                var res = ARM_Service.JTI_GetAllTIJournals(inList, StartDateTime.Get(context), EndDateTime.Get(context));
                if (res != null)
                {
                    foreach (var jti in res)
                    {
                        result.Add(new EventsJournalTI
                        {
                            TI_ID                   = jti.TI_ID,
                            EventDateTime           = jti.EventDateTime,
                            EventCode               = jti.EventCode,
                            DispatchDateTime        = jti.DispatchDateTime,
                            ExtendedEventCode       = jti.ExtendedEventCode,
                            Event61968Domain_ID     = jti.Event61968Domain_ID,
                            Event61968DomainPart_ID = jti.Event61968DomainPart_ID,
                            Event61968Type_ID       = jti.Event61968Type_ID,
                            Event61968Index_ID      = jti.Event61968Index_ID,
                            Event61968Param         = jti.Event61968Param
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            EventsJournal.Set(context, result);
            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Пример #3
0
        protected override bool Execute(CodeActivityContext context)
        {
            DataTable TempTable = null;
            string    sql       = @"set nocount on;set transaction isolation level read uncommitted;select TI_ID from  Info_Meters_TO_TI join Hard_MetersUSPD_Links on Hard_MetersUSPD_Links.METER_ID=Info_Meters_TO_TI.METER_ID where USPD_ID=" + USPD_ID.Get(context);

            try
            {
                var serverData = ARM_Service.REP_Query_Report(
                    sql, new List <QueryParameter>());

                if (!string.IsNullOrEmpty(serverData.Value))
                {
                    Error.Set(context, serverData.Value);
                }
                else if (serverData.Key != null)
                {
                    TempTable = serverData.Key;

                    var result = new List <int>();
                    foreach (DataRow r in TempTable.Rows)
                    {
                        if (r.ItemArray != null && r.ItemArray.Length > 0)
                        {
                            result.Add((int)r.ItemArray[0]);
                        }
                    }
                    TIList.Set(context, result);
                }
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }