using AUTS.Services.Extensions; using Face.Domain.Application; using Face.Domain.Entities; using Face.Domain.ViewModels; using Face.Services.Cache; using Face.Services.DBUtility.Common; using Face.Services.DBUtility.Custom; using Face.Services.Manager; using Face.Web.Areas.App.Models; using PagedList; using SqlSugar; using System; using System.Collections; using System.Collections.Generic; using System.Data.Entity.Core.Metadata.Edm; using System.Data.Entity.Validation; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Security; using System.Net.Sockets; using System.Net.WebSockets; using System.Reflection; using System.Reflection.Emit; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Web.Hosting; using System.Web.Mvc; using WebSocketToolsConsole; using static Face.Web.Areas.App.Models.Roominfo; using static WebSocketToolsConsole.Entity; namespace Face.Web.Areas.App.Controllers { public class FaceController : BaseController { List li = new List(); public List GetFace//人脸机缓存 { get { return CacheHelp.GetFaceList(); } } public List GetHotel//酒店缓存 { get { return CacheHelp.GetHotelslist(); } } public List GetRoom//房间缓存 { get { return CacheHelp.GetRoomGroup(); } } //*********************************************** // GET: App/Face public ActionResult Facetest(obje data)//人脸机测试 { Session["sn"] = data.faceNo; Session["hotelCode"] = data.hotel; return View(); } public ActionResult TestFaceall(string Sn) { ViewData["SnDing"] = Sn; return View(); } [HttpPost] public ActionResult InquireFaceall(Condition data) { List lit = (List)Session["list"]; List authItem = (List)Session["authItems"]; string strSql = ""; strSql += ("select * "); strSql += (" from devicemanage where 0=0 and ("); for (int i = 0; i < lit.Count; i++) { strSql += (" HotelCode=" + lit[i] + " or"); } strSql = strSql.Substring(0, strSql.Length - 2); if (authItem[0].AuthorityId == 3) { strSql += " or HotelCode=0 or HotelCode is null "; } strSql += ")"; if (data.HotelID == -1) { strSql += " and (HotelCode=0 or HotelCode is null) "; } //酒店id判断 else if (data.HotelID != 0) { strSql += " and HotelCode=" + data.HotelID; } //-1代表全部房间 if (data.Notbing != -1) { strSql += " and bindingStatus=" + data.Notbing; } //-1代表全部 if (data.Status != -1) { strSql += " and Status=" + data.Status; } //人脸机名称 if (data.FaceName != "" && data.FaceName != null) { strSql += " and SerialNo like '%" + data.FaceName + "%' "; } string sqlnumber = strSql; strSql += " ORDER BY `Status` DESC LIMIT " + (data.dataMin) + ",8;"; //分页后 var countNum = new DALHelperCustom("DeviceManage").SqlQueryGetList(strSql.ToString()); //一共多少页 var countNumCount = new DALHelperCustom("DeviceManage").SqlQueryGetList(sqlnumber.ToString()); if (countNumCount != null && countNumCount.Count != 0) { ViewBag.count = countNumCount.Count; ViewBag.allpage = (countNumCount.Count + 8 - 1) / 8; } else { countNum = null; } DateTime dt = Convert.ToDateTime("2000-01-01"); var sd = SqlSugarBase.GesmartDb().Queryable().Where(s => s.checkOutTime == dt).ToList(); ViewData["sungo"] = sd; return PartialView("InquireFaceall", countNum); } public ActionResult unbundle(int? page, string skip = null)//解绑人脸机 { List lit = (List)Session["list"]; List ZongRoominfo = (List)Session["ZongRoominfo"]; List hotellist = new List(); try { using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { hotellist = db.Queryable().ToList(); ViewBag.Orgs = hotellist; var userList = db.Queryable().ToList(); //第几页 int pageNumber = page ?? 1; //每页显示多少条 int pageSize = 8; //根据ID升序排序 userList = userList.OrderByDescending(x => x.Status).ToList(); for (int i = 0; i < lit.Count; i++) { var id = Convert.ToInt32(lit[i]); li.AddRange(userList.Where(x => x.HotelCode == id.ToString()).ToList()); } //绑定状态为true li = li.Where(x => x.bindingStatus == true).ToList(); if (skip != "" && skip != null) { //var ro = from s in Authority.Hotels where s.Name == skip select s.Id; ViewData["ho"] = SqlSugarBase.authoriydb.Queryable().ToList(); ViewData["skip"] = skip; //li = li.Where(x => x.RoomNumber.Contains(skip)).ToList(); } //通过ToPagedList扩展方法进行分页 IPagedList userPagedList = li.ToPagedList(pageNumber, pageSize); //将分页处理后的列表传给View return View(userPagedList); } } catch (Exception ex) { LogHelp.WriteExceptionLog(ex); throw; } } /// /// 解绑房间人脸机操作 /// /// /// public ActionResult unbundleoperate(obje hotelno) { ReturnResult result = new ReturnResult(); try { if (SqlOperationsData.unbundleoperateRoom(hotelno.faceNo) != 0) { FaceBinding binding = new FaceBinding { bindingDate = DateTime.Now, HotelCode = int.Parse(hotelno.hotel), OperatorType = false, RoomId = hotelno.romm, SerialNo = hotelno.faceNo, Operator = Session["username"].ToString() }; if (SqlOperationsData.bindingState(binding) != 0) result.Status = 200; } else { result.Status = 500; } } catch (Exception ex) { LogHelp.WriteExceptionLog(ex, Session["username"].ToString()); result.Status = 100; } return Json(result); } /// /// 解绑酒店人脸机操作 /// /// /// public ActionResult unbundlehotel(obje hotelno) { ReturnResult result = new ReturnResult(); try { if (SqlOperationsData.unbundleoperatehotel(hotelno.faceNo) != 0) { FaceBinding binding = new FaceBinding { bindingDate = DateTime.Now, HotelCode = int.Parse(hotelno.hotel), OperatorType = false, RoomId = hotelno.romm, SerialNo = hotelno.faceNo, Operator = Session["username"].ToString() }; if (SqlOperationsData.bindingState(binding) != 0) result.Status = 200; } else { result.Status = 500; } } catch (Exception ex) { LogHelp.WriteExceptionLog(ex, Session["username"].ToString()); result.Status = 100; } return Json(result); } /// /// 绑定房间 /// /// /// public ActionResult bindingRoom(int? page, string sun = null) { ViewData["hw"] = SqlSugarBase.authoriydb.Queryable().ToList(); List hotellist = new List(); using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { hotellist = db.Queryable().ToList(); ViewBag.Orgs = hotellist; var userList = db.Queryable().ToList(); //第几页 int pageNumber = page ?? 1; //每页显示多少条 int pageSize = 8; //根据ID升序排序 li = li.OrderByDescending(x => x.Status).ToList(); List lit = (List)Session["list"]; List ZongRoominfo = (List)Session["ZongRoominfo"]; for (int i = 0; i < lit.Count; i++) { var id = Convert.ToInt32(lit[i]); li.AddRange(userList.Where(x => x.HotelCode == id.ToString()).ToList()); } //绑定状态为false li = li.Where(x => x.bindingStatus == false).ToList(); if (sun != "" && sun != null) { ViewData["sun"] = sun; li = li.Where(x => x.SerialNo.Contains(sun)).ToList(); } //通过ToPagedList扩展方法进行分页 IPagedList userPagedList = li.ToPagedList(pageNumber, pageSize); //将分页处理后的列表传给View return View(userPagedList); } } public ActionResult BingInfo(obje ob)//绑定房间操作 { ViewData["hh"] = SqlSugarBase.authoriydb.Queryable().ToList(); List hotellist = new List(); Session["SnoNO"] = ob.faceNo; Session["hotelcode"] = ob.hotel; using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { hotellist = db.Queryable().ToList(); ViewBag.Orgs = hotellist; } return View(); } public ActionResult addfaceroom(obje obje)//房间绑定人脸机操作 { ReturnResult result = new ReturnResult(); try { if (SqlOperationsData.reviseRommFace(obje.hotel, obje.romm, obje.faceNo) != 0) { FaceBinding binding = new FaceBinding { bindingDate = DateTime.Now, HotelCode = int.Parse(obje.hotel), OperatorType = true, RoomId = obje.romm, SerialNo = obje.faceNo, Operator = Session["username"].ToString() }; if (SqlOperationsData.bindingState(binding) != 0) { result.Status = 200; result.Message = "为房间添加人脸机成功"; } } else { result.Status = 500; } } catch (Exception ex) { LogHelp.WriteExceptionLog(ex, Session["username"].ToString()); result.Status = 100; } return Json(result); } public ActionResult addfacehotel(obje obje)//酒店绑定人脸机操作 { ReturnResult result = new ReturnResult(); try { if (SqlOperationsData.reviseHotelFace(obje.hotel, obje.faceNo) != 0) { result.Status = 200; result.Message = "为酒店添加人脸机成功"; } else { result.Status = 500; } } catch (Exception ex) { LogHelp.WriteExceptionLog(ex, Session["username"].ToString()); result.Status = 100; } return Json(result); } #region 人脸机操作 public ActionResult IssuedPeople()//下发人员 { return View(); } public ActionResult selectpeople()//查询人员信息 { return View(); } public ActionResult DeletePeople(string name)//根据名字删除人员 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Session["sn"].ToString(); msgx.cmd = "removePerson"; StringBuilder builder = new StringBuilder(); builder.Append("key=abc"); builder.Append("&id=" + name); msgx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString()); info.pmsid = -1; info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); string sn = Session["sn"].ToString(); int dbt = SqlSugarBase.Db.Queryable().First(x => x.SerialNo == sn).RoomId.Value; ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Session["sn"].ToString(), operatetype = "删除操作", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt, Creationtime = DateTime.Now }; //SqlOperationsData.writeLog(uLog); SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult SelectPople(string name)//根据id查询人员信息 { Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Session["sn"].ToString(); msgx.cmd = "getPerson"; StringBuilder builder = new StringBuilder(); builder.Append("key=abc"); builder.Append("&id=" + name); msgx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString()); string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx); UdpCommunication.UdpState2(sendMsg); //var seta = UdpCommunication.UdpStateinfo2(); return Json(true); } /// /// 下发固件 /// /// /// public ActionResult SetAPKSand(string ApkName) { Entity.Rootinfo rootinfo = new Entity.Rootinfo(); Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Session["sn"].ToString(); msgx.cmd = "updateAPK";//操作 StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); sbperson.Append(@"&url=yh/fw/" + ApkName); msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); rootinfo.msgx = msgx; rootinfo.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rootinfo); UdpCommunication.QueueSend(sendMsg); using (var db = SqlSugarBase.GesmartDb()) { string sn = Session["sn"].ToString(); var dbt = db.Queryable().First(x => x.SerialNo == sn); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Session["sn"].ToString(), operatetype = "升级固件", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt.RoomId, Creationtime = DateTime.Now }; SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); } return Json(true); } /// /// 测试下发固件 /// /// /// public ActionResult TestSetAPKSandWithProgress() { Entity.Rootinfo rootinfo = new Entity.Rootinfo(); Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Session["sn"].ToString(); msgx.cmd = "updateAPK";//操作 StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); //sbperson.Append(@"&url=yh/fw/EUPGRADE-v1.9.9-ce7d1577424a3759b1c2302ac565287e.pkg"); //移海2023-10-12版本测试 sbperson.Append(@"&url=yh/fw/EUPGRADE-v1.3.7-d1c0d1b86b7a4ec24d679ae93a41f1db.pkg"); //移海2023-10-12版本测试 msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); rootinfo.msgx = msgx; rootinfo.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rootinfo); UdpCommunication.QueueSend(sendMsg); using (var db = SqlSugarBase.GesmartDb()) { string sn = Session["sn"].ToString(); var dbt = db.Queryable().First(x => x.SerialNo == sn); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Session["sn"].ToString(), operatetype = "升级固件", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt.RoomId, Creationtime = DateTime.Now }; SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); } return Json(new { result = true, msgid = msgx.msgid }); } public ActionResult GetSetAPKSandProgressData(List msgidList) { //In future, will return percentage directly. //Dictionary listdevprog = new Dictionary(); Dictionary> listdevprog = new Dictionary>(); using (var db = SqlSugarBase.GesmartDb()) { List matchedList = db.Queryable() .Where(x => msgidList.Contains(x.msgid) && x.direction == "Rx") .ToList(); foreach (string msgid in msgidList) { List currMsgList = matchedList.Where(x => x.msgid == msgid).ToList(); listdevprog.Add(msgid, currMsgList); //if (currMsgList.Count <= 0) //{ // //listdevprog.Add(msgid, 0); //no record, 0% //} //else //{ // //found the max value as percentage // //need analysis the format //} } } return Json(listdevprog); } /// /// 批量下发固件 /// /// /// public ActionResult BatchSetAPKSand(string ApkName, string RoomidList) { List Roomidlist = RoomidList.Split(',').ToList(); string sql = "SELECT * from devicemanage where "; for (int i = 0; i < Roomidlist.Count; i++) { sql += "RoomId=" + Roomidlist[i] + " or "; } sql = sql.Substring(0, sql.Length - 3); var countNum = new DALHelperCustom("DeviceManage").SqlQueryGetList(sql.ToString()); List arrlist = new List(); try { for (int i = 0; i < countNum.Count; i++) { //Entity.Rootinfo rootinfo = new Entity.Rootinfo(); //Entity.msgx msgx = new Entity.msgx(); //msgx.msgid = Guid.NewGuid().ToString(); //msgx.sn = Session["sn"].ToString(); //msgx.cmd = "updateAPK";//操作 //StringBuilder sbperson = new StringBuilder(); //sbperson.Append("key=abc"); //sbperson.Append(@"&url=yh/fw/" + ApkName); //msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); //rootinfo.msgx = msgx; //rootinfo.pmsid = -1; //string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rootinfo); //UdpCommunication.QueueSend(sendMsg); Entity.Rootinfo rootinfo = new Entity.Rootinfo(); Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); if (!arrlist.Contains(msgx.msgid)) { arrlist.Add(msgx.msgid); } msgx.sn = countNum[i].SerialNo; msgx.cmd = "updateAPK";//操作 StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); sbperson.Append(@"&url=yh/fw/" + ApkName); msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); rootinfo.msgx = msgx; rootinfo.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rootinfo); UdpCommunication.QueueSend(sendMsg); } return Json(new { isok = true, arr = arrlist }); } catch (Exception) { return Json(false); } } /// /// 创建过闸人员 /// /// /// public ActionResult IssuedSandShow(InfoBody ib) { string returninfo = ""; if (string.IsNullOrEmpty(ib.name) | string.IsNullOrEmpty(ib.id_no)) { string info = "不可为空"; return Json(info, JsonRequestBehavior.AllowGet); } else if (string.IsNullOrEmpty(ib.photo)) { string info = "请选择图片,点击上传"; return Json(info, JsonRequestBehavior.AllowGet); } try { StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); sbperson.Append("&id=" + ib.id_no); sbperson.Append("&name=" + ib.name); sbperson.Append("&IC_NO=0001"); sbperson.Append("&ID_NO=" + ib.id_no); sbperson.Append("&photo=<" + ib.photo + ">"); sbperson.Append("&startTs=" + ib.startTs); sbperson.Append("&endTs=-1"); sbperson.Append("&passCount=10000"); sbperson.Append("&visitor=true"); Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Session["sn"].ToString(); msgx.cmd = "setPerson)"; msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx); UdpCommunication.QueueSend(sendMsg); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Session["sn"].ToString(), operatetype = "创建过闸人员操作", hotelcode = int.Parse(Session["hotelCode"].ToString()) }; SqlOperationsData.writeLog(uLog); } catch (CustomException ex) { LogHelp.WriteExceptionLog(ex); } catch (DbEntityValidationException ex) { LogHelp.WriteExceptionLog(ex); } return Json(returninfo, JsonRequestBehavior.AllowGet); } public ActionResult rebootSand(string Serial)//命令人脸机重启 { Entity.Rootinfo info = new Entity.Rootinfo(); Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "reboot";//操作 msgx.msg = "key=abc"; info.msgx = msgx; info.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); using (var db = SqlSugarBase.GesmartDb()) { var dbt = db.Queryable().First(x => x.SerialNo == Serial); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Serial, operatetype = "重启操作", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt.RoomId, Creationtime = DateTime.Now }; //SqlOperationsData.writeLog(uLog); SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); } string s = "重启成功"; return Json(s, JsonRequestBehavior.AllowGet); } public ActionResult GetRebootSandResult(string Serial)//取到命令人脸机重启设备端上报信息。。root重启了。所有没有记录。 { if (!String.IsNullOrWhiteSpace(Serial)) { List matchedPmsLog = SqlSugarBase.Db.Queryable().Where(it => it.pmsid == 0 && it.message.Contains(Serial)).ToList(); if (matchedPmsLog.Count > 0) { return Json(matchedPmsLog[0], JsonRequestBehavior.AllowGet); } } return Json("取人脸机响应失败", JsonRequestBehavior.AllowGet); } public ActionResult openTheDoor(string Serial)//命令人脸机开门 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); sbperson.Append("&id=1123"); sbperson.Append("&name=2323"); sbperson.Append("&IC_NO=0001"); sbperson.Append("&ID_NO=23"); sbperson.Append("&photo=34"); sbperson.Append("&startTs=234"); sbperson.Append("&endTs=-1"); sbperson.Append("&passCount=345"); sbperson.Append("&visitor=true"); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "open";//操作 msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); info.msgx = msgx; info.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); using (var db = SqlSugarBase.GesmartDb()) { string sn = Serial; var dbt = db.Queryable().First(x => x.SerialNo == sn); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Serial, operatetype = "开门操作", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt.RoomId, Creationtime = DateTime.Now }; //SqlOperationsData.writeLog(uLog); SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); } return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult GetOpenTheDoorResult(string Serial)//取到命令人脸机开门设备端回复消息 { List matchedPmsLog = new List(); if (!String.IsNullOrWhiteSpace(Serial)) { matchedPmsLog = SqlSugarBase.Db.Queryable() .Where(it => it.pmsid == 0 && it.message.Contains(Serial) && (it.step == 5 || it.step == 3)) .OrderBy(it => it.Creationtime, OrderByType.Desc) .ToList(); } return PartialView("DeviceResponseResultView", matchedPmsLog); } public ActionResult ActionOpenDoorToDevice(string Serial)//命令人脸机开门 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "open";//操作 msgx.msg = "key=abc"; info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult ActionResetToDevice(string Serial)//命令人脸机重启 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "reboot";//操作 msgx.msg = "key=abc"; info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult UpdateKeepLiveInterval(string Serial, int NewInt) { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "updateKeepAliveInterval";//操作 msgx.msg = "key=abc&interval=" + NewInt; info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult SetOnePeopleToDevice(string Serial, string npeople, bool isNew1Point6 = false) { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "setPerson"; StringBuilder sb = new StringBuilder(); sb.Append("key=abc"); if (npeople == "1") { if (isNew1Point6) sb.Append("&datatype=2"); sb.Append("&id=432156782341123429"); sb.Append("&name=KevinLu"); sb.Append("&IC_NO=0001"); sb.Append("&ID_NO=432156782341123429"); sb.Append("&photo="); //sb.Append("&photo="); } else { if (isNew1Point6) sb.Append("&datatype=2"); sb.Append("&id=123456782341127777"); sb.Append("&name=VellaLiu"); sb.Append("&IC_NO=0002"); sb.Append("&ID_NO=123456782341127777"); sb.Append("&photo="); //sb.Append("&photo="); } if (!isNew1Point6) { sb.Append("&startTs=-1"); sb.Append("&endTs=-1"); sb.Append("&passCount=10000"); } msgx.msg = System.Web.HttpUtility.HtmlDecode(sb.ToString()); info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult GetOnePeopleFromDevice(string Serial, string npeople) { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "getPerson"; StringBuilder sb = new StringBuilder(); sb.Append("key=abc"); if (npeople == "1") { sb.Append("&id=432156782341123429"); } else { sb.Append("&id=123456782341127777"); } msgx.msg = System.Web.HttpUtility.HtmlDecode(sb.ToString()); info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult DeletePeopleFromDevice(string Serial, string npeople, bool isNew1Point6 = false)//根据名字删除人员 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "removePerson"; StringBuilder builder = new StringBuilder(); builder.Append("key=abc"); if (isNew1Point6) { if (npeople == "1") { builder.Append("&id=[432156782341123429]"); } else { builder.Append("&id=[123456782341127777]"); } } else { if (npeople == "1") { builder.Append("&id=432156782341123429"); } else { builder.Append("&id=123456782341127777"); } } msgx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString()); info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult DeletePeopleFromDeviceByGroup(string Serial, string GroupId = "1")//根据名字删除人员 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "removeGroup"; StringBuilder builder = new StringBuilder(); builder.Append("key=abc"); builder.Append("&Group=" + GroupId); msgx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString()); info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult GetThePeopleListOfDevice(string Serial, int TotalNumber)//命令人脸机开门 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); sbperson.Append("&number=" + TotalNumber); sbperson.Append("&offset=0"); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "listPersonByNumber";//获取人员列表 msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); info.msgx = msgx; info.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); using (var db = SqlSugarBase.GesmartDb()) { string sn = Serial; var dbt = db.Queryable().First(x => x.SerialNo == sn); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Serial, operatetype = "获取人员列表", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt.RoomId, Creationtime = DateTime.Now }; SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); } return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult GetDeviceInfo(string Serial)//命令人脸机开门 { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); //sbperson.Append("&number=50"); //sbperson.Append("&offset=0"); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "getDeviceInfo";//得到设备信息 msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); info.msgx = msgx; info.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); using (var db = SqlSugarBase.GesmartDb()) { string sn = Serial; var dbt = db.Queryable().First(x => x.SerialNo == sn); ULog uLog = new ULog { Uname = Session["username"].ToString(), faceSN = Serial, operatetype = "得到设备基本信息", hotelcode = int.Parse(Session["hotelCode"].ToString()), roomid = dbt.RoomId, Creationtime = DateTime.Now }; SqlSugarBase.Db.Insertable(uLog).ExecuteCommand(); } return Json("成功", JsonRequestBehavior.AllowGet); } /// /// 获取websocket服务器 /// /// 人脸机序号 /// public ActionResult GetWebsktServerAddr(string Serial) { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "getWebSocketBaseURL";//得到设备信息 msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); info.msgx = msgx; info.pmsid = -1; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } /// /// 设置websocket服务器 /// /// /// public ActionResult setWebsktServerAddr(string Serial) { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "setWebSocketBaseURL"; StringBuilder sb = new StringBuilder(); sb.Append("key=abc"); sb.Append("&url=ws://47.119.147.104:82"); sb.Append("&auth=ZGV2OjEyMw=="); msgx.msg = System.Web.HttpUtility.HtmlDecode(sb.ToString()); info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } /// /// 设置设备信息 /// /// /// public ActionResult setDeviceInfo(string Serial) { Entity.Rootinfo info = new Entity.Rootinfo(); info.pmsid = -1; Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Serial; msgx.cmd = "setDeviceInfo"; StringBuilder sb = new StringBuilder(); sb.Append("key=abc"); sb.Append("&cameraDetectType=0"); sb.Append("&faceFeaturePairNumber=0.50"); sb.Append("&faceFeaturePairSuccessOrFailWaitTime=2000"); sb.Append("&openDoorType=2"); sb.Append("&openDoorContinueTime=1000"); sb.Append("&doorType=340"); sb.Append("&idCardFaceFeaturePairNumber=0.50"); sb.Append("&appWelcomeMsg=识别成功了吗。"); sb.Append("&deviceSoundSize=100"); sb.Append("&deviceDefendTime=00:00-00:0Boonlive"); sb.Append("&deviceName=Boonlive"); sb.Append("&tipsPairFail=Fail"); sb.Append("&picQualityRate = 0.72000002861022949"); sb.Append("&beginRecoDistance = 0"); sb.Append("&pairSuccessOpenDoor=0"); sb.Append("&fillLightTimes=06:06-07:00"); sb.Append("&lowPowerTimes=00:00-00:0\u0001"); sb.Append("&recognitionSwitch=1"); msgx.msg = System.Web.HttpUtility.HtmlDecode(sb.ToString()); info.msgx = msgx; string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info); UdpCommunication.QueueSend(sendMsg); return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult ClearFaceDeviceResult(string Serial)//命令人脸机开门 { List matchedPmsLog = new List(); if (!String.IsNullOrWhiteSpace(Serial)) { SqlSugarBase.Db.Deleteable().Where(it => it.pmsid == 0 && it.message.Contains(Serial)).ExecuteCommand(); } return Json("成功", JsonRequestBehavior.AllowGet); } public ActionResult selectinfoShow(string name)//查询客户信息 { StringBuilder sbperson = new StringBuilder(); sbperson.Append("key=abc"); sbperson.Append("&id=" + name); Entity.msgx msgx = new Entity.msgx(); msgx.msgid = Guid.NewGuid().ToString(); msgx.sn = Session["sn"].ToString(); msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString()); string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx); UdpCommunication.QueueSend(sendMsg); return View(); } /// /// 实时控制人脸机状态 /// /// public ActionResult Status() { //SqlOperationsData.Monitor(); List facelist = new List(); using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { facelist = db.Queryable().ToList(); } return Json(facelist); } #endregion public ActionResult adminjurisdiction(int? page, string location = null, string Sno = null)//无绑定酒店人脸机 { using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { var userList = db.Queryable().ToList(); //var groups = from p in db.DeviceManage group p by p.faceAddress; ViewData["groups"] = SqlOperationsData.facelocation(); int pageNumber = page ?? 1; //每页显示多少条 int pageSize = 8; //根据ID升序排序 userList = userList.OrderByDescending(x => x.Status).ToList(); userList = userList.Where(x => x.HotelCode == "").ToList(); if (location != null && location != "") { ViewData["location"] = location; userList = userList.Where(x => x.faceAddress == location).ToList(); } if (Sno != null && Sno != "") { ViewData["Snos"] = Sno; userList = userList.Where(x => x.SerialNo.Contains(location)).ToList(); } IPagedList userPagedList = userList.ToPagedList(pageNumber, pageSize); //将分页处理后的列表传给View return View(userPagedList); } } public ActionResult Bing(string StrNo)//绑定酒店操作 { Session["StrNo"] = StrNo; return View(); } public ActionResult officialHotel(int hotelId)//根据酒店id有人脸机的房间下拉框 { List relist = null; Hotels hotel = new Hotels(); hotel = SqlSugarBase.authoriydb.Queryable().First(x => x.Id == hotelId); using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { var dm = db.Queryable().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList(); GetRoomInterface.test te = new GetRoomInterface.test(); if (hotel != null) { te = new GetRoomInterface.test { code = hotel.Code.ToString(), creatDate = hotel.CreateTime.ToString("yyyy-MM-dd") }; } var geiRoomShow = GetRoomInterface.Roomport(te); if (geiRoomShow.IsSuccess == true) { //酒店对应的所有房间 relist = geiRoomShow.Result; //relist = relist./*Where(s => s.RoomStatusID == 16).*/Where(j => dm.IndexOf(j.ID) < 0).ToList(); } string[] arrlist = new string[relist.Count]; for (int i = 0; i < relist.Count; i++) { arrlist[i] = relist[i].HotelID; } var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable().ToList(); var rljfsis = from s in tbl_room_basic_info join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId select new roominfo { Facelid = d.Facelid, SerialNo = d.SerialNo, CreatedDate = d.CreatedDate, HotelCode = d.HotelCode, RoomId = d.RoomId, Factory = d.Factory, Status = d.Status, bindingDate = d.bindingDate, bindingStatus = d.bindingStatus, faceIp = d.faceIp, faceAddress = d.faceAddress, maintainStatus = d.maintainStatus, ROOM_NUMBER = s.ROOM_NUMBER }; return Json(rljfsis); //return Json(rljilistm); } } public ActionResult RoomIdbyRoom(int Roomid, int ApkName) { List relist = null; Hotels hotel = new Hotels(); if (ApkName != 0) { hotel = SqlSugarBase.authoriydb.Queryable().First(x => x.Id == ApkName); } using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { var dm = db.Queryable().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList(); GetRoomInterface.test te = new GetRoomInterface.test(); if (hotel != null) { te = new GetRoomInterface.test { code = hotel.Code.ToString(), creatDate = hotel.CreateTime.ToString("yyyy-MM-dd") }; } var geiRoomShow = GetRoomInterface.Roomport(te); if (geiRoomShow.IsSuccess == true) { relist = geiRoomShow.Result; relist = relist.Where(j => dm.IndexOf(j.ID) >= 0).ToList(); } string[] arrlist = new string[relist.Count]; for (int i = 0; i < relist.Count; i++) { arrlist[i] = relist[i].HotelID; } var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); if (Roomid != 0) { rljilistm = rljilistm.Where(x => x.RoomId == Roomid).ToList(); } var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable().ToList(); //var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); var rljfsis = from s in tbl_room_basic_info join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId select new roominfo { Facelid = d.Facelid, SerialNo = d.SerialNo, CreatedDate = d.CreatedDate, HotelCode = d.HotelCode, RoomId = d.RoomId, Factory = d.Factory, Status = d.Status, bindingDate = d.bindingDate, bindingStatus = d.bindingStatus, faceIp = d.faceIp, faceAddress = d.faceAddress, maintainStatus = d.maintainStatus, ROOM_NUMBER = s.ROOM_NUMBER }; //Dictionary _testDic = new Dictionary(); //roominfo infos = new roominfo(); //for (int i = 0; i < rljilistm.Count; i++) //{ // if (_testDic.Keys[i] == rljilistm[i].RoomId) // { // } //} return Json(rljfsis); //return Json(rljilistm); } } public ActionResult RoomIdbybrandid(int brandid, int ApkName) { string brandname = ""; if (brandid == 2) { brandname = "实义德"; } else { brandname = "移海"; } List relist = null; Hotels hotel = new Hotels(); if (ApkName != 0) { hotel = SqlSugarBase.authoriydb.Queryable().First(x => x.Id == ApkName); } using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { var dm = db.Queryable().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList(); GetRoomInterface.test te = new GetRoomInterface.test(); if (hotel == null) { te = new GetRoomInterface.test { code = hotel.Code.ToString(), creatDate = hotel.CreateTime.ToString("yyyy-MM-dd") }; } var geiRoomShow = GetRoomInterface.Roomport(te); if (geiRoomShow.IsSuccess == true) { relist = geiRoomShow.Result; relist = relist.Where(j => dm.IndexOf(j.ID) >= 0).ToList(); } string[] arrlist = new string[relist.Count]; for (int i = 0; i < relist.Count; i++) { arrlist[i] = relist[i].HotelID; } var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); if (brandid != 0) { rljilistm = rljilistm.Where(x => x.Factory == brandname).ToList(); } var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable().ToList(); //var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); var rljfsis = from s in tbl_room_basic_info join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId select new roominfo { Facelid = d.Facelid, SerialNo = d.SerialNo, CreatedDate = d.CreatedDate, HotelCode = d.HotelCode, RoomId = d.RoomId, Factory = d.Factory, Status = d.Status, bindingDate = d.bindingDate, bindingStatus = d.bindingStatus, faceIp = d.faceIp, faceAddress = d.faceAddress, maintainStatus = d.maintainStatus, ROOM_NUMBER = s.ROOM_NUMBER }; //Dictionary _testDic = new Dictionary(); //roominfo infos = new roominfo(); //for (int i = 0; i < rljilistm.Count; i++) //{ // if (_testDic.Keys[i] == rljilistm[i].RoomId) // { // } //} return Json(rljfsis); //return Json(rljilistm); } } public ActionResult RoomIdbysn(string sn, int ApkName) { List relist = null; Hotels hotel = new Hotels(); if (ApkName != 0) { hotel = SqlSugarBase.authoriydb.Queryable().First(x => x.Id == ApkName); } using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { var dm = db.Queryable().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList(); GetRoomInterface.test te = new GetRoomInterface.test(); if (hotel != null) { te = new GetRoomInterface.test { code = hotel.Code.ToString(), creatDate = hotel.CreateTime.ToString("yyyy-MM-dd") }; } var geiRoomShow = GetRoomInterface.Roomport(te); if (geiRoomShow.IsSuccess == true) { relist = geiRoomShow.Result; relist = relist.Where(j => dm.IndexOf(j.ID) >= 0).ToList(); } string[] arrlist = new string[relist.Count]; for (int i = 0; i < relist.Count; i++) { arrlist[i] = relist[i].HotelID; } var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); if (!string.IsNullOrEmpty(sn)) { rljilistm = rljilistm.Where(x => x.SerialNo.Contains(sn)).ToList(); } var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable().ToList(); //var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); var rljfsis = from s in tbl_room_basic_info join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId select new roominfo { Facelid = d.Facelid, SerialNo = d.SerialNo, CreatedDate = d.CreatedDate, HotelCode = d.HotelCode, RoomId = d.RoomId, Factory = d.Factory, Status = d.Status, bindingDate = d.bindingDate, bindingStatus = d.bindingStatus, faceIp = d.faceIp, faceAddress = d.faceAddress, maintainStatus = d.maintainStatus, ROOM_NUMBER = s.ROOM_NUMBER }; //Dictionary _testDic = new Dictionary(); //roominfo infos = new roominfo(); //for (int i = 0; i < rljilistm.Count; i++) //{ // if (_testDic.Keys[i] == rljilistm[i].RoomId) // { // } //} return Json(rljfsis); //return Json(rljilistm); } } public ActionResult officialHotels(int hotelId)//根据酒店id无人脸机房间下拉框 { List relist = null; Hotels hotel = new Hotels(); hotel = SqlSugarBase.authoriydb.Queryable().First(x => x.Id == hotelId); using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { var dm = db.Queryable().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList(); GetRoomInterface.test te = new GetRoomInterface.test(); if (hotel != null) { te = new GetRoomInterface.test { code = hotel.Code.ToString(), creatDate = hotel.CreateTime.ToString("yyyy-MM-dd") }; } var geiRoomShow = GetRoomInterface.Roomport(te); if (geiRoomShow.IsSuccess == true) { relist = geiRoomShow.Result; //relist = relist.Where(j => dm.IndexOf(j.ID) >= 0).ToList(); } string[] arrlist; if (relist == null) { arrlist = new string[0]; } else { arrlist = new string[relist.Count]; for (int i = 0; i < relist.Count; i++) { arrlist[i] = relist[i].HotelID; } } var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable().ToList(); var rljilistm = db.Queryable().Where(x => arrlist.Contains(x.HotelCode)).ToList(); var rljfsis = from s in tbl_room_basic_info join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId select new roominfo { Facelid =d.Facelid, SerialNo = d.SerialNo, CreatedDate = d.CreatedDate, HotelCode = d.HotelCode, RoomId = d.RoomId, Factory = d.Factory, Status = d.Status, bindingDate = d.bindingDate, bindingStatus = d.bindingStatus, faceIp = d.faceIp, faceAddress = d.faceAddress, maintainStatus = d.maintainStatus, ROOM_NUMBER=s.ROOM_NUMBER }; //Dictionary _testDic = new Dictionary(); //roominfo infos = new roominfo(); //for (int i = 0; i < rljilistm.Count; i++) //{ // if (_testDic.Keys[i] == rljilistm[i].RoomId) // { // } //} return Json(rljfsis); } } //public ActionResult bingHotel(string no)//绑定酒店 //{ // Session["no"] = no; // return View(); //} /// /// 接收类 /// public class obje { public string hotel { get; set; } public int romm { get; set; } public string faceNo { get; set; } } public ActionResult Roomselect(int? page, string hotel = "", string room = "") { ViewData["he"] = SqlSugarBase.authoriydb.Queryable().ToList(); using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { if (hotel != "") { Session["hoteloperation"] = hotel; } if (room != "") { Session["roll"] = room; } var userList = db.Queryable().Where(it => it.HotelCode == hotel).ToList(); userList = userList.Where(s => s.RoomId == null || s.RoomId ==0).ToList(); //第几页 int pageNumber = page ?? 1; //每页显示多少条 int pageSize = 8; //根据ID升序排序 userList = userList.OrderByDescending(x => x.Status).ToList(); //通过ToPagedList扩展方法进行分页 IPagedList userPagedList = userList.ToPagedList(pageNumber, pageSize); //将分页处理后的列表传给View return View(userPagedList); } } public ActionResult bingdingRoomoperate(obje ob) { ReturnResult result = new ReturnResult(); if (SqlOperationsData.reviseRommFace(ob.hotel, ob.romm, ob.faceNo) != 0) { result.Status = 200; result.Message = "添加成功"; } else { result.Status = 100; result.Message = "添加失败"; } return Json(result); } public ActionResult faultmaintain(string id)//故障维修 { using (SqlSugarClient db = SqlSugarBase.GesmartDb()) { int did = int.Parse(id); var dst = db.Updateable().SetColumns(it => it.maintainStatus == 0).Where(it => it.Facelid == did).ExecuteCommand(); return Json(dst); } } public ActionResult updateAkp() { ImgServerController imgServer = new ImgServerController(); ViewData["Akplist"] = imgServer.GetFilesList("FW"); return View(); } public ActionResult updateAkps(int type = 1) { string FTP = ""; if (type == 1) { FTP = "FW"; } else if (type == 2) { FTP = "BkgPng"; } else if (type == 3) { FTP = "Logo"; } ImgServerController imgServer = new ImgServerController(); ViewData["Akplists"] = imgServer.GetFilesList(FTP); return View(); } public ActionResult updateBkgPngLogo(int type = 1) { string FTP = ""; if (type == 1) { FTP = "FW"; } else if (type == 2) { FTP = "BkgPng"; } else if (type == 3) { FTP = "Logo"; } ImgServerController imgServer = new ImgServerController(); ViewData["Akplists"] = imgServer.GetFilesList(FTP); return View(); } public ActionResult updateLogo(int type = 1) { string FTP = ""; if (type == 1) { FTP = "FW"; } else if (type == 2) { FTP = "BkgPng"; } else if (type == 3) { FTP = "Logo"; } ImgServerController imgServer = new ImgServerController(); ViewData["Akplists"] = imgServer.GetFilesList(FTP); return View(); } public ActionResult TestFaceLogsAll() { return View(); } public ActionResult InquireFaceLogAll(Condition data) { string strSql = ""; strSql += ("select * "); strSql += (" from facedevicerxtxinfo where 1=1 "); //人脸机序列号 if (data.FaceName != "" && data.FaceName != null) { strSql += " and sn like '%" + data.FaceName + "%' "; } //时间范围 if ( (data.RoomMinDate != null && data.RoomMinDate.ToString() != "0001/1/1 0:00:00") && (data.RoomMaxDate != null && data.RoomMinDate.ToString() != "0001/1/1 0:00:00") ) { strSql += " and datatime>='" + data.RoomMinDate.ToString("yyyy/MM/dd") + " 00:00:00' and datatime<'" + data.RoomMaxDate.ToString("yyyy/MM/dd") + " 23:59:59'"; } string sqlnumber = strSql; strSql += " ORDER BY `datatime` DESC LIMIT " + (data.dataMin) + ",16;"; //分页后 var countNum = new DALHelperCustom("facedevicerxtxinfo").SqlQueryGetList(strSql.ToString()); //一共多少页 var countNumCount = new DALHelperCustom("facedevicerxtxinfo").SqlQueryGetList(sqlnumber.ToString()); if (countNumCount != null && countNumCount.Count != 0) { ViewBag.count = countNumCount.Count; ViewBag.allpage = (countNumCount.Count + 16 - 1) / 16; } else { countNum = null; } return PartialView("InquireFaceLogAll", countNum); } } public class tbl_room_basic_info { public int ROOM_OLD_ID { get; set; } public string ROOM_NUMBER { get; set; } public int IsDel { get; set; } public int isPublicArea { get; set; } public string AssociatedPublicArea { get; set; } public string HOTEL_OLD_ID { get; set; } } //public class setpassword //{ // public int id { get; set; } // public string sn { get; set; } // public string password { get; set; } // public DateTime creationtime { get; set; } //} public class roominfo: DeviceManage { public string ROOM_NUMBER { get; set; } } }