/// <summary>
        /// 对ModuleConfig进行再处理,FormName不为空时则只对单个Form处理(例如,多表中对某张表进行查询)
        /// </summary>
        /// <param name="moduleConfig"></param>
        /// <returns></returns>
        private ModuleConfig AnalysisModule(ModuleConfig moduleConfig)
        {
            FormConfigs = moduleConfig.Forms.Where(a => a is FormConfig)
                          .Cast <FormConfig>()
                          .Where(a => IsSupportPage(a.SupportPage, this.PageStyle));
            MvcFormConfigs = moduleConfig.Forms.Where(a => a is MvcFormConfig) == null ? null :
                             moduleConfig.Forms.Where(a => a is MvcFormConfig).Cast <MvcFormConfig>();
            SeaFormConfigs = moduleConfig.Forms.Where(a => a is SeaFormConfig) == null ? null :
                             moduleConfig.Forms.Where(a => a is SeaFormConfig).Cast <SeaFormConfig>();

            ScriptFormConfigs = moduleConfig.Forms.Where(a => a is ScriptFormConfig) == null ? null :
                                moduleConfig.Forms.Where(a => a is ScriptFormConfig).Cast <ScriptFormConfig>();

            //if (moduleConfig.Mode == ModuleMode.MasterDetail)
            //{
            // AtawDebug.AssertArgumentNull(moduleConfig.Relations, "主从表必须配置Relation", this);
            //BasePageView.KeyValue = KeyValue;  //主从表修改时,主表主键需要传递给前台
            // }
            #region 非空属性赋值
            //Form配置中Name或TableName或Title可能没有值,此时需要赋值
            moduleConfig.Forms.ForEach(a =>
            {
                if (a is FormConfig)
                {
                    var form     = a as FormConfig;
                    var dataForm = form.File.InstanceByPage <DataFormConfig>(a.Name);

                    if (form.TableName.IsEmpty())
                    {
                        form.TableName = dataForm.TableName;
                    }
                    if (form.TableName.IsEmpty())
                    {
                        form.TableName = form.DataPlug.InstanceByPage <IListDataTable>(a.Name).RegName;
                    }
                    if (a.Name.IsEmpty())
                    {
                        a.Name = dataForm.Name;
                    }
                    if (a.Name.IsEmpty())
                    {
                        a.Name = form.TableName;
                    }
                    a.Width    = form.Width;
                    string msg = string.Format("数据源为{0}插件的form的名称不能为空", form.DataPlug);
                    AtawDebug.AssertNotNullOrEmpty(form.Name, msg, this);

                    if (a.Title.IsEmpty())
                    {
                        a.Title = dataForm.Title;
                    }
                    if (a.Title.IsEmpty())
                    {
                        a.Title = moduleConfig.Title;
                    }
                }
                if (a is MvcFormConfig)
                {
                    var mvcForm = a as MvcFormConfig;
                    AtawDebug.AssertNotNull(mvcForm.DataRoute, "MvcForm需要配置DataRoute", this);
                    var dataRoute = AtawAppContext.Current.MvcConfigXml.DataRoutes.FirstOrDefault(route => route.Name == mvcForm.DataRoute.Name);
                    if (dataRoute != null)
                    {
                        mvcForm.DataRoute.ActionName  = dataRoute.ActionName;
                        mvcForm.DataRoute.ControlName = dataRoute.ControlName;
                        mvcForm.DataRoute.AreaName    = dataRoute.AreaName;
                        mvcForm.DataRoute.NameSpace   = dataRoute.NameSpace;
                    }
                    else
                    {
                        if (mvcForm.DataRoute.ControlName.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.ControlName, "DataRoute的ControlName不能为空", this);
                        }
                        if (mvcForm.DataRoute.ActionName.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.ActionName, "DataRoute的ActionName不能为空", this);
                        }
                        if (mvcForm.DataRoute.AreaName.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.AreaName, "DataRoute的AreaName不能为空", this);
                        }
                        if (mvcForm.DataRoute.NameSpace.IsEmpty())
                        {
                            AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.NameSpace, "DataRoute的NameSpace不能为空", this);
                        }
                    }
                }
            });
            #endregion

            #region 主从表批量修改或显示明细时,现只针对主表操作
            if (PostDataSet != null && PostDataSet.Tables.Count > 0)
            {
                DataTable dt = PostDataSet.Tables["_KEY"];
                if (dt != null)
                {
                    if (dt.Rows.Count > 1)
                    {
                        moduleConfig.Mode = ModuleMode.Single;
                    }
                    //else if (dt.Rows.Count == 1)
                    //    BasePageView.KeyValue = dt.Rows[0][0].ToString();


                    var keyValueList = new List <string>();
                    foreach (DataRow row in dt.Rows)
                    {
                        string _key = row["KeyValue"].ToString();
                        keyValueList.Add(_key);
                    }
                    BasePageView.KeyValue = String.Join <string>(",", keyValueList);
                }
            }
            #endregion

            if (FormName.IsEmpty())
            {
                if (moduleConfig.Mode == ModuleMode.Single || moduleConfig.Mode == ModuleMode.MasterDetail ||
                    moduleConfig.Mode == ModuleMode.SingleToSingle)
                {
                    var form     = FormConfigs.FirstOrDefault(a => a.IsMainTable);
                    var mainForm = form == null?FormConfigs.FirstOrDefault() : form;  //若没有配置主表,则指定第一个为主表

                    mainForm.IsMainTable = true;
                    switch (PageStyle)
                    {
                    case PageStyle.List:
                        moduleConfig.Forms.Clear();
                        mainForm.HasSearch = true;
                        moduleConfig.Forms.Add(mainForm);
                        moduleConfig.HasReview = mainForm.HasReview;
                        break;

                    case PageStyle.Insert:
                    case PageStyle.Update:
                    case PageStyle.Review:
                    case PageStyle.Detail:
                        mainForm.FormType = FormType.Normal;
                        if (moduleConfig.Mode == ModuleMode.Single)
                        {
                            moduleConfig.Forms.Clear();
                            moduleConfig.Forms.Add(mainForm);
                            moduleConfig.HasReview = mainForm.HasReview;
                        }
                        else
                        {
                            //var detailForms = FormConfigs.Where(a => !a.IsMainTable);
                            //foreach (FormConfig item in detailForms)
                            //{
                            //    item.FormType = FormType.Grid;
                            //}
                        }
                        break;
                    }
                }
            }
            else
            {
                var form = moduleConfig.Forms.Find(a => a.Name == FormName);
                AtawDebug.AssertNotNull(form, string.Format(ObjectUtil.SysCulture, "请求的formname:  {0}不存在,请检查xml文件是否有问题", FormName), this);
                //var mainForm = form == null ? moduleConfig.Forms.First() : form;//若没有配置主表,则指定第一个为主表
                //if (PageStyle == PageStyle.Insert || PageStyle == PageStyle.Detail || PageStyle == PageStyle.Update)
                //{
                //    mainForm.FormType = FormType.Normal;
                //}
                //if (moduleConfig.Mode == ModuleMode.Single)
                //{
                moduleConfig.Forms.Clear();
                moduleConfig.Forms.Add(form);
                // }
            }

            return(moduleConfig);
        }