Browse Source

考勤对接优化

大厂分支
liangkun 4 years ago
parent
commit
c219609363
3 changed files with 25 additions and 11 deletions
  1. +1
    -1
      Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.JobService/App.config
  2. +1
    -1
      Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.JobService/Quanjiang.DigitalScholl.JobService.csproj
  3. +23
    -9
      Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.JobService/Service1.cs

+ 1
- 1
Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.JobService/App.config View File

@@ -15,7 +15,7 @@
<add name="tsDBString" connectionString="Server=112.45.152.8,17049;Initial Catalog=tsgxtjh;User ID=tsgxtjh;Password=Qs6cYOzFoQupbr12MFZm" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<appSettings>
<add key="dbbackuppath" value="D:\数字化校园\lr7test\Publish\Resource\DataBaseBackup"/>


+ 1
- 1
Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.JobService/Quanjiang.DigitalScholl.JobService.csproj View File

@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Quanjiang.DigitalScholl.JobService</RootNamespace>
<AssemblyName>Quanjiang.DigitalScholl.JobService</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<SccProjectName>


+ 23
- 9
Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.JobService/Service1.cs View File

@@ -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;
}
//考勤记录


Loading…
Cancel
Save