Browse Source

考勤设备开门功能

芮城一职
dao 1 month ago
parent
commit
8875417e88
4 changed files with 43 additions and 2 deletions
  1. +24
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ADR_DeviceController.cs
  2. +4
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ADR_Device/Index.cshtml
  3. +13
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ADR_Device/Index.js
  4. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config

+ 24
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ADR_DeviceController.cs View File

@@ -3,6 +3,8 @@ using System.Data;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Configuration;
using System.Net.Http;

namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
@@ -94,6 +96,28 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
return Success("删除成功!");
}
/// <summary>
/// 开门
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult DoorForm(string keyValue)
{
var url = ConfigurationManager.AppSettings["HkOpenDoor"];
var close=false;
using (var client=new HttpClient())
{
var r=client.GetAsync($"{url}{keyValue}?c={close}").Result;
if(r.IsSuccessStatusCode)
{
var str=r.Content.ReadAsStringAsync().Result;
return Success(str);
}
return Fail("开门失败");
}
}
/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>


+ 4
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ADR_Device/Index.cshtml View File

@@ -13,10 +13,12 @@
<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="yes">
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;新增</a>
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a>
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;新增</a>
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑</a>
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
</div>

<a id="lr_print" class="btn btn-default"><i class="fa fa-address-card"></i>&nbsp;开门</a>
</div>
</div>
<div class="lr-layout-body" id="gridtable"></div>


+ 13
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ADR_Device/Index.js View File

@@ -59,6 +59,19 @@ var bootstrap = function ($, learun) {
});
}
});
//开门
$('#lr_print').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('确认开门吗!', function (res) {
if (res) {
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ADR_Device/DoorForm', { keyValue: keyValue }, function () {

});
}
});
}
});
},
// 初始化列表
initGird: function () {


+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config View File

@@ -196,4 +196,6 @@
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/>
<!--CMS地址-->
<add key="Ports" value="192.168.50.127:8007"/>
<!--海康开门接口-->
<add key="HkOpenDoor" value="http://localhost:60037/api/YKT/OpenCloseDoor/"/>
</appSettings>

Loading…
Cancel
Save