//Конструктор для чтения информации по параметру из рекордсета //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); } }
public ArchiveParam(IRecordRead rec) { FullCode = rec.GetString("Code"); var codep = rec.GetString("CodeParam"); bool hasSubParams = FullCode.ToLower() != codep.ToLower(); if (hasSubParams) { CodeSubParam = FullCode.Substring(codep.Length + 1); } DataType = rec.GetString("DataType").ToDataType(); Units = rec.GetString("Units"); SuperProcess = rec.GetString("SuperProcessType").ToSuperProcess(); DecPlaces = rec.GetIntNull("DecPlaces"); Min = rec.GetDoubleNull("Min"); Max = rec.GetDoubleNull("Max"); FirstParam = new CalcParamBase(rec.GetString("CodeParam"), rec.GetString("Name"), rec.GetString("Comment"), rec.GetString("Task"), rec.GetString("CalcParamType").ToCalcParamType(), rec.GetString("Tag")); if (hasSubParams) { LastParam = new CalcParamBase(CodeSubParam, rec.GetString("SubName"), rec.GetString("SubComment")); } }
//Чтение значений по одному выходу из рекордсета источника и добавление их в список или клон //Возвращает количество сформированных значений protected override int ReadMoments(IRecordRead rec) { double?fValue = rec.GetDoubleNull("F_VALUE"); int? rawValue = rec.GetIntNull("RAW_VALUE"); int? sts = rec.GetIntNull("STS"); var time = ReadTime(rec); double mean = (fValue ?? rawValue) ?? 0; int nwrite = 0; if (sts != null) { nwrite = AddMom(StateSignal, time, sts); } return(nwrite + AddMom(ValueSignal, time, mean, ReadError(fValue, rawValue, sts))); }
public CalcParamArchive(IRecordRead rec, Project project) { FirstParam = project.CalcParamsId[rec.GetInt("CalcParamId")]; int sid = rec.GetInt("CalcSubParamId"); LastParam = project.CalcSubParamsId[sid]; DataType = rec.GetString("DataType").ToDataType(); ArchiveParam = new ArchiveParam(rec.GetString("FullCode"), DataType, rec.GetString("Units"), FirstParam, LastParam, rec.GetString("SuperProcessType").ToSuperProcess(), rec.GetInt("DecPlaces", -1), rec.GetDoubleNull("Min"), rec.GetDoubleNull("Max")); //ab 12.04.2019 в Min и Max было rec.GetDouble _saveAbsolute = ArchiveParam.SuperProcess.IsAbsolute(); _savePeriodic = ArchiveParam.SuperProcess.IsPeriodic(); }