Exemplo n.º 1
0
        public override DateTime GetObservedDate(int year)
        {
            var firstDayOfMonth = new DateTime(year, _month, 01);
            var noOfdaysToAdd   = (_week - 1) * 7;
            var holiday         = HolidayHelper.FindDateForDayOfWeek(firstDayOfMonth, _dayOfWeek).AddDays(noOfdaysToAdd);

            return(holiday);
        }
Exemplo n.º 2
0
    protected void btn_NDelivery_Click(object sender, EventArgs e)
    {
        //未释放订单,5个工作日之前创建的还未释放的订单
        DateTime dt_Deadline = HolidayHelper.GetInstance().GetReckonDate2Today(-5, false);
        string   sqlStr      = " where [" + excelHeader[27] + "] is null and [" + excelHeader[26] + "]<#" + dt_Deadline.ToString("yyyy-MM-dd") + "#";

        //GlobalParas.GlobalParas.mDataSet = SelectCMD(" where [Actual Release Date] is null and [PrdCreatedOn]<#2018-10-10#", @"C:\Users\Public\Music\" + this.Application["filePath"].ToString());
        GlobalParas.GlobalParas.mDataSet = SelectCMD(sqlStr, @"C:\Users\Public\Music\" + this.Application["filePath"].ToString());
        GridView1.DataSource             = GlobalParas.GlobalParas.mDataSet;
        GridView1.DataBind();
    }
Exemplo n.º 3
0
 /// <summary>
 /// 获得单例对象,使用懒汉式(双重锁定)
 /// </summary>
 /// <returns></returns>
 public static HolidayHelper GetInstance()
 {
     if (_instance == null)
     {
         lock (_syncObj)
         {
             if (_instance == null)
             {
                 _instance = new HolidayHelper();
             }
         }
     }
     return(_instance);
 }
Exemplo n.º 4
0
        public ActionResult Gantte()
        {
            string defineID         = this.GetQueryString("DefineID");
            var    engineeringInfos = entities.Set <S_I_Engineering>().ToList();

            ViewBag.DefineID = defineID;

            var infra  = FormulaHelper.GetEntities <InfrastructureEntities>();
            var define = infra.Set <S_C_ScheduleDefine>().Find(defineID);

            if (define == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("未找到【" + defineID + "】计划");
            }

            var nodeTypeEnum = EnumBaseHelper.GetEnumDef("Base.WBSType");

            if (nodeTypeEnum == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到编号为【Base.WBSType】的枚举");
            }
            var nodeTypeList = define.S_C_ScheduleDefine_Nodes.Where(c => c.NodeType != WBSConst.taskNodeType && c.Visible == "1").Select(c => c.NodeType).Distinct().ToList();
            var list         = nodeTypeEnum.EnumItem.Where(c => nodeTypeList.Contains(c.Code)).OrderBy(c => c.SortIndex).ToList();
            var enumNodeType = new List <Dictionary <string, object> >();

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];
                var dic  = new Dictionary <string, object>();
                dic.SetValue("value", i + 1);
                dic.SetValue("text", item.Name);
                dic.SetValue("sortindex", item.SortIndex);
                enumNodeType.Add(dic);
                if (i == list.Count - 1)
                {
                    ViewBag.ExpandLevel = i + 1;
                }
            }
            ViewBag.NodeTypeEnum  = JsonHelper.ToJson(enumNodeType);
            ViewBag.HolidayTable  = JsonHelper.ToJson(HolidayHelper.GetHolidayTable());
            ViewBag.MonthFirstDay = DateTime.Now.ToString("yyyy-MM");
            ViewBag.MonthLastDay  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
            return(View());
        }
Exemplo n.º 5
0
        public object IsHoliday(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string date   = dicParas.ContainsKey("date") ? Convert.ToString(dicParas["date"]) : string.Empty;

                //DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo();
                //dtFormat.ShortDatePattern = "yyyyMMdd";
                //var dt = Convert.ToDateTime(date, dtFormat);
                var dt     = DateTime.ParseExact(date, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                var result = HolidayHelper.GetInstance().IsHoliday(dt);
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 6
0
        public void GetNationalPublicHolidays_ValidYear_Should_Return_List()
        {
            //Arrange
            var holidayHealper = new HolidayHelper();
            var year           = 2020;
            //Act
            var result = holidayHealper.GetNationalPublicHolidays(year);

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(7, result.Count);

            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 1, 1)));   // New Year
            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 1, 27)));  // Australia Day
            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 4, 10)));  // Easter Friday
            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 4, 13)));  // Easter Monday
            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 4, 25)));  // ANZAC Day
            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 12, 25))); // Christmas Day
            Assert.IsTrue(result.Any(x => x == new DateTime(2020, 12, 28))); // Boxing Day
        }
