public ActionResult CreateAosTable()
        {
            //string plmName = this["platform"];
            string tabName = this["table"];

            if (tabName != "AosObjects")
            {
                using (dpz.Gdbc.Connection dbc = new dpz.Gdbc.Connection(site.Config.Database.Aos)) {
                    if (!dbc.CheckTable("AosObjects"))
                    {
                        return(JsonContent(0, $"请在安装{tabName}表前先安装AosObjects表"));
                    }
                }
            }

            string tabVersion = "";
            string xmlSetting = dpz.Net.Http.GetUTF8($"{site.Config.Orm.XmlUrl}/Setting.xml");

            using (dpz.Data.Xml xml = new dpz.Data.Xml(xmlSetting)) {
                var xmlDB    = xml["database"];
                var xmlAos   = xmlDB.GetNodeByAttrValue("name", "Aos", false);
                var xmlTable = xmlAos.GetNodeByAttrValue("name", tabName, false);
                tabVersion = xmlTable.Attr["version"];
            }

            string xmlString = dpz.Net.Http.GetUTF8($"{site.Config.Orm.XmlUrl}/Aos/{tabName}.xml");

            if (xmlString == "")
            {
                return(JsonContent(0, "配置获取失败,请检查表名称是否存在"));
            }

            using (dpz.Gdbc.Connection dbc = new dpz.Gdbc.Connection(site.Config.Database.Aos)) {
                //string sql = "";

                using (dpz.Data.Xml xml = new dpz.Data.Xml(xmlString)) {
                    var xmlTable = xml["table"];

                    //判断表是否存在
                    if (!dbc.CheckTable(tabName))
                    {
                        List <dpz.Gdbc.TableFieldDefine> fields = new List <dpz.Gdbc.TableFieldDefine>();

                        foreach (var xmlField in xmlTable.Nodes)
                        {
                            if (xmlField.Name.ToLower() == "field")
                            {
                                string fieldName      = xmlField.Attr["name"];
                                var    xmlData        = xmlField["data"];
                                string fieldDataType  = xmlData.Attr["type"].ToLower();
                                int    fieldDataSize  = xmlData.Attr["size"].ToInteger();
                                int    fieldDataFloat = xmlData.Attr["float"].ToInteger();

                                var field = new dpz.Gdbc.TableFieldDefine();
                                field.Name  = fieldName;
                                field.Type  = fieldDataType;
                                field.Size  = fieldDataSize;
                                field.Float = fieldDataFloat;
                                fields.Add(field);
                            }
                        }

                        dbc.CreateTable(tabName, fields);
                    }
                    else
                    {
                        //更新字段
                        foreach (var xmlField in xmlTable.Nodes)
                        {
                            if (xmlField.Name.ToLower() == "field")
                            {
                                string fieldName      = xmlField.Attr["name"];
                                var    xmlData        = xmlField["data"];
                                string fieldDataType  = xmlData.Attr["type"].ToLower();
                                int    fieldDataSize  = xmlData.Attr["size"].ToInteger();
                                int    fieldDataFloat = xmlData.Attr["float"].ToInteger();

                                dpz.Gdbc.TableFieldDefine fieldDefine = new dpz.Gdbc.TableFieldDefine()
                                {
                                    Name  = fieldName,
                                    Type  = fieldDataType,
                                    Size  = fieldDataSize,
                                    Float = fieldDataFloat
                                };

                                if (!dbc.CheckTableFiled(tabName, fieldName))
                                {
                                    dbc.AddTableFiled(tabName, fieldDefine);
                                }
                                else
                                {
                                    dbc.UpdateTableFiled(tabName, fieldName, fieldDefine);
                                }
                            }
                        }
                    }

                    //更新表格结构信息
                    if (dbc.GetGdmlOne($"@{{$[AosObjects]&[Name=='{tabName}']}}").IsEmpty)
                    {
                        dbc.ExecGdml($"+{{$[AosObjects].[Name='{tabName}'].[Version='{tabVersion}']}}");
                    }
                    else
                    {
                        dbc.ExecGdml($"!{{$[AosObjects].[Version='{tabVersion}']&[Name=='{tabName}']}}");
                    }

                    JResponse["Version"] = tabVersion;
                }
            }

            return(JsonContent(1));
        }
        public ActionResult CreateManageTable()
        {
            string plmName = this["platform"];
            string tabName = this["table"];

            if (tabName != "SystemObjects")
            {
                using (dpz.Gdbc.Connection dbc = new dpz.Gdbc.Connection(site.Config.Database.Manage)) {
                    if (!dbc.CheckTable("SystemObjects"))
                    {
                        return(JsonContent(0, $"请先安装SystemObjects表"));
                    }
                }
            }

            string tabVersion = "";
            string xmlSetting = dpz.Net.Http.GetUTF8($"{site.Config.Orm.XmlUrl}/Setting.xml");

            using (dpz.Data.Xml xml = new dpz.Data.Xml(xmlSetting)) {
                var xmlDB    = xml["database"];
                var xmlAos   = xmlDB.GetNodeByAttrValue("name", plmName, false);
                var xmlTable = xmlAos.GetNodeByAttrValue("name", tabName, false);
                tabVersion = xmlTable.Attr["version"];
            }

            string xmlString = dpz.Net.Http.GetUTF8($"{site.Config.Orm.XmlUrl}/{plmName}/{tabName}.xml");

            if (xmlString == "")
            {
                return(JsonContent(0, "配置获取失败,请检查表名称是否存在"));
            }

            using (dpz.Gdbc.Connection dbc = new dpz.Gdbc.Connection(site.Config.Database.Manage)) {
                string sql = "";

                using (dpz.Data.Xml xml = new dpz.Data.Xml(xmlString)) {
                    var xmlTable = xml["table"];

                    //判断表是否存在
                    //if (!dbc.GetOne($"Select * From sysObjects Where Name ='{tabName}' And Type In ('S','U')").HasData) {
                    if (!dbc.CheckTable(tabName))
                    {
                        //添加表
                        List <dpz.Gdbc.TableFieldDefine> fields = new List <dpz.Gdbc.TableFieldDefine>();

                        foreach (var xmlField in xmlTable.Nodes)
                        {
                            if (xmlField.Name.ToLower() == "field")
                            {
                                string fieldName      = xmlField.Attr["name"];
                                var    xmlData        = xmlField["data"];
                                string fieldDataType  = xmlData.Attr["type"].ToLower();
                                int    fieldDataSize  = xmlData.Attr["size"].ToInteger();
                                int    fieldDataFloat = xmlData.Attr["float"].ToInteger();

                                var field = new dpz.Gdbc.TableFieldDefine();
                                field.Name  = fieldName;
                                field.Type  = fieldDataType;
                                field.Size  = fieldDataSize;
                                field.Float = fieldDataFloat;
                                fields.Add(field);
                            }
                        }

                        dbc.CreateTable(tabName, fields);
                    }
                    else
                    {
                        //更新字段
                        foreach (var xmlField in xmlTable.Nodes)
                        {
                            if (xmlField.Name.ToLower() == "field")
                            {
                                string fieldName      = xmlField.Attr["name"];
                                var    xmlData        = xmlField["data"];
                                string fieldDataType  = xmlData.Attr["type"].ToLower();
                                int    fieldDataSize  = xmlData.Attr["size"].ToInteger();
                                int    fieldDataFloat = xmlData.Attr["float"].ToInteger();

                                dpz.Gdbc.TableFieldDefine fieldDefine = new dpz.Gdbc.TableFieldDefine()
                                {
                                    Name  = fieldName,
                                    Type  = fieldDataType,
                                    Size  = fieldDataSize,
                                    Float = fieldDataFloat
                                };

                                if (!dbc.CheckTableFiled(tabName, fieldName))
                                {
                                    dbc.AddTableFiled(tabName, fieldDefine);
                                }
                                else
                                {
                                    dbc.UpdateTableFiled(tabName, fieldName, fieldDefine);
                                }
                            }
                        }
                    }

                    //更新表格结构信息
                    if (dbc.GetGdmlOne($"@{{$[SystemObjects]&[Name=='{tabName}'&&Type=='Table']}}").IsEmpty)
                    {
                        string guid = "";
                        do
                        {
                            guid = Guid.NewGuid().ToString();
                        } while (!dbc.GetGdmlOne($"@{{$[SystemObjects]&[Guid=='{guid}']}}").IsEmpty);

                        dbc.ExecGdml($"+{{$[SystemObjects].[Name='{tabName}'].[Type='Table'].[Version='{tabVersion}'].[Guid='{guid}']}}");
                    }
                    else
                    {
                        dbc.ExecGdml($"!{{$[SystemObjects].[Version='{tabVersion}']&[Name=='{tabName}'&&Type=='Table']}}");
                    }

                    JResponse["Version"] = tabVersion;
                }
            }

            return(JsonContent(1));
        }