Пример #1
0
 /// <summary>
 /// 导出员工签卡明细
 /// </summary>
 /// <param name="signinID">签卡单ID</param>
 /// <returns></returns>
 public byte[] ExportEmployeeSignIn(string signinID)
 {
     try
     {
         EmployeeSignInRecordBLL   bll    = new EmployeeSignInRecordBLL();
         T_HR_EMPLOYEESIGNINRECORD record = bll.GetEmployeeSigninRecordByID(signinID);
         string empName = string.Empty;
         if (record != null)
         {
             empName = record.EMPLOYEENAME;
         }
         var       ent = this.GetEmployeeSignInDetailBySigninID(signinID);
         byte[]    result;
         DataTable dt = TableToExportInit();
         if (ent != null && ent.Any())
         {
             DataTable dttoExport = GetDataConversion(dt, ent);
             result = Utility.OutFileStream(empName + Utility.GetResourceStr(" 异常签卡明细"), dttoExport);
             return(result);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         SMT.Foundation.Log.Tracer.Debug("ExportEmployeeSignIn导出员工签卡信息:" + ex.Message);
         return(null);
     }
 }
Пример #2
0
 /// <summary>
 /// 按条件查询 导出员工签卡明细
 /// </summary>
 /// <param name="signinID">签卡单ID</param>
 /// <returns></returns>
 public byte[] ExportEmployeeAllSignIn(string sort, string filterString, List <object> paras, ref int pageCount, string strCheckState, string strOwnerID, string recorderDate)
 {
     using (EmployeeSignInRecordBLL bll = new EmployeeSignInRecordBLL())
     {
         var ents = bll.EmployeeSignInRecordPagingIncludeDetail(sort, filterString, paras, ref pageCount, strCheckState, strOwnerID, recorderDate);
         if (ents == null)
         {
             return(null);
         }
         if (ents != null && ents.Count() > 0)
         {
             DataTable     dt = TableToExportInit();
             StringBuilder sb = new StringBuilder();
             sb.Append(GetHeader().ToString());
             sb.Append("<body>\n\r");
             foreach (var ent in ents)
             {
                 DataTable dttoExport = GetDataConversion(dt, ent.T_HR_EMPLOYEESIGNINDETAIL);
                 sb.Append(GetBody(ent.EMPLOYEENAME, dt).ToString());
                 sb.Append("<br>");
             }
             sb.Append("</body></html>");
             byte[] by = Encoding.UTF8.GetBytes(sb.ToString());
             return(by);
         }
     }
     return(null);
 }
Пример #3
0
        /// <summary>
        /// 针对补请假的情况,用于删除异常考勤
        /// </summary>
        /// <param name="entAttRds"></param>
        private void RemoveWrongSignRds(List <T_HR_ATTENDANCERECORD> entAttRds)
        {
            EmployeeSignInRecordBLL bllSignInRd = new EmployeeSignInRecordBLL();
            AbnormRecordBLL         bllAbnormRd = new AbnormRecordBLL();

            string strAbnormCategory = (Convert.ToInt32(Common.AbnormCategory.Absent) + 1).ToString();

            try
            {
                foreach (T_HR_ATTENDANCERECORD item in entAttRds)
                {
                    //获取请假当天所有异常考勤(针对补请假的情况,用于删除异常考勤)
                    List <T_HR_EMPLOYEEABNORMRECORD> entAbnormRecords = (from a in dal.GetObjects <T_HR_EMPLOYEEABNORMRECORD>().Include("T_HR_ATTENDANCERECORD")
                                                                         where a.T_HR_ATTENDANCERECORD.ATTENDANCERECORDID == item.ATTENDANCERECORDID && a.ABNORMCATEGORY == strAbnormCategory
                                                                         select a).ToList();

                    if (entAbnormRecords.Count() == 0)
                    {
                        continue;
                    }

                    bllSignInRd.ClearNoSignInRecord("T_HR_EMPLOYEEABNORMRECORD", item.EMPLOYEEID, entAbnormRecords);

                    foreach (T_HR_EMPLOYEEABNORMRECORD entAbnormRecord in entAbnormRecords)
                    {
                        if (!entAbnormRecord.T_HR_ATTENDANCERECORDReference.IsLoaded)
                        {
                            entAbnormRecord.T_HR_ATTENDANCERECORDReference.Load();
                        }
                        string msg = "员工id:" + entAbnormRecord.OWNERID
                                     + "员工姓名:" + entAbnormRecord.T_HR_ATTENDANCERECORD.EMPLOYEENAME
                                     + "异常签卡状态" + entAbnormRecord.SINGINSTATE
                                     + "异常日期:" + entAbnormRecord.ABNORMALDATE
                                     + "异常类型:" + entAbnormRecord.ABNORMCATEGORY
                                     + "异常时间段:" + entAbnormRecord.ATTENDPERIOD
                                     + "异常时长:" + entAbnormRecord.ABNORMALTIME
                                     + "考勤初始化记录id:" + entAbnormRecord.T_HR_ATTENDANCERECORD.ATTENDANCERECORDID;
                        bool bdel = bllAbnormRd.Delete(entAbnormRecord);
                        if (bdel)
                        {
                            Tracer.Debug("RemoveWrongSignRds 处理错误的异常考勤记录,直接删除:" + msg);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.SaveLog(ex.ToString());
            }
        }
Пример #4
0
        /// <summary>
        /// 检测并清除指定员工指定时间段内考勤异常记录并重置考勤初始化记录状态
        /// </summary>
        /// <param name="EMPLOYEEID">员工id</param>
        /// <param name="datLevestart">开始时间长日期格式2013/2/16 8:30:00</param>
        /// <param name="dtLeveEnd">结束时间长日期格式2013/2/16 8:30:00</param>
        public void DealEmployeeAbnormRecord(string EMPLOYEEID, DateTime datLevestart, DateTime dtLeveEnd, string attState)
        {
            var emp = (from em in dal.GetObjects <T_HR_EMPLOYEE>()
                       where em.EMPLOYEEID == EMPLOYEEID
                       select em.EMPLOYEEENAME).FirstOrDefault();

            string dealType = string.Empty;

            if (attState == (Convert.ToInt32(Common.AttendanceState.Leave) + 1).ToString())
            {
                dealType = "员工:" + emp + " 请假消除异常," + "时间区间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                           + "----" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (attState == (Convert.ToInt32(Common.AttendanceState.Travel) + 1).ToString())
            {
                dealType = "员工:" + emp + " 出差消除异常," + "时间区间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                           + "----" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (attState == (Convert.ToInt32(Common.AttendanceState.OutApply) + 1).ToString())
            {
                dealType = "员工:" + emp + " 外出申请消除异常," + "时间区间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                           + "----" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss");
            }
            if (attState == (Convert.ToInt32(Common.AttendanceState.OutApplyConfirm) + 1).ToString())
            {
                dealType = "员工:" + emp + " 外出确认消除异常," + "时间区间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                           + "----" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss");
            }

            Tracer.Debug(dealType + " 开始");

            DateTime dtStart = new DateTime(datLevestart.Year, datLevestart.Month, datLevestart.Day);
            DateTime dtEnd   = new DateTime(dtLeveEnd.Year, dtLeveEnd.Month, dtLeveEnd.Day);

            DateTime dtAtt = new DateTime();
            int      iDate = 0;


            #region 判断是否要初始化考勤
            while (dtAtt < dtEnd)
            {
                dtAtt = dtStart.AddDays(iDate);
                iDate++;
                IQueryable <T_HR_ATTENDANCERECORD> entArs = from r in dal.GetObjects <T_HR_ATTENDANCERECORD>()
                                                            where r.EMPLOYEEID == EMPLOYEEID &&
                                                            r.ATTENDANCEDATE == dtAtt
                                                            select r;
                if (entArs.Count() < 1)
                {
                    string dtInit = datLevestart.Year.ToString() + "-" + datLevestart.Month.ToString();
                    try
                    {
                        Tracer.Debug(dealType + " 没有查到考勤初始化数据,开始初始化员工考勤:" + dtInit);
                        AttendanceSolutionAsignBLL bllAttendanceSolutionAsign = new AttendanceSolutionAsignBLL();
                        //初始化该员工当月考勤记录
                        bllAttendanceSolutionAsign.AsignAttendanceSolutionByOrgID("4", EMPLOYEEID, dtInit);

                        Tracer.Debug(dealType + " 初始化员工考勤成功,初始化月份:" + dtInit);
                        break;
                    }
                    catch (Exception ex)
                    {
                        Tracer.Debug(dealType + " 初始化考勤失败:月份:" + dtInit + "失败原因:" + ex.ToString());
                        return;
                    }
                }
            }
            #endregion

            #region 循环检查考勤初始化记录状态

            IQueryable <T_HR_ATTENDANCERECORD> entAttAll = from r in dal.GetObjects <T_HR_ATTENDANCERECORD>()
                                                           where r.EMPLOYEEID == EMPLOYEEID &&
                                                           r.ATTENDANCEDATE >= dtStart &&
                                                           r.ATTENDANCEDATE <= dtEnd
                                                           select r;


            foreach (T_HR_ATTENDANCERECORD item in entAttAll)
            {
                string strAbnormCategory = (Convert.ToInt32(AbnormCategory.Absent) + 1).ToString();
                //获取请假当天所有异常考勤(针对补请假的情况,用于删除异常考勤)
                List <T_HR_EMPLOYEEABNORMRECORD> entAbnormRecords
                    = (from a in dal.GetObjects <T_HR_EMPLOYEEABNORMRECORD>().Include("T_HR_ATTENDANCERECORD")
                       where a.T_HR_ATTENDANCERECORD.ATTENDANCERECORDID == item.ATTENDANCERECORDID &&
                       a.ABNORMCATEGORY == strAbnormCategory
                       select a).ToList();
                int i = 0;
                i = entAbnormRecords.Count();
                #region 如果当天没有异常,直接更新此考勤记录的考勤状态
                if (i == 0)
                {
                    //Tracer.Debug(strMsg);
                    item.ATTENDANCESTATE = attState;
                    item.UPDATEDATE      = DateTime.Now;

                    string strMsg = item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + dealType + " ,无考勤异常,查询时间:" + item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd")
                                    + ",没有查到异常记录,修改考勤记录状态为:" + attState;
                    item.REMARK = dealType + strMsg;
                    int iUpdate = dal.Update(item);
                    if (iUpdate == 1)
                    {
                        Tracer.Debug(dealType + strMsg + " 成功");
                    }
                    else
                    {
                        Tracer.Debug(dealType + strMsg + " 失败");
                    }
                    continue;
                }
                #endregion
                try
                {
                    Tracer.Debug(dealType + " 日期:" + item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + ",发现当天有异常考勤,需要重新检查当天出勤状态,检查到异常记录共:" + i + "条记录"
                                 + "开始处理重新检查考勤异常——————————————————————————————————————Start");

                    Dictionary <AttendPeriod, AttendanceState> thisDayAttendState = new Dictionary <AttendPeriod, AttendanceState>();//考勤时间段1上午,2中午,3下午 考勤异常状态 1 缺勤 2 请假
                    foreach (T_HR_EMPLOYEEABNORMRECORD AbnormRecorditem in entAbnormRecords.ToList())
                    {
                        //需根据请假时间判断是否要删除掉考勤异常
                        //DateTime datLevestart = entLeaveRecord.STARTDATETIME.Value;//长日期格式2013/2/16 8:30:00
                        //DateTime datLeveEnd = entLeaveRecord.ENDDATETIME.Value;//长日期格式2013/2/16 8:30:00
                        DateTime dtDateAbnorm = AbnormRecorditem.ABNORMALDATE.Value;//短日期格式2013/3/8
                        #region 循环当天考勤异常检查出勤状态并修改考勤记录状态
                        var q = (from entsf in dal.GetObjects <T_HR_SHIFTDEFINE>()
                                 join ab in dal.GetObjects <T_HR_ATTENDANCERECORD>()
                                 on entsf.SHIFTDEFINEID equals ab.T_HR_SHIFTDEFINE.SHIFTDEFINEID
                                 where ab.ATTENDANCERECORDID == AbnormRecorditem.T_HR_ATTENDANCERECORD.ATTENDANCERECORDID
                                 select entsf);
                        if (q.Count() > 0)
                        {
                            T_HR_SHIFTDEFINE defineTime = q.FirstOrDefault();
                            if (AbnormRecorditem.ATTENDPERIOD.Trim() == "1")                                            //上午上班8:30异常
                            {
                                if (!string.IsNullOrEmpty(defineTime.NEEDFIRSTCARD) && defineTime.NEEDFIRSTCARD == "2") //以集团打卡举例,第一段上班打卡8:30
                                {
                                    Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第一段开始上班时间需打卡");
                                    if (!string.IsNullOrEmpty(defineTime.FIRSTSTARTTIME))
                                    {
                                        //定义的开始上班时间8:30
                                        DateTime ShiftFirstStartTime   = DateTime.Parse(defineTime.FIRSTSTARTTIME);
                                        DateTime ShiftstartDateAndTime = new DateTime(dtDateAbnorm.Year, dtDateAbnorm.Month, dtDateAbnorm.Day, ShiftFirstStartTime.Hour, ShiftFirstStartTime.Minute, ShiftFirstStartTime.Second);
                                        //定义的第一段上班结束时间12:00
                                        if (!string.IsNullOrEmpty(defineTime.FIRSTENDTIME))
                                        {
                                            DateTime FirstEndTime        = DateTime.Parse(defineTime.FIRSTENDTIME);
                                            DateTime FirstEndDateAndTime = new DateTime(dtDateAbnorm.Year, dtDateAbnorm.Month, dtDateAbnorm.Day, FirstEndTime.Hour, FirstEndTime.Minute, FirstEndTime.Second);

                                            //如果请假时间包括了第一段上班时间,那么消除异常
                                            if (datLevestart <= ShiftstartDateAndTime &&
                                                dtLeveEnd >= ShiftstartDateAndTime)
                                            {
                                                Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第一段开始上班时间需打卡时间被请假时间覆盖,消除异常"
                                                             + " 消除异常,开始时间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                                                             + " 结束时间:" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss") + "定义的上班开始时间:" +
                                                             ShiftstartDateAndTime.ToString("yyyy-MM-dd HH:mm:ss") + "定义的上班结束时间:" + FirstEndDateAndTime.ToString("yyyy-MM-dd HH:mm:ss"));
                                                //消除第一段异常生成的签卡
                                                DeleteSigFromAbnormal(AbnormRecorditem);
                                                //消除第一段打卡时间异常考勤
                                                dal.Delete(AbnormRecorditem);
                                                //第一段考勤时间标记为请假
                                                thisDayAttendState.Add(AttendPeriod.Morning, AttendanceState.Leave);
                                            }
                                            else
                                            {   //第一段考勤时间标记为异常
                                                thisDayAttendState.Add(AttendPeriod.Morning, AttendanceState.Abnormal);
                                            }
                                        }
                                        else
                                        {
                                            Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第一段开始上班时间需打卡,但班次定义中的FIRSTSTARTTIME为空");
                                        }
                                    }
                                    else
                                    {
                                        Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第一段开始上班时间需打卡,但班次定义中的FIRSTSTARTTIME为空");
                                    }
                                }
                            }
                            if (AbnormRecorditem.ATTENDPERIOD.Trim() == "2")                                              //中午上班13:30异常
                            {
                                if (!string.IsNullOrEmpty(defineTime.NEEDSECONDCARD) && defineTime.NEEDSECONDCARD == "2") //以集团打卡举例,第二段上班打卡13:30
                                {
                                    Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段开始上班时间需打卡");
                                    if (!string.IsNullOrEmpty(defineTime.SECONDSTARTTIME))
                                    {
                                        DateTime SecondStartTime        = DateTime.Parse(defineTime.SECONDSTARTTIME);
                                        DateTime SecondStartDateAndTime = new DateTime(dtDateAbnorm.Year, dtDateAbnorm.Month, dtDateAbnorm.Day, SecondStartTime.Hour, SecondStartTime.Minute, SecondStartTime.Second);
                                        if (!string.IsNullOrEmpty(defineTime.SECONDENDTIME))
                                        {
                                            DateTime SencondEndTime        = DateTime.Parse(defineTime.SECONDENDTIME);
                                            DateTime SencondEndDateAndTime = new DateTime(dtDateAbnorm.Year, dtDateAbnorm.Month, dtDateAbnorm.Day, SencondEndTime.Hour, SencondEndTime.Minute, SencondEndTime.Second);

                                            if (datLevestart <= SecondStartDateAndTime &&
                                                dtLeveEnd >= SecondStartDateAndTime)
                                            {
                                                Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段开始上班时间需打卡时间被请假时间覆盖,消除异常"
                                                             + " 消除异常,开始时间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                                                             + " 结束时间:" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss") + "定义的上班开始时间:" +
                                                             SecondStartDateAndTime.ToString("yyyy-MM-dd HH:mm:ss") + "定义的上班结束时间:" + SencondEndDateAndTime.ToString("yyyy-MM-dd HH:mm:ss"));

                                                //消除第二段异常生成的签卡
                                                DeleteSigFromAbnormal(AbnormRecorditem);
                                                //消除第二段打卡时间异常考勤
                                                dal.Delete(AbnormRecorditem);
                                                thisDayAttendState.Add(AttendPeriod.Midday, AttendanceState.Leave);
                                            }
                                            else
                                            {
                                                thisDayAttendState.Add(AttendPeriod.Midday, AttendanceState.Abnormal);
                                            }
                                        }
                                        else
                                        {
                                            Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段开始上班时间需打卡,但班次定义中的SECONDENDTIME为空");
                                        }
                                    }
                                    else
                                    {
                                        Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段开始上班时间需打卡,但班次定义中的SECONDSTARTTIME为空");
                                    }
                                }
                            }
                            if (AbnormRecorditem.ATTENDPERIOD.Trim() == "3")                                                    //下午17:30下班异常
                            {
                                if (!string.IsNullOrEmpty(defineTime.NEEDSECONDOFFCARD) && defineTime.NEEDSECONDOFFCARD == "2") //以集团打卡举例,第二段下班打卡17:30
                                {
                                    Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段结束上班时间需打卡");
                                    if (!string.IsNullOrEmpty(defineTime.SECONDSTARTTIME))
                                    {
                                        DateTime SecondStartTime        = DateTime.Parse(defineTime.SECONDSTARTTIME);
                                        DateTime SecondStartDateAndTime = new DateTime(dtDateAbnorm.Year, dtDateAbnorm.Month, dtDateAbnorm.Day, SecondStartTime.Hour, SecondStartTime.Minute, SecondStartTime.Second);

                                        if (!string.IsNullOrEmpty(defineTime.SECONDENDTIME))
                                        {
                                            DateTime SencondEndTime        = DateTime.Parse(defineTime.SECONDENDTIME);
                                            DateTime SencondEndDateAndTime = new DateTime(dtDateAbnorm.Year, dtDateAbnorm.Month, dtDateAbnorm.Day, SencondEndTime.Hour, SencondEndTime.Minute, SencondEndTime.Second);

                                            if (datLevestart <= SencondEndDateAndTime &&
                                                dtLeveEnd >= SencondEndDateAndTime)
                                            {
                                                Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段结束上班时间需打卡时间被请假时间覆盖,消除异常"
                                                             + " 消除异常,开始时间:" + datLevestart.ToString("yyyy-MM-dd HH:mm:ss")
                                                             + " 结束时间:" + dtLeveEnd.ToString("yyyy-MM-dd HH:mm:ss") + "定义的上班开始时间:" +
                                                             SecondStartDateAndTime.ToString("yyyy-MM-dd HH:mm:ss") + "定义的上班结束时间:" + SencondEndDateAndTime.ToString("yyyy-MM-dd HH:mm:ss"));

                                                //消除第三段异常生成的签卡
                                                DeleteSigFromAbnormal(AbnormRecorditem);
                                                //消除第三段打卡时间异常考勤
                                                dal.Delete(AbnormRecorditem);
                                                thisDayAttendState.Add(AttendPeriod.Evening, AttendanceState.Leave);
                                            }
                                            else
                                            {
                                                thisDayAttendState.Add(AttendPeriod.Evening, AttendanceState.Abnormal);
                                            }
                                        }
                                        else
                                        {
                                            Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段结束上班时间需打卡,但班次定义中的SECONDENDTIME为空");
                                        }
                                    }
                                    else
                                    {
                                        Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "考勤班次定义T_HR_SHIFTDEFINE第二段结束上班时间需打卡,但班次定义中的SECONDSTARTTIME为空");
                                    }
                                }
                            }
                        }
                        else
                        {
                            Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + "消除异常,通过异常记录获取到考勤初始化记录但通过考勤初始化记录获取的考勤班次定义T_HR_SHIFTDEFINE为空");
                        }
                        #endregion
                    }
                    #region 修改考勤记录状态
                    if (thisDayAttendState.Count() > 0) //如果当天存在异常或请假情况
                    {                                   //如果当天存在请假,同时也存在异常
                        if (thisDayAttendState.Values.Contains(AttendanceState.Leave) && thisDayAttendState.Values.Contains(AttendanceState.Abnormal))
                        {                               //标记当天出勤状况为Mix状态
                            if (attState == (Convert.ToInt32(Common.AttendanceState.Leave) + 1).ToString())
                            {
                                item.ATTENDANCESTATE = (Convert.ToInt32(Common.AttendanceState.MixLeveAbnormal) + 1).ToString();
                            }
                            if (attState == (Convert.ToInt32(Common.AttendanceState.Travel) + 1).ToString())
                            {
                                item.ATTENDANCESTATE = (Convert.ToInt32(Common.AttendanceState.MixTravelAbnormal) + 1).ToString();
                            }
                            if (attState == (Convert.ToInt32(Common.AttendanceState.OutApply) + 1).ToString())
                            {
                                item.ATTENDANCESTATE = (Convert.ToInt32(Common.AttendanceState.MixOutApplyAbnormal) + 1).ToString();
                            }
                            item.UPDATEDATE = DateTime.Now;

                            string strMsg = item.ATTENDANCEDATE.Value.ToString("yyy-MM-dd") + " 消除异常修改状态完成,员工姓名:" + item.EMPLOYEENAME
                                            + ",修改的状态为:" + item.ATTENDANCESTATE;

                            item.REMARK = dealType + strMsg;
                            int iUpdate = dal.Update(item);
                            if (iUpdate == 1)
                            {
                                Tracer.Debug(dealType + strMsg + " 成功");
                            }
                            else
                            {
                                Tracer.Debug(dealType + strMsg + " 失败");
                            }
                        }
                        else if (thisDayAttendState.Values.Contains(AttendanceState.Leave) && !thisDayAttendState.Values.Contains(AttendanceState.Abnormal))
                        {
                            //如果当天异常时间已全部被请假时间涵盖,删除签卡提醒并标记考勤为请假
                            EmployeeSignInRecordBLL bllSignInRd = new EmployeeSignInRecordBLL();
                            bllSignInRd.ClearNoSignInRecord("T_HR_EMPLOYEEABNORMRECORD", item.EMPLOYEEID, entAbnormRecords);
                            item.ATTENDANCESTATE = attState;
                            item.UPDATEDATE      = DateTime.Now;

                            string strMsg = item.ATTENDANCEDATE.Value.ToString("yyy-MM-dd") + " 消除异常修改状态完成,员工姓名:" + item.EMPLOYEENAME
                                            + ",修改的状态为:" + item.ATTENDANCESTATE;
                            item.REMARK = dealType + strMsg;
                            int iUpdate = dal.Update(item);
                            if (iUpdate == 1)
                            {
                                Tracer.Debug(dealType + strMsg + " 成功");
                            }
                            else
                            {
                                Tracer.Debug(dealType + strMsg + " 失败");
                            }
                        }
                    }
                    #endregion

                    Tracer.Debug(dealType + " 日期:" + item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + ",发现当天有异常考勤,需要重新检查当天出勤状态,检查到异常记录共:" + i + "条记录"
                                 + "开始处理重新检查考勤异常——————————————————————————————————————End");
                }
                catch (Exception ex)
                {
                    Tracer.Debug(item.ATTENDANCEDATE.Value.ToString("yyyy-MM-dd") + " " + dealType + " 异常:" + ex.ToString());
                }
            }//for each T_HR_ATTENDANCERECORD End
            #endregion

            Tracer.Debug(dealType + " 结束!");
        }