Exemplo n.º 1
0
        /// <summary>
        /// 根据公司ID,计算该公司指定时间段内员工考勤异常情况
        /// </summary>
        /// <param name="strCompanyId"></param>
        /// <param name="dtPunchFrom"></param>
        /// <param name="dtPunchTo"></param>
        /// <param name="strMsg"></param>
        public void CheckAbnormRdForCompanyByDate(string strCompanyId, DateTime dtPunchFrom, DateTime dtPunchTo, ref string strMsg)
        {
            if (dtPunchFrom > dtPunchTo)
            {
                return;
            }

            EmployeeBLL          bllEmployee  = new EmployeeBLL();
            List <T_HR_EMPLOYEE> entEmployees = new List <T_HR_EMPLOYEE>();
            var ents = bllEmployee.GetEmployeeByCompanyID(strCompanyId, dtPunchFrom);

            if (ents == null)
            {
                strMsg = "当前查询公司无员工记录";
                return;
            }

            if (ents.Count() == 0)
            {
                strMsg = "当前查询公司无员工记录";
                return;
            }

            entEmployees = ents.ToList();

            AbnormRecordBLL bllAbnormRecord = new AbnormRecordBLL();

            bllAbnormRecord.CheckAbnormRecordForEmployees(entEmployees, dtPunchFrom, dtPunchTo, ref strMsg);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据员工ID,计算该公司指定时间段内员工考勤异常情况
        /// </summary>
        /// <param name="strEmployeeIds"></param>
        /// <param name="dtPunchFrom"></param>
        /// <param name="dtPunchTo"></param>
        /// <param name="strMsg"></param>
        public void CheckAbnormRdForEmployeesByDate(string strEmployeeIds, DateTime dtPunchFrom, DateTime dtPunchTo, ref string strMsg)
        {
            if (dtPunchFrom > dtPunchTo)
            {
                return;
            }

            string[] strlist = strEmployeeIds.Split(',');

            EmployeeBLL          bllEmployee  = new EmployeeBLL();
            List <T_HR_EMPLOYEE> entEmployees = bllEmployee.GetEmployeeByIDs(strlist);

            if (entEmployees == null)
            {
                strMsg = "当前员工编号无对应的员工";
                return;
            }

            if (entEmployees.Count() == 0)
            {
                strMsg = "当前员工编号无对应的员工";
                return;
            }

            AbnormRecordBLL bllAbnormRecord = new AbnormRecordBLL();

            bllAbnormRecord.CheckAbnormRecordForEmployees(entEmployees, dtPunchFrom, dtPunchTo, ref strMsg);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据员工指纹编号,计算该员工指定月份考勤异常情况
        /// </summary>
        /// <param name="strFingertId">员工指纹编号</param>
        /// <param name="strPunchMonth">月份</param>
        /// <param name="strMsg">返回处理消息</param>
        public void CheckAbnormRecordByFingertId(string strFingertId, string strPunchMonth, ref string strMsg)
        {
            DateTime dtCheck = new DateTime();
            DateTime dtStart = new DateTime(), dtEnd = new DateTime();

            DateTime.TryParse(strPunchMonth + "-1", out dtStart);
            if (dtStart <= dtCheck)
            {
                return;
            }

            dtEnd = dtStart.AddMonths(1).AddDays(-1);
            //DateTime.TryParse("2011-10-16", out dtEnd);

            List <T_HR_EMPLOYEE> entEmployees = new List <T_HR_EMPLOYEE>();

            EmployeeBLL   bllEmployee         = new EmployeeBLL();
            T_HR_EMPLOYEE entEmployee         = bllEmployee.GetEmployeeByFingerPrintID(strFingertId);

            if (entEmployee == null)
            {
                strMsg = "当前指纹编号无对应的员工";
                return;
            }

            entEmployees.Add(entEmployee);

            AbnormRecordBLL bllAbnormRecord = new AbnormRecordBLL();

            bllAbnormRecord.CheckAbnormRecordForEmployees(entEmployees, dtStart, dtEnd, ref strMsg);
        }
Exemplo n.º 4
0
        /// <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);
            }
        }
Exemplo n.º 5
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());
            }
        }
