public bool updataAddExcleHeader(int pagesize, int page, ref int totalnum, ref int pagecount,
                                         ref DataTable dt, string pagecode, string onetypehcode, string onetype,
                                         string onetypevalues, string datetypehcode, string datetypeselecttype, string startdate,
                                         string enddata, string startdata_time, string enddata_time,
                                         string digitaltypehcode, string digitaltypeselecttype, string twotypetype,
                                         string oneval1, string oneval2, string choosetypehcode, string choosetypeselecttype, string choosetype, ref string errmsg)
        {
            bool result             = true;
            DALUniversalExcel mydal = new DALUniversalExcel();

            result = mydal.updataAddExcleHeader(pagesize, page, ref totalnum, ref pagecount,
                                                ref dt, pagecode, onetypehcode, onetype,
                                                onetypevalues, datetypehcode, datetypeselecttype, startdate,
                                                enddata, startdata_time, enddata_time,
                                                digitaltypehcode, digitaltypeselecttype, twotypetype,
                                                oneval1, oneval2, choosetypehcode, choosetypeselecttype, choosetype, ref errmsg);
            return(result);
        }
        /// <summary>
        /// 更新添加表头
        /// </summary>
        /// <param name="pagecode"></param>
        /// <param name="hcode"></param>
        /// <param name="hname"></param>
        /// <param name="breadth"></param>
        /// <param name="nowrow"></param>
        /// <param name="nowline"></param>
        /// <param name="takerow"></param>
        /// <param name="takeline"></param>
        /// <param name="errmsg"></param>
        /// <returns></returns>
        public bool updataAddExcleHeader(string pagecode, TableHeaders[][] tableHeaders, ref string errmsg)
        {
            bool result = true;

            List <Excel信息> list      = new List <Excel信息>();
            List <Excel信息> new_list  = new List <Excel信息>();
            List <Excel信息> merge     = new List <Excel信息>();
            List <Excel信息> effective = new List <Excel信息>();

            for (int i = 0; i < tableHeaders.Length; i++)
            {
                for (int j = 0; j < tableHeaders[i].Length; j++)
                {
                    Excel信息 info = new Excel信息();
                    info.第几行        = i;
                    info.第几列        = j;
                    info.称          = tableHeaders[i][j].hname;
                    info.占几行        = Convert.ToInt32(tableHeaders[i][j].takerow);
                    info.占几列        = Convert.ToInt32(tableHeaders[i][j].takeline);
                    info.selecttype = tableHeaders[i][j].selecttype;
                    info.optiontype = tableHeaders[i][j].optiontype;
                    list.Add(info);
                }
            }

            //临时性的方法
            for (int i = 0; i < list.Count; i++)
            {
                for (int j = 0; j < list[i].占几行; j++)
                {
                    for (int k = 0; k < list[i].占几列; k++)
                    {
                        Excel信息 newinfo = new Excel信息();
                        if (list[i].第几行 == 0)
                        {
                            int    当前行    = j;
                            int    当前列    = k + list[i].第几列;
                            string 称      = list[i].称;
                            bool   是否比较完成 = false;
                            while (!是否比较完成)
                            {
                                for (int q = 0; q < new_list.Count; q++)
                                {
                                    if (new_list[q].第几行 == 当前行 && 当前列 == new_list[q].第几列)
                                    {
                                        当前列 += 1;
                                        break;
                                    }
                                    if (q == new_list.Count - 1)
                                    {
                                        是否比较完成 = true;
                                    }
                                }

                                if (new_list.Count == 0)
                                {
                                    是否比较完成 = true;
                                }
                            }
                            newinfo.第几行 = 当前行;
                            if (当前行 > 0)
                            {
                                for (int kk = 0; kk < new_list.Count; kk++)
                                {
                                    if (new_list[kk].称 == 称)
                                    {
                                        newinfo.第几列 = new_list[kk].第几列;
                                    }
                                }
                            }
                            else
                            {
                                newinfo.第几列 = 当前列;
                            }
                            newinfo.占几行        = 1;
                            newinfo.占几列        = 1;
                            newinfo.称          = 称;
                            newinfo.optiontype = list[i].optiontype;
                            newinfo.selecttype = list[i].selecttype;
                            new_list.Add(newinfo);
                        }
                        else
                        {
                            int    目前总行数  = 0;
                            int    目前第几行  = list[i].第几行; //1
                            int    目前比较列  = list[i].第几列; //0
                            string 称      = list[i].称;
                            bool   是否比较完成 = false;
                            while (!是否比较完成)
                            {
                                for (int a = 0; a < 目前第几行 - 1; a++)
                                {
                                    if (list[a].第几行 == a && list[a].第几列 == 目前比较列)
                                    {
                                        目前总行数 += list[a].占几行;
                                    }
                                }

                                for (int n = 0; n < new_list.Count; n++)
                                {
                                    if (目前第几行 == new_list[n].第几行 && 目前比较列 == new_list[n].第几列)
                                    {
                                        目前比较列 += 1;
                                    }
                                }
                                if (目前总行数 > 目前第几行)
                                {
                                    目前比较列 += 1;
                                    目前总行数  = 0;
                                }
                                else
                                {
                                    是否比较完成 = true;
                                }
                            }
                            newinfo.第几行        = 目前第几行;
                            newinfo.第几列        = 目前比较列;
                            newinfo.称          = 称;
                            newinfo.占几行        = 1;
                            newinfo.占几行        = 1;
                            newinfo.optiontype = list[i].optiontype;
                            newinfo.selecttype = list[i].selecttype;
                            new_list.Add(newinfo);
                        }
                    }
                }
            }


            List <Excel信息> 排序后 = new List <Excel信息>();

            排序后 = new_list.OrderByDescending(a => a.第几行).ThenBy(a => a.第几列).ToList();

            List <Excel信息> 效表头 = new List <Excel信息>();
            int            一列  = 0;

            for (int n = 0; n < 排序后.Count; n++)
            {
                if (一列 == 排序后[n].第几列)
                {
                    一列 += 1;
                    效表头.Add(排序后[n]);
                }
            }

            if (效表头.Count > 0)
            {
                Excel信息 newinfo = new Excel信息();
                newinfo.称          = 效表头[0].称;
                newinfo.占几列        = 1;
                newinfo.optiontype = 效表头[0].optiontype;
                newinfo.selecttype = 效表头[0].selecttype;
                effective.Add(newinfo);

                for (int n = 1; n < 效表头.Count; n++)
                {
                    Excel信息 newinfo1 = new Excel信息();
                    bool    是否只更新    = false;
                    for (int h = 0; h < effective.Count; h++)
                    {
                        if (效表头[n].称 == effective[h].称)
                        {
                            effective[h].占几列 += 1;
                            是否只更新             = true;
                        }
                    }
                    if (!是否只更新)
                    {
                        newinfo1.称          = 效表头[n].称;
                        newinfo1.占几列        = 1;
                        newinfo1.optiontype = 效表头[0].optiontype;
                        newinfo1.selecttype = 效表头[0].selecttype;
                        effective.Add(newinfo1);
                    }
                }
            }



            for (int i = 0; i < tableHeaders.Length; i++)
            {
                for (int j = 0; j < tableHeaders[i].Length; j++)
                {
                    string hcode = "";
                    if (string.IsNullOrEmpty(tableHeaders[i][j].hcode))
                    {
                        BLLSequence myseq = new BLLSequence();
                        result = myseq.GetExcelCode(ref hcode, ref errmsg);
                    }


                    if (result)
                    {
                        DALUniversalExcel mydal = new DALUniversalExcel();
                        result = mydal.updataAddExcleHeader(pagecode, hcode, tableHeaders[i][j].hcode, tableHeaders[i][j].hname, tableHeaders[i][j].breadth, tableHeaders[i][j].nowrow, tableHeaders[i][j].nowline, tableHeaders[i][j].takerow, tableHeaders[i][j].takeline, tableHeaders[i][j].selecttype, tableHeaders[i][j].optiontype, ref errmsg);
                        if (!result)
                        {
                            result = false;
                            break;
                        }
                    }

                    for (int h = 0; h < effective.Count; h++)
                    {
                        if (tableHeaders[i][j].hname == effective[h].称)
                        {
                            DALUniversalExcel mydal = new DALUniversalExcel();
                            result = mydal.updataAddEffectiveExcleHeader(pagecode, hcode, tableHeaders[i][j].hcode, effective[h].称, effective[h].占几列, effective[h].selecttype, effective[h].optiontype, ref errmsg);
                        }
                    }
                }
            }

            return(result);
        }