/// <summary>
        /// 验证公式
        /// </summary>
        /// <param name="Formula"></param>
        /// <param name="SchemaCode">流程模板编码</param>
        /// <param name="RuleCode"></param>
        /// <returns></returns>
        public JsonResult Validate(string Formula, string SchemaCode, string RuleCode)
        {
            return(ExecuteFunctionRun(() =>
            {
                //校验结果
                ActionResult result = new ActionResult(true, "");

                Formula = Server.HtmlDecode(Formula);
                //错误项
                string[] errorItems = null;
                //错误信息
                List <string> Errors = new List <string>();

                if (!string.IsNullOrEmpty(Formula))
                {
                    // 所有数据项的名称
                    Dictionary <string, string> formulaItemNames = new Dictionary <string, string>();
                    string formulaId = Guid.NewGuid().ToString();
                    formulaItemNames.Add(formulaId, Formula);

                    //所有项名称:数据项、流程关键字
                    List <string> allItemNames = new List <string>();

                    //流程关键字
                    string[] words = OThinker.H3.Instance.Keywords.ParserFactory.GetKeywords();
                    allItemNames.AddRange(words);

                    //业务模型数据项
                    //string SchemaCode = CurrentParams[ConstantString.Param_SchemaCode];
                    if (!string.IsNullOrEmpty(SchemaCode))
                    {
                        DataModel.BizObjectSchema Schema = this.Engine.BizObjectManager.GetDraftSchema(SchemaCode);
                        //如果一个流程包含有多个流程模板的时候,需要重新计算一下shcema
                        if (Schema == null)
                        {
                            WorkflowTemplate.WorkflowClause clause = this.Engine.WorkflowManager.GetClause(SchemaCode);
                            if (clause != null)
                            {
                                Schema = this.Engine.BizObjectManager.GetDraftSchema(clause.BizSchemaCode);
                            }
                        }
                        if (Schema != null)
                        {
                            if (Schema.IsQuotePacket)
                            {
                                Schema = this.Engine.BizObjectManager.GetDraftSchema(Schema.BindPacket);
                            }
                            foreach (DataModel.PropertySchema item in Schema.Properties)
                            {
                                allItemNames.Add(item.Name);
                            }
                        }
                    }

                    //string RuleCode = CurrentContext.Request[ConstantString.Param_RuleCode];
                    // 业务规则数据项
                    if (!string.IsNullOrEmpty(RuleCode))
                    {
                        OThinker.H3.BizBus.BizRule.BizRuleTable rule = this.Engine.BizBus.GetBizRule(RuleCode);
                        if (rule != null)
                        {
                            if (rule.DataElements != null)
                            {
                                foreach (OThinker.H3.BizBus.BizRule.BizRuleDataElement RuleElement in rule.DataElements)
                                {
                                    allItemNames.Add(RuleElement.ElementName);
                                }
                            }
                        }
                    }

                    Function[] fs = FunctionFactory.Create(this.Engine.Organization, this.Engine.BizBus);
                    Dictionary <string, Function> fDic = new Dictionary <string, Function>();
                    if (fs != null)
                    {
                        foreach (OThinker.H3.Math.Function f in fs)
                        {
                            fDic.Add(f.FunctionName, f);
                        }
                    }

                    result.Success = FormulaParser.Validate(Formula, fDic, allItemNames, ref Errors);

                    result.Message = string.Join(";", Errors);
                }
                return Json(result, JsonRequestBehavior.AllowGet);
            }));
        }