Exemple #1
0
        /// <summary>
        /// 检查宗地图
        /// </summary>
        /// <param name="jsyd"></param>
        /// <param name="entitys">图框内的所有实体</param>
        internal static void CheckZDT(Jsyd jsyd, Autodesk.AutoCAD.DatabaseServices.DBObjectCollection entitys)
        {
            Utils  utils     = new Utils();
            string layerName = "宗地图检查错误";

            foreach (DBObject dBObject in entitys)
            {
                if (dBObject is DBText)
                {
                    DBText  dBText2 = (DBText)dBObject;
                    string  text    = dBText2.TextString;
                    Point3d pt      = dBText2.Position;
                    if (text.Contains("宗地面积"))
                    {
                        if (jsyd.Zdmj != GetArea(text))
                        {
                            utils.CreateCircle(pt, 1, layerName);
                        }
                    }
                    else if (text.Contains("-"))//地籍图号
                    {
                        if (text != jsyd.TFH)
                        {
                            utils.CreateCircle(pt, 1, layerName);
                        }
                    }
                    else if (text.Contains("宅基地面积"))
                    {
                        if (jsyd.Syqmj != GetArea2(text))
                        {
                            utils.CreateCircle(pt, 1, layerName);
                        }
                    }
                    else if (text.Contains("建设用地面积"))
                    {
                        if (jsyd.Czmj != GetArea2(text))
                        {
                            utils.CreateCircle(pt, 1, layerName);
                        }
                    }
                    else if (text.Contains("土地权利人"))
                    {
                        if (!text.Contains("、"))
                        {
                            text = text.Replace("土地权利人:", "").Replace("(户)", "").Replace("(户)", "").Trim();
                            if (jsyd.QLRMC != text)
                            {
                                utils.CreateCircle(pt, 1, layerName);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// excel 转换为 jsyd
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static IList <Jsyd> ReadExcel(string path)
        {
            IRow         row;
            ICell        cell;
            IList <Jsyd> list = new List <Jsyd>();

            if (!File.Exists(path))
            {
                return(list);
            }
            ISheet sheet = ExcelRead.ReadExcelSheet(path, 0);

            for (int a = 4; a <= sheet.LastRowNum; a++)//减去一行,有合计
            {
                row = sheet.GetRow(a);

                string zdnum = row.GetCell(1).StringCellValue;
                if (zdnum != null && zdnum.Length == 19)
                {
                    Jsyd jsyd = new Jsyd();
                    jsyd.Zdnum   = zdnum;
                    jsyd.QLRMC   = GetStringValue(row.GetCell(3));
                    jsyd.Zdmj    = GetDobleValue(row.GetCell(30));
                    jsyd.Syqmj   = GetDobleValue(row.GetCell(31));
                    jsyd.Czmj    = GetDobleValue(row.GetCell(34));
                    jsyd.JZZDZMJ = GetDobleValue(row.GetCell(34));
                    jsyd.TFH     = GetStringValue(row.GetCell(28));
                    list.Add(jsyd);
                }
                else
                {
                    return(list);
                }
                //如果是合计,直接退出
            }
            return(list);
        }
Exemple #3
0
        internal static Dictionary <string, Jsyd> ExcelToJsyd(string path)
        {
            Dictionary <string, Jsyd> dictionary = new Dictionary <string, Jsyd>();
            IWorkbook workbook = ExcelRead.ReadExcel(path);
            ISheet    sheetAt  = workbook.GetSheetAt(0);

            for (int i = 4; i <= sheetAt.LastRowNum; i++)
            {
                Jsyd jsyd = new Jsyd();
                IRow row  = sheetAt.GetRow(i);
                if (row != null)
                {
                    for (int j = 0; j < 50; j++)
                    {
                        ICell cell = row.GetCell(j);
                        if (cell != null && cell.CellType != CellType.Blank)
                        {
                            cell.SetCellType(CellType.String);
                            string text = cell.StringCellValue.Trim();
                            int    num  = j;
                            if (num != 1)
                            {
                                switch (num)
                                {
                                case 30:
                                {
                                    double num2;
                                    if (double.TryParse(text, out num2))
                                    {
                                        jsyd.Zdmj = num2;
                                    }
                                    break;
                                }

                                case 31:
                                {
                                    double num2;
                                    if (double.TryParse(text, out num2))
                                    {
                                        jsyd.Syqmj = num2;
                                    }
                                    break;
                                }

                                case 34:
                                {
                                    double num2;
                                    if (double.TryParse(text, out num2))
                                    {
                                        jsyd.Czmj = num2;
                                    }
                                    break;
                                }
                                }
                            }
                            else
                            {
                                jsyd.Zdnum = text;
                                if (text.Length == 19)
                                {
                                    dictionary.Add(text, jsyd);
                                }
                            }
                        }
                    }
                }
            }
            return(dictionary);
        }