Exemplo n.º 7
0
        public IActionResult Get(
            [FromRoute] string value,
            [FromRoute] CountryEnum?country)
        {
            if (!country.HasValue)
            {
                country = CountryEnum.fr;
            }

            if (country == CountryEnum.unknown)
            {
                return(BadRequest("Invalid Country"));
            }

            DateTimeOffset?date = GetDateFromInput(value);

            if (date.HasValue)
            {
                return(Ok(new HolidayResponse(date.Value, HolidayHelper.GetHoliday(date.Value, country.Value))));
            }

            return(BadRequest("Invalid date, accepted values: now|tomorrow|yesterday|date(YYYY-MM-DD)"));
        }
Exemplo n.º 8
0
        public ActionResult Gantte()
        {
            string engineeringInfoID = this.GetQueryString("EngineeringInfoID");
            var    engineeringInfo   = this.GetEntityByID <S_I_Engineering>(engineeringInfoID);

            if (engineeringInfo == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到指定的工程信息");
            }
            if (engineeringInfo.Mode == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("工程未关联任何管理模式,请联系管理员");
            }
            string versionID = this.GetQueryString("VersionID");
            string Code      = this.GetQueryString("ScheduleCode");
            var    define    = engineeringInfo.Mode.S_C_ScheduleDefine.FirstOrDefault(c => c.Code == Code);

            if (define == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到编号为【" + Code + "】的计划定义视图,请联系管理员");
            }
            var version = engineeringInfo.S_I_WBS_Version.Where(c => c.ScheduleCode == Code && c.FlowPhase == "End").
                          OrderByDescending(c => c.ID).FirstOrDefault();
            bool flowEnd = true;

            if (version == null)
            {
                ViewBag.VersionID = "";
                ViewBag.FlowPhase = "";
                ViewBag.VersionNo = "0";
            }
            else
            {
                if (version.FlowPhase != "End")
                {
                    flowEnd = false;
                }
                ViewBag.FlowPhase = version.FlowPhase;
                ViewBag.VersionID = version.ID;
                ViewBag.VersionNo = version.VersionNumber;
            }
            ViewBag.FlowEnd           = flowEnd;
            ViewBag.EngineeringInfoID = engineeringInfoID;
            ViewBag.ScheduleCode      = Code;
            ViewBag.DefineID          = define.ID;

            var nodeTypeEnum = EnumBaseHelper.GetEnumDef("Base.WBSType");

            if (nodeTypeEnum == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到编号为【Base.WBSType】的枚举");
            }
            var nodeTypeList = define.S_C_ScheduleDefine_Nodes.Where(c => c.NodeType != WBSConst.taskNodeType && c.Visible == "1").Select(c => c.NodeType).Distinct().ToList();
            var list         = nodeTypeEnum.EnumItem.Where(c => nodeTypeList.Contains(c.Code)).OrderBy(c => c.SortIndex).ToList();
            var enumNodeType = new List <Dictionary <string, object> >();

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];
                var dic  = new Dictionary <string, object>();
                dic.SetValue("value", i + 1);
                dic.SetValue("text", item.Name);
                dic.SetValue("sortindex", item.SortIndex);
                enumNodeType.Add(dic);
                if (i == list.Count - 1)
                {
                    ViewBag.ExpandLevel = i + 1;
                }
            }
            ViewBag.NodeTypeEnum = JsonHelper.ToJson(enumNodeType);
            ViewBag.HolidayTable = JsonHelper.ToJson(HolidayHelper.GetHolidayTable());
            return(View());
        }
Exemplo n.º 9
0
        public override DateTime GetObservedDate(int year)
        {
            var holidayDate = new DateTime(year, _month, _day);

            return(HolidayHelper.GetNextWorkingDay(holidayDate));
        }