Exemplo n.º 6
0
        /// <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());
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 签卡记录审核
        /// </summary>
        /// <param name="strSignInID"></param>
        /// <param name="strCheckState"></param>
        public string EmployeeSigninRecordAudit(string strSignInID, string strCheckState)
        {
            string strMsg      = string.Empty;
            string singinstate = "0";

            try
            {
                if (string.IsNullOrEmpty(strSignInID) || string.IsNullOrEmpty(strCheckState))
                {
                    return("{NOTFOUND}");
                }

                bool          flag      = false;
                StringBuilder strFilter = new StringBuilder();
                List <string> objArgs   = new List <string>();

                strFilter.Append(" SIGNINID == @0");

                objArgs.Add(strSignInID);

                EmployeeSigninRecordDAL dalSigninRecord = new EmployeeSigninRecordDAL();
                flag = dalSigninRecord.IsExistsRd(strFilter.ToString(), objArgs.ToArray());

                if (!flag)
                {
                    return("{NOTFOUND}");
                }

                T_HR_EMPLOYEESIGNINRECORD entAudit = dalSigninRecord.GetSigninRecordByMultSearch(strFilter.ToString(), objArgs.ToArray());

                //已审核通过的记录禁止再次提交审核
                if (entAudit.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString())
                {
                    return("{REPEATAUDITERROR}");
                }

                //审核状态变为审核中或者审核通过时,生成对应的员工考勤记录(应用的员工范围,视应用对象而定)
                if (strCheckState == Convert.ToInt32(CheckStates.Approved).ToString())
                {
                    singinstate = "2";
                }
                else if (strCheckState == Convert.ToInt32(CheckStates.Approving).ToString())
                {
                    singinstate = "3";
                }
                else if (strCheckState == Convert.ToInt32(CheckStates.UnApproved).ToString())
                {
                    singinstate = "1";
                }

                if (Convert.ToInt32(singinstate) == 0)
                {
                    return("{NOTFOUND}");
                }

                EmployeeSignInDetailBLL bllDetail = new EmployeeSignInDetailBLL();
                IQueryable <T_HR_EMPLOYEESIGNINDETAIL> entDetails = bllDetail.GetEmployeeSignInDetailBySigninID(strSignInID);
                foreach (T_HR_EMPLOYEESIGNINDETAIL item in entDetails)
                {
                    AbnormRecordBLL           bllAbnormRecord = new AbnormRecordBLL();
                    T_HR_EMPLOYEEABNORMRECORD entAbnormRecord = item.T_HR_EMPLOYEEABNORMRECORD;
                    entAbnormRecord.SINGINSTATE = singinstate;//(Convert.ToInt32(Common.IsChecked.Yes) + 1).ToString();
                    bllAbnormRecord.ModifyAbnormRecord(entAbnormRecord);
                    try
                    {
                        var q = (from ent in dal.GetObjects <T_HR_EMPLOYEEABNORMRECORD>()
                                 where ent.ABNORMRECORDID == entAbnormRecord.ABNORMRECORDID
                                 select ent).FirstOrDefault();
                        Tracer.Debug("异常签卡终审修改异常考勤记录状态为已签卡,异常日期:" + q.ABNORMALDATE
                                     + "异常考勤状态,2为正常状态:" + q.SINGINSTATE);
                    }
                    catch (Exception ex)
                    {
                        Tracer.Debug("异常签卡终审修改异常考勤记录异常:" + ex.ToString());
                    }
                }

                entAudit.CHECKSTATE = strCheckState;
                dalSigninRecord.Update(entAudit);

                SaveMyRecord(entAudit);
                strMsg = "{SAVESUCCESSED}";

                if (entAudit.CHECKSTATE == Convert.ToInt32(CheckStates.UnSubmit).ToString() && entAudit.CHECKSTATE != strCheckState)
                {
                    Tracer.Debug(" 异常签卡审核异常 entAudit.CHECKSTATE != strCheckState,entAudit.CHECKSTATE:" + entAudit.CHECKSTATE
                                 + " 流程传过来的审核状态为:" + strCheckState
                                 + " 表示流程更新业务表单失败:执行ClearNoSignInRecord"
                                 + " entAudit.EMPLOYEENAME:" + entAudit.EMPLOYEENAME
                                 + " entAudit.SIGNINID:" + entAudit.SIGNINID
                                 + " entAudit.SIGNINTIME:" + entAudit.SIGNINTIME);

                    List <T_HR_EMPLOYEEABNORMRECORD> entABnormRecords = entDetails.Select(c => c.T_HR_EMPLOYEEABNORMRECORD).ToList();
                    ClearNoSignInRecord("T_HR_EMPLOYEESIGNINRECORD", entAudit.EMPLOYEEID, entABnormRecords);
                }
            }
            catch (Exception ex)
            {
                strMsg = ex.Message;
            }

            return(strMsg);
        }