|
|
@@ -219,6 +219,21 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
DateTime signOutStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime); |
|
|
|
DateTime signOutEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime); |
|
|
|
|
|
|
|
//中午下班时间 |
|
|
|
DateTime offworkDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonCloseTime); |
|
|
|
//中午上班时间 |
|
|
|
DateTime workDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonWorkTime); |
|
|
|
//中午下班考勤时间段 |
|
|
|
DateTime offworkstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime2); |
|
|
|
DateTime offworkendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime2); |
|
|
|
//中午上班考勤时间段 |
|
|
|
DateTime workstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime2); |
|
|
|
DateTime workendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime2); |
|
|
|
|
|
|
|
|
|
|
|
var leaveTime = attendancerulEntity.LeaveOverTime ?? 0; |
|
|
|
var overTime = attendancerulEntity.LateOvertime ?? 0; |
|
|
|
|
|
|
|
|
|
|
|
//2021.12.30 上下班设置时间段打卡 |
|
|
|
#region 二次打卡 |
|
|
@@ -238,7 +253,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
ADType = "2";//下班 |
|
|
|
ClockStatus = "1";//正常 |
|
|
|
} |
|
|
|
else if (devicetime <= signOutStartTime)//小于下班时间 |
|
|
|
else if (devicetime < signOutStartTime && devicetime > signInEndTime)//小于下班时间 |
|
|
|
{ |
|
|
|
//首先判断是上班还是下班 |
|
|
|
//该用户当日有签到记录视为下班签退 |
|
|
@@ -249,50 +264,101 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
|
|
|
|
if (attendancerecord.Count() > 0)//如果存在上班考勤记录 |
|
|
|
{ |
|
|
|
//判断为下班早退 |
|
|
|
if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)//如果允许早退,获取范围 |
|
|
|
ADType = "2";//下班 |
|
|
|
|
|
|
|
if(devicetime< workDateTimelunch) |
|
|
|
{ |
|
|
|
//最早签退时间 |
|
|
|
DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime)); |
|
|
|
if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常 |
|
|
|
DateTime offworkDateTimeFree1 = offworkstartlunch.AddMinutes(-leaveTime); |
|
|
|
if (devicetime < offworkDateTimeFree1) |
|
|
|
{ |
|
|
|
ADType = "2";//下班 |
|
|
|
ClockStatus = "1";//正常 |
|
|
|
ClockStatus = "3"; |
|
|
|
} |
|
|
|
else//超出早退范围视为早退 |
|
|
|
else |
|
|
|
{ |
|
|
|
ADType = "2";//下班 |
|
|
|
ClockStatus = "3";//早退 |
|
|
|
ClockStatus = "1"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else//不允许早退直接视为早退 |
|
|
|
{ |
|
|
|
ADType = "2";//下班 |
|
|
|
ClockStatus = "3";//早退 |
|
|
|
} |
|
|
|
} |
|
|
|
else//判断为上班迟到 |
|
|
|
{ |
|
|
|
if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)//如果允许迟到,获取范围 |
|
|
|
else |
|
|
|
{ |
|
|
|
//最晚签到时间 |
|
|
|
DateTime workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime)); |
|
|
|
if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常 |
|
|
|
if(devicetime>=(signOutStartTime.AddMinutes(-leaveTime))) |
|
|
|
{ |
|
|
|
ADType = "1";//上班 |
|
|
|
ClockStatus = "1";//正常 |
|
|
|
ClockStatus = "1"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ADType = "1";//上班 |
|
|
|
ClockStatus = "2";//迟到 |
|
|
|
ClockStatus = "3"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
////判断为下班早退 |
|
|
|
//if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)//如果允许早退,获取范围 |
|
|
|
//{ |
|
|
|
// //最早签退时间 |
|
|
|
// DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime)); |
|
|
|
// if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常 |
|
|
|
// { |
|
|
|
// ADType = "2";//下班 |
|
|
|
// ClockStatus = "1";//正常 |
|
|
|
// } |
|
|
|
// else//超出早退范围视为早退 |
|
|
|
// { |
|
|
|
// ADType = "2";//下班 |
|
|
|
// ClockStatus = "3";//早退 |
|
|
|
// } |
|
|
|
//} |
|
|
|
//else//不允许早退直接视为早退 |
|
|
|
//{ |
|
|
|
// ADType = "2";//下班 |
|
|
|
// ClockStatus = "3";//早退 |
|
|
|
//} |
|
|
|
} |
|
|
|
else//判断为上班迟到 |
|
|
|
{ |
|
|
|
if (devicetime< offworkstartlunch.AddMinutes(-leaveTime)) |
|
|
|
{ |
|
|
|
ADType = "1"; |
|
|
|
ClockStatus = "2"; |
|
|
|
} |
|
|
|
else if(devicetime>= offworkstartlunch.AddMinutes(-leaveTime) && devicetime<= offworkendlunch) |
|
|
|
{ |
|
|
|
ADType = "2"; |
|
|
|
ClockStatus = "1"; |
|
|
|
} |
|
|
|
else if(devicetime>= workstartlunch && devicetime<=workendlunch.AddMinutes(overTime)) |
|
|
|
{ |
|
|
|
ADType = "1"; |
|
|
|
ClockStatus = "1"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ADType = "1";//上班 |
|
|
|
ClockStatus = "2";//迟到 |
|
|
|
ADType = "1"; |
|
|
|
ClockStatus = "2"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)//如果允许迟到,获取范围 |
|
|
|
//{ |
|
|
|
// //最晚签到时间 |
|
|
|
// DateTime workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime)); |
|
|
|
// if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常 |
|
|
|
// { |
|
|
|
// ADType = "1";//上班 |
|
|
|
// ClockStatus = "1";//正常 |
|
|
|
// } |
|
|
|
// else |
|
|
|
// { |
|
|
|
// ADType = "1";//上班 |
|
|
|
// ClockStatus = "2";//迟到 |
|
|
|
// } |
|
|
|
//} |
|
|
|
//else |
|
|
|
//{ |
|
|
|
// ADType = "1";//上班 |
|
|
|
// ClockStatus = "2";//迟到 |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -455,16 +521,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
#region 四次打卡 |
|
|
|
else//四次打卡 |
|
|
|
{ |
|
|
|
//中午下班时间 |
|
|
|
DateTime offworkDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonCloseTime); |
|
|
|
//中午上班时间 |
|
|
|
DateTime workDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonWorkTime); |
|
|
|
//中午下班考勤时间段 |
|
|
|
DateTime offworkstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime2); |
|
|
|
DateTime offworkendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime2); |
|
|
|
//中午上班考勤时间段 |
|
|
|
DateTime workstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime2); |
|
|
|
DateTime workendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime2); |
|
|
|
|
|
|
|
//首先判断是否在中午考勤时间段 |
|
|
|
//如果在中午下班考勤时间段 |
|
|
|
if (offworkstartlunch <= devicetime && devicetime <= offworkendlunch) |
|
|
@@ -563,7 +620,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
{ |
|
|
|
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.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 + "')"); |
|
|
|
return true; |
|
|
|
} |
|
|
@@ -655,7 +712,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
{ |
|
|
|
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.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 + "')"); |
|
|
|
} |
|
|
|
return true; |
|
|
@@ -989,7 +1046,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
adrRecordEntity.ClockPlace = ClockPlace; |
|
|
|
adrRecordEntity.Img = img; |
|
|
|
adrRecordEntity.IsFit = true; |
|
|
|
|
|
|
|
|
|
|
|
//adrRecordEntity.ADPhoto = str; |
|
|
|
////记录日志 |
|
|
|
//ADR_DeviceLogEntity adrDeviceLogEntitylateorleave = new ADR_DeviceLogEntity(); |
|
|
@@ -2093,7 +2150,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement |
|
|
|
var preTeachAttendanceList = this.BaseRepository("CollegeMIS").FindList<Teach_attendanceEntity>(x => x.EmpNo == entity.UserNo && preALTIdList.Contains(x.ALTId)); |
|
|
|
if (preTeachAttendanceList.Any()) |
|
|
|
{ |
|
|
|
db.ExecuteBySql($"delete from Teach_Attendance where ID in ('{string.Join("','",preTeachAttendanceList.Select(x => x.ID)) }')"); |
|
|
|
db.ExecuteBySql($"delete from Teach_Attendance where ID in ('{string.Join("','", preTeachAttendanceList.Select(x => x.ID)) }')"); |
|
|
|
} |
|
|
|
|
|
|
|
//上班-下班打卡时间范围内的课 |
|
|
|