Ver código fonte

【修改】教师考勤打卡:授课教师可实现一直打卡;

黑龙江艺术高中职
dyy 6 meses atrás
pai
commit
3930277f9d
1 arquivos alterados com 93 adições e 14 exclusões
  1. +93
    -14
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs

+ 93
- 14
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs Ver arquivo

@@ -184,6 +184,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
var userinfo = LoginUserInfo.Get();
//员工账号
string EmpNo = userinfo.account;
EmpInfoEntity empInfo = this.BaseRepository("CollegeMIS").FindEntity<EmpInfoEntity>(x => x.EmpNo == EmpNo);
if (empInfo == null)
{
return true;
}

//考勤状态
string ADType = "0";
@@ -207,6 +212,68 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
//设备事件时间(在这里,=当前时间)
DateTime devicetime = Convert.ToDateTime(strTime);

//判断教师是坐班还是授课:授课的话可一直正常打卡,不受考勤规则的限制;第一次为上班,第二次为下班,第三次之后更新下班;
if (empInfo.CompilationCategory == "2") //授课
{
ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity();
adrRecordEntity.Create();
adrRecordEntity.UserName = userinfo.realName;
adrRecordEntity.UserNo = EmpNo;
adrRecordEntity.ADType = ADType;
adrRecordEntity.ADTime = datetimenow;
adrRecordEntity.ClockTime = devicetime;
adrRecordEntity.ClockStatus = ClockStatus;
adrRecordEntity.ADYear = strTimeYear;
adrRecordEntity.ADMonth = strTimeMonth;
adrRecordEntity.ADDay = strTimeDay;
adrRecordEntity.ALon = ALon;
adrRecordEntity.ALat = ALat;
adrRecordEntity.AIsOut = AIsOut;
adrRecordEntity.ARemark = ARemark;
adrRecordEntity.ADPhoto = ADPhoto;
adrRecordEntity.ClockPlace = ClockPlace;
adrRecordEntity.Img = img;
adrRecordEntity.IsFit = true;
//判断是上班还是下班
var attendancerecord = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(
"select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList();
if (attendancerecord.Where(x => x.ADType == "1").Any())
{
adrRecordEntity.ADType = "2";
if (attendancerecord.Where(x => x.ADType == "2").Any())
{
//更新签退时间,签退状态
var firstoffworkentity = attendancerecord.FirstOrDefault(m => m.ADType == "2");
firstoffworkentity.ADTime = datetimenow;
firstoffworkentity.ClockTime = devicetime;
firstoffworkentity.ClockStatus = ClockStatus;
firstoffworkentity.ARemark = ARemark;
firstoffworkentity.ClockPlace = ClockPlace;
firstoffworkentity.Img = img;
firstoffworkentity.ADPhoto = ADPhoto;
firstoffworkentity.AIsOut = AIsOut;
this.BaseRepository("CollegeMIS").ExecuteBySql("update ADR_Record set ADTime='" + firstoffworkentity.ADTime + "',ClockTime='" + firstoffworkentity.ClockTime + "',ClockStatus='" + firstoffworkentity.ClockStatus + "',ADPhoto='" + firstoffworkentity.ADPhoto + "' where ID='" + firstoffworkentity.ID + "'");
//同步修改授课考勤打卡
ClockInModifyTeachAttendance(adrRecordEntity);
return true;
}
}
else
{
//写入上班记录
adrRecordEntity.ADType = "1";
}
//考勤记录
this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,IsFit,ARemark) values(" +
"'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," +
"'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," +
"'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.IsFit + "','" + adrRecordEntity.ARemark + "')");
//同步修改授课考勤打卡
ClockInModifyTeachAttendance(adrRecordEntity);
return true;
}

//上班时间
DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime);
//上班考勤时间段
@@ -253,7 +320,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
ADType = "2";//下班
ClockStatus = "1";//正常
}
else if (devicetime < signOutStartTime && devicetime > signInEndTime)//小于下班时间
else if (devicetime < signOutStartTime && devicetime > signInEndTime)//小于下班时间
{
//首先判断是上班还是下班
//该用户当日有签到记录视为下班签退
@@ -266,7 +333,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
{
ADType = "2";//下班

if(devicetime< workDateTimelunch)
if (devicetime < workDateTimelunch)
{
DateTime offworkDateTimeFree1 = offworkstartlunch.AddMinutes(-leaveTime);
if (devicetime < offworkDateTimeFree1)
@@ -281,7 +348,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
else
{
if(devicetime>=(signOutStartTime.AddMinutes(-leaveTime)))
if (devicetime >= (signOutStartTime.AddMinutes(-leaveTime)))
{
ClockStatus = "1";
}
@@ -316,17 +383,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
else//判断为上班迟到
{
if (devicetime< offworkstartlunch.AddMinutes(-leaveTime))
if (devicetime < offworkstartlunch.AddMinutes(-leaveTime))
{
ADType = "1";
ClockStatus = "2";
}
else if(devicetime>= offworkstartlunch.AddMinutes(-leaveTime) && devicetime<= offworkendlunch)
else if (devicetime >= offworkstartlunch.AddMinutes(-leaveTime) && devicetime <= offworkendlunch)
{
ADType = "2";
ClockStatus = "1";
}
else if(devicetime>= workstartlunch && devicetime<=workendlunch.AddMinutes(overTime))
else if (devicetime >= workstartlunch && devicetime <= workendlunch.AddMinutes(overTime))
{
ADType = "1";
ClockStatus = "1";
@@ -1163,14 +1230,15 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
return adrresult;
}
//代课老师全天可以考勤
if (empinfo.IsHasLesson == true)
{
attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true && m.AType == 2);
}
else
{
attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true && m.AType == 1);
}
//if (empinfo.IsHasLesson == true)
//{
// attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true && m.AType == 2);
//}
//else
//{
// attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true && m.AType == 1);
//}
attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RestrictionEntity>(m => m.REnable == true);
//考勤规则为空时
if (attendancerulEntity == null)
{
@@ -1236,6 +1304,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
"select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList();

//判断教师是坐班还是授课:授课的话可一直正常打卡,不受考勤规则的限制;
if (empinfo.CompilationCategory == "2")//授课
{
adrresult.AttendanceType = 1;
adrresult.AttendanceTypeString = "正常打卡";
var userWorkTime = attendancerecordList.Where(m => m.ADType == "1").OrderByDescending(m => m.ADTime).FirstOrDefault()?.ADTime.Value;
var userCloseTime = attendancerecordList.Where(m => m.ADType == "2").OrderByDescending(m => m.ADTime).FirstOrDefault()?.ADTime.Value;
adrresult.UserWorkTime = userWorkTime != null ? userWorkTime.ToString() : "";
adrresult.UserCloseTime = userCloseTime != null ? userCloseTime.ToString() : "";
return adrresult;
}

if (attendancerulEntity.ClockTime == "二次打卡")
{


Carregando…
Cancelar
Salvar