Browse Source

考勤打卡调整不在打卡时间段显示黄色

新疆影视学院高职
zhangli 3 years ago
parent
commit
98da26e0dc
5 changed files with 152 additions and 38 deletions
  1. BIN
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/dkyellow.png
  2. +8
    -4
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.js
  3. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs
  4. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs
  5. +142
    -32
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs

BIN
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/dkyellow.png View File

Before After
Width: 360  |  Height: 360  |  Size: 19 KiB

+ 8
- 4
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.js View File

@@ -8,15 +8,19 @@
learun.httpget(config.webapi + 'learun/adms/attendance/IsAttendance', {}, (
data) => {
learun.layer.loading(false);
if (data.data == true) {
$('#attimg').attr('src', 'images/dk.png');
} else {
//console.log(data.data);
if (data.data == "red") {
$('#attimg').attr('src', 'images/dkred.png');
} else if (data.data == "yellow") {
$('#attimg').attr('src', 'images/dkyellow.png');
}else {
$('#attimg').attr('src', 'images/dk.png');
}
});

$('#attendContent').on('tap', function(ev) {
if(($('#attimg')[0].src).indexOf('dk.png')>0){
if((($('#attimg')[0].src).indexOf('dk.png')>0)||(($('#attimg')[0].src).indexOf('dkyellow.png')>0)){
var account = learun.storage.get('logininfo').account;
learun.layer.loading(true);
learun.httppost(config.webapi + 'learun/adms/attendance/clockin', {}, (


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs View File

@@ -166,7 +166,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
}

public bool IsAttendance()
public string IsAttendance()
{
try
{


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs View File

@@ -55,7 +55,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
/// <returns></returns>
bool ClockIn();

bool IsAttendance();
string IsAttendance();
#endregion

ADR_RestrictionEntity GetADR_RestrictionEntityEnabled();


+ 142
- 32
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs View File

@@ -244,6 +244,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
//下班考勤时间段
DateTime signOutStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime);
DateTime signOutEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime);

//2021.12.30 上下班设置时间段打卡
#region 二次打卡
@@ -251,12 +252,14 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
if (attendancerulEntity.ClockTime == "二次打卡")
{
//上下班正常打卡
if (devicetime >= signInStartTime && devicetime <= signInEndTime)
//if (devicetime >= signInStartTime && devicetime <= signInEndTime)
if (devicetime <= signInEndTime)
{
ADType = "1";//上班
ClockStatus = "1";//正常
}
else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime)
//else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime)
else if (devicetime >= signOutStartTime)
{
ADType = "2";//下班
ClockStatus = "1";//正常
@@ -654,12 +657,22 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
else//不在中午考勤时间段判断迟到早退
{
//上下班正常打卡
if (devicetime >= signInStartTime && devicetime <= signInEndTime)
//if (devicetime >= signInStartTime && devicetime <= signInEndTime)
//{
// ADType = "1";//上班
// ClockStatus = "1";//正常
//}
//else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime)
//{
// ADType = "2";//下班
// ClockStatus = "1";//正常
//}
if (devicetime <= signInEndTime)
{
ADType = "1";//上班
ClockStatus = "1";//正常
}
else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime)
else if (devicetime >= signOutStartTime)
{
ADType = "2";//下班
ClockStatus = "1";//正常
@@ -1051,7 +1064,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
/// 判断当前时间是否可以打卡
/// </summary>
/// <returns></returns>
public bool IsAttendance()
public string IsAttendance()
{
try
{
@@ -1075,18 +1088,22 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
DateTime signOutStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime);
DateTime signOutEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime);

//小于上班考勤开始时间或大于下班考勤结束时间,不允许打卡
//小于上班考勤开始时间或大于下班考勤结束时间,(超出打卡时间范围黄色)
if (datetimenow < signInStartTime || datetimenow > signOutEndTime)
{
return false;
return "yellow";
}
string strTimeYear = (datetimenow.Year).ToString();
string strTimeMonth = (datetimenow.Month).ToString("d2");
string strTimeDay = (datetimenow.Day).ToString("d2");
//该用户当日签到记录
var attendancerecordList = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(
"select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList();

//早上上班最晚签到时间
DateTime workDateTimeFree = signInEndTime;
//获取迟到范围
if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
{
workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
}

//下班最早签退时间
DateTime offworkDateTimeFree = signOutStartTime;
@@ -1096,17 +1113,28 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
offworkDateTimeFree =
offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
}
//该用户当日签到记录
var attendancerecordList = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(
"select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList();


if (attendancerulEntity.ClockTime == "二次打卡")
{
//上班
if (datetimenow > signInStartTime && datetimenow < offworkDateTimeFree && attendancerecordList.Count(x => x.ADType == "1") > 0)
//上班 大于上班开始时间 小于上班最晚签到时间,已经打卡是红色
if (datetimenow > signInStartTime && datetimenow < workDateTimeFree && attendancerecordList.Count(x => x.ADType == "1") > 0)
{
return "red";
}
//超过上班最晚签到时间 小于下班最早签退时间,黄色
else if (datetimenow > workDateTimeFree && datetimenow < offworkDateTimeFree)
{
return false;
return "yellow";
}
//下班
else if (datetimenow > offworkDateTimeFree && datetimenow < signOutEndTime && attendancerecordList.Count(x => x.ADType == "2") > 0)
{
return false;
return "red";
}
}
else//四次打卡
@@ -1130,40 +1158,122 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
offworkDateTimelunchFree =
offworkDateTimelunch.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
}
////中午最晚签到时间
//DateTime workDateTimelunchFree = workendlunch;
////获取迟到范围
//if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
//{
// workDateTimelunchFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
//}
//中午最晚签到时间
DateTime workDateTimelunchFree = workendlunch;
//获取迟到范围
if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
{
workDateTimelunchFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
}

//上班 大于上班开始时间 ,小于中午最早签退时间
if (datetimenow > signInStartTime && datetimenow < offworkDateTimelunchFree && attendancerecordList.Count(x => x.ADType == "1") > 0)
//上班 大于上班开始时间 小于上班最晚签到时间,已经打卡是红色
if (datetimenow > signInStartTime && datetimenow < workDateTimeFree && attendancerecordList.Count(x => x.ADType == "1") > 0)
{
return false;
return "red";
}
//中午下班 大于中午最早签退时间,小于 中午下班结束时间
//超过上班最晚签到时间 小于中午下班最早签退时间,黄色
else if (datetimenow > workDateTimeFree && datetimenow < offworkDateTimelunchFree)
{
return "yellow";
}
//中午下班 大于中午下班最早签退时间 小于中午下班结束时间
else if (datetimenow > offworkDateTimelunchFree && datetimenow < offworkendlunch && attendancerecordList.Count(x => x.ADType == "8") > 0)
{
return false;
return "red";
}
//中午上班 大于中午上班开始时间,小于下班最早签退时间
else if (datetimenow > workstartlunch && datetimenow < offworkDateTimeFree &&
//超过中午下班结束时间 小于中午上班开始时间
else if (datetimenow > offworkendlunch && datetimenow < workstartlunch)
{
return "yellow";
}
//中午上班 大于中午上班开始时间,小于中午上班最晚签到时间
else if (datetimenow > workstartlunch && datetimenow < workDateTimelunchFree &&
attendancerecordList.Count(x => x.ADType == "7") > 0)
{
return false;
return "red";
}
//大于中午上班最晚签到时间 小于下午下班最早签退时间
else if (datetimenow > workDateTimelunchFree && datetimenow < offworkDateTimeFree)
{
return "yellow";
}
//下班 大于下班最早签退时间,小于 下班结束时间
else if (datetimenow > offworkDateTimeFree && datetimenow < signOutEndTime && attendancerecordList.Count(x => x.ADType == "2") > 0)
{
return false;
return "red";
}

}

#region 20220115old 判断能不能打卡
//if (attendancerulEntity.ClockTime == "二次打卡")
//{

return true;
// if (datetimenow > signInStartTime && datetimenow < offworkDateTimeFree && attendancerecordList.Count(x => x.ADType == "1") > 0)
// {
// return false;
// }
// //下班
// else if (datetimenow > offworkDateTimeFree && datetimenow < signOutEndTime && attendancerecordList.Count(x => x.ADType == "2") > 0)
// {
// return false;
// }
//}
//else//四次打卡
//{
// //中午下班时间
// DateTime offworkDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonCloseTime);
// //中午下班考勤时间段
// DateTime offworkstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime2);
// DateTime offworkendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime2);

// //中午上班时间
// DateTime workDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonWorkTime);
// //中午上班考勤时间段
// DateTime workstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime2);
// DateTime workendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime2);

// //中午最早签退时间,默认中午下班开始时间。
// DateTime offworkDateTimelunchFree = offworkstartlunch;
// if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0) //如果允许早退,获取范围
// {
// offworkDateTimelunchFree =
// offworkDateTimelunch.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
// }
// ////中午最晚签到时间
// //DateTime workDateTimelunchFree = workendlunch;
// ////获取迟到范围
// //if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
// //{
// // workDateTimelunchFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
// //}

// //上班 大于上班开始时间 ,小于中午最早签退时间
// if (datetimenow > signInStartTime && datetimenow < offworkDateTimelunchFree && attendancerecordList.Count(x => x.ADType == "1") > 0)
// {
// return false;
// }
// //中午下班 大于中午最早签退时间,小于 中午下班结束时间
// else if (datetimenow > offworkDateTimelunchFree && datetimenow < offworkendlunch && attendancerecordList.Count(x => x.ADType == "8") > 0)
// {
// return false;
// }
// //中午上班 大于中午上班开始时间,小于下班最早签退时间
// else if (datetimenow > workstartlunch && datetimenow < offworkDateTimeFree &&
// attendancerecordList.Count(x => x.ADType == "7") > 0)
// {
// return false;
// }
// //下班 大于下班最早签退时间,小于 下班结束时间
// else if (datetimenow > offworkDateTimeFree && datetimenow < signOutEndTime && attendancerecordList.Count(x => x.ADType == "2") > 0)
// {
// return false;
// }

//}
#endregion

return "blue";
}
catch (Exception ex)
{


Loading…
Cancel
Save