@@ -108,7 +108,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
public ActionResult GetPageListOfMerge(string pagination, string queryJson) | |||
{ | |||
Pagination paginationobj = pagination.ToObject<Pagination>(); | |||
var data = openLessonPlanOfElectiveIBLL.GetPageListOfMerge(paginationobj, queryJson).OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonNo); | |||
var data = openLessonPlanOfElectiveIBLL.GetPageListOfMerge(paginationobj, queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
@@ -157,6 +157,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
} | |||
return Success("操作成功!"); | |||
} | |||
/// <summary> | |||
/// 批量拒绝【审核学生页面】 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="OLPEId"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult UnPass(string keyValue, string OLPEId) | |||
@@ -174,6 +180,28 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
return Success("操作成功!"); | |||
} | |||
/// <summary> | |||
/// 批量拒绝【已审学生页面】 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="OLPEId"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult UnPassOfFinish(string keyValue, string OLPEId) | |||
{ | |||
var stulist = keyValue.Split(','); | |||
var olpentity = openLessonPlanOfElectiveIBLL.GetOpenLessonPlanOfElectiveEntity(OLPEId); | |||
if (olpentity != null) | |||
{ | |||
stuSelectLessonListOfElectiveIBLL.UnPassOfFinish(stulist, olpentity); | |||
} | |||
else | |||
{ | |||
return Fail("当前选课数据不存在!"); | |||
} | |||
return Success("操作成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
@@ -162,18 +162,21 @@ var bootstrap = function ($, learun) { | |||
{ label: "学年", name: "AcademicYearNo", width: 45, align: "left" }, | |||
{ label: "学期", name: "Semester", width: 35, align: "left" }, | |||
{ label: "课程号", name: "LessonNo", width: 70, align: "left" }, | |||
//{ | |||
// label: "课程名称", name: "LessonNo2", width: 170, align: "left", | |||
// formatterAsync: function (callback, value, row, op, $cell) { | |||
// learun.clientdata.getAsync('custmerData', { | |||
// url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', | |||
// key: value, | |||
// keyId: 'lessonno', | |||
// callback: function (_data) { | |||
// callback(_data['lessonname']); | |||
// } | |||
// }); | |||
// } | |||
//}, | |||
{ | |||
label: "课程名称", name: "LessonNo2", width: 170, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', | |||
key: value, | |||
keyId: 'lessonno', | |||
callback: function (_data) { | |||
callback(_data['lessonname']); | |||
} | |||
}); | |||
} | |||
label: "课程名称", name: "LessonName", width: 170, align: "left" | |||
}, | |||
{ | |||
label: "上课节次", name: "LessonSection", width: 100, align: "left", | |||
@@ -233,7 +236,7 @@ var bootstrap = function ($, learun) { | |||
], | |||
mainId: 'Id', | |||
isPage: true, | |||
sidx: 'AcademicYearNo,Semester', | |||
sidx: 'AcademicYearNo DESC, Semester DESC, LessonName ASC', | |||
sord: 'desc' | |||
}); | |||
page.search(); | |||
@@ -28,7 +28,7 @@ | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize=""> | |||
<a id="lr_audit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 单个审核</a> | |||
<a id="lr_auditpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量审核</a> | |||
<a id="lr_auditpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量审核通过</a> | |||
<a id="lr_auditunpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量拒绝</a> | |||
</div> | |||
</div> | |||
@@ -46,7 +46,7 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//批量审核 | |||
//批量审核通过 | |||
$('#lr_auditpass').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
@@ -59,6 +59,7 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//批量拒绝 | |||
$('#lr_auditunpass').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
@@ -26,6 +26,9 @@ | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize=""> | |||
<a id="lr_auditunpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量拒绝</a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
@@ -21,6 +21,20 @@ var bootstrap = function ($, learun) { | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
//批量拒绝 | |||
$('#lr_auditunpass').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认拒绝?', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/UnPassOfFinish', { keyValue: keyValue, OLPEId: OLPEId }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -71,6 +85,7 @@ var bootstrap = function ($, learun) { | |||
], | |||
mainId:'Id', | |||
isPage: true, | |||
isMultiselect: true, | |||
sidx: 'StuNo', | |||
sord:'asc' | |||
}); | |||
@@ -28,7 +28,7 @@ | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize=""> | |||
<a id="lr_audit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 单个审核</a> | |||
<a id="lr_auditpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量审核</a> | |||
<a id="lr_auditpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量审核通过</a> | |||
<a id="lr_auditunpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量拒绝</a> | |||
</div> | |||
</div> | |||
@@ -46,7 +46,7 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//批量审核 | |||
//批量审核通过 | |||
$('#lr_auditpass').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
@@ -59,6 +59,7 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//批量拒绝 | |||
$('#lr_auditunpass').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
@@ -26,6 +26,9 @@ | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize=""> | |||
<a id="lr_auditunpass" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 批量拒绝</a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
@@ -21,6 +21,20 @@ var bootstrap = function ($, learun) { | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
}); | |||
//批量拒绝 | |||
$('#lr_auditunpass').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('Id'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认拒绝?', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/UnPass', { keyValue: keyValue, OLPEId: OLPEId }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -71,6 +85,7 @@ var bootstrap = function ($, learun) { | |||
], | |||
mainId:'Id', | |||
isPage: true, | |||
isMultiselect: true, | |||
sidx: 'StuNo', | |||
sord:'asc' | |||
}); | |||
@@ -1545,7 +1545,6 @@ | |||
} | |||
} | |||
console.log(head); | |||
}, | |||
// 单击行 | |||
clickRow: function ($self, $et, op) { | |||
@@ -26,10 +26,14 @@ | |||
<UseGlobalApplicationHostFile /> | |||
<NuGetPackageImportStamp> | |||
</NuGetPackageImportStamp> | |||
<SccProjectName>Learun.Application.Website</SccProjectName> | |||
<SccLocalPath>1~a7250b02-76e9-4d74-aa27-f5cdf7719296</SccLocalPath> | |||
<SccAuxPath>http://123.57.209.16:8090/VaultService</SccAuxPath> | |||
<SccProvider>SourceGear Vault Visual Studio 2005 Client:{1EA47954-8515-402d-82D9-B5C332120A8D}</SccProvider> | |||
<SccProjectName> | |||
</SccProjectName> | |||
<SccLocalPath> | |||
</SccLocalPath> | |||
<SccAuxPath> | |||
</SccAuxPath> | |||
<SccProvider> | |||
</SccProvider> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
<DebugSymbols>true</DebugSymbols> | |||
@@ -12,7 +12,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// 日 期:2020-09-03 12:11 | |||
/// 描 述:考勤设备管理 | |||
/// </summary> | |||
[StructLayout(LayoutKind.Sequential)] | |||
public class ADR_DeviceEntity | |||
{ | |||
#region 实体成员 | |||
@@ -242,6 +242,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public void UnPassOfFinish(string[] stulist, OpenLessonPlanOfElectiveEntity olpentity) | |||
{ | |||
try | |||
{ | |||
stuSelectLessonListOfElectiveService.UnPassOfFinish(stulist, olpentity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public IEnumerable<StuSelectLessonListOfElectiveEntity> GetAllElectiveLesson(string academicYearNo, string semester) | |||
{ | |||
@@ -70,6 +70,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
IEnumerable<StuSelectLessonListOfElectiveEntity> GetQueryStuSelectResultList(Pagination pagination, string queryJson); | |||
void Pass(string[] stulist, OpenLessonPlanOfElectiveEntity olpentity); | |||
void UnPass(string[] stulist, OpenLessonPlanOfElectiveEntity olpentity); | |||
void UnPassOfFinish(string[] stulist, OpenLessonPlanOfElectiveEntity olpentity); | |||
IEnumerable<StuSelectLessonListOfElectiveEntity> GetAllElectiveLesson(string academicYearNo, string semester); | |||
} | |||
} |
@@ -243,6 +243,43 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public void UnPassOfFinish(string[] stulist, OpenLessonPlanOfElectiveEntity olpentity) | |||
{ | |||
var db = BaseRepository("CollegeMIS"); | |||
try | |||
{ | |||
db.BeginTrans(); | |||
int count = 0;//待拒绝学生数量 | |||
foreach (var item in stulist) | |||
{ | |||
var model = db.FindEntity<StuSelectLessonListOfElectiveEntity>(item); | |||
if (model != null) | |||
{ | |||
count++; | |||
db.ExecuteBySql("update StuSelectLessonListOfElective set Status=3 where Id='" + item + "'"); | |||
} | |||
} | |||
//修改OpenLessonPlanOfElective通过人数 | |||
if (count > 0) | |||
{ | |||
olpentity.StuNum = olpentity.StuNum - count; | |||
db.Update(olpentity); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
@@ -5,17 +5,14 @@ | |||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | |||
</configSections> | |||
<connectionStrings> | |||
<add name="ConnectionPfcMisDBString" connectionString="server=192.168.100.225;database=CollegeMIS;Max Pool Size=1000;Min Pool Size=5;UID=sa;Pwd=Jykj@2019;" providerName="System.Data.SqlClient" /> | |||
<add name="ConnectionPfcMisDBString" connectionString="server=123.57.209.16;database=CollegeMIS_西昌;Max Pool Size=1000;Min Pool Size=5;UID=sa;Pwd=bjqjkj@2014~2015!;" providerName="System.Data.SqlClient" /> | |||
<add name="ConnectionPfcMisDBString2" connectionString="server=192.168.100.225;database=CollegeMIS_金隅;Max Pool Size=1000;Min Pool Size=5;UID=sa;Pwd=Jykj@2019;" providerName="System.Data.SqlClient" /> | |||
<add name="CoreDBString" connectionString="server=192.168.100.225;database=adms7ultimate2;Max Pool Size=1000;Min Pool Size=5;UID=sa;Pwd=Jykj@2019;" providerName="System.Data.SqlClient" /> | |||
<add name="CoreDBString" connectionString="server=123.57.209.16;database=adms7ultimate2_西昌;Max Pool Size=1000;Min Pool Size=5;UID=sa;Pwd=bjqjkj@2014~2015!;" providerName="System.Data.SqlClient" /> | |||
<add name="CoreDBString2" connectionString="server=192.168.100.225;database=adms7ultimate2_金隅;Max Pool Size=1000;Min Pool Size=5;UID=sa;Pwd=Jykj@2019;" providerName="System.Data.SqlClient" /> | |||
<add name="HangfireConnString" connectionString="Server=192.168.100.225;Initial Catalog=Hangfire;User ID=sa;Password=Jykj@2019" providerName="System.Data.SqlClient" /> | |||
<add name="HangfireConnString" connectionString="Server=123.57.209.16;Initial Catalog=Hangfire;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="YKTDBString" connectionString="Data Source=xcykt;Persist Security Info=True;User ID=xcysdata;Password=xcysdata2019;Unicode=True" providerName="System.Data.OracleClient" /> | |||
<add name="mjDBString" connectionString="Server=112.45.152.8,17049;Initial Catalog=mjxtjh;User ID=mjxtjh;Password=s1RKFzJvIG7KfcNRtntZ" providerName="System.Data.SqlClient" /> | |||
<add name="tsDBString" connectionString="Server=112.45.152.8,17049;Initial Catalog=tsgxtjh;User ID=tsgxtjh;Password=Qs6cYOzFoQupbr12MFZm" providerName="System.Data.SqlClient" /> | |||
<!--考勤机对接--> | |||
<add name="BaseDb" connectionString="Server=123.57.209.16;Initial Catalog=adms7ultimate2_西昌;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="CollegeMIS" connectionString="Server=123.57.209.16;Initial Catalog=CollegeMIS_西昌;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
</connectionStrings> | |||
<startup> | |||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | |||
@@ -23,7 +20,6 @@ | |||
<appSettings> | |||
<add key="dbbackuppath" value="E:\西昌程序单校区版2019_09_16\Learun.Framework.Ultimate V7\Learun.Application.Web\Resource\DataBaseBackup" /> | |||
<add key="AttendancePhotoPath" value="E:\西昌程序单校区版2019_09_16\Learun.Framework.Ultimate V7\Learun.Application.Web\Resource\AttendancePhoto" /> | |||
<add key="enableHK" value="true"/> | |||
</appSettings> | |||
<runtime> | |||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |||
@@ -1,357 +0,0 @@ | |||
using System; | |||
using System.Runtime.InteropServices; | |||
namespace AlarmCSharpDemo | |||
{ | |||
/// <summary> | |||
/// CHCNetSDK 的摘要说明。 | |||
/// </summary> | |||
public class CHCNetSDK | |||
{ | |||
public CHCNetSDK() | |||
{ | |||
// | |||
// TODO: 在此处添加构造函数逻辑 | |||
// | |||
} | |||
//常量 | |||
public const int SERIALNO_LEN = 48;//序列号长度 | |||
public const int NAME_LEN = 32;//用户名长度 | |||
public const int PASSWD_LEN = 16;//密码长度 | |||
public const int MACADDR_LEN = 6;//mac地址长度 | |||
public const int MAX_NAMELEN = 16;//DVR本地登陆名 | |||
public const int ACS_CARD_NO_LEN = 32; //门禁卡号长度 | |||
public delegate void LoginResultCallBack(int lUserID, uint dwResult, ref NET_DVR_DEVICEINFO_V30 lpDeviceInfo, IntPtr pUser); | |||
/********************************************************* | |||
Function: EXCEPYIONCALLBACK | |||
Desc: (回调函数) | |||
Input: | |||
Output: | |||
Return: | |||
**********************************************************/ | |||
public delegate void EXCEPYIONCALLBACK(uint dwType, int lUserID, int lHandle, IntPtr pUser); | |||
public delegate bool MSGCallBack_V31(int lCommand, ref NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser); | |||
//报警设备信息 | |||
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] | |||
public struct NET_DVR_ALARMER | |||
{ | |||
public byte byUserIDValid;/* userid是否有效 0-无效,1-有效 */ | |||
public byte bySerialValid;/* 序列号是否有效 0-无效,1-有效 */ | |||
public byte byVersionValid;/* 版本号是否有效 0-无效,1-有效 */ | |||
public byte byDeviceNameValid;/* 设备名字是否有效 0-无效,1-有效 */ | |||
public byte byMacAddrValid; /* MAC地址是否有效 0-无效,1-有效 */ | |||
public byte byLinkPortValid;/* login端口是否有效 0-无效,1-有效 */ | |||
public byte byDeviceIPValid;/* 设备IP是否有效 0-无效,1-有效 */ | |||
public byte bySocketIPValid;/* socket ip是否有效 0-无效,1-有效 */ | |||
public int lUserID; /* NET_DVR_Login()返回值, 布防时有效 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sSerialNumber;/* 序列号 */ | |||
public uint dwDeviceVersion;/* 版本信息 高16位表示主版本,低16位表示次版本*/ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sDeviceName;/* 设备名字 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byMacAddr;/* MAC地址 */ | |||
public ushort wLinkPort; /* link port */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sDeviceIP;/* IP地址 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sSocketIP;/* 报警主动上传时的socket IP地址 */ | |||
public byte byIpProtocol; /* Ip协议 0-IPV4, 1-IPV6 */ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; | |||
} | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_LOCAL_GENERAL_CFG | |||
{ | |||
public byte byExceptionCbDirectly; //0-通过线程池异常回调,1-直接异常回调给上层 | |||
public byte byNotSplitRecordFile; //回放和预览中保存到本地录像文件不切片 0-默认切片,1-不切片 | |||
public byte byResumeUpgradeEnable; //断网续传升级使能,0-关闭(默认),1-开启 | |||
public byte byAlarmJsonPictureSeparate; //控制JSON透传报警数据和图片是否分离,0-不分离,1-分离(分离后走COMM_ISAPI_ALARM回调返回) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; //保留 | |||
public Int64 i64FileSize; //单位:Byte | |||
public uint dwResumeUpgradeTimeout; //断网续传重连超时时间,单位毫秒 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 236, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes1; //预留 | |||
} | |||
public const int NET_DVR_DEV_ADDRESS_MAX_LEN = 129; | |||
public const int NET_DVR_LOGIN_USERNAME_MAX_LEN = 64; | |||
public const int NET_DVR_LOGIN_PASSWD_MAX_LEN = 64; | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct NET_DVR_USER_LOGIN_INFO | |||
{ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_DEV_ADDRESS_MAX_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sDeviceAddress; | |||
public byte byUseTransport; | |||
public ushort wPort; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_LOGIN_USERNAME_MAX_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sUserName; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_LOGIN_PASSWD_MAX_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sPassword; | |||
public LoginResultCallBack cbLoginResult; | |||
public IntPtr pUser; | |||
public bool bUseAsynLogin; | |||
public byte byProxyType; //0:不使用代理,1:使用标准代理,2:使用EHome代理 | |||
public byte byUseUTCTime; //0-不进行转换,默认,1-接口上输入输出全部使用UTC时间,SDK完成UTC时间与设备时区的转换,2-接口上输入输出全部使用平台本地时间,SDK完成平台本地时间与设备时区的转换 | |||
public byte byLoginMode; //0-Private, 1-ISAPI, 2-自适应 | |||
public byte byHttps; //0-不适用tls,1-使用tls 2-自适应 | |||
public int iProxyID; //代理服务器序号,添加代理服务器信息时,相对应的服务器数组下表值 | |||
public byte byVerifyMode; //认证方式,0-不认证,1-双向认证,2-单向认证;认证仅在使用TLS的时候生效; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 119, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes3; | |||
} | |||
//NET_DVR_Login_V30()参数结构 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_DEVICEINFO_V30 | |||
{ | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sSerialNumber; //序列号 | |||
public byte byAlarmInPortNum; //报警输入个数 | |||
public byte byAlarmOutPortNum; //报警输出个数 | |||
public byte byDiskNum; //硬盘个数 | |||
public byte byDVRType; //设备类型, 1:DVR 2:ATM DVR 3:DVS ...... | |||
public byte byChanNum; //模拟通道个数 | |||
public byte byStartChan; //起始通道号,例如DVS-1,DVR - 1 | |||
public byte byAudioChanNum; //语音通道数 | |||
public byte byIPChanNum; //最大数字通道个数,低位 | |||
public byte byZeroChanNum; //零通道编码个数 //2010-01-16 | |||
public byte byMainProto; //主码流传输协议类型 0-private, 1-rtsp,2-同时支持private和rtsp | |||
public byte bySubProto; //子码流传输协议类型0-private, 1-rtsp,2-同时支持private和rtsp | |||
public byte bySupport; //能力,位与结果为0表示不支持,1表示支持, | |||
//bySupport & 0x1, 表示是否支持智能搜索 | |||
//bySupport & 0x2, 表示是否支持备份 | |||
//bySupport & 0x4, 表示是否支持压缩参数能力获取 | |||
//bySupport & 0x8, 表示是否支持多网卡 | |||
//bySupport & 0x10, 表示支持远程SADP | |||
//bySupport & 0x20, 表示支持Raid卡功能 | |||
//bySupport & 0x40, 表示支持IPSAN 目录查找 | |||
//bySupport & 0x80, 表示支持rtp over rtsp | |||
public byte bySupport1; // 能力集扩充,位与结果为0表示不支持,1表示支持 | |||
//bySupport1 & 0x1, 表示是否支持snmp v30 | |||
//bySupport1 & 0x2, 支持区分回放和下载 | |||
//bySupport1 & 0x4, 是否支持布防优先级 | |||
//bySupport1 & 0x8, 智能设备是否支持布防时间段扩展 | |||
//bySupport1 & 0x10, 表示是否支持多磁盘数(超过33个) | |||
//bySupport1 & 0x20, 表示是否支持rtsp over http | |||
//bySupport1 & 0x80, 表示是否支持车牌新报警信息2012-9-28, 且还表示是否支持NET_DVR_IPPARACFG_V40结构体 | |||
public byte bySupport2; /*能力,位与结果为0表示不支持,非0表示支持 | |||
bySupport2 & 0x1, 表示解码器是否支持通过URL取流解码 | |||
bySupport2 & 0x2, 表示支持FTPV40 | |||
bySupport2 & 0x4, 表示支持ANR | |||
bySupport2 & 0x8, 表示支持CCD的通道参数配置 | |||
bySupport2 & 0x10, 表示支持布防报警回传信息(仅支持抓拍机报警 新老报警结构) | |||
bySupport2 & 0x20, 表示是否支持单独获取设备状态子项 | |||
bySupport2 & 0x40, 表示是否是码流加密设备*/ | |||
public ushort wDevType; //设备型号 | |||
public byte bySupport3; //能力集扩展,位与结果为0表示不支持,1表示支持 | |||
//bySupport3 & 0x1, 表示是否多码流 | |||
// bySupport3 & 0x4 表示支持按组配置, 具体包含 通道图像参数、报警输入参数、IP报警输入、输出接入参数、 | |||
// 用户参数、设备工作状态、JPEG抓图、定时和时间抓图、硬盘盘组管理 | |||
//bySupport3 & 0x8为1 表示支持使用TCP预览、UDP预览、多播预览中的"延时预览"字段来请求延时预览(后续都将使用这种方式请求延时预览)。而当bySupport3 & 0x8为0时,将使用 "私有延时预览"协议。 | |||
//bySupport3 & 0x10 表示支持"获取报警主机主要状态(V40)"。 | |||
//bySupport3 & 0x20 表示是否支持通过DDNS域名解析取流 | |||
public byte byMultiStreamProto;//是否支持多码流,按位表示,0-不支持,1-支持,bit1-码流3,bit2-码流4,bit7-主码流,bit-8子码流 | |||
public byte byStartDChan; //起始数字通道号,0表示无效 | |||
public byte byStartDTalkChan; //起始数字对讲通道号,区别于模拟对讲通道号,0表示无效 | |||
public byte byHighDChanNum; //数字通道个数,高位 | |||
public byte bySupport4; | |||
public byte byLanguageType;// 支持语种能力,按位表示,每一位0-不支持,1-支持 | |||
// byLanguageType 等于0 表示 老设备 | |||
// byLanguageType & 0x1表示支持中文 | |||
// byLanguageType & 0x2表示支持英文 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; //保留 | |||
} | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct NET_DVR_DEVICEINFO_V40 | |||
{ | |||
public NET_DVR_DEVICEINFO_V30 struDeviceV30; | |||
public byte bySupportLock; //设备支持锁定功能,该字段由SDK根据设备返回值来赋值的。bySupportLock为1时,dwSurplusLockTime和byRetryLoginTime有效 | |||
public byte byRetryLoginTime; //剩余可尝试登陆的次数,用户名,密码错误时,此参数有效 | |||
public byte byPasswordLevel; //admin密码安全等级0-无效,1-默认密码,2-有效密码,3-风险较高的密码。当用户的密码为出厂默认密码(12345)或者风险较高的密码时,上层客户端需要提示用户更改密码。 | |||
public byte byProxyType;//代理类型,0-不使用代理, 1-使用socks5代理, 2-使用EHome代理 | |||
public uint dwSurplusLockTime; //剩余时间,单位秒,用户锁定时,此参数有效 | |||
public byte byCharEncodeType; //字符编码类型 | |||
public byte bySupportDev5;//支持v50版本的设备参数获取,设备名称和设备类型名称长度扩展为64字节 | |||
public byte bySupport; //能力集扩展,位与结果:0- 不支持,1- 支持 | |||
// bySupport & 0x1: 保留 | |||
// bySupport & 0x2: 0-不支持变化上报 1-支持变化上报 | |||
public byte byLoginMode; //登录模式 0-Private登录 1-ISAPI登录 | |||
public int dwOEMCode; | |||
public int iResidualValidity; //该用户密码剩余有效天数,单位:天,返回负值,表示密码已经超期使用,例如“-3表示密码已经超期使用3天” | |||
public byte byResidualValidity; // iResidualValidity字段是否有效,0-无效,1-有效 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 243, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; | |||
} | |||
//报警布防参数结构体 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_SETUPALARM_PARAM | |||
{ | |||
public uint dwSize; | |||
public byte byLevel;//布防优先级:0- 一等级(高),1- 二等级(中),2- 三等级(低,保留) | |||
public byte byAlarmInfoType;//上传报警信息类型(智能交通摄像机支持):0- 老报警信息(NET_DVR_PLATE_RESULT),1- 新报警信息(NET_ITS_PLATE_RESULT) | |||
public byte byRetAlarmTypeV40; | |||
public byte byRetDevInfoVersion; | |||
public byte byRetVQDAlarmType; | |||
public byte byFaceAlarmDetection; | |||
public byte bySupport; | |||
public byte byBrokenNetHttp; | |||
public ushort wTaskNo; | |||
public byte byDeployType; //布防类型:0-客户端布防,1-实时布防 | |||
public byte bySubScription; //订阅,按位表示,未开启订阅不上报 //占位 //Bit7-移动侦测人车分类是否传图;0-不传图(V30上报),1-传图(V40上报) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes1; | |||
public byte byAlarmTypeURL; | |||
//bit0-表示人脸抓拍报警上传(INTER_FACESNAP_RESULT);0-表示二进制传输,1-表示URL传输(设备支持的情况下,设备支持能力根据具体报警能力集判断,同时设备需要支持URL的相关服务,当前是”云存储“) | |||
//bit1-表示EVENT_JSON中图片数据长传类型;0-表示二进制传输,1-表示URL传输(设备支持的情况下,设备支持能力根据具体报警能力集判断) | |||
//bit2 - 人脸比对(报警类型为COMM_SNAP_MATCH_ALARM)中图片数据上传类型:0 - 二进制传输,1 - URL传输 | |||
//bit3 - 行为分析(报警类型为COMM_ALARM_RULE)中图片数据上传类型:0 - 二进制传输,1 - URL传输,本字段设备是否支持,对应软硬件能力集中<isSupportBehaviorUploadByCloudStorageURL>节点是否返回且为true | |||
public byte byCustomCtrl;//Bit0- 表示支持副驾驶人脸子图上传: 0-不上传,1-上传 | |||
} | |||
//校时结构参数 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_TIME | |||
{ | |||
public uint dwYear; | |||
public uint dwMonth; | |||
public uint dwDay; | |||
public uint dwHour; | |||
public uint dwMinute; | |||
public uint dwSecond; | |||
} | |||
/*IP地址*/ | |||
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] | |||
public struct NET_DVR_IPADDR | |||
{ | |||
/// char[16] | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sIpV4; | |||
/// BYTE[128] | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
public void Init() | |||
{ | |||
byRes = new byte[128]; | |||
} | |||
} | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_ACS_EVENT_INFO | |||
{ | |||
public uint dwSize; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byCardNo; //卡号,为0无效 | |||
public byte byCardType; //卡类型,1-普通卡,2-残疾人卡,3-黑名单卡,4-巡更卡,5-胁迫卡,6-超级卡,7-来宾卡,为0无效 | |||
public byte byWhiteListNo; //白名单单号,1-8,为0无效 | |||
public byte byReportChannel; //报告上传通道,1-布防上传,2-中心组1上传,3-中心组2上传,为0无效 | |||
public byte byCardReaderKind; //读卡器属于哪一类,0-无效,1-IC读卡器,2-身份证读卡器,3-二维码读卡器,4-指纹头 | |||
public uint dwCardReaderNo; //读卡器编号,为0无效 | |||
public uint dwDoorNo; //门编号(楼层编号),为0无效 | |||
public uint dwVerifyNo; //多重卡认证序号,为0无效 | |||
public uint dwAlarmInNo; //报警输入号,为0无效 | |||
public uint dwAlarmOutNo; //报警输出号,为0无效 | |||
public uint dwCaseSensorNo; //事件触发器编号 | |||
public uint dwRs485No; //RS485通道号,为0无效 | |||
public uint dwMultiCardGroupNo; //群组编号 | |||
public ushort wAccessChannel; //人员通道号 | |||
public byte byDeviceNo; //设备编号,为0无效 | |||
public byte byDistractControlNo;//分控器编号,为0无效 | |||
public uint dwEmployeeNo; //工号,为0无效 | |||
public ushort wLocalControllerID; //就地控制器编号,0-门禁主机,1-64代表就地控制器 | |||
public byte byInternetAccess; //网口ID:(1-上行网口1,2-上行网口2,3-下行网口1) | |||
public byte byType; //防区类型,0:即时防区,1-24小时防区,2-延时防区 ,3-内部防区,4-钥匙防区 5-火警防区 6-周界防区 7-24小时无声防区 8-24小时辅助防区,9-24小时震动防区,10-门禁紧急开门防区,11-门禁紧急关门防区 0xff-无 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byMACAddr; //物理地址,为0无效 | |||
public byte bySwipeCardType;//刷卡类型,0-无效,1-二维码 | |||
public byte byMask;//是否带口罩:0-保留,1-未知,2-不戴口罩,3-戴口罩 | |||
public uint dwSerialNo; //事件流水号,为0无效 | |||
public byte byChannelControllerID; //通道控制器ID,为0无效,1-主通道控制器,2-从通道控制器 | |||
public byte byChannelControllerLampID; //通道控制器灯板ID,为0无效(有效范围1-255) | |||
public byte byChannelControllerIRAdaptorID; //通道控制器红外转接板ID,为0无效(有效范围1-255) | |||
public byte byChannelControllerIREmitterID; //通道控制器红外对射ID,为0无效(有效范围1-255) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
} | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_ACS_ALARM_INFO | |||
{ | |||
public uint dwSize; | |||
public uint dwMajor; //报警主类型,参考宏定义 | |||
public uint dwMinor; //报警次类型,参考宏定义 | |||
public NET_DVR_TIME struTime; //时间 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] sNetUser;//网络操作的用户名 | |||
public NET_DVR_IPADDR struRemoteHostAddr;//远程主机地址 | |||
public NET_DVR_ACS_EVENT_INFO struAcsEventInfo; //详细参数 | |||
public uint dwPicDataLen; //图片数据大小,不为0是表示后面带数据 | |||
public IntPtr pPicData; | |||
public ushort wInductiveEventType; //归纳事件类型,0-无效,客户端判断该值为非0值后,报警类型通过归纳事件类型区分,否则通过原有报警主次类型(dwMajor、dwMinor)区分 | |||
public byte byPicTransType; //图片数据传输方式: 0-二进制;1-url | |||
public byte byRes1; //保留字节 | |||
public uint dwIOTChannelNo; //IOT通道号 | |||
public IntPtr pAcsEventInfoExtend; //byAcsEventInfoExtend为1时,表示指向一个NET_DVR_ACS_EVENT_INFO_EXTEND结构体 | |||
public byte byAcsEventInfoExtend; //pAcsEventInfoExtend是否有效:0-无效,1-有效 | |||
public byte byTimeType; //时间类型:0-设备本地时间,1-UTC时间(struTime的时间) | |||
public byte byRes2; //保留字节 | |||
public byte byAcsEventInfoExtendV20; //pAcsEventInfoExtendV20是否有效:0-无效,1-有效 | |||
public IntPtr pAcsEventInfoExtendV20; //byAcsEventInfoExtendV20为1时,表示指向一个NET_DVR_ACS_EVENT_INFO_EXTEND_V20结构体 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
} | |||
public const int NET_SDK_EMPLOYEE_NO_LEN = 32; //工号长度 | |||
public const int NET_SDK_UUID_LEN = 36; //UUID长度 | |||
public const int NET_DEV_NAME_LEN = 64; //设备名称长度 | |||
[StructLayoutAttribute(LayoutKind.Sequential)] | |||
public struct NET_DVR_ACS_EVENT_INFO_EXTEND | |||
{ | |||
public int dwFrontSerialNo; //事件流水号,为0无效(若该字段为0,平台根据dwSerialNo判断是否丢失事件;若该字段不为0,平台根据该字段和dwSerialNo字段共同判断是否丢失事件)(主要用于解决报警订阅后导致dwSerialNo不连续的情况) | |||
public byte byUserType; //人员类型:0-无效,1-普通人(主人),2-来宾(访客),3-黑名单人,4-管理员 | |||
public byte byCurrentVerifyMode; //读卡器当前验证方式:0-无效,1-休眠,2-刷卡+密码,3-刷卡,4-刷卡或密码,5-指纹,6-指纹+密码,7-指纹或刷卡,8-指纹+刷卡,9-指纹+刷卡+密码,10-人脸或指纹或刷卡或密码,11-人脸+指纹,12-人脸+密码,13-人脸+刷卡,14-人脸,15-工号+密码,16-指纹或密码,17-工号+指纹,18-工号+指纹+密码,19-人脸+指纹+刷卡,20-人脸+密码+指纹,21-工号+人脸,22-人脸或人脸+刷卡,23-指纹或人脸,24-刷卡或人脸或密码,25-刷卡或人脸,26-刷卡或人脸或指纹,27-刷卡或指纹或密码 | |||
public byte byCurrentEvent; //是否为实时事件:0-无效,1-是(实时事件),2-否(离线事件) | |||
public byte byPurePwdVerifyEnable; //设备是否支持纯密码认证, 0-不支持,1-支持 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EMPLOYEE_NO_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byEmployeeNo; //工号(人员ID)(对于设备来说,如果使用了工号(人员ID)字段,byEmployeeNo一定要传递,如果byEmployeeNo可转换为dwEmployeeNo,那么该字段也要传递;对于上层平台或客户端来说,优先解析byEmployeeNo字段,如该字段为空,再考虑解析dwEmployeeNo字段) | |||
public byte byAttendanceStatus; //考勤状态:0-未定义,1-上班,2-下班,3-开始休息,4-结束休息,5-开始加班,6-结束加班 | |||
public byte byStatusValue; //考勤状态值 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes2; | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_UUID_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byUUID; //UUID(该字段仅在对接萤石平台过程中才会使用) | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DEV_NAME_LEN, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byDeviceName; //设备序列号 | |||
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] | |||
public byte[] byRes; | |||
} | |||
/********************************************************* | |||
Function: NET_DVR_Init | |||
Desc: 初始化SDK,调用其他SDK函数的前提。 | |||
Input: | |||
Output: | |||
Return: TRUE表示成功,FALSE表示失败。 | |||
**********************************************************/ | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern bool NET_DVR_Init(); | |||
//启用日志文件写入接口 | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetLogToFile(int bLogEnable, string strLogDir, bool bAutoDel); | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetSDKLocalCfg(int enumType, IntPtr lpInBuff); | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern uint NET_DVR_GetLastError(); | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetExceptionCallBack_V30(uint nMessage, IntPtr hWnd, EXCEPYIONCALLBACK fExceptionCallBack, IntPtr pUser); | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern bool NET_DVR_SetDVRMessageCallBack_V31(MSGCallBack_V31 fMessageCallBack, IntPtr pUser); | |||
[DllImport(@"HCNetSDK.dll")] | |||
public static extern int NET_DVR_Login_V40(ref NET_DVR_USER_LOGIN_INFO pLoginInfo, ref NET_DVR_DEVICEINFO_V40 lpDeviceInfo); | |||
[DllImport(@"..\bin\HCNetSDK.dll")] | |||
public static extern int NET_DVR_SetupAlarmChan_V41(int lUserID, ref NET_DVR_SETUPALARM_PARAM lpSetupParam); | |||
} | |||
} |
@@ -92,7 +92,6 @@ | |||
<Reference Include="System.Xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="CHCNetSDK.cs" /> | |||
<Compile Include="ProjectInstaller.cs"> | |||
<SubType>Component</SubType> | |||
</Compile> | |||
@@ -113,10 +112,6 @@ | |||
<SubType>Designer</SubType> | |||
</None> | |||
<None Include="packages.config" /> | |||
<None Include="海康考勤机必须文件\HCNetSDKCom\HCAlarm.lib" /> | |||
<None Include="海康考勤机必须文件\HCNetSDKCom\HCGeneralCfgMgr.lib" /> | |||
<None Include="海康考勤机必须文件\HCNetSDKCom\HCPreview.lib" /> | |||
<None Include="海康考勤机必须文件\log4cxx.properties" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<EmbeddedResource Include="ProjectInstaller.resx"> | |||
@@ -128,68 +123,6 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="installanduninstall.txt" /> | |||
<Content Include="海康考勤机必须文件\HCCore.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDK.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\AnalyzeData.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\AudioIntercom.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCAlarm.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCCoreDevCfg.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCDisplay.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCGeneralCfgMgr.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCIndustry.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCPlayBack.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCPreview.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\HCVoiceTalk.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\libiconv2.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\OpenAL32.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\StreamTransClient.dll" /> | |||
<Content Include="海康考勤机必须文件\HCNetSDKCom\SystemTransform.dll" /> | |||
<Content Include="海康考勤机必须文件\hlog.dll" /> | |||
<Content Include="海康考勤机必须文件\hpr.dll" /> | |||
<Content Include="海康考勤机必须文件\libeay32.dll" /> | |||
<Content Include="海康考勤机必须文件\Newtonsoft.Json.dll" /> | |||
<Content Include="海康考勤机必须文件\Newtonsoft.Json.xml" /> | |||
<Content Include="海康考勤机必须文件\ssleay32.dll" /> | |||
<Content Include="海康考勤机必须文件\zlib1.dll" /> | |||
<Content Include="海康考勤机必须文件\文件部署说明.txt" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Application.Module\Learun.Application.AppMagager\Learun.Application.AppMagager.csproj"> | |||
<Project>{8f770f8b-06b3-43da-886f-15d41cec62ee}</Project> | |||
<Name>Learun.Application.AppMagager</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Application.Module\Learun.Application.Base\Learun.Application.Base.csproj"> | |||
<Project>{0cdd0dc8-74cf-4c71-923c-66204a8923d3}</Project> | |||
<Name>Learun.Application.Base</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Application.Module\Learun.Application.Mapping\Learun.Application.Mapping.csproj"> | |||
<Project>{79f8e2f1-08e7-4336-93e0-512b39f9dd54}</Project> | |||
<Name>Learun.Application.Mapping</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Application.Module\Learun.Application.TwoDevelopment\Learun.Application.TwoDevelopment.csproj"> | |||
<Project>{56f9a112-fd96-4809-98f4-0d7c5de0711b}</Project> | |||
<Name>Learun.Application.TwoDevelopment</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Db\Learun.DataBase.EF.Sqlserver\Learun.DataBase.SqlServer.csproj"> | |||
<Project>{890532f8-5205-4ee9-965c-84500cad24de}</Project> | |||
<Name>Learun.DataBase.SqlServer</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Db\Learun.DataBase.Repository\Learun.DataBase.Repository.csproj"> | |||
<Project>{7f5e2a6c-c859-494a-8577-75bf9603a80c}</Project> | |||
<Name>Learun.DataBase.Repository</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Db\Learun.DataBase\Learun.DataBase.csproj"> | |||
<Project>{c329f9e1-4327-4769-9d08-07e6fec41005}</Project> | |||
<Name>Learun.DataBase</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Ioc\Learun.Ioc.csproj"> | |||
<Project>{81c03609-ae0d-414c-829b-16b990487add}</Project> | |||
<Name>Learun.Ioc</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\Learun.Framework.Module\Learun.Util\Learun.Util\Learun.Util.csproj"> | |||
<Project>{cf8ae293-88ab-436c-9720-a8386ba5d7b7}</Project> | |||
<Name>Learun.Util</Name> | |||
</ProjectReference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.10.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" /> | |||
@@ -1,613 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Diagnostics; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.ServiceProcess; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using AlarmCSharpDemo; | |||
using System.ServiceProcess; | |||
using Hangfire; | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Application.TwoDevelopment.LogisticsManagement; | |||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
namespace Quanjiang.DigitalScholl.JobService | |||
{ | |||
public partial class QuanjiangDigitalSchollJobService : ServiceBase | |||
{ | |||
private BackgroundJobServer _server; | |||
private ADR_DeviceIBLL adrDeviceIbll = new ADR_DeviceBLL(); | |||
private ADR_DeviceLogIBLL adrDeviceLogIbll = new ADR_DeviceLogBLL(); | |||
private ADR_RestrictionIBLL adrRestrictionIbll = new ADR_RestrictionBLL(); | |||
private ADR_RecordIBLL adrRecordIbll = new ADR_RecordBLL(); | |||
//海康考勤机回调 | |||
public CHCNetSDK.LoginResultCallBack LoginCallBack = null; | |||
private CHCNetSDK.EXCEPYIONCALLBACK m_fExceptionCB = null; | |||
private CHCNetSDK.MSGCallBack_V31 m_falarmData_V31 = null; | |||
public QuanjiangDigitalSchollJobService() | |||
{ | |||
try | |||
{ | |||
InitializeComponent(); | |||
GlobalConfiguration.Configuration.UseSqlServerStorage("HangfireConnString"); | |||
} | |||
catch (Exception e) | |||
{ | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
adrDeviceLogEntity.LogData = "服务初始化失败:" + e.Message + ",详细:" + e.StackTrace; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
InitializeComponent(); | |||
GlobalConfiguration.Configuration.UseSqlServerStorage("HangfireConnString"); | |||
} | |||
protected override void OnStart(string[] args) | |||
{ | |||
try | |||
{ | |||
var options = new BackgroundJobServerOptions | |||
{ | |||
ServerName = "QuanjiangDigitalSchollJobService" | |||
}; | |||
_server = new BackgroundJobServer(options); | |||
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["enableHK"])&&Convert.ToBoolean(ConfigurationManager.AppSettings["enableHK"])) | |||
{ | |||
//海康考勤机对接 | |||
#region 海康考勤机对接 | |||
//初始化SDK | |||
bool m_bInitSDK = CHCNetSDK.NET_DVR_Init(); | |||
if (m_bInitSDK) | |||
{ | |||
//保存SDK日志 To save the SDK log | |||
CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\HKSdkLog\\", true); | |||
//设置透传报警信息类型 | |||
CHCNetSDK.NET_DVR_LOCAL_GENERAL_CFG struLocalCfg = new CHCNetSDK.NET_DVR_LOCAL_GENERAL_CFG(); | |||
struLocalCfg.byAlarmJsonPictureSeparate = 1;//控制JSON透传报警数据和图片是否分离,0-不分离(COMM_VCA_ALARM返回),1-分离(分离后走COMM_ISAPI_ALARM回调返回) | |||
Int32 nSize = Marshal.SizeOf(struLocalCfg); | |||
IntPtr ptrLocalCfg = Marshal.AllocHGlobal(nSize); | |||
Marshal.StructureToPtr(struLocalCfg, ptrLocalCfg, false); | |||
if (!CHCNetSDK.NET_DVR_SetSDKLocalCfg(17, ptrLocalCfg)) //NET_DVR_LOCAL_CFG_TYPE_GENERAL | |||
{ | |||
string strErr = "海康NET_DVR_SetSDKLocalCfg 失败, error code= " + CHCNetSDK.NET_DVR_GetLastError(); | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
adrDeviceLogEntity.LogData = strErr; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
Marshal.FreeHGlobal(ptrLocalCfg); | |||
//设置异常消息回调函数 | |||
if (m_fExceptionCB == null) | |||
{ | |||
m_fExceptionCB = new CHCNetSDK.EXCEPYIONCALLBACK(cbExceptionCB); | |||
} | |||
CHCNetSDK.NET_DVR_SetExceptionCallBack_V30(0, IntPtr.Zero, m_fExceptionCB, IntPtr.Zero); | |||
//设置报警回调函数 | |||
if (m_falarmData_V31 == null) | |||
{ | |||
m_falarmData_V31 = new CHCNetSDK.MSGCallBack_V31(MsgCallback_V31); | |||
} | |||
CHCNetSDK.NET_DVR_SetDVRMessageCallBack_V31(m_falarmData_V31, IntPtr.Zero); | |||
//获取设备 | |||
var devicelist = adrDeviceIbll.GetAllUnconnectedList(true); | |||
//登录设备 | |||
foreach (var deviceEntity in devicelist) | |||
{ | |||
CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLogInfo = new CHCNetSDK.NET_DVR_USER_LOGIN_INFO(); | |||
//设备IP地址或者域名 | |||
byte[] byIP = System.Text.Encoding.Default.GetBytes(deviceEntity.IpAddress); | |||
struLogInfo.sDeviceAddress = new byte[129]; | |||
byIP.CopyTo(struLogInfo.sDeviceAddress, 0); | |||
//设备用户名 | |||
byte[] byUserName = System.Text.Encoding.Default.GetBytes(deviceEntity.AdminAccount); | |||
struLogInfo.sUserName = new byte[64]; | |||
byUserName.CopyTo(struLogInfo.sUserName, 0); | |||
//设备密码 | |||
byte[] byPassword = System.Text.Encoding.Default.GetBytes(deviceEntity.AdminPwd); | |||
struLogInfo.sPassword = new byte[64]; | |||
byPassword.CopyTo(struLogInfo.sPassword, 0); | |||
struLogInfo.wPort = ushort.Parse(deviceEntity.PortNumber.ToString());//设备服务端口号 | |||
//用户数据,回调时可用 | |||
//获取大小 | |||
//uint dwSize = (uint)Marshal.SizeOf(deviceEntity); | |||
////分配内存 | |||
//IntPtr ptrCond = Marshal.AllocHGlobal((int)dwSize); | |||
////写入内存 | |||
//Marshal.StructureToPtr(deviceEntity, ptrCond, false); | |||
////用户数据,回调时可用 | |||
//struLogInfo.pUser = ptrCond; | |||
//struLogInfo.bUseAsynLogin = false; //是否异步登录:0- 否,1- 是 | |||
//struLogInfo.cbLoginResult = new CHCNetSDK.LoginResultCallBack(AsynLoginMsgCallback);//注册回调函数; | |||
struLogInfo.byLoginMode = 0; //0-Private, 1-ISAPI, 2-自适应 | |||
struLogInfo.byHttps = 0; //0-不适用tls,1-使用tls 2-自适应 | |||
CHCNetSDK.NET_DVR_DEVICEINFO_V40 DeviceInfo = new CHCNetSDK.NET_DVR_DEVICEINFO_V40(); | |||
DeviceInfo.struDeviceV30.sSerialNumber = new byte[CHCNetSDK.SERIALNO_LEN]; | |||
//登录设备 Login the device | |||
var lUserID = CHCNetSDK.NET_DVR_Login_V40(ref struLogInfo, ref DeviceInfo); | |||
//释放内存 | |||
//Marshal.FreeHGlobal(ptrCond); | |||
//同步登录方法 | |||
string strLoginCallBack = ""; | |||
if (lUserID < 0) | |||
{ | |||
uint iErrCode = CHCNetSDK.NET_DVR_GetLastError(); | |||
strLoginCallBack = "登录设备失败,lUserID:" + lUserID + ",错误号:" + iErrCode; | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strLoginCallBack += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strLoginCallBack; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
else | |||
{ | |||
//登录成功 | |||
strLoginCallBack = "登录设备成功,lUserID:" + lUserID; | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strLoginCallBack += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strLoginCallBack; | |||
adrDeviceLogEntity.LogType = "0"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//设备布防 | |||
CHCNetSDK.NET_DVR_SETUPALARM_PARAM struAlarmParam = new CHCNetSDK.NET_DVR_SETUPALARM_PARAM(); | |||
struAlarmParam.dwSize = (uint)Marshal.SizeOf(struAlarmParam); | |||
struAlarmParam.byLevel = 1; //0- 一级布防,1- 二级布防 | |||
struAlarmParam.byAlarmInfoType = 1;//智能交通设备有效,新报警信息类型 | |||
struAlarmParam.byDeployType = 0; | |||
struAlarmParam.byFaceAlarmDetection = 1;//1-人脸侦测 | |||
var m_lUserID = CHCNetSDK.NET_DVR_SetupAlarmChan_V41(lUserID, ref struAlarmParam); | |||
if (m_lUserID < 0) | |||
{ | |||
string strErr = "布防失败,错误号:" + CHCNetSDK.NET_DVR_GetLastError(); //布防失败,输出错误号 | |||
adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strErr += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strErr; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//更新设备状态 | |||
deviceEntity.DOnlineStatus = false; | |||
} | |||
else | |||
{ | |||
adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
string strNotice = "布防成功"; | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strNotice += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strNotice; | |||
adrDeviceLogEntity.LogType = "0"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//更新设备状态 | |||
deviceEntity.DOnlineStatus = true; | |||
} | |||
//更新设备状态 | |||
adrDeviceIbll.SaveEntity(deviceEntity.Id, deviceEntity); | |||
} | |||
} | |||
} | |||
else//初始化失败 | |||
{ | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
adrDeviceLogEntity.LogData = "海康SDK初始化失败"; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
#endregion | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
adrDeviceLogEntity.LogData = "服务启动失败:" + e.Message + ",详细:" + e.StackTrace; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
} | |||
/// <summary> | |||
/// 海康登录回调 | |||
/// </summary> | |||
/// <param name = "lUserID" ></ param > | |||
/// < param name="dwResult"></param> | |||
/// <param name = "lpDeviceInfo" ></ param > | |||
/// < param name="pUser"></param> | |||
public void AsynLoginMsgCallback(Int32 lUserID, UInt32 dwResult, ref CHCNetSDK.NET_DVR_DEVICEINFO_V30 lpDeviceInfo, IntPtr pUser) | |||
{ | |||
try | |||
{ | |||
ADR_DeviceEntity deviceEntity = new ADR_DeviceEntity(); | |||
uint dwSize = (uint)Marshal.SizeOf(deviceEntity); | |||
deviceEntity = (ADR_DeviceEntity)Marshal.PtrToStructure(pUser, typeof(ADR_DeviceEntity)); | |||
string strLoginCallBack = ""; | |||
//登录失败 | |||
if (dwResult == 0) | |||
{ | |||
uint iErrCode = CHCNetSDK.NET_DVR_GetLastError(); | |||
strLoginCallBack = "登录设备失败,lUserID:" + lUserID + ",错误号:" + iErrCode; | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strLoginCallBack += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strLoginCallBack; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
else//登录成功 | |||
{ | |||
strLoginCallBack = "登录设备成功,lUserID:" + lUserID; | |||
ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strLoginCallBack += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strLoginCallBack; | |||
adrDeviceLogEntity.LogType = "0"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//设备布防 | |||
CHCNetSDK.NET_DVR_SETUPALARM_PARAM struAlarmParam = new CHCNetSDK.NET_DVR_SETUPALARM_PARAM(); | |||
struAlarmParam.dwSize = (uint)Marshal.SizeOf(struAlarmParam); | |||
struAlarmParam.byLevel = 1; //0- 一级布防,1- 二级布防 | |||
struAlarmParam.byAlarmInfoType = 1;//智能交通设备有效,新报警信息类型 | |||
struAlarmParam.byDeployType = 0; | |||
struAlarmParam.byFaceAlarmDetection = 1;//1-人脸侦测 | |||
var m_lUserID = CHCNetSDK.NET_DVR_SetupAlarmChan_V41(lUserID, ref struAlarmParam); | |||
if (m_lUserID < 0) | |||
{ | |||
string strErr = "布防失败,错误号:" + CHCNetSDK.NET_DVR_GetLastError(); //布防失败,输出错误号 | |||
adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strErr += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strErr; | |||
adrDeviceLogEntity.LogType = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//更新设备状态 | |||
deviceEntity.DOnlineStatus = false; | |||
} | |||
else | |||
{ | |||
adrDeviceLogEntity = new ADR_DeviceLogEntity(); | |||
adrDeviceLogEntity.Create(); | |||
string strNotice = "布防成功"; | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) | |||
{ | |||
adrDeviceLogEntity.DeviceId = deviceEntity.Id; | |||
strNotice += ",设备IP:" + deviceEntity.IpAddress; | |||
} | |||
adrDeviceLogEntity.LogData = strNotice; | |||
adrDeviceLogEntity.LogType = "0"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//更新设备状态 | |||
deviceEntity.DOnlineStatus = true; | |||
} | |||
//更新设备状态 | |||
adrDeviceIbll.SaveEntity(deviceEntity.Id, deviceEntity); | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
LogEntity lrBaseLogoEntity = new LogEntity(); | |||
lrBaseLogoEntity.F_LogId = Guid.NewGuid().ToString(); | |||
lrBaseLogoEntity.F_CategoryId = 4; | |||
lrBaseLogoEntity.F_Module = "海康考勤机"; | |||
lrBaseLogoEntity.F_ExecuteResultJson = "操作海康考勤机异常" + e.Message + ",详细" + e.StackTrace; | |||
lrBaseLogoEntity.WriteLog(); | |||
} | |||
} | |||
/// <summary> | |||
/// 海康异常回调 | |||
/// </summary> | |||
/// <param name = "dwType" ></ param > | |||
/// < param name="lUserID"></param> | |||
/// <param name = "lHandle" ></ param > | |||
/// < param name="pUser"></param> | |||
public void cbExceptionCB(uint dwType, int lUserID, int lHandle, IntPtr pUser) | |||
{ | |||
//异常消息信息类型 | |||
string stringAlarm = "海康异常消息回调,信息类型:0x" + Convert.ToString(dwType, 16) + ", lUserID:" + lUserID + ", lHandle:" + lHandle; | |||
var deviceEntity = adrDeviceIbll.GetADR_DeviceEntityBylUserID(lUserID.ToString()); | |||
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 = "2"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
} | |||
/// <summary> | |||
/// 海康报警事件回调 | |||
/// </summary> | |||
/// <param name = "lCommand" ></ param > | |||
/// < param name="pAlarmer"></param> | |||
/// <param name = "pAlarmInfo" ></ param > | |||
/// < param name="dwBufLen"></param> | |||
/// <param name = "pUser" ></ param > | |||
/// < returns ></ returns > | |||
public bool MsgCallback_V31(int lCommand, ref CHCNetSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser) | |||
{ | |||
try | |||
{ | |||
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); | |||
struAcsAlarm = | |||
(CHCNetSDK.NET_DVR_ACS_ALARM_INFO)Marshal.PtrToStructure(pAlarmInfo, | |||
typeof(CHCNetSDK.NET_DVR_ACS_ALARM_INFO)); | |||
//这里判断是为了只获取刷脸的信息 | |||
if (struAcsAlarm.dwMajor == 0x5 && struAcsAlarm.dwMinor == 0x4b)//主事件0x5 代表EVENT,次事件0x4b 代表MINOR_FACE_VERIFY_PASS人脸认证通过 | |||
{ | |||
//报警设备IP地址 | |||
string strIP = System.Text.Encoding.UTF8.GetString(pAlarmer.sDeviceIP).TrimEnd('\0'); | |||
//抓拍图片路径 | |||
string str = ""; | |||
//保存抓拍图片 | |||
if ((struAcsAlarm.dwPicDataLen != 0) && (struAcsAlarm.pPicData != IntPtr.Zero)) | |||
{ | |||
string path = ConfigurationManager.AppSettings["AttendancePhotoPath"]; | |||
string datepath = DateTime.Now.ToString("yyyy-MM-dd"); | |||
if (!Directory.Exists(path + "\\" + datepath)) | |||
{ | |||
Directory.CreateDirectory(path + "\\" + datepath); | |||
} | |||
str = path + "\\Device_Acs_CapturePic_[" + strIP + "]_lUerID_[" + pAlarmer.lUserID + "]_" + | |||
Learun.Util.CommonHelper.CreateNo() + ".jpg"; | |||
FileStream fs = new FileStream(str, FileMode.Create); | |||
int iLen = (int)struAcsAlarm.dwPicDataLen; | |||
byte[] by = new byte[iLen]; | |||
Marshal.Copy(struAcsAlarm.pPicData, by, 0, iLen); | |||
fs.Write(by, 0, iLen); | |||
fs.Close(); | |||
} | |||
//报警时间:年月日时分秒 | |||
string strTimeYear = (struAcsAlarm.struTime.dwYear).ToString(); | |||
string strTimeMonth = (struAcsAlarm.struTime.dwMonth).ToString("d2"); | |||
string strTimeDay = (struAcsAlarm.struTime.dwDay).ToString("d2"); | |||
string strTimeHour = (struAcsAlarm.struTime.dwHour).ToString("d2"); | |||
string strTimeMinute = (struAcsAlarm.struTime.dwMinute).ToString("d2"); | |||
string strTimeSecond = (struAcsAlarm.struTime.dwSecond).ToString("d2"); | |||
string strTime = strTimeYear + "-" + strTimeMonth + "-" + strTimeDay + " " + strTimeHour + ":" + | |||
strTimeMinute + ":" + strTimeSecond; | |||
string stringAlarm = "门禁主机报警信息,dwMajor:0x" + Convert.ToString(struAcsAlarm.dwMajor, 16) + | |||
",dwMinor:0x" + | |||
Convert.ToString(struAcsAlarm.dwMinor, 16) + ",卡号:" + System.Text.Encoding.UTF8 | |||
.GetString(struAcsAlarm.struAcsEventInfo.byCardNo).TrimEnd('\0') | |||
+ ",读卡器编号:" + struAcsAlarm.struAcsEventInfo.dwCardReaderNo + ",报警触发时间:" + | |||
strTime + | |||
",事件流水号:" + struAcsAlarm.struAcsEventInfo.dwSerialNo; | |||
//如果能取到详细信息 | |||
if (struAcsAlarm.byAcsEventInfoExtend == 1) | |||
{ | |||
CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND struInfoExtend = | |||
new CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND(); | |||
uint dwSizeEx = (uint)Marshal.SizeOf(struInfoExtend); | |||
struInfoExtend = (CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND)Marshal.PtrToStructure( | |||
struAcsAlarm.pAcsEventInfoExtend, typeof(CHCNetSDK.NET_DVR_ACS_EVENT_INFO_EXTEND)); | |||
stringAlarm = stringAlarm + ", 人员类型:" + struInfoExtend.byUserType; | |||
} | |||
//记录日志 | |||
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 = "0"; | |||
adrDeviceLogIbll.SaveEntity(null, adrDeviceLogEntity); | |||
//考勤记录 | |||
//首先获取考勤规则 | |||
var attendancerulEntity = adrRestrictionIbll.GetADR_RestrictionEntityEnabled(); | |||
if (attendancerulEntity != null) | |||
{ | |||
//员工卡号 | |||
string EmpNo = System.Text.Encoding.UTF8.GetString(struAcsAlarm.struAcsEventInfo.byCardNo).TrimEnd('\0'); | |||
//考勤状态 | |||
string ADType = "0"; | |||
//考勤结果 | |||
string ClockStatus = "1"; | |||
//当前服务器日期 | |||
var datenow = DateTime.Now.ToString("yyyy-MM-dd"); | |||
//设备事件时间 | |||
DateTime devicetime = Convert.ToDateTime(strTime); | |||
//上班时间 | |||
DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime); | |||
//下班时间 | |||
DateTime offworkDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.CloseTime); | |||
//迟到判断 | |||
if (devicetime <= workDateTime)//正常 | |||
{ | |||
ADType = "1";//上班 | |||
ClockStatus = "1";//正常 | |||
} | |||
else//迟到 | |||
{ | |||
//签到与签退判断 | |||
if (devicetime >= offworkDateTime)//如果签到时间大于下班时间则为签退状态 | |||
{ | |||
ADType = "2";//下班 | |||
ClockStatus = "1";//正常 | |||
} | |||
else//小于下班时间 | |||
{ | |||
//首先判断是上班还是下班 | |||
//该用户当日有签到记录视为下班签退 | |||
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)//如果允许早退,获取范围 | |||
{ | |||
//最早签退时间 | |||
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";//迟到 | |||
} | |||
} | |||
} | |||
} | |||
ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity(); | |||
adrRecordEntity.Create(); | |||
adrRecordEntity.UserNo = EmpNo; | |||
adrRecordEntity.ADType = ADType; | |||
adrRecordEntity.ADTime = datetimenow; | |||
adrRecordEntity.ClockTime = devicetime; | |||
adrRecordEntity.ClockStatus = ClockStatus; | |||
if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) | |||
{ | |||
adrRecordEntity.ClockPlace = deviceEntity.DName; | |||
} | |||
else | |||
{ | |||
adrRecordEntity.ClockPlace = "未知"; | |||
} | |||
adrRecordEntity.ADYear = datetimenow.Year.ToString(); | |||
adrRecordEntity.ADMonth = datetimenow.Month.ToString(); | |||
adrRecordEntity.ADDay = datetimenow.Day.ToString(); | |||
adrRecordEntity.ADPhoto = str; | |||
//去重 | |||
//获取当日考勤记录 | |||
var attendancerecordlist = adrRecordIbll.GetADR_RecordEntityByEmpNo(strTimeYear, strTimeMonth, strTimeDay, EmpNo); | |||
//签到去重 | |||
if (adrRecordEntity.ADType == "1" && attendancerecordlist.Count(m => m.ADType == "1") == 0)//签过到了 | |||
{ | |||
//每日保留第一次签到记录 | |||
return true; | |||
} | |||
//签退去重 | |||
if (adrRecordEntity.ADType == "2" && attendancerecordlist.Count(m => m.ADType == "2") > 0)//签过退了 | |||
{ | |||
//更新签退时间,签退状态 | |||
var firstoffworkentity = attendancerecordlist.FirstOrDefault(m => m.ADType == "2"); | |||
firstoffworkentity.ADTime = datetimenow; | |||
firstoffworkentity.ClockTime = devicetime; | |||
firstoffworkentity.ClockStatus = ClockStatus; | |||
firstoffworkentity.ADPhoto = str; | |||
adrRecordIbll.SaveEntity(firstoffworkentity.ID, firstoffworkentity); | |||
return true; | |||
} | |||
//考勤记录 | |||
adrRecordIbll.SaveEntity(null, adrRecordEntity); | |||
} | |||
} | |||
} | |||
return true; //回调函数需要有返回,表示正常接收到数据 | |||
} | |||
catch (Exception e) | |||
var options = new BackgroundJobServerOptions | |||
{ | |||
LogEntity lrBaseLogoEntity = new LogEntity(); | |||
lrBaseLogoEntity.F_LogId = Guid.NewGuid().ToString(); | |||
lrBaseLogoEntity.F_CategoryId = 4; | |||
lrBaseLogoEntity.F_Module = "海康考勤机"; | |||
lrBaseLogoEntity.F_ExecuteResultJson = "海康考勤机报警事件回调异常" + e.Message + ",详细" + e.StackTrace; | |||
lrBaseLogoEntity.WriteLog(); | |||
return true; | |||
} | |||
ServerName = "QuanjiangDigitalSchollJobService" | |||
}; | |||
_server = new BackgroundJobServer(options); | |||
//自动运行连接考勤机 | |||
RecurringJob.Trigger("HKAttendance"); | |||
} | |||
protected override void OnStop() | |||
@@ -1,26 +0,0 @@ | |||
#缺省不输出日志到控制台 | |||
#FATAL、ERROR、WARN、INFO、DEBUG 优先级顺序 如果子模块和根模块都匹配,那么都会输出 | |||
log4j.rootLogger=DEBUG, stdout | |||
#log4j.rootLogger=DEBUG | |||
##hlog.async=false | |||
##hlog.secret.show=true | |||
##hlog.secret.encrypt=false | |||
#log4j.logger用于控制日志采集级别及采集内容,Threshold用于控制日志输出级别 | |||
#应用于控制台 | |||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |||
log4j.appender.stdout.layout.ConversionPattern=[%d][%t][%-5p]- %m%n | |||
log4j.logger.NPQ=TRACE, NPQ | |||
log4j.appender.NPQ=org.apache.log4j.RollingFileAppender | |||
log4j.appender.NPQ.File=./NPQLog/NPQ.log | |||
log4j.appender.NPQ.MaxFileSize=80MB | |||
log4j.appender.NPQ.MaxBackupIndex=12 | |||
log4j.appender.NPQ.Append=false | |||
log4j.appender.NPQ.Threshold=TRACE | |||
log4j.appender.NPQ.layout=org.apache.log4j.PatternLayout | |||
log4j.appender.NPQ.layout.ConversionPattern=[%d][%t][%-5p]- %m%n | |||
log4j.additivity.NPQ = false | |||
#最后一位修改为true 既可以控制台输出又可以文件输出 | |||
@@ -1,26 +0,0 @@ | |||
#缺省不输出日志到控制台 | |||
#FATAL、ERROR、WARN、INFO、DEBUG 优先级顺序 如果子模块和根模块都匹配,那么都会输出 | |||
log4j.rootLogger=DEBUG, stdout | |||
#log4j.rootLogger=DEBUG | |||
##hlog.async=false | |||
##hlog.secret.show=true | |||
##hlog.secret.encrypt=false | |||
#log4j.logger用于控制日志采集级别及采集内容,Threshold用于控制日志输出级别 | |||
#应用于控制台 | |||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |||
log4j.appender.stdout.layout.ConversionPattern=[%d][%t][%-5p]- %m%n | |||
log4j.logger.NPQ=TRACE, NPQ | |||
log4j.appender.NPQ=org.apache.log4j.RollingFileAppender | |||
log4j.appender.NPQ.File=./NPQLog/NPQ.log | |||
log4j.appender.NPQ.MaxFileSize=80MB | |||
log4j.appender.NPQ.MaxBackupIndex=12 | |||
log4j.appender.NPQ.Append=false | |||
log4j.appender.NPQ.Threshold=TRACE | |||
log4j.appender.NPQ.layout=org.apache.log4j.PatternLayout | |||
log4j.appender.NPQ.layout.ConversionPattern=[%d][%t][%-5p]- %m%n | |||
log4j.additivity.NPQ = false | |||
#最后一位修改为true 既可以控制台输出又可以文件输出 | |||
@@ -1,3 +0,0 @@ | |||
1.部署海康考勤机时,将此文件夹内所有文件(包括HCNetSDKCom文件夹)复制到exe目录内 | |||
2.务必保证考勤机与exe所在机器网络互通 | |||
3.配置App.config文件下的appSettings节AttendancePhotoPath,存储考勤刷脸图片路径到数字化校园网站Resource\AttendancePhoto目录下 |
@@ -1595,6 +1595,10 @@ Global | |||
{36083FBB-CE7F-4EE0-8459-C4B60A2DD070} = {16DDB25D-3101-47A2-BDC8-161954FD77FA} | |||
{DBB22F9E-ED75-40EB-A091-717D42C65A9B} = {29DFF52B-8455-4EA1-8798-3AEE210D9372} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35 | |||
SolutionGuid = {968C278F-4142-4DFF-96B0-B3D70A649451} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {968C278F-4142-4DFF-96B0-B3D70A649451} | |||
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35 | |||