private void Bulk_Import_Crossing(string[] fileArray)
        {
            if (fileArray == null || fileArray.Length == 0)
            {
                return;
            }
            try
            {
                //定义一个开始时间
                DateTime    startTime   = DateTime.Now;
                int         nCount      = 0;
                CoordCovert dataConvert = new CoordCovert();

                for (int i = 0; i < fileArray.Length; i++)
                {
                    string fileName = fileArray[i];
                    //因为文件比较大,所有使用StreamReader的效率要比使用File.ReadLines高
                    using (StreamReader sr = new StreamReader(fileName, Encoding.Default))
                    {
                        while (!sr.EndOfStream)
                        {
                            string   readStr = sr.ReadLine();                                                                  //读取一行数据
                            string[] strs    = readStr.Split(new char[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries); //将读取的字符串按"制表符/t“和”“分割成数组

                            string jkqd    = "";                                                                               //区段
                            string xhcgtjl = "";                                                                               //距小号塔距离
                            string wd      = "";                                                                               //纬度
                            string jd      = "";                                                                               //经度
                            string gc      = "";                                                                               //高程
                            string wxdmc   = "";                                                                               //危险点名称
                            string spjl    = "";                                                                               //水平距离
                            string czjl    = "";                                                                               //垂直距离
                            string kjjl    = "";                                                                               //空间距离
                            string ddjl    = "";                                                                               //对地距离
                            string version = "";                                                                               //数据版本

                            string line_jd = "";                                                                               //导线点经度
                            string line_wd = "";                                                                               //导线点维度
                            string line_gc = "";                                                                               //导线点高程

                            if (strs.Length == 8)                                                                              //缺高程、空间距离、对地距离
                            {
                                jkqd    = strs[1];                                                                             //区段
                                xhcgtjl = strs[2];                                                                             //距小号塔距离
                                wd      = strs[3];                                                                             //纬度
                                jd      = strs[4];                                                                             //经度
                                gc      = "null";                                                                              //高程
                                wxdmc   = strs[5];                                                                             //危险点名称
                                spjl    = strs[6];                                                                             //水平距离
                                czjl    = strs[7];                                                                             //垂直距离
                            }
                            else if (strs.Length == 9)                                                                         //缺空间距离、对地距离
                            {
                                jkqd    = strs[1];                                                                             //区段
                                xhcgtjl = strs[2];                                                                             //距小号塔距离
                                wd      = strs[3];                                                                             //纬度
                                jd      = strs[4];                                                                             //经度
                                gc      = strs[5];                                                                             //高程
                                wxdmc   = strs[6];                                                                             //危险点名称
                                spjl    = strs[7];                                                                             //水平距离
                                czjl    = strs[8];                                                                             //垂直距离
                            }
                            else if (strs.Length == 10)                                                                        //缺对地距离
                            {
                                jkqd    = strs[1];                                                                             //区段
                                xhcgtjl = strs[2];                                                                             //距小号塔距离
                                wd      = strs[3];                                                                             //纬度
                                jd      = strs[4];                                                                             //经度
                                gc      = strs[5];                                                                             //高程
                                wxdmc   = strs[6];                                                                             //危险点名称
                                spjl    = strs[7];                                                                             //水平距离
                                czjl    = strs[8];                                                                             //垂直距离
                                kjjl    = strs[9];                                                                             //空间距离
                                //jkjl = "null"; //对地距离
                            }
                            else if (strs.Length == 11)
                            {
                                jkqd    = strs[1]; //区段
                                xhcgtjl = strs[2]; //距小号塔距离
                                wd      = strs[3]; //纬度
                                jd      = strs[4]; //经度
                                gc      = strs[5]; //高程
                                wxdmc   = strs[6]; //危险点名称
                                spjl    = strs[7]; //水平距离
                                czjl    = strs[8]; //垂直距离
                                kjjl    = strs[9]; //空间距离
                                //jkjl = strs[10]; //对地距离
                            }
                            else if (strs.Length == 17)
                            {
                                jkqd    = strs[1]; //区段
                                xhcgtjl = strs[2]; //距小号塔距离
                                wd      = strs[3]; //纬度
                                jd      = strs[4]; //经度
                                gc      = strs[5]; //高程
                                wxdmc   = strs[6]; //危险点名称
                                spjl    = strs[7]; //水平距离
                                czjl    = strs[8]; //垂直距离
                                kjjl    = strs[9]; //空间距离
                                //jkjl = strs[10]; //对地距离

                                line_jd = strs[12];
                                line_wd = strs[13];
                                line_gc = strs[14];
                            }
                            else
                            {
                                continue;
                            }

                            string qsh = "";
                            if (jkqd.Length > 0)
                            {
                                string[] arr = jkqd.Split(new char[] { ')' });
                                qsh = arr[0].Substring(1);
                            }
                            txtStart.Text = qsh;

                            //有重复的不插入
                            //string sql = string.Format("select * from t_poles where name='{0}'", TGH + "#");
                            //if (DbHelper.Count(CommandType.Text, sql, null) >= 1)
                            //    continue;
                            version = dtVersion.Value.Year.ToString();

                            string cmdText = string.Format("insert into r_crosses(XLID,XLMC,NAME,JKLX,JKQD,XHCGT,XHCGTJL,SPJL,CZJL,KJJL,JD,WD,GC,VERSION,LINE_JD,LINE_WD,LINE_GC) " +
                                                           "values({0},'{1}','{2}','{3}','{4}','{5}',{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16})", xlid, xlmc, wxdmc,
                                                           wxdmc, jkqd, qsh, xhcgtjl, spjl, czjl, kjjl, jd, wd, gc, version, line_jd, line_wd, line_gc);

                            //交跨
                            //string cmdText = string.Format("update r_crosses set line_jd={0}, line_wd={1},line_gc={2} where xlmc='复奉线' and name='{3}'and jkqd='{4}' and xhcgtjl={5}",
                            //                                line_jd, line_wd, line_gc, wxdmc, jkqd, xhcgtjl);

                            DbHelper.ExecuteNonQuery(CommandType.Text, cmdText, null);
                            nCount++;
                        }
                    }
                }
                //结束时间-开始时间=总共花费的时间
                TimeSpan ts = DateTime.Now - startTime;
                lblInfo.Text = "导入状态:" + "共花费时间:" + ts.ToString() + " 导入记录条数:" + nCount;
                Array.Clear(fileArr, 0, fileArr.Length);
                txtFileName.Text = "";

                //更新指定线路的顺序号
                //string sql_update = "UPDATE t_poles AA JOIN(SELECT NAME,(@rowNum := @rowNum + 1) AS rowNo FROM t_poles a,(SELECT(@rowNum:= 0)) b ";
                //sql_update = sql_update + " WHERE a.xlmc = @xlmc ORDER BY a.NAME ASC) CC";
                //sql_update = sql_update + " SET AA.SXH = CC.rowNO WHERE AA.XLMC = @xlmc AND AA.NAME = CC.NAME";
                //MySqlParameter[] ps ={ new MySqlParameter("@compartName", xlmc) };
                //DbHelper.ExecuteNonQuery(CommandType.Text, sql_update, ps);
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        //导入杆塔数据
        private void Bulk_Import_Poles(string[] fileArr)
        {
            int nCount = 0;

            try
            {
                //定义一个开始时间
                DateTime startTime = DateTime.Now;

                CoordCovert dataConvert = new CoordCovert();

                for (int i = 0; i < fileArr.Length; i++)
                {
                    string fileName = fileArr[i];
                    //因为文件比较大,所有使用StreamReader的效率要比使用File.ReadLines高
                    int nRow = -1;
                    using (StreamReader sr = new StreamReader(fileName, Encoding.Default))
                    {
                        while (!sr.EndOfStream)
                        {
                            nRow++;
                            string   readStr = sr.ReadLine();                                                                  //读取一行数据
                            string[] strs    = readStr.Split(new char[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries); //将读取的字符串按"制表符/t“和”“分割成数组
                            if (strs.Length < 7)
                            {
                                continue;
                            }

                            string sxh  = strs[0]; //顺序号
                            string X    = strs[1]; //
                            string Y    = strs[2];
                            string TJGC = strs[3]; //塔基高程
                            string TDGC = strs[4]; //塔顶高程
                            string TX   = strs[5]; //塔型
                            string TGH  = strs[6]; //杆塔号

                            if (nRow == 0 && (containChinese(sxh) || containChinese(X)))
                            {
                                continue;
                            }

                            //去掉杆子中包含的括号
                            if (TGH.Contains('('))
                            {
                                TGH = TGH.Split(new char[] { '(' })[0].Trim();
                            }
                            if (TGH.Contains('('))
                            {
                                TGH = TGH.Split(new char[] { '(' })[0].Trim();
                            }


                            int      n_DH    = int.Parse(cboxDH.Text.Trim());
                            double[] lon_lat = dataConvert.UTMXYToToLonLat(double.Parse(X), double.Parse(Y), n_DH, false);

                            double JD   = lon_lat[0];
                            double WD   = lon_lat[1];
                            double GC   = double.Parse(TJGC);
                            double GTQG = double.Parse(TDGC) - GC;

                            ///计算档距
                            int    dj    = 0; //档距,即前后杆塔之间的水平距离
                            string t_sql = "";
                            if (TGH.Contains('+'))
                            {
                                //TGH = (TGH.Split(new char[] { '+' })[0]).Trim();
                                t_sql = string.Format("select jd,wd from t_poles where xlmc='{0}' and name='{1}'", xlmc, (TGH.Split(new char[] { '+' })[0]).Trim() + "#");
                            }
                            else
                            {
                                t_sql = string.Format("select jd,wd from t_poles where xlmc='{0}' and name='{1}'", xlmc, (int.Parse(TGH) - 1) + "#");
                            }

                            DataSet ds = DbHelper.GetDataSet(CommandType.Text, t_sql, null);

                            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)  //如果能读到数据,一行一行地读
                            {
                                double t_jd = double.Parse(ds.Tables[0].Rows[0].ItemArray[0].ToString());
                                double t_wd = double.Parse(ds.Tables[0].Rows[0].ItemArray[1].ToString());
                                dj = (int)dataConvert.GetDistance(JD, WD, t_jd, t_wd);
                            }

                            //有重复的不插入
                            string sql = string.Format("select * from t_poles where name='{0}' and xlmc='{1}'", TGH + "#", xlmc);
                            if (DbHelper.Count(CommandType.Text, sql, null) >= 1)
                            {
                                continue;
                            }

                            string cmdText = string.Format("insert into t_poles(XLID,XLMC,NAME,GTXH,YWDW,YWBM,GTQG,JD,WD,GC,SXH,DJ) " +
                                                           "values({0},'{1}','{2}','{3}','{4}','{5}',{6},{7},{8},{9},{10},{11})", xlid, xlmc, TGH + "#",
                                                           TX, ywdw, ywbm, GTQG, JD, WD, GC, sxh, dj);
                            DbHelper.ExecuteNonQuery(CommandType.Text, cmdText, null);
                            nCount++;
                        }
                    }
                }

                //string mysql = "update t_poles AA join ( Select NAME,(@rowNum:=@rowNum+1) as rowNo From t_poles a,(Select (@rowNum :=0) ) b where a.xlmc = '复奉线(安徽)' Order by a.name asc) CC SET AA.SXH = CC.rowNO WHERE AA.XLMC = '复奉线(安徽)' and AA.NAME = CC.NAME";
                //DbHelper.ExecuteNonQuery(CommandType.Text, mysql, null);

                //结束时间-开始时间=总共花费的时间
                TimeSpan ts = DateTime.Now - startTime;
                lblInfo.Text = "导入状态:" + "共花费时间:" + ts.ToString() + " 导入记录条数:" + nCount;
                Array.Clear(fileArr, 0, fileArr.Length);
                txtFileName.Text = "";
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message + " :" + nCount);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " :" + nCount);
            }
        }
        private void Bulk_Import_Danger(string[] fileArray)
        {
            if (fileArray == null || fileArray.Length == 0)
            {
                return;
            }
            try
            {
                //定义一个开始时间
                DateTime    startTime   = DateTime.Now;
                int         nCount      = 0;
                CoordCovert dataConvert = new CoordCovert();

                for (int i = 0; i < fileArray.Length; i++)
                {
                    string fileName = fileArray[i];
                    //因为文件比较大,所有使用StreamReader的效率要比使用File.ReadLines高
                    using (StreamReader sr = new StreamReader(fileName, Encoding.Default))
                    {
                        while (!sr.EndOfStream)
                        {
                            string   readStr = sr.ReadLine();                                                                  //读取一行数据
                            string[] strs    = readStr.Split(new char[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries); //将读取的字符串按"制表符/t“和”“分割成数组
                            if (strs.Length < 11)
                            {
                                continue;
                            }

                            string yhqd    = strs[1];  //区段
                            string xhcgtjl = strs[2];  //距小号塔距离
                            string wd      = strs[3];  //纬度
                            string jd      = strs[4];  //经度
                            string gc      = strs[5];  //高程
                            string wxdmc   = strs[6];  //危险点名称
                            string spjl    = strs[7];  //水平距离
                            string czjl    = strs[8];  //垂直距离
                            string kjjl    = strs[9];  //空间距离
                            string ddjl    = strs[10]; //对地距离

                            string line_jd = strs[18];
                            string line_wd = strs[19];
                            string line_gc = strs[20];

                            string qsh = "";
                            if (yhqd.Length > 0)
                            {
                                string[] arr = yhqd.Split(new char[] { ')' });
                                qsh = arr[0].Substring(1);
                            }
                            txtStart.Text = qsh;

                            //有重复的不插入
                            //string sql = string.Format("select * from t_poles where name='{0}'", TGH + "#");
                            //if (DbHelper.Count(CommandType.Text, sql, null) >= 1)
                            //    continue;
                            string cmdText = string.Format("insert into r_dangers(XLID,XLMC,YHLX,YHQD,XHCGT,XHCGTJL,SPJL,CZJL,DDJL,KJJL,JD,WD,GC,STATUS,LINE_JD,LINE_WD,LINE_GC) " +
                                                           "values({0},'{1}','{2}','{3}','{4}',{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16})", xlid, xlmc, wxdmc,
                                                           yhqd, qsh, xhcgtjl, spjl, czjl, ddjl, kjjl, jd, wd, gc, status, line_jd, line_wd, line_gc);

                            DbHelper.ExecuteNonQuery(CommandType.Text, cmdText, null);
                            nCount++;
                        }
                    }
                }
                //结束时间-开始时间=总共花费的时间
                TimeSpan ts = DateTime.Now - startTime;
                lblInfo.Text = "导入状态:" + "共花费时间:" + ts.ToString() + " 导入记录条数:" + nCount;
                Array.Clear(fileArr, 0, fileArr.Length);
                txtFileName.Text = "";
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }