Exemplo n.º 1
0
        //Конструктор для чтения информации по параметру из рекордсета
        //rec - рекордсет с таблицей CalcParams, project - проект
        public CalcParam(Project project, IRecordRead rec, bool isSubParam)
        {
            Project = project;
            _logger = Project.ThreadCalc;
            try
            {
                Code          = rec.GetString("Code");
                Id            = rec.GetInt("CalcParamId");
                Name          = rec.GetString("Name");
                Units         = rec.GetString("Units");
                Comment       = rec.GetString("Comment");
                Interpolation = rec.GetString("InterpolationType").ToInterpolation();
                if (Interpolation == InterpolationType.None)
                {
                    Interpolation = project.Interpolation;
                }
                ExprString = rec.GetString("Expr");
                ResultType = rec.GetString("ResultType");
                Min        = rec.GetDoubleNull("Min");
                Max        = rec.GetDoubleNull("Max");
                DecPlaces  = rec.GetIntNull("DecPlaces");
                Tag        = rec.GetString("Tag");

                if (!isSubParam)
                {
                    CalcParamType = rec.GetString("CalcParamType").ToCalcParamType();
                    if (CalcParamType != CalcParamType.Class)
                    {
                        HandInputValue = new Moment(CalcParamType.HandDataType(), rec.GetString("DefaultValue"));
                    }
                    Task       = rec.GetString("Task");
                    CodeSignal = rec.GetString("CodeSignal");
                }

                //Архив
                SuperProcess = rec.GetString("SuperProcessType").ToSuperProcess();

                //Приемник
                var rcode = rec.GetString("ReceiverCode");
                if (Project.SignalsReceivers.ContainsKey(rcode))
                {
                    ReceiverSignal = Project.SignalsReceivers[rcode].ReceiverSignal;
                }

                if (!rec.GetString("ErrMess").IsEmpty())
                {
                    _logger.AddError("Список расчетных параметров содержит ошибки компиляции", null, "Параметр=" + Code);
                }
            }
            catch (Exception ex)
            {
                AddLog(ex);
            }
        }