|
|
@@ -174,6 +174,7 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
try |
|
|
|
{ |
|
|
|
ADR_DeviceEntity deviceEntity = new ADR_DeviceEntity(); |
|
|
|
uint dwSize = (uint)Marshal.SizeOf(deviceEntity); |
|
|
|
deviceEntity = (ADR_DeviceEntity)Marshal.PtrToStructure(pUser, typeof(ADR_DeviceEntity)); |
|
|
|
string strLoginCallBack = ""; |
|
|
|
//登录失败 |
|
|
@@ -195,6 +196,7 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
else//登录成功 |
|
|
|
{ |
|
|
|
strLoginCallBack = "登录设备成功,lUserID:" + lUserID; |
|
|
|
|
|
|
|
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); |
|
|
|
adrDeviceLogEntity.Create(); |
|
|
|
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) |
|
|
@@ -226,6 +228,8 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
adrDeviceLogEntity.LogData = strErr; |
|
|
|
adrDeviceLogEntity.LogType = "2"; |
|
|
|
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); |
|
|
|
//更新设备状态 |
|
|
|
deviceEntity.DOnlineStatus = false; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@@ -240,8 +244,11 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
adrDeviceLogEntity.LogData = strNotice; |
|
|
|
adrDeviceLogEntity.LogType = "0"; |
|
|
|
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); |
|
|
|
//更新设备状态 |
|
|
|
deviceEntity.DOnlineStatus = true; |
|
|
|
} |
|
|
|
|
|
|
|
//更新设备状态 |
|
|
|
adrDeviceIbll.SaveEntity(deviceEntity.Id, deviceEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
@@ -293,6 +300,15 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
{ |
|
|
|
if (lCommand == 0x5002) //门禁主机报警上传 |
|
|
|
{ |
|
|
|
var deviceEntity = adrDeviceIbll.GetADR_DeviceEntityBylUserID(pAlarmer.lUserID.ToString()); |
|
|
|
var datetimenow = DateTime.Now; |
|
|
|
if (deviceEntity != null) |
|
|
|
{ |
|
|
|
//更新设备状态 |
|
|
|
deviceEntity.DConnectDate = datetimenow; |
|
|
|
adrDeviceIbll.SaveEntity(deviceEntity.Id, deviceEntity); |
|
|
|
} |
|
|
|
|
|
|
|
//通过lCommand来判断接收到的报警信息类型,不同的lCommand对应不同的pAlarmInfo内容 |
|
|
|
CHCNetSDK.NET_DVR_ACS_ALARM_INFO struAcsAlarm = new CHCNetSDK.NET_DVR_ACS_ALARM_INFO(); |
|
|
|
uint dwSize = (uint)Marshal.SizeOf(struAcsAlarm); |
|
|
@@ -358,7 +374,6 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
//记录日志 |
|
|
|
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); |
|
|
|
adrDeviceLogEntity.Create(); |
|
|
|
var deviceEntity = adrDeviceIbll.GetADR_DeviceEntityBylUserID(pAlarmer.lUserID.ToString()); |
|
|
|
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) |
|
|
|
{ |
|
|
|
adrDeviceLogEntity.DeviceId = deviceEntity.Id; |
|
|
@@ -381,7 +396,6 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
string ClockStatus = "1"; |
|
|
|
//当前服务器日期 |
|
|
|
var datenow = DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
|
var datetimenow = DateTime.Now; |
|
|
|
//设备事件时间 |
|
|
|
DateTime devicetime = Convert.ToDateTime(strTime); |
|
|
|
//上班时间 |
|
|
@@ -397,7 +411,7 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
else//迟到 |
|
|
|
{ |
|
|
|
//签到与签退判断 |
|
|
|
if (devicetime>= offworkDateTime)//如果签到时间大于下班时间则为签退状态 |
|
|
|
if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态 |
|
|
|
{ |
|
|
|
ADType = "2";//下班 |
|
|
|
ClockStatus = "1";//正常 |
|
|
@@ -406,8 +420,8 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
{ |
|
|
|
//首先判断是上班还是下班 |
|
|
|
//该用户当日有签到记录视为下班签退 |
|
|
|
var attendancerecord =adrRecordIbll.GetADR_RecordEntityByEmpNo(strTimeYear, strTimeMonth, strTimeDay,EmpNo).Where(m=>m.ADType=="1"); |
|
|
|
if (attendancerecord.Count()>0)//如果存在上班考勤记录 |
|
|
|
var attendancerecord = adrRecordIbll.GetADR_RecordEntityByEmpNo(strTimeYear, strTimeMonth, strTimeDay, EmpNo).Where(m => m.ADType == "1"); |
|
|
|
if (attendancerecord.Count() > 0)//如果存在上班考勤记录 |
|
|
|
{ |
|
|
|
//判断为下班早退 |
|
|
|
if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0)//如果允许早退,获取范围 |
|
|
@@ -459,7 +473,7 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
adrRecordEntity.ADTime = datetimenow; |
|
|
|
adrRecordEntity.ClockTime = devicetime; |
|
|
|
adrRecordEntity.ClockStatus = ClockStatus; |
|
|
|
if (deviceEntity!=null&&!string.IsNullOrEmpty(deviceEntity.DName)) |
|
|
|
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) |
|
|
|
{ |
|
|
|
adrRecordEntity.ClockPlace = deviceEntity.DName; |
|
|
|
} |
|
|
@@ -475,7 +489,7 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
//获取当日考勤记录 |
|
|
|
var attendancerecordlist = adrRecordIbll.GetADR_RecordEntityByEmpNo(strTimeYear, strTimeMonth, strTimeDay, EmpNo); |
|
|
|
//签到去重 |
|
|
|
if (adrRecordEntity.ADType == "1"&&attendancerecordlist.Count(m=>m.ADType=="1")==0)//签过到了 |
|
|
|
if (adrRecordEntity.ADType == "1" && attendancerecordlist.Count(m => m.ADType == "1") == 0)//签过到了 |
|
|
|
{ |
|
|
|
//每日保留第一次签到记录 |
|
|
|
return true; |
|
|
@@ -489,7 +503,7 @@ namespace Quanjiang.DigitalScholl.JobService |
|
|
|
firstoffworkentity.ClockTime = devicetime; |
|
|
|
firstoffworkentity.ClockStatus = ClockStatus; |
|
|
|
firstoffworkentity.ADPhoto = str; |
|
|
|
adrRecordIbll.SaveEntity(firstoffworkentity.ID,firstoffworkentity); |
|
|
|
adrRecordIbll.SaveEntity(firstoffworkentity.ID, firstoffworkentity); |
|
|
|
return true; |
|
|
|
} |
|
|
|
//考勤记录 |
|
|
|