Exemplo n.º 10
0
        private void DoShowUnCheck()
        {
            IWorkbook writeBook = null;

            try
            {
                label1.Text = string.Empty;

                FileInfo newFile = new FileInfo(localSavePath);
                if (newFile.Exists)
                {
                    newFile.Delete();
                }

                if (Path.GetExtension(localOpenPath).Equals(".xlsm"))
                {
                    localOpenPath = ChangeExtension1(localOpenPath);
                    //FileInfo newFile = new FileInfo(localSavePath);
                    //if (newFile.Exists)
                    //{
                    //    newFile.Delete();
                    //}
                    // Path.ChangeExtension("xlsx");
                }

                // FileInfo modelFile = new FileInfo(localOpenPath);
                //modelFile.CopyTo(localSavePath);
                FileStream fsRead = new FileStream(localOpenPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                fsRead.Position = 0;
                //  StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default);
                ////读取Bom表
                //  FileStream fsRead = System.IO.File.OpenRead(localOpenPath);
                writeBook = getPath(localOpenPath, fsRead);
                //var sheet = writeBook.GetSheetAt(0);



                //XSSFWorkbook writeBook = null;
                //writeBook = new XSSFWorkbook();
                //ISheet newsheet = writeBook.CreateSheet("Sheet1");
                //XSSFSheet writeSheet = (XSSFSheet)writeBook.GetSheetAt(0);

                ////样式
                //ICellStyle style1 = writeBook.CreateCellStyle();
                //style1.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;//文字水平对齐方式
                //style1.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;//文字垂直对齐方式

                ////单元格边框样式
                //style1.BorderBottom = BorderStyle.Thin;
                //style1.BorderLeft = BorderStyle.Thin;
                //style1.BorderRight = BorderStyle.Thin;
                //style1.BorderTop = BorderStyle.Thin;
                //style1.WrapText = true;//自动换行ho
                //style1.BottomBorderColor = IndexedColors.Black.Index;//设置边框颜色

                //try
                //{
                //    //根据Bom表内容创建新表
                //    for (int k = 0; k < sheet.LastRowNum + 1; k++)
                //    {
                //        //获取第i行,得到对象
                //        IRow row = sheet.GetRow(k);
                //        //新建第i行,并返回得到的对象
                //        IRow writeRow = writeSheet.CreateRow(k);
                //        for (int j = 0; j < row.LastCellNum + 1; j++)
                //        {
                //            ICell cell = row.GetCell(j);
                //            if (cell == null)
                //            {
                //                break;
                //            }

                //            row.GetCell(j).SetCellType(CellType.String);
                //            string readValue = sheet.GetRow(k).GetCell(j).StringCellValue;

                //            if (string.IsNullOrEmpty(readValue))
                //            {

                //                readValue = string.Empty;
                //            }
                //            //新建第i行,第j列
                //            writeRow.CreateCell(j);
                //            writeRow.GetCell(j).CellStyle = style1;
                //            writeRow.GetCell(j).SetCellType(CellType.String);
                //            writeSheet.GetRow(k).GetCell(j).SetCellValue(readValue);
                //        }


                //    }

                //}
                //catch (Exception)
                //{
                //    label1.Width = 300;
                //    label1.Text = "请选择正确文件";
                //}
                // writeBook.Write(writeFile);
                //var workbook2 = new XSSFWorkbook(fy);

                //FileStream fsRead = System.IO.File.OpenRead(localSavePath);
                //IWorkbook wkcopy = getPath(localSavePath, fsRead);

                // 读取新表
                var    sheetcopy2 = writeBook.GetSheetAt(0);
                IRow   headrow    = sheetcopy2.GetRow(2);
                IRow   headrow2   = sheetcopy2.GetRow(3);
                IRow   h1         = sheetcopy2.GetRow(1);
                IRow[] headrows   = new IRow[] { headrow, headrow2, h1 };
                ////在最后添加新列
                //headrow.CreateCell(headrow.LastCellNum).SetCellType(CellType.String);
                //headrow.GetCell(headrow.LastCellNum - 1).CellStyle = style1;
                //headrow.CreateCell(headrow.LastCellNum - 1).SetCellValue("商品编码");

                //headrow.CreateCell(headrow.LastCellNum).SetCellType(CellType.String);
                //headrow.GetCell(headrow.LastCellNum - 1).CellStyle = style1;
                //headrow.CreateCell(headrow.LastCellNum - 1).SetCellValue("Count");



                //Reference列
                //  int refcell = 0;
                //Part 列
                int PartCell     = 1;
                int remarkCell   = 65;
                int changeColumn = 38;
                int leaveC       = 8;
                int startIndexC  = 8;
                //商品编码列
                //  int code = 0;

                //   int count = 0;
                //获取列号

                foreach (var item in headrows)
                {
                    for (int i = 0; i < item.LastCellNum - 1; i++)
                    {
                        if (item.Cells[i].CellType != CellType.String)
                        {
                            continue;
                        }
                        //item.Cells[i].SetCellType(CellType.String);
                        if (item.Cells[i].StringCellValue.Trim().Equals("姓名"))
                        {
                            PartCell = item.Cells[i].ColumnIndex;
                        }
                        if (item.Cells[i].StringCellValue.Trim().Equals("调整"))
                        {
                            changeColumn = item.Cells[i].ColumnIndex;
                        }
                        if (item.Cells[i].StringCellValue.Trim().Equals("离职日期"))
                        {
                            leaveC      = item.Cells[i].ColumnIndex;
                            startIndexC = leaveC + 1;
                        }

                        // item.Cells[i].SetCellType(CellType.String);
                        if (item.Cells[i].StringCellValue.Trim().Equals("备注"))
                        {
                            remarkCell = item.Cells[i].ColumnIndex;
                        }
                        //  }
                    }
                }
                //设置列宽【SetColumnWidth(列索引,N*256) 第二个参数是列宽 单位是1/256个字符宽度】
                //    newsheet.SetColumnWidth(refcell, 40 * 256);

                //if (headrow.Cells[refcell].StringCellValue == "Reference")
                //{
                //    List<string> pad = new List<string>();
                //    for (int r = 1; r < sheetcopy2.LastRowNum + 1; r++)
                //    {
                //        IRow row2 = sheetcopy2.GetRow(r);
                //        if (row2 != null)
                //        {
                //            //Reference
                //            row2.GetCell(refcell).SetCellType(CellType.String);
                //            string a = row2.GetCell(refcell).StringCellValue;
                //            pad.Add(a);
                //        }
                //    }
                //    for (int r = 1; r < sheetcopy2.LastRowNum + 1; r++)
                //    {
                //        IRow row2 = sheetcopy2.GetRow(r);
                //        row2.CreateCell(count).SetCellType(CellType.Numeric);
                //        row2.GetCell(count).CellStyle = style1;
                //        try
                //        {
                //            if (pad[r - 1] == null)
                //            {
                //                row2.GetCell(count).SetCellValue(string.Empty);
                //            }
                //            else
                //            {

                //                string refe = pad[r - 1].Replace(",", ",").Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "");
                //                string[] ss = refe.ToString().Split(',');
                //                row2.GetCell(count).SetCellValue(ss.Length);

                //            }
                //        }
                //        catch (Exception)
                //        {

                //            row2.GetCell(count).SetCellValue(string.Empty);
                //        }
                //    }
                //}

                //workbook2.Write(fy);
                //fy.Close();


                using (FileStream fsRead2 = System.IO.File.OpenRead(localOpenPath2))
                {
                    IWorkbook wk = getPath(localOpenPath2, fsRead2);

                    ISheet sheet2   = wk.GetSheetAt(0);
                    IRow   headrow3 = sheet2.GetRow(2);
                    //商品编码 列
                    int ComcodeCell = 5;
                    int ComnameCell = 35;
                    for (int i = 0; i < headrow3.LastCellNum - 1; i++)
                    {
                        if (headrow3.Cells[i].CellType != CellType.String)
                        {
                            continue;
                        }
                        if (headrow3.Cells[i].StringCellValue == "姓名")
                        {
                            ComcodeCell = headrow3.Cells[i].ColumnIndex;
                        }
                        if (headrow3.Cells[i].StringCellValue == "工号")
                        {
                            ComnameCell = headrow3.Cells[i].ColumnIndex;
                        }
                        //}
                    }
                    Dictionary <String, IRow> myDictionary = new Dictionary <String, IRow>();
                    string a  = null;
                    string b  = null;
                    string md = null;
                    try
                    {
                        if (headrow3.Cells[ComcodeCell].StringCellValue == "姓名" && headrow3.Cells[ComnameCell].StringCellValue == "工号")
                        {
                            ISheet sheet3 = wk.GetSheetAt(0);
                            for (int r = 3; r < sheet3.LastRowNum; r++)
                            {
                                IRow row2 = sheet3.GetRow(r);
                                if (row2 != null)
                                {
                                    //商品编码
                                    row2.GetCell(ComcodeCell).SetCellType(CellType.String);
                                    a = row2.GetCell(ComcodeCell).StringCellValue;

                                    //商品名称
                                    row2.GetCell(ComnameCell).SetCellType(CellType.String);
                                    b = row2.GetCell(ComnameCell).StringCellValue;
                                    U <String, String> keyValue = new U <string, string>(b, a);
                                    if (!String.IsNullOrEmpty(a))
                                    {
                                        try
                                        {
                                            myDictionary.Add(a, row2);
                                        }
                                        catch
                                        {
                                            throw new Exception("重复打卡人姓名:" + a);
                                        }
                                    }
                                }
                            }

                            //d
                            List <int> holiday = new List <int>();
                            List <int> ban     = new List <int>();
                            //foreach (ICell cell in rowTitle.Cells)
                            //{
                            //    cell.SetCellType(CellType.String);
                            //    if (cell.StringCellValue.Equals("假"))
                            //    {
                            //        holiday.Add(cell.ColumnIndex);
                            //    }
                            //}

                            //计算是不是周六周日,还有法定节假日

                            IRow   rowTitle  = sheetcopy2.GetRow(0);
                            IRow   rowTitle1 = sheetcopy2.GetRow(1);
                            IRow   rowTitle2 = sheetcopy2.GetRow(2);
                            String workDays  = rowTitle.Cells[1].StringCellValue;
                            Int32  datetime  = Int32.Parse(rowTitle1.Cells[0].NumericCellValue.ToString());

                            DateTime           dateMonth    = DateTime.Parse("1900/01/01").AddDays(datetime - 1);
                            List <HolidayList> holidayLists = HolidayHelper.GetHolidayMonth(dateMonth.Year, dateMonth.Month);
                            foreach (var item in holidayLists)
                            {
                                String[] days = item.date.Split('-');
                                int      day  = Int32.Parse(days[days.Length - 1]);
                                if (item.status == 1)
                                {
                                    if (!holiday.Contains(day))
                                    {
                                        holiday.Add(day);
                                    }
                                }
                                else
                                {
                                    if (!ban.Contains(day))
                                    {
                                        ban.Add(day);
                                    }
                                }
                            }

                            for (int i = 0; i < 31; i++)
                            {
                                DateTime date = DateTime.Parse(dateMonth.Year + "-" + dateMonth.Month + "-" + (i + 1));

                                String value = String.Empty;
                                switch (date.DayOfWeek)
                                {
                                case DayOfWeek.Sunday:
                                    value = "日";
                                    break;

                                case DayOfWeek.Monday:
                                    value = "一";
                                    break;

                                case DayOfWeek.Tuesday:
                                    value = "二";
                                    break;

                                case DayOfWeek.Wednesday:
                                    value = "三";
                                    break;

                                case DayOfWeek.Thursday:
                                    value = "四";
                                    break;

                                case DayOfWeek.Friday:
                                    value = "五";
                                    break;

                                case DayOfWeek.Saturday:
                                    value = "六";
                                    break;

                                default:
                                    break;
                                }
                                if (changeColumn > startIndexC + i)
                                {
                                    rowTitle1.GetCell(startIndexC + i).SetCellValue(value);
                                }


                                if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
                                {
                                    if (date.Month == dateMonth.Month)
                                    {
                                        if (!holiday.Contains(date.Day) && !ban.Contains(date.Day))
                                        {
                                            holiday.Add(date.Day);
                                        }
                                    }
                                }
                            }

                            //  style1.FillBackgroundColor = IndexedColors.Blue.Index;
                            // cell.CellStyle = style1;


                            ICellStyle style = writeBook.CreateCellStyle();
                            //关键点 IndexedColors.AQUA.getIndex() 对应颜色
                            // style.FillBackgroundColor=IndexedColors.Black.Index;
                            // style.setFillPattern(CellStyle.SOLID_FOREGROUND);
                            for (int i = startIndexC; i < changeColumn; i++)
                            {
                                var cell  = rowTitle.GetCell(i);
                                var cell1 = rowTitle1.GetCell(i);
                                var cell2 = rowTitle2.GetCell(i);

                                if (holiday.Contains(i - startIndexC + 1))
                                {
                                    cell.SetCellValue("假");
                                    //cell.CellStyle = style;
                                    //cell2.CellStyle = style;
                                    //cell1.CellStyle = style;
                                    cell.CellStyle.FillForegroundColor = IndexedColors.SkyBlue.Index;
                                    //cell.CellStyle.FillBackgroundColor = IndexedColors.SkyBlue.Index;
                                    cell.CellStyle.FillPattern          = FillPattern.SolidForeground;
                                    cell2.CellStyle.FillForegroundColor = IndexedColors.SkyBlue.Index;
                                    //cell2.CellStyle.FillBackgroundColor = IndexedColors.SkyBlue.Index;
                                    cell2.CellStyle.FillPattern         = FillPattern.SolidForeground;
                                    cell1.CellStyle.FillForegroundColor = IndexedColors.SkyBlue.Index;
                                    //cell1.CellStyle.FillBackgroundColor = IndexedColors.SkyBlue.Index;
                                    cell1.CellStyle.FillPattern = FillPattern.SolidForeground;
                                    cell2.SetCellType(CellType.String);
                                    cell2.SetCellValue(i - startIndexC + 1);
                                }
                                else
                                {
                                    cell.CellStyle.FillForegroundColor = IndexedColors.White.Index;
                                    //cell.CellStyle.FillBackgroundColor = IndexedColors.White.Index;
                                    cell.CellStyle.FillPattern = FillPattern.SolidForeground;
                                    //cell2.CellStyle.FillBackgroundColor = IndexedColors.White.Index;
                                    cell2.CellStyle.FillForegroundColor = IndexedColors.White.Index;
                                    cell2.CellStyle.FillPattern         = FillPattern.SolidForeground;
                                    //  cell1.CellStyle.FillBackgroundColor = IndexedColors.White.Index;
                                    cell1.CellStyle.FillForegroundColor = IndexedColors.White.Index;
                                    cell1.CellStyle.FillPattern         = FillPattern.SolidForeground;
                                    cell.SetCellValue(String.Empty);
                                    cell2.SetCellType(CellType.String);
                                    cell2.SetCellValue(i - startIndexC + 1);
                                    // cell.CellStyle.FillBackgroundColorColor =
                                }
                            }

                            InitProgress(sheetcopy2.LastRowNum + 1 - 4);
                            for (int r = 4; r < sheetcopy2.LastRowNum + 1; r++)
                            {
                                IRow row2 = sheetcopy2.GetRow(r);
                                //row2.CreateCell(code).SetCellType(CellType.String);
                                // row2.GetCell(code).CellStyle = style1;
                                if (row2 == null)
                                {
                                    continue;
                                }
                                row2.GetCell(PartCell).SetCellType(CellType.String);
                                md = row2.GetCell(PartCell).StringCellValue;
                                IRow row = null;
                                try
                                {
                                    row = myDictionary[md];
                                    UpdateProgress(md);
                                }
                                catch
                                { }
                                getPath(startIndexC, md, row, row2, holiday, changeColumn, remarkCell);
                            }
                        }

                        //判断选择保存路径是否存在该文件,存在则替换
                        newFile = new FileInfo(localSavePath);
                        if (newFile.Exists)
                        {
                            newFile.Delete();
                        }
                        //创建新表

                        FileStream writeFile = new FileStream(localSavePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                        // FileStream writeFile = new FileStream(localSavePath, FileMode.OpenOrCreate);
                        writeFile.Position = 0;
                        // writeBook.w
                        //writeBook.
                        writeBook.Write(writeFile);

                        writeFile.Close();

                        // UpdateProgress( "保存成功");
                    }
                    finally
                    {
                        if (fsRead != null)
                        {
                            fsRead.Close();
                        }
                        if (fsRead2 != null)
                        {
                            fsRead2.Close();
                        }
                        //fsRead.Close();
                        //fsRead2.Close();
                    }


                    //try
                    //{

                    //    FileStream fs = new FileStream(localSavePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    //    fs.Position = 0;
                    //    StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default);

                    //    StringBuilder sb = new StringBuilder();
                    //    while (!sr.EndOfStream)
                    //    {
                    //        sb.AppendLine(sr.ReadLine() + "<br>");
                    //    }
                    //    FileStream saveRead = System.IO.File.OpenRead(localSavePath);
                    //    IWorkbook wb = getPath(localSavePath, fs);
                    //    int n = wb.NumberOfSheets;
                    //    if (n > 0)
                    //    {
                    //        label1.Text = "保存成功";
                    //        writeFile.Close();
                    //        fsRead.Close();
                    //        fsRead2.Close();
                    //        fs.Close();
                    //    }
                    //}
                    //catch (Exception ex)
                    //{
                    //    label1.ForeColor = Color.Red;
                    //    label1.Width = 200;
                    //    writeFile.Close();
                    //    fsRead.Close();
                    //    fsRead2.Close();
                    //    label1.Text = "请选择正确文件";
                    //}
                }
                UpdateProgress("保存成功");
            }
            catch (Exception ex)
            {
                ShowError(ex);
                //   label1.Text = ex.Message;
            }
            finally
            {
                Complete(writeBook);
            }
        }