/// <summary> /// 外出消除异常 /// </summary> /// <param name="obj"></param> private void dealAttend(object obj) { Dictionary <string, object> parameterDic = (Dictionary <string, object>)obj; string employeeid = parameterDic["EMPLOYEEID"].ToString(); DateTime STARTDATETIME = (DateTime)parameterDic["STARTDATETIME"]; DateTime ENDDATETIME = (DateTime)parameterDic["ENDDATETIME"]; string attState = parameterDic["ATTSTATE"].ToString(); using (AbnormRecordBLL bll = new AbnormRecordBLL()) { //外出消除异常 bll.DealEmployeeAbnormRecord(employeeid, STARTDATETIME, ENDDATETIME, attState); } }
/// <summary> /// 新增出差记录信息 /// </summary> /// <param name="entity">出差记录实体</param> public void EmployeeEvectionRecordADD(T_HR_EMPLOYEEEVECTIONRECORD entity) { try { //IQueryable<T_HR_ATTENDANCERECORD> entArs = from r in dal.GetObjects<T_HR_ATTENDANCERECORD>() // where r.EMPLOYEEID == entity.EMPLOYEEID && r.ATTENDANCEDATE >= entity.STARTDATE && r.ATTENDANCEDATE <= entity.ENDDATE // select r; //if (entArs.Count() > 0) //{ // AttendanceRecordBLL bllAttendRecord = new AttendanceRecordBLL(); // EmployeeSignInRecordBLL bllSignInRd = new EmployeeSignInRecordBLL(); // foreach (T_HR_ATTENDANCERECORD item in entArs) // { //item.ATTENDANCESTATE = (Convert.ToInt32(Common.AttendanceState.OutOnDuty) + 1).ToString(); //bllAttendRecord.ModifyAttRd(item); // string strAbnormCategory = (Convert.ToInt32(Common.AbnormCategory.Absent) + 1).ToString(); // IQueryable<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; // if (entAbnormRecords.Count() == 0) // { // continue; // } // bllSignInRd.ClearNoSignInRecord("T_HR_EMPLOYEEABNORMRECORD", item.EMPLOYEEID, entAbnormRecords); // foreach (T_HR_EMPLOYEEABNORMRECORD entAbnormRecord in entAbnormRecords) // { // dal.DeleteFromContext(entAbnormRecord); // } // dal.SaveContextChanges(); // } //} #region 启动处理考勤异常的线程 string attState = (Convert.ToInt32(Common.AttendanceState.Travel) + 1).ToString(); //Dictionary<string, object> d = new Dictionary<string, object>(); //d.Add("EMPLOYEEID", entity.EMPLOYEEID); //d.Add("STARTDATETIME", entity.STARTDATE.Value); //d.Add("ENDDATETIME", entity.ENDDATE.Value); //d.Add("ATTSTATE", attState); //Thread thread = new Thread(dealAttend); //thread.Start(d); Tracer.Debug("出差启动消除异常,出差开始时间:" + entity.STARTDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") + " 结束时间:" + entity.ENDDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") + "员工id:" + entity.EMPLOYEEID); using (AbnormRecordBLL bll = new AbnormRecordBLL()) { bll.DealEmployeeAbnormRecord(entity.EMPLOYEEID, entity.STARTDATE.Value, entity.ENDDATE.Value, attState); } Tracer.Debug("出差启动消除异常完成"); #endregion //Tracer.Debug("出差消除异常开始,请假开始时间:" + entity.STARTDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") // + " 结束时间:" + entity.ENDDATE.Value.ToString("yyyy-MM-dd HH:mm:ss")); //AbnormRecordBLL bll = new AbnormRecordBLL(); ////string attState = (Convert.ToInt32(Common.AttendanceState.Travel) + 1).ToString(); //bll.DealEmployeeAbnormRecord(entity.EMPLOYEEID, entity.STARTDATE.Value, entity.ENDDATE.Value, attState); //Tracer.Debug("出差消除异常结束,请假开始时间:" + entity.STARTDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") // + " 结束时间:" + entity.ENDDATE.Value.ToString("yyyy-MM-dd HH:mm:ss")); dal.Add(entity); Tracer.Debug("出差同步HR考勤记录完毕"); } catch (Exception ex) { Utility.SaveLog(ex.ToString()); } }