/// <summary>
 /// 判据封装类
 /// </summary>
 /// <param name="one">如果这个是空则说明是空判据</param>
 /// <param name="decision"></param>
 public DecisionWrap(DecisionRecord one, Decision decision)
 {
     // TODO: Complete member initialization
     this.one = one;
     this.decision = decision;
 }
        /// <summary>
        /// 通过记录找到判据
        /// </summary>
        /// <param name="one"></param>
        /// <param name="decisions"></param>
        /// <returns></returns>
        private Decision FindDecisionRecord(DecisionRecord one, IEnumerable<Decision> decisions)
        {
            var finded = decisions.FirstOrDefault(new Func<Decision, bool>(delegate(Decision dec)
            {
                if (dec.DecisionID == one.DecisionID)
                    return true;
                return false;
            }));

            return finded;
        }
Esempio n. 3
0
        public string ToDecisionDescriptionString(DecisionRecord record)
        {
            //   "左发排气温度=000℃>630℃,dT=00s≥1s"
            string template = this.DecisionDescriptionStringTemplate;// "@@T6L#=##T6L@℃>630℃,dT=##dT@s≥1s";
            if (string.IsNullOrEmpty(template))
                return record.ToString();
            //暂时只做单层算了
            foreach (var sub in this.Conditions)
            {
                string paramChar = string.Format("@@{0}#", sub.ParameterID);
                string paramValueChar = string.Format("##{0}@", sub.ParameterID);
                if (template.Contains(paramChar) && template.Contains(paramValueChar))
                {
                    template = template.Replace(paramChar, this.GetParameterCaption(sub.ParameterID));
                    template = template.Replace(paramValueChar, this.GetParameterValue(sub.ParameterValue));
                }
            }
            if (template.Contains("##dT@"))
                template = template.Replace("##dT@", Convert.ToString(record.EndSecond - record.StartSecond));

            return template;
        }
        /// <summary>
        /// 通过判据找到记录
        /// </summary>
        /// <param name="one"></param>
        /// <param name="decisionRecords"></param>
        /// <returns></returns>
        private DecisionRecord FindDecisionRecord(Decision one, DecisionRecord[] decisionRecords)
        {
            var finded = decisionRecords.FirstOrDefault(new Func<DecisionRecord, bool>(
                delegate(DecisionRecord rec)
                {
                    if (rec.DecisionID == one.DecisionID)
                        return true;
                    return false;
                }));

            return finded;
        }