Ejemplo n.º 1
0
        public static List <string> CheckLayer(LayerArgs lyrArgs, DicInfoReader dicInfo)
        {
            List <string> rlts      = new List <string>();
            TxLayerInfo   txLyrInfo = dicInfo.TxLyrList.First(t => t.DataLayer == lyrArgs.DataLayer); //t.TxName == lyrArgs.TxName && t.TjName == lyrArgs.TjName && t.LayerName == lyrArgs.LayerName && t.DataLayer == lyrArgs.DataLayer);
            //List<LayerAttInfo> attInfoList = dicInfo.LyrAttList.Where(t => t.TxName == txLyrInfo.TxName).Where(t => t.TjName == txLyrInfo.TjName).Where(t => t.LayerName == txLyrInfo.LayerName).ToList();
            List <LayerAttInfo> attInfoList = dicInfo.LyrAttList.Where(t => t.DataLayer == txLyrInfo.DataLayer).ToList();
            DataTable           tbl         = ShpUtility.GetRecords(lyrArgs.LayerPath, null);

            // 检查列名是否有特殊字符
            for (int i = 0; i < tbl.Columns.Count; i++)
            {
                if (tbl.Columns[i].ColumnName.IndexOf('?') != -1)
                {
                    string info = string.Format("数据检查:列名长度不符合ArcGIS规范:{0}", tbl.Columns[i].ColumnName);
                    rlts.Add(info);
                }
            }

            //检查字段及名称是否齐全
            List <string> logs = CheckFiledNums(tbl, attInfoList);

            if (logs != null && logs.Count > 0)
            {
                rlts.AddRange(logs);
            }
            //检查字段值是否溢出(超过限定长度或不在给定阈值范围)
            logs = CheckFiledValueRange(tbl, attInfoList);
            if (logs != null && logs.Count > 0)
            {
                rlts.AddRange(logs);
            }
            //检查字段字典项
            for (int i = 0; i < attInfoList.Count; i++)
            {
                LayerAttInfo lyrAtt = attInfoList[i];
                logs = CheckDicAtt(tbl, lyrAtt, dicInfo);
                if (logs != null && logs.Count > 0)
                {
                    rlts.AddRange(logs);
                }
            }
            return(rlts);
        }
Ejemplo n.º 2
0
        private void GetData()
        {
            InfoEarthFrame.Data.IDatabase DBAccess = InfoEarthFrame.Data.Factory.GetDBAccess(ConfigurationManager.ConnectionStrings["Default"].ConnectionString, InfoEarthFrame.Data.AccessDBType.Oracle);

            _txLyrList.Clear();
            _lyrAttList.Clear();
            _attValueList.Clear();

            //图系图层信息
            //string sqlStr = "select trim(GUID) as GUID,trim(TXNAME) AS TXNAME,trim(TJNAME) AS TJNAME ,trim(LAYERNAME) AS LAYERNAME,trim(JHTZ) AS JHTZ from DIC_TX_LAYER order by SERIALNUM";
            string  sqlStr  = "select  Max(\"Id\") as GUID,\"TXName\",\"TJName\" ,\"LayerName\", \"DataLayer\" from DIC_TX_LAYERPROPERTY  group by \"TXName\",\"TJName\" ,\"LayerName\", \"DataLayer\"";
            DataSet dataset = DBAccess.GetDataSetFromExcuteCommand(sqlStr, null);

            if (dataset != null && dataset.Tables.Count > 0)
            {
                DataTable tbl = dataset.Tables[0];
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    TxLayerInfo info = new TxLayerInfo()
                    {
                        Guid      = tbl.Rows[i]["GUID"] as string,
                        TxName    = tbl.Rows[i]["TXNAME"] as string,
                        TjName    = tbl.Rows[i]["TJNAME"] as string,
                        LayerName = tbl.Rows[i]["LAYERNAME"] as string,
                        DataLayer = tbl.Rows[i]["DataLayer"] as string,
                        GeoType   = "",//tbl.Rows[i]["JHTZ"] as string,
                    };
                    _txLyrList.Add(info);
                }
            }
            //图层属性信息
            //sqlStr = "select trim(GUID) as GUID,trim(LAYERID) AS LAYERID,trim(DATANAME) AS DATANAME ,trim(DATACODE) AS DATACODE,trim(DES) AS DES,trim(DATATYPE) AS DATATYPE,trim(CONSTRAINT) AS CONSTRAINT,trim(VALUETYPE) AS VALUETYPE,trim(UNIT) AS UNIT,trim(MEMO) AS MEMO from DIC_TX_LAYERPROPERTY order by LAYERID";
            sqlStr  = "select  \"Id\" as GUID,\"TXName\",\"TJName\" ,\"LayerName\",trim(\"FieldName\") AS DATANAME, trim(\"InputControl\") AS INPUTCONTROL, trim(\"DataLayer\") as DATALAYER ,trim(\"FieldCode\") AS DATACODE ,\"FieldType\", \"FieldLen\",\"FieldDec\",trim(\"InputControl\") AS CONSTRAINT from DIC_TX_LAYERPROPERTY";
            dataset = DBAccess.GetDataSetFromExcuteCommand(sqlStr, null);
            if (dataset != null && dataset.Tables.Count > 0)
            {
                DataTable tbl = dataset.Tables[0];
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    LayerAttInfo info = new LayerAttInfo()
                    {
                        Guid         = tbl.Rows[i]["GUID"] as string,
                        TxName       = tbl.Rows[i]["TXName"] as string,
                        TjName       = tbl.Rows[i]["TJName"] as string,
                        LayerName    = tbl.Rows[i]["LayerName"] as string,
                        DataName     = tbl.Rows[i]["DATANAME"] as string,
                        DataCode     = tbl.Rows[i]["DATACODE"] as string,
                        Des          = "",                           //tbl.Rows[i]["DES"] as string,
                        DataLayer    = tbl.Rows[i]["DATALAYER"] as string,
                        DataType     = ConvertDataType(tbl.Rows[i]), //tbl.Rows[i]["DATATYPE"] as string,
                        Constraint   = tbl.Rows[i]["CONSTRAINT"] as string,
                        ValueType    = "自由文本",                       //tbl.Rows[i]["VALUETYPE"] as string,
                        Unit         = "/",                          //tbl.Rows[i]["U_NAME"] as string,
                        Memo         = "/",                          //tbl.Rows[i]["MEMO"] as string,
                        InputControl = tbl.Rows[i]["INPUTCONTROL"] as string,
                    };
                    _lyrAttList.Add(info);
                }
            }
            //字典项字段信息
            //sqlStr = "select trim(GUID) as GUID,trim(PROPERTYID) AS PROPERTYID,trim(VALUE) AS VALUE ,trim(MEMO) AS MEMO,trim(PARENTPROPERTYID) AS PARENTPROPERTYID from DIC_TX_PROPERTYVALUE";
            sqlStr  = "select trim(\"Id\") as GUID, trim(\"FieldValue\") AS VALUE from DIC_TX_PROPERTYVALUE";
            dataset = DBAccess.GetDataSetFromExcuteCommand(sqlStr, null);
            if (dataset != null && dataset.Tables.Count > 0)
            {
                DataTable tbl = dataset.Tables[0];
                for (int i = 0; i < tbl.Rows.Count; i++)
                {
                    AttValueInfo info = new AttValueInfo()
                    {
                        Guid     = tbl.Rows[i]["GUID"] as string,
                        AttId    = "", //tbl.Rows[i]["PROPERTYID"] as string,
                        Value    = tbl.Rows[i]["VALUE"] as string,
                        Memo     = "", //tbl.Rows[i]["MEMO"] as string,
                        ParentId = "", //tbl.Rows[i]["PARENTPROPERTYID"] as string
                    };
                    _attValueList.Add(info);
                }
            }
        }