diff --git a/.gitignore b/.gitignore
index 8a18751f3..cee9adda7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,3 +79,5 @@ Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
/Learun.Framework.Ultimate V7/Learun.Application.Mobile/platforms/android/assets/www
/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www.7z
/Learun.Framework.Ultimate V7/Learun.Application.WebApi/bin.7z
+/Learun.Framework.Ultimate V7/Learun.Application.Web/Properties/PublishProfiles
+/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Properties/PublishProfiles
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/2.png b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/2.png
new file mode 100644
index 000000000..efccc99b6
Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/2.png differ
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/dkred.png b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/dkred.png
new file mode 100644
index 000000000..a2dc327d0
Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/images/dkred.png differ
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.js
deleted file mode 100644
index 6f795a0f5..000000000
--- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.js
+++ /dev/null
@@ -1,42 +0,0 @@
-(function() {
- var page = {
- isScroll: false,
- init: function($page) {
- $(document).ready(function() {
- $('#attendContent').on('tap', function(ev) {
- //ev.stopPropagation();
- var account = learun.storage.get('logininfo').account;
- learun.layer.loading(true);
- learun.httppost(config.webapi + 'learun/adms/attendance/clockin', {}, (
- data) => {
- learun.layer.loading(false);
- if (data) { // 表单数据保存成功
- learun.layer.toast("打卡成功");
- learun.nav.closeCurrent();
- }else{
- learun.layer.toast("打卡失败!");
- }
- });
-
- });
-
- function setTime() {
- var date = new Date();
- var HH = date.getHours(),
- MM = date.getMinutes(),
- SS = date.getSeconds(),
- date = date.getDate();
- if (SS < 10) {
- SS = "0" + SS
- }
- $("#show").text(HH + ":" + MM + ":" + SS);
- }
- setInterval(setTime, 1000);
-
- })
- },
-
- };
-
- return page;
-})();
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.css b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.css
similarity index 100%
rename from Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.css
rename to Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.css
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.html b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.html
similarity index 100%
rename from Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.html
rename to Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.html
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.js
similarity index 69%
rename from Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.js
rename to Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.js
index d22e65ca4..5a48d3dfe 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/ADRRecord/ADRRecord.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRRecord/ADRRecord.js
@@ -19,14 +19,14 @@
return page.rowRender(_index, _item, _$item, $page);
},
click: function (item, $item, $et) {// 列表行点击事件
- if ($et.hasClass('lr-btn-danger')) {
- page.btnClick(item, $item, $page);
- }
- else {
- page.rowClick(item, $item, $page);
- }
- },
- btns: page.rowBtns });
+ // if ($et.hasClass('lr-btn-danger')) {
+ // page.btnClick(item, $item, $page);
+ // }
+ // else {
+ // page.rowClick(item, $item, $page);
+ // }
+ }
+ });
},
lclass: 'lr-list',
@@ -84,6 +84,12 @@
}else if(ADType=='6')
{
type='结束加班';
+ }else if(ADType=='7')
+ {
+ type='中午上班';
+ }else if(ADType=='8')
+ {
+ type='中午下班';
}
var ClockStatus=_item.ClockStatus;
var status='';
@@ -106,30 +112,14 @@
{
status='缺勤';
}
- //_$item.append($('
姓名:
').dataFormatter({ value: _item.UserName }));
- //_$item.append($('账号:
').dataFormatter({ value: _item.UserNo }));
+ //var name=_item.UserName+'('+_item.UserNo+')'
_$item.append($('打卡时间:
').dataFormatter({ value: _item.ClockTime }));
_$item.append($('考勤类型:
').dataFormatter({ value: type }));
_$item.append($('打卡结果:
').dataFormatter({ value: status }));
+ //_$item.append($('用户:
').dataFormatter({ value: name }));
return '';
- },
- rowClick: function (item, $item, $page) {// 列表行点击触发方法
- learun.nav.go({ path: 'LR_Desktop/1/form', title: '详情', type: 'right', param: { keyValue: item.ID } });
- },
- btnClick: function (item, $item, $page) {// 左滑按钮点击事件
- learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
- if (_index === '1') {
- learun.layer.loading(true, '正在删除该笔数据');
- learun.httppost(config.webapi + 'learun/LR_Desktop/1/delete', item.ID , (data) => {
- if (data) {// 删除数据成功
- page.grid.reload();
- }
- learun.layer.loading(false);
- });
- }
- }, 'Learun智慧校园提示', ['取消', '确定']);
- },
- rowBtns: ['删除'] // 列表行左滑按钮
+ }
+
};
return page;
})();
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.css b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.css
similarity index 100%
rename from Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.css
rename to Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.css
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.html b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.html
similarity index 75%
rename from Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.html
rename to Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.html
index b30e7f7ee..1cfbce9e4 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/ADRClockIn/AttendanceCard/AttendanceCard.html
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.html
@@ -7,11 +7,11 @@
打卡
-->
-
+
\ No newline at end of file
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.js
new file mode 100644
index 000000000..d9d2f147c
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/AttendanceCard/AttendanceCard.js
@@ -0,0 +1,55 @@
+(function() {
+ var page = {
+ isScroll: false,
+ init: function($page) {
+ $(document).ready(function() {
+ learun.layer.loading(true);
+ //判断当前时间是否可以打卡
+ learun.httpget(config.webapi + 'learun/adms/attendance/IsAttendance', {}, (
+ data) => {
+ learun.layer.loading(false);
+ if (data.data == true) {
+ $('#attimg').attr('src', 'images/dk.png');
+ } else {
+ $('#attimg').attr('src', 'images/dkred.png');
+ }
+ });
+
+ $('#attendContent').on('tap', function(ev) {
+ if(($('#attimg')[0].src).indexOf('dk.png')>0){
+ var account = learun.storage.get('logininfo').account;
+ learun.layer.loading(true);
+ learun.httppost(config.webapi + 'learun/adms/attendance/clockin', {}, (
+ data) => {
+ learun.layer.loading(false);
+ if (data) {
+ learun.layer.toast("打卡成功");
+ learun.nav.closeCurrent();
+ } else {
+ learun.layer.toast("打卡失败!");
+ }
+ });
+ }
+
+ });
+
+ function setTime() {
+ var date = new Date();
+ var HH = date.getHours(),
+ MM = date.getMinutes(),
+ SS = date.getSeconds(),
+ date = date.getDate();
+ if (SS < 10) {
+ SS = "0" + SS
+ }
+ $("#show").text(HH + ":" + MM + ":" + SS);
+ }
+ setInterval(setTime, 1000);
+
+ })
+ },
+
+ };
+
+ return page;
+})();
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Form.cshtml
index 146e25bce..0f5e3ee8f 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Form.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Form.cshtml
@@ -17,27 +17,27 @@
上班时间*
- @*
- @*
打卡次数*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js
index 0fee97a93..2ba26bc5d 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js
@@ -80,11 +80,11 @@ var bootstrap = function ($, learun) {
url: top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/GetPageList',
headData: [
{ label: "上班时间", name: "WorkTime", width: 100, align: "left" },
- //{ label: "签到开始时间", name: "SignInStartTime", width: 100, align: "left" },
- //{ label: "签到结束时间", name: "SignInEndTime", width: 100, align: "left" },
+ { label: "签到开始时间", name: "SignInStartTime", width: 100, align: "left" },
+ { label: "签到结束时间", name: "SignInEndTime", width: 100, align: "left" },
{ label: "下班时间", name: "CloseTime", width: 100, align: "left" },
- //{ label: "签退开始时间", name: "SignOutStartTime", width: 100, align: "left" },
- //{ label: "签退结束时间", name: "SignOutEndTime", width: 100, align: "left" },
+ { label: "签退开始时间", name: "SignOutStartTime", width: 100, align: "left" },
+ { label: "签退结束时间", name: "SignOutEndTime", width: 100, align: "left" },
{ label: "打卡次数", name: "ClockTime", width: 100, align: "left" },
{ label: "中午签退时间", name: "NoonCloseTime", width: 100, align: "left" },
{ label: "中午签退开始时间", name: "SignOutStartTime2", width: 150, align: "left" },
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
index d3635507f..9592e4aee 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
@@ -160,7 +160,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
index 856889ee0..a5634307c 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
@@ -167,6 +167,8 @@
+
+
Web.config
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs
index 1c71e104d..5fb68930c 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs
@@ -17,12 +17,31 @@ namespace Learun.Application.WebApi.Modules
public AttendanceApi()
: base("/learun/adms/attendance")
{
- Get["/getrecordpagelist"] = GetRecordPageList;
+ //判断当前时间是否可以打卡
+ Get["/IsAttendance"] = IsAttendance;
+ //打卡
Post["/clockin"] = ClockIn;
+ //获取考勤打卡记录
+ Get["/getrecordpagelist"] = GetRecordPageList;
}
private ADR_RestrictionIBLL adr_RestrictionBLL = new ADR_RestrictionBLL();
private ADR_RecordIBLL adr_RecordBLL = new ADR_RecordBLL();
+ ///
+ /// 判断当前时间是否可以打卡
+ ///
+ ///
+ ///
+ public Response IsAttendance(dynamic _)
+ {
+ var res = adr_RestrictionBLL.IsAttendance();
+ var jsondata =
+ new
+ {
+ data = res
+ };
+ return Success(jsondata);
+ }
///
/// 打卡
///
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Module/ModuleBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Module/ModuleBLL.cs
index 2c3889e69..dd00880e1 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Module/ModuleBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Module/ModuleBLL.cs
@@ -147,7 +147,7 @@ namespace Learun.Application.Base.SystemModule
node.value = item.F_EnCode;
node.showcheck = true;
node.checkstate = 0;
- node.isexpand = true;
+ node.isexpand = false;//true;
node.icon = item.F_Icon;
node.parentId = item.F_ParentId;
treeList.Add(node);
@@ -346,7 +346,7 @@ namespace Learun.Application.Base.SystemModule
node.value = module.F_EnCode;
node.showcheck = true;
node.checkstate = 0;
- node.isexpand = true;
+ node.isexpand = false; //true;
node.icon = module.F_Icon;
node.parentId = module.F_ParentId + "_learun_moduleId";
if (module.F_Target != "expand")
@@ -462,7 +462,7 @@ namespace Learun.Application.Base.SystemModule
node.value = module.F_EnCode;
node.showcheck = true;
node.checkstate = 0;
- node.isexpand = true;
+ node.isexpand = false;// true;
node.icon = module.F_Icon;
node.parentId = module.F_ParentId + "_learun_moduleId";
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs
index dc6529489..6992f7c6c 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs
@@ -35,7 +35,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement
[Column("DEPARTMENT")]
public string Department { get; set; }
///
- /// 考勤类型 0-未定义,1-上班,2-下班,3-开始休息,4-结束休息,5-开始加班,6-结束加班
+ /// 考勤类型 0-未定义,1-上班,2-下班,3-开始休息,4-结束休息,5-开始加班,6-结束加班,7-中午上班,8-中午下班
///
[Column("ADTYPE")]
public string ADType { get; set; }
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs
index 976464f97..5ffc24efd 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs
@@ -166,6 +166,25 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
}
+ public bool IsAttendance()
+ {
+ try
+ {
+ return aDR_RestrictionService.IsAttendance();
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowBusinessException(ex);
+ }
+ }
+ }
+
public ADR_RestrictionEntity GetADR_RestrictionEntityEnabled()
{
try
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs
index 244d0cb51..28516e9e2 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs
@@ -54,6 +54,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
///
///
bool ClockIn();
+
+ bool IsAttendance();
#endregion
ADR_RestrictionEntity GetADR_RestrictionEntityEnabled();
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs
index 69006e1ff..b15f9484f 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs
@@ -213,17 +213,19 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
//当前服务器日期
var datenow = DateTime.Now.ToString("yyyy-MM-dd");
+ var datetimenow = DateTime.Now;
+
//当前时间年月日时分秒
- string strTimeYear = (DateTime.Now.Year).ToString();
- string strTimeMonth = (DateTime.Now.Month).ToString("d2");
- string strTimeDay = (DateTime.Now.Day).ToString("d2");
- string strTimeHour = (DateTime.Now.Hour).ToString("d2");
- string strTimeMinute = (DateTime.Now.Minute).ToString("d2");
- string strTimeSecond = (DateTime.Now.Second).ToString("d2");
+ string strTimeYear = (datetimenow.Year).ToString();
+ string strTimeMonth = (datetimenow.Month).ToString("d2");
+ string strTimeDay = (datetimenow.Day).ToString("d2");
+ string strTimeHour = (datetimenow.Hour).ToString("d2");
+ string strTimeMinute = (datetimenow.Minute).ToString("d2");
+ string strTimeSecond = (datetimenow.Second).ToString("d2");
string strTime = strTimeYear + "-" + strTimeMonth + "-" + strTimeDay + " " + strTimeHour + ":" +
strTimeMinute + ":" + strTimeSecond;
- //设备事件时间
+ //设备事件时间(在这里,=当前时间)
DateTime devicetime = Convert.ToDateTime(strTime);
//掉线补传数据时间判断
//设备时间小于当前时间,判断为补传历史时间数据
@@ -233,77 +235,75 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
//}
//上班时间
DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime);
+ //上班考勤时间段
+ DateTime signInStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime);
+ DateTime signInEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime);
+
//下班时间
DateTime offworkDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.CloseTime);
+ //下班考勤时间段
+ DateTime signOutStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime);
+ DateTime signOutEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime);
- var datetimenow = DateTime.Now;
+ //2021.12.30 上下班设置时间段打卡
#region 二次打卡
//判断打卡次数
if (attendancerulEntity.ClockTime == "二次打卡")
{
- //迟到判断
- if (devicetime <= workDateTime)//正常
+ //上下班正常打卡
+ if (devicetime >= signInStartTime && devicetime <= signInEndTime)
{
ADType = "1";//上班
ClockStatus = "1";//正常
}
- else//迟到
+ else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime)
{
- //签到与签退判断
- if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态
- {
- ADType = "2";//下班
- ClockStatus = "1";//正常
- }
- else//小于下班时间
- {
- //首先判断是上班还是下班
- //该用户当日有签到记录视为下班签退
- var attendancerecord = this.BaseRepository("CollegeMIS").FindList
(
- "select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
- strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo +
- "' and ADType='1'").ToList();
+ ADType = "2";//下班
+ ClockStatus = "1";//正常
+ }
+ else if (devicetime <= signOutStartTime)//小于下班时间
+ {
+ //首先判断是上班还是下班
+ //该用户当日有签到记录视为下班签退
+ var attendancerecord = this.BaseRepository("CollegeMIS").FindList(
+ "select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
+ strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo +
+ "' and ADType='1'").ToList();
- if (attendancerecord.Count() > 0)//如果存在上班考勤记录
+ if (attendancerecord.Count() > 0)//如果存在上班考勤记录
+ {
+ //判断为下班早退
+ if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)//如果允许早退,获取范围
{
- //判断为下班早退
- if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)//如果允许早退,获取范围
+ //最早签退时间
+ DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
+ if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常
{
- //最早签退时间
- DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
- if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常
- {
- ADType = "2";//下班
- ClockStatus = "1";//正常
- }
- else//超出早退范围视为早退
- {
- ADType = "2";//下班
- ClockStatus = "3";//早退
- }
+ ADType = "2";//下班
+ ClockStatus = "1";//正常
}
- else//不允许早退直接视为早退
+ else//超出早退范围视为早退
{
ADType = "2";//下班
ClockStatus = "3";//早退
}
}
- else//判断为上班迟到
+ else//不允许早退直接视为早退
{
- if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)//如果允许迟到,获取范围
+ ADType = "2";//下班
+ ClockStatus = "3";//早退
+ }
+ }
+ else//判断为上班迟到
+ {
+ if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)//如果允许迟到,获取范围
+ {
+ //最晚签到时间
+ DateTime workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
+ if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常
{
- //最晚签到时间
- DateTime workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
- if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常
- {
- ADType = "1";//上班
- ClockStatus = "1";//正常
- }
- else
- {
- ADType = "1";//上班
- ClockStatus = "2";//迟到
- }
+ ADType = "1";//上班
+ ClockStatus = "1";//正常
}
else
{
@@ -311,9 +311,91 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
ClockStatus = "2";//迟到
}
}
+ else
+ {
+ ADType = "1";//上班
+ ClockStatus = "2";//迟到
+ }
}
-
}
+
+ #region old 上下班无打卡时间段
+
+ //if (devicetime <= workDateTime)//正常
+ //{
+ // ADType = "1";//上班
+ // ClockStatus = "1";//正常
+ //}
+ //else//迟到
+ //{
+ // //签到与签退判断
+ // if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态
+ // {
+ // ADType = "2";//下班
+ // ClockStatus = "1";//正常
+ // }
+ // else//小于下班时间
+ // {
+ // //首先判断是上班还是下班
+ // //该用户当日有签到记录视为下班签退
+ // var attendancerecord = this.BaseRepository("CollegeMIS").FindList(
+ // "select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
+ // strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo +
+ // "' and ADType='1'").ToList();
+
+ // if (attendancerecord.Count() > 0)//如果存在上班考勤记录
+ // {
+ // //判断为下班早退
+ // 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 (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";//迟到
+ // }
+ // }
+ // }
+
+ //}
+
+ #endregion
+
ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity();
adrRecordEntity.Create();
adrRecordEntity.UserName = userinfo.realName;
@@ -571,162 +653,297 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
else//不在中午考勤时间段判断迟到早退
{
- //迟到判断
- if (devicetime <= workDateTime)//正常
+ //上下班正常打卡
+ if (devicetime >= signInStartTime && devicetime <= signInEndTime)
{
ADType = "1";//上班
ClockStatus = "1";//正常
}
- else//迟到
+ else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime)
{
- //签到与签退判断
- if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态
- {
- ADType = "2";//下班
- ClockStatus = "1";//正常
- }
- //迟到状态
- else
+ ADType = "2";//下班
+ ClockStatus = "1";//正常
+ }
+ else
+ {
+ //该用户当日有签到记录视为下班签退
+ var attendancerecord = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'");
+ //首先判断上午考勤还是下午考勤
+ //如果小于中午下班时间
+ if (devicetime < offworkDateTimelunch)
{
- //首先判断是否中午时间段
- if (devicetime > offworkDateTimelunch && devicetime < workDateTimelunch)
+ //迟到
+ //无上班记录视为迟到
+ if (attendancerecord.Count(m => m.ADType == "1") == 0)
{
- //无效打卡
- ////记录日志
- //ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity();
- //adrDeviceLogEntity.Create();
- //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id))
- //{
- // adrDeviceLogEntity.DeviceId = deviceEntity.Id;
- // stringAlarm += ",设备IP:" + deviceEntity.IpAddress + "不在考勤时间范围内,打卡无效";
- //}
-
- //adrDeviceLogEntity.LogData = stringAlarm;
- //adrDeviceLogEntity.LogType = "1";
- //connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" +
- // "'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," +
- // "'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')");
- return true;
+ //上班迟到
+ //获取迟到范围
+ 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";//迟到
+ }
}
+ //早退
+ //有签到记录视为早退
else
{
- //该用户当日有签到记录视为下班签退
- var attendancerecord = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'");
- //首先判断上午考勤还是下午考勤
- //如果小于中午下班时间
- if (devicetime < offworkDateTimelunch)
+ //获取早退范围
+ if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)
{
- //迟到
- //无上班记录视为迟到
- if (attendancerecord.Count(m => m.ADType == "1") == 0)
+ //最早签退时间
+ DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
+ if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常
{
- //上班迟到
- //获取迟到范围
- 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";//迟到
- }
+ ADType = "8";//中午下班
+ ClockStatus = "1";//正常
}
- //早退
- //有签到记录视为早退
- else
+ else//超出早退范围视为早退
{
- //获取早退范围
- if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)
- {
- //最早签退时间
- DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
- if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常
- {
- ADType = "8";//中午下班
- ClockStatus = "1";//正常
- }
- else//超出早退范围视为早退
- {
- ADType = "8";//中午下班
- ClockStatus = "3";//早退
- }
- }
- else
- {
- ADType = "8";//中午下班
- ClockStatus = "3";//早退
- }
+ ADType = "8";//中午下班
+ ClockStatus = "3";//早退
+ }
+ }
+ else
+ {
+ ADType = "8";//中午下班
+ ClockStatus = "3";//早退
+ }
+ }
+ }
+ else if (devicetime > workDateTimelunch)//如果大于中午上班时间,且上级if判断小于下班时间
+ //判断为下午上班打卡迟到或早退
+ {
+ //如果存在中午签到记录
+ //判断为下班早退
+ if (attendancerecord.Count(m => m.ADType == "7") > 0)
+ {
+ //早退判断
+ //获取早退范围
+ 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 > workDateTimelunch)//如果大于中午上班时间,且上级if判断小于下班时间
- //判断为下午上班打卡迟到或早退
+ }
+ else
+ {
+ //获取迟到范围
+ if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
{
- //如果存在中午签到记录
- //判断为下班早退
- if (attendancerecord.Count(m => m.ADType == "7") > 0)
+ //最晚签到时间
+ DateTime workDateTimeFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
+ if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常
{
- //早退判断
- //获取早退范围
- 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";//早退
- }
+ ADType = "7";//中午上班
+ ClockStatus = "1";//正常
}
else
{
- //获取迟到范围
- if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
- {
- //最晚签到时间
- DateTime workDateTimeFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
- if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常
- {
- ADType = "7";//中午上班
- ClockStatus = "1";//正常
- }
- else
- {
- ADType = "7";//中午上班
- ClockStatus = "2";//迟到
- }
- }
- else
- {
- ADType = "7";//中午上班
- ClockStatus = "2";//迟到
- }
+ ADType = "7";//中午上班
+ ClockStatus = "2";//迟到
}
}
+ else
+ {
+ ADType = "7";//中午上班
+ ClockStatus = "2";//迟到
+ }
}
}
}
+
+ #region old
+ ////迟到判断
+ //if (devicetime <= workDateTime)//正常
+ //{
+ // ADType = "1";//上班
+ // ClockStatus = "1";//正常
+ //}
+ //else//迟到
+ //{
+ // //签到与签退判断
+ // if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态
+ // {
+ // ADType = "2";//下班
+ // ClockStatus = "1";//正常
+ // }
+ // //迟到状态
+ // else
+ // {
+ // //首先判断是否中午时间段
+ // if (devicetime > offworkDateTimelunch && devicetime < workDateTimelunch)
+ // {
+ // //无效打卡
+ // ////记录日志
+ // //ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity();
+ // //adrDeviceLogEntity.Create();
+ // //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id))
+ // //{
+ // // adrDeviceLogEntity.DeviceId = deviceEntity.Id;
+ // // stringAlarm += ",设备IP:" + deviceEntity.IpAddress + "不在考勤时间范围内,打卡无效";
+ // //}
+
+ // //adrDeviceLogEntity.LogData = stringAlarm;
+ // //adrDeviceLogEntity.LogType = "1";
+ // //connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" +
+ // // "'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," +
+ // // "'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')");
+ // return true;
+ // }
+ // else
+ // {
+ // //该用户当日有签到记录视为下班签退
+ // var attendancerecord = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'");
+ // //首先判断上午考勤还是下午考勤
+ // //如果小于中午下班时间
+ // if (devicetime < offworkDateTimelunch)
+ // {
+ // //迟到
+ // //无上班记录视为迟到
+ // if (attendancerecord.Count(m => m.ADType == "1") == 0)
+ // {
+ // //上班迟到
+ // //获取迟到范围
+ // 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";//迟到
+ // }
+ // }
+ // //早退
+ // //有签到记录视为早退
+ // else
+ // {
+ // //获取早退范围
+ // if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)
+ // {
+ // //最早签退时间
+ // DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
+ // if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常
+ // {
+ // ADType = "8";//中午下班
+ // ClockStatus = "1";//正常
+ // }
+ // else//超出早退范围视为早退
+ // {
+ // ADType = "8";//中午下班
+ // ClockStatus = "3";//早退
+ // }
+ // }
+ // else
+ // {
+ // ADType = "8";//中午下班
+ // ClockStatus = "3";//早退
+ // }
+
+ // }
+ // }
+ // else if (devicetime > workDateTimelunch)//如果大于中午上班时间,且上级if判断小于下班时间
+ // //判断为下午上班打卡迟到或早退
+ // {
+ // //如果存在中午签到记录
+ // //判断为下班早退
+ // if (attendancerecord.Count(m => m.ADType == "7") > 0)
+ // {
+ // //早退判断
+ // //获取早退范围
+ // 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 (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0)
+ // {
+ // //最晚签到时间
+ // DateTime workDateTimeFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime));
+ // if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常
+ // {
+ // ADType = "7";//中午上班
+ // ClockStatus = "1";//正常
+ // }
+ // else
+ // {
+ // ADType = "7";//中午上班
+ // ClockStatus = "2";//迟到
+ // }
+ // }
+ // else
+ // {
+ // ADType = "7";//中午上班
+ // ClockStatus = "2";//迟到
+ // }
+ // }
+ // }
+ // }
+ // }
+ //}
+
+ #endregion
+
+
+
ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity();
adrRecordEntity.Create();
adrRecordEntity.UserNo = EmpNo;
@@ -830,6 +1047,137 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
}
}
+ ///
+ /// 判断当前时间是否可以打卡
+ ///
+ ///
+ public bool IsAttendance()
+ {
+ try
+ {
+ //当前服务器日期
+ var datenow = DateTime.Now.ToString("yyyy-MM-dd");
+
+ var datetimenow = DateTime.Now;
+ var EmpNo = LoginUserInfo.Get().account;
+
+ //首先获取考勤规则
+ var attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity(m => m.REnable == true);
+ //上班时间
+ DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime);
+ //上班考勤时间段
+ DateTime signInStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime);
+ DateTime signInEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime);
+
+ //下班时间
+ DateTime offworkDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.CloseTime);
+ //下班考勤时间段
+ DateTime signOutStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime);
+ DateTime signOutEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime);
+
+ //小于上班考勤开始时间或大于下班考勤结束时间,不允许打卡
+ if (datetimenow < signInStartTime || datetimenow > signOutEndTime)
+ {
+ return false;
+ }
+ string strTimeYear = (datetimenow.Year).ToString();
+ string strTimeMonth = (datetimenow.Month).ToString("d2");
+ string strTimeDay = (datetimenow.Day).ToString("d2");
+ //该用户当日签到记录
+ var attendancerecordList = this.BaseRepository("CollegeMIS").FindList(
+ "select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" +
+ strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList();
+
+ //下班最早签退时间
+ DateTime offworkDateTimeFree = signOutStartTime;
+ if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0
+ ) //如果允许早退,获取范围
+ {
+ offworkDateTimeFree =
+ offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime));
+ }
+ if (attendancerulEntity.ClockTime == "二次打卡")
+ {
+ //上班
+ 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;
+ }
+
+ }
+
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowServiceException(ex);
+ }
+ }
+ }
+
#endregion
public ADR_RestrictionEntity GetADR_RestrictionEntityEnabled()