@@ -3,6 +3,8 @@ using System.Data; | |||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | using Learun.Application.TwoDevelopment.EducationalAdministration; | ||||
using System.Web.Mvc; | using System.Web.Mvc; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Configuration; | |||||
using System.Net.Http; | |||||
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | ||||
{ | { | ||||
@@ -94,6 +96,28 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
return Success("删除成功!"); | return Success("删除成功!"); | ||||
} | } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -13,10 +13,12 @@ | |||||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | <a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | ||||
</div> | </div> | ||||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | <div class=" btn-group btn-group-sm" learun-authorize="yes"> | ||||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | <a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | ||||
</div> | </div> | ||||
<a id="lr_print" class="btn btn-default"><i class="fa fa-address-card"></i> 开门</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="lr-layout-body" id="gridtable"></div> | <div class="lr-layout-body" id="gridtable"></div> | ||||
@@ -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 () { | initGird: function () { | ||||
@@ -196,4 +196,6 @@ | |||||
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/> | <add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/> | ||||
<!--CMS地址--> | <!--CMS地址--> | ||||
<add key="Ports" value="192.168.50.127:8007"/> | <add key="Ports" value="192.168.50.127:8007"/> | ||||
<!--海康开门接口--> | |||||
<add key="HkOpenDoor" value="http://localhost:60037/api/YKT/OpenCloseDoor/"/> | |||||
</appSettings> | </appSettings> |