Files
Web_Faces_Prod/Face.Web/Areas/App/Controllers/WxTestController.cs
2025-11-25 17:41:57 +08:00

1507 lines
73 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using AUTS.Services.Manager;
using Face.Domain.Application.FaceAll;
using Face.Domain.Entities;
using Face.Domain.ViewModels;
using Face.Services.DBUtility.Common;
using Face.Web.Areas.App.Models;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.Mvc;
using WebServer;
using WebSocketToolsConsole;
using static Face.Web.Areas.App.Models.Roominfo;
using static WebSocketToolsConsole.Entity;
namespace Face.Web.Areas.App.Controllers
{
public class WxTestController : Controller
{
// GET: App/WxTest
[HttpPost]
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);
var json = new
{
Status = 200,
Message = "成功"
};
return Json(json, JsonRequestBehavior.AllowGet);
}
[HttpPost]
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);
var json = new
{
Status = 200,
Message = "成功"
};
return Json(json, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public ActionResult GetDeviceInfo(string Serial, string hotelCode)//命令获取设备信息
{
Entity.Rootinfo info = new Entity.Rootinfo();
cmdinfo cinfo = new cmdinfo();
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<Face.Domain.Entities.DeviceManage>().First(x => x.SerialNo == sn);
Domain.Application.FaceAll.ULog uLog = new Domain.Application.FaceAll.ULog
{
Uname = "oy",
faceSN = Serial,
operatetype = "得到设备基本信息",
hotelcode = int.Parse(hotelCode),
roomid = dbt.RoomId,
Creationtime = DateTime.Now
};
SqlSugarBase.Db.Insertable(uLog).ExecuteCommand();
//需要延时处理
//facedevicerxtxinfo shuju = db.Queryable<facedevicerxtxinfo>().First(it => it.sn == Serial && it.data.Contains(msgx.msgid) && it.direction == "Rx");//不是null
//cinfo = JsonConvert.DeserializeObject<cmdinfo>(shuju.data);
var json = new
{
APKVersion = dbt.APKVersion,
Status = 200,
Message = "成功"
};
return Json(json, JsonRequestBehavior.AllowGet);
}
}
[HttpPost]
public ActionResult DeletePeopleFromDeviceByGroup(string Serial, string hotelCode, 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);
var json = new
{
Status = 200,
Message = "成功"
};
return Json(json, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public ActionResult GetThePeopleListOfDevice(string Serial, string hotelCode)//获取人员列表
{
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 = "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<Domain.Application.FaceAll.DeviceManage>().First(x => x.SerialNo == sn);
Domain.Application.FaceAll.ULog uLog = new Domain.Application.FaceAll.ULog
{
Uname = "oy",
faceSN = Serial,
operatetype = "获取人员列表",
hotelcode = int.Parse(hotelCode),
roomid = dbt.RoomId,
Creationtime = DateTime.Now
};
SqlSugarBase.Db.Insertable(uLog).ExecuteCommand();
}
// Errormessageinfo.TimerElapseds();
// cmdinfo cinfo = new cmdinfo();
//; facedevicerxtxinfo shuju = SqlSugarBase.GesmartDb().Queryable<facedevicerxtxinfo>().First(it => it.sn == Serial && it.data.Contains(msgx.msgid) && it.direction == "Rx");//不是null
// cinfo = JsonConvert.DeserializeObject<cmdinfo>(shuju.data);
var json = new
{
puinfo= 1,
Status = 200,
Message = "成功"
};
return Json(json, JsonRequestBehavior.AllowGet);
}
//private static void TimerElapsed()
//{
// Timer timer = new Timer();
// timer.Interval = 120000; // 1000毫秒 = 1秒
// timer.AutoReset = false;
// //启动定时器
// timer.Start();
// //// 停止定时器
// //timer.Stop();
//}
[HttpPost]
/// <summary>
/// pms开房测试
/// </summary>
/// <param name="idNumber">证件号码</param>
/// <param name="name">入住人员姓名</param>
/// <param name="sex">入住人员姓别</param>
/// <param name="picture">入住人员照片路径</param>
/// <param name="phone">入住人员电话号码</param>
/// <param name="hotel">酒店编号</param>
/// <param name="room">房间编号</param>
/// <param name="shi">开房时间长度</param>
/// <returns></returns>
public ActionResult visitinfo(string idNumber, string name,int sex,string picture,string phone, string hotel, string room,string faceSN, int shi=0)//开房测试
{
try
{
List<Result> relist = null;
DateTime date = DateTime.Now.AddSeconds(-3);
var code = int.Parse(hotel);
//查询酒店
var hotellist = SqlSugarBase.authoriydb.Queryable<Hotels>().First(s => s.Id == code);
if (hotellist == null)
{
return Json(false);
}
hotel = hotellist.Code;
GetRoomInterface.test test = new GetRoomInterface.test
{
code = hotellist.Code.ToString(),
creatDate = hotellist.CreateTime.ToString("yyyy-MM-dd")
};
//查询房间
Roominfo.Root asd = GetRoomInterface.Roomport(test);
if (asd == null)
{
return Json(false);
}
if (asd.IsSuccess != true)
{
return Json(false);
}
relist = asd.Result;
//查询房间的第一条数据
var sc = relist.FirstOrDefault(j => j.RoomNumber == room);
if (sc == null)
{
return Json(false);
}
int state = 0;
Domain.Application.FaceAll.CheckinTest user = new Domain.Application.FaceAll.CheckinTest() { testState = state, creationTime = DateTime.Now, predictCheckIn = date, checkInduration = shi, hotelid = hotellist.Id, Roomid = sc.ID };
//插入到数据库Face的表CheckinTest返回主键
var Staty = SqlSugarBase.Db.Insertable(user).ExecuteReturnIdentity();
//Logs.WriteTimingUDPLog("保存开房信息主表成功");
int id = Staty;
Domain.Application.FaceAll.subtabulation su = new Domain.Application.FaceAll.subtabulation() { masterid = id, Lodgerid = 0 };
//插入到数据库Face的表subtabulation返回主键
SqlSugarBase.Db.Insertable(su).ExecuteCommand();
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
{
//查询CheckinTest数据表对应的数据信息
var OutRoom = db.Queryable<Domain.Application.FaceAll.CheckinTest>().First(x => x.id == id);
//添加时间处理
var timeOut = DateTime.Parse(OutRoom.predictCheckIn.ToString()).AddMinutes(Convert.ToDouble(OutRoom.checkInduration.ToString()));
var dqsj = timeOut - DateTime.Now;
if (OutRoom.checkInduration != 0)
{
Thread S = new Thread(new ThreadStart(() =>
{
try
{
var time = (int)dqsj.TotalMilliseconds;
Thread.Sleep(time);
using (var ar = SqlSugarBase.GesmartDb())
{
var Out = ar.Queryable<Domain.Application.FaceAll.CheckinTest>().First(x => x.id == id);
if (OutRoom.checkInduration != 0)//判断是否为永久开房
{
if (FJHelp.outinfos(id.ToString()))
{
//Logs.WriteTimingUDPLog("退房ok");
}
else
{
//Logs.WriteTimingUDPLog("退房no id" + id + ":" + Out);
}
}
}
}
catch (Exception ex)
{
Logs.WriteLog("预退出错" + ex.ToString());
}
}));//到达时间的时候执行事件;
S.Start();
}
//查询下发人员信息
//var select = SqlSugarBase.Db.Queryable<Domain.Application.FaceAll.TestUser>().Where(x => vs.Contains(x.id.ToString())).ToList();
List<WebServer.UserInfo> users = new List<WebServer.UserInfo>();
var nowok = true;
bool isok = false;
if (date <= DateTime.Now)
{
//Logs.WriteTimingUDPLog("立即开房");
WebServer.UserInfo fo = new WebServer.UserInfo()
{
idcard = idNumber,
customer = name,
sex = sex == 1 ? "男" : "女",
photoUrl = "http://face.blv-oa.com/ImgServer/FileImage?url=" + picture,
};
users.Add(fo);
//int uid = int.Parse(vs[i]);
//var sm = SqlSugarBase.Db.Queryable<Domain.Application.FaceAll.TestUser>().First(x => x.id == uid);
isok = WebHelp.Send(new SendInfo { code = hotel, roomNumber = room, idNumber = idNumber, phoneNumber = phone }, users.ToArray());
users.Clear();
//}
int states = 3;
if (isok)
{
states = 1;
}
else
{
nowok = false;
}
SqlSugarBase.Db.Updateable<Domain.Application.FaceAll.CheckinTest>().SetColumns(it => it.testState == states).Where(it => it.id == Staty).ExecuteCommand();
}
else
{
try
{
var dt = date - DateTime.Now;
Thread thread = new Thread(new ThreadStart(() =>
{
try
{
List<WebServer.UserInfo> users1 = new List<WebServer.UserInfo>();
var time = (int)dt.TotalMilliseconds;
Thread.Sleep(time);
WebServer.UserInfo fo = new WebServer.UserInfo()
{
idcard = idNumber,
customer = name,
sex = sex == 1 ? "男" : "女",
photoUrl = "http://face.blv-oa.com/ImgServer/FileImage?url=" + picture,
};
users1.Add(fo);
//int uid = int.Parse(vs[i]);
//var sm = SqlSugarBase.Db.Queryable<Domain.Application.FaceAll.TestUser>().First(x => x.id == uid);
isok = WebHelp.Send(new SendInfo { code = hotel, roomNumber = room, idNumber = idNumber, phoneNumber = phone }, users1.ToArray());
users1.Clear();
int states = 3;
if (isok)
{
states = 1;
}
else
{
nowok = false;
}
SqlSugarBase.Db.Updateable<Domain.Application.FaceAll.CheckinTest>().SetColumns(it => it.testState == states).Where(it => it.id == user.id).ExecuteCommand();
}
catch (Exception ex)
{
AUTS.Services.Manager.Logs.WriteTimingUDPLog("预开出错" + ex.ToString());
}
}));//到达时间的时候执行事件;
thread.Start();
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
}
}
return Json(nowok);
}
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
return Json(false);
}
}
[HttpPost]
public ActionResult CheckOut(string key, data data)
{
int pmsid = -1;
List<string> message = new List<string>();
string messageid = "";
string sn = "";
//酒店编号
string hc = "";
//房间编号
string ridname = "";
ReturnResult result = new ReturnResult();
Hotels hotel = new Hotels();
List<Face.Domain.Entities.pmsLog> logList = new List<Face.Domain.Entities.pmsLog>();
hotel = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == int.Parse(data.HotelCode));
data.HotelCode = hotel.Code;
string da = JsonConvert.SerializeObject(data);
try
{
hc = hotel.Code;
//ridname = ci.roomid;
//密码出错,直接返回。不跟踪。
if (key != "abc")
{
result.Status = 100;
result.Message = "密钥错误";
return Json(result);
}
//hotel = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Code == data.HotelCode);
#region pmsid
//记录入口产生pmsid以备跟踪
Face.Domain.Entities.pmsInterface info = new Face.Domain.Entities.pmsInterface
{
pmstype = 0,
DateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
pmsContent = da,
hotelid = hotel.Id,
};
pmsid = SqlSugarBase.Db.Insertable(info).ExecuteReturnIdentity();
messageid = pmsid.ToString();
Face.Domain.Entities.pmsLog pmslog = new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
step = 201,
Data = da,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
message = "收到pms信息",
HotelCode = hc,
};
SqlSugarBase.Db.Insertable(pmslog).ExecuteCommand();
#endregion
//酒店出错:酒店为空。跟踪记录到 step 9 返回酒店code错误。
if (data.HotelCode == "")
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 290,
Data = "",
message = $"已校验数据,酒店code输入错误",
HotelCode = hc,
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 291,
Data = "",
message = $"无需处理,未找到{data.HotelCode}(code)输入错误",
HotelCode = hc,
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 350;
result.Message = "酒店code错误";
return Json(result);
}
//hotel = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Code == data.HotelCode);
//酒店出错,直接返回。跟踪记录到 step 9 返回无编号酒店错误。
if (hotel == null)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 292,
Data = "",
message = "已校验数据,无酒店",
HotelCode = hc,
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 293,
Data = "",
message = $"无需处理,无编号为{data.HotelCode}酒店",
HotelCode = hc,
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 121;
result.Message = "无酒店";
return Json(result);
}
data.HotelCode = hotel.Id.ToString();
GetRoomInterface.test test = new GetRoomInterface.test
{
code = hotel.Code.ToString(),
creatDate = hotel.CreateTime.ToString("yyyy-MM-dd")
};
Roominfo.Root asd = GetRoomInterface.Roomport(test);
//酒店出错,直接返回。跟踪记录到 step 9 返回酒店输入错误。
if (asd != null && asd.IsSuccess == false)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 290,
Data = "",
message = $"已校验数据,酒店code输入错误",
HotelCode = hc,
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 291,
Data = "",
message = $"无需处理,未找到{data.HotelCode}(code)输入错误",
HotelCode = hc,
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 300;
result.Message = "酒店输入错误";
return Json(result);
}
var Hotelroomid = asd.Result.FirstOrDefault(x => x.RoomNumber == data.roomid);
//房间出错,直接返回。跟踪记录到 step 9 返回无房间错误。
if (Hotelroomid == null)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 296,
Data = "",
message = $"已校验数据,无{data.roomid}此房间",
HotelCode = hc,
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 297,
Data = "",
message = $"无需处理,未找到{data.roomid}此房间",
HotelCode = hc,
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 120;
result.Message = "无房间";
return Json(result);
}
#region
data.roomid = Hotelroomid.ID.ToString();
//查询房间是否关联公区
tbl_room_basic_info tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().First(x => x.IsDel == 0 && x.ROOM_OLD_ID == int.Parse(data.roomid));
//是公区
if (tbl_room_basic_info.isPublicArea == 1)
{
#region
List<string> sdres = SqlOperationsData.getCheck(data.HotelCode, data.roomid);
sn = SqlOperationsData.selectFace(data.HotelCode, data.roomid);
Face.Domain.Entities.DeviceManage deviced = SqlSugarBase.GesmartDb().Queryable<Face.Domain.Entities.DeviceManage>().First(x => x.SerialNo == sn);
string Factorysd = "";
if (deviced != null)
{
if (deviced.Factory == "移海")
{
Factorysd = "yh";
}
else if (deviced.Factory == "实义德")
{
Factorysd = "devs";
}
else if (deviced.Factory == "深圳嘉禾兴")
{
Factorysd = "szjhx";
}
else
{
Factorysd = " ";
}
}
Face.Domain.Entities.pmsInterface pmss = new Face.Domain.Entities.pmsInterface
{
faceSN = sn,
hotelid = int.Parse(data.HotelCode),
room = int.Parse(data.roomid),
messageid = messageid,
pmsId = pmsid,
};
SqlOperationsData.revisepms(pmss);
//住客错误。直接返回。跟踪记录到 step 8 返回无客人错误。
if (sdres.Count == 0)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 298,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = data.roomid
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 299,
Data = "",
message = $"无需处理,房间无客人入住,房号" + data.roomid + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = data.roomid
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 404;
result.Message = "此房间无客人入住,房号" + data.roomid + ",SN:" + sn + ",是否公区:是";
return Json(result);
}
if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
{
Entity.Rootinfo msgx = new Entity.Rootinfo();
Entity.msgx mx = new Entity.msgx();
//mx.msgid = Guid.NewGuid().ToString();
//messageid = mx.msgid;//保存信息id
mx.msgid = messageid;
mx.sn = sn;
mx.cmd = "removePerson";
StringBuilder builder = new StringBuilder();
builder.Append("key=abc");
builder.Append("&id=[]");
builder.Append("&HotelID=" + data.HotelCode);
builder.Append("&RoomID=" + data.roomid);
//协议里面没有的字段是否公区
builder.Append("&isPublicArea=1");
mx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString());
msgx.pmsid = pmsid;
msgx.msgx = mx;
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx);
string Number = sdres[0];
var sdete = SqlSugarBase.Db.Queryable<Face.Domain.Entities.CheckInInfo>().First(x => x.IdNumber == Number).picture;
Face.Domain.Entities.FaceIssue issue = new Face.Domain.Entities.FaceIssue()
{
faceSn = sn,
creationtime = DateTime.Now,
messageid = messageid,
issuestate = 0,
picture = "http://face.blv-oa.com/ImgServer/FileImage?url=" + sdete,
Factory = Factorysd,
APKVersion = deviced.APKVersion
};
SqlSugarBase.Db.Insertable(issue).ExecuteCommand();
message.Add(messageid);
Face.Domain.Entities.pmsLog log = new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 300,
Data = sendMsg,
message = "已校验数据,准备向控制台发送,房号" + data.roomid + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = data.roomid
};
SqlSugarBase.Db.Insertable(log).ExecuteCommand();
#region
/*改成MSMQ消息队列*/
//UdpCommunication.UdpState(sendMsg);
//Thread.Sleep(100);
//DateTime dateTimess = DateTime.Now;
//DateTime dateTime = DateTime.Now;
//TimeSpan ss = dateTime - dateTimess;
//string times = ss.TotalSeconds.ToString();
//float ssd = float.Parse(times);
//if (ssd > 4)
//{
// if (log.message == "已校验数据,准备向控制台发送")
// {
// DateTime nowtime = DateTime.Now.AddDays(-1);
// string infos = "已校验数据,准备向控制台发送";
// var logspms = SqlSugarBase.Db.Queryable<pmsLog>().Where(x => x.step == 2 && x.Creationtime >= nowtime && x.message.Contains(infos)).ToList();
// if (logspms.Count() > 10)
// {
// smsconts = smsconts + 1;
// //Responsesd info = SMSinfo.SMSNotify();
// }
// }
//}
//if (smsconts >= 10)
//{
// Responsesd responsesd = SMSinfo.SMSNotify();
// if (responsesd.SendStatusSet[0].Code == "ok" || responsesd.SendStatusSet[0].Code == "Ok")
// {
// GetProcess();
// smsconts = 0;
// }
//}
#endregion
UdpCommunication.QueueSend(sendMsg);
Errormessageinfo errorinfo = new Errormessageinfo();
errorinfo.Errormessage(pmsid, log.message);
result.Status = 200;
result.Message = "退房成功";
//每次调用都会记录FaceIssue日志
foreach (var item in message)
{
SqlSugarBase.Db.Updateable<Face.Domain.Entities.FaceIssue>().SetColumns(x => x.pmsid == pmsid.ToString()).Where(x => x.messageid == item).ExecuteCommand();
}
//return Json(result);
}//end of if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 301,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = data.roomid
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 302,
Data = "",
message = $"无需处理,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = data.roomid
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 200;
result.Message = "退房成功";
//return Json(result);
} //end of else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
#endregion
}
//不是公区
else
{
//没有关联公区
if (string.IsNullOrEmpty(tbl_room_basic_info.AssociatedPublicArea))
{
#region
List<string> sdre = SqlOperationsData.getCheck(data.HotelCode, data.roomid);
sn = SqlOperationsData.selectFace(data.HotelCode, data.roomid.ToString());
Face.Domain.Entities.DeviceManage deviced = SqlSugarBase.GesmartDb().Queryable<Face.Domain.Entities.DeviceManage>().First(x => x.SerialNo == sn);
string Factorysd = "";
if (deviced != null)
{
if (deviced.Factory == "移海")
{
Factorysd = "yh";
}
else if (deviced.Factory == "实义德")
{
Factorysd = "devs";
}
else if (deviced.Factory == "深圳嘉禾兴")
{
Factorysd = "szjhx";
}
else
{
Factorysd = " ";
}
}
Face.Domain.Entities.pmsInterface pms = new Face.Domain.Entities.pmsInterface
{
faceSN = sn,
hotelid = int.Parse(data.HotelCode),
room = int.Parse(data.roomid),
messageid = messageid,
pmsId = pmsid,
};
SqlOperationsData.revisepms(pms);
//住客错误。直接返回。跟踪记录到 step 8 返回无客人错误。
if (sdre.Count == 0)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 303,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 304,
Data = "",
message = $"无需处理,房间无客人入住,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 404;
result.Message = "此房间无客人入住,房号" + data.roomid + ",SN:" + sn + ",是否公区:否";
return Json(result);
}
if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
{
Entity.Rootinfo msgx = new Entity.Rootinfo();
Entity.msgx mx = new Entity.msgx();
//mx.msgid = Guid.NewGuid().ToString();
//messageid = mx.msgid;//保存信息id
mx.msgid = messageid;
mx.sn = sn;
mx.cmd = "removePerson";
StringBuilder builder = new StringBuilder();
builder.Append("key=abc");
builder.Append("&id=[]");
builder.Append("&HotelID=" + data.HotelCode);
builder.Append("&RoomID=" + data.roomid);
//协议里面没有的字段是否公区
builder.Append("&isPublicArea=0");
mx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString());
msgx.pmsid = pmsid;
msgx.msgx = mx;
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx);
string Number = sdre[0];
var sdete = SqlSugarBase.Db.Queryable<Face.Domain.Entities.CheckInInfo>().First(x => x.IdNumber == Number).picture;
Face.Domain.Entities.FaceIssue issue = new Face.Domain.Entities.FaceIssue()
{
faceSn = sn,
creationtime = DateTime.Now,
messageid = messageid,
issuestate = 0,
picture = "http://face.blv-oa.com/ImgServer/FileImage?url=" + sdete,
Factory = Factorysd,
APKVersion = deviced.APKVersion
};
SqlSugarBase.Db.Insertable(issue).ExecuteCommand();
message.Add(messageid);
Face.Domain.Entities.pmsLog log = new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 305,
Data = sendMsg,
message = "已校验数据,准备向控制台发送,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
};
SqlSugarBase.Db.Insertable(log).ExecuteCommand();
#region
/*改成MSMQ消息队列*/
//UdpCommunication.UdpState(sendMsg);
//Thread.Sleep(100);
//DateTime dateTimess = DateTime.Now;
//DateTime dateTime = DateTime.Now;
//TimeSpan ss = dateTime - dateTimess;
//string times = ss.TotalSeconds.ToString();
//float ssd = float.Parse(times);
//if (ssd > 4)
//{
// if (log.message == "已校验数据,准备向控制台发送")
// {
// DateTime nowtime = DateTime.Now.AddDays(-1);
// string infos = "已校验数据,准备向控制台发送";
// var logspms = SqlSugarBase.Db.Queryable<pmsLog>().Where(x => x.step == 2 && x.Creationtime >= nowtime && x.message.Contains(infos)).ToList();
// if (logspms.Count() > 10)
// {
// smsconts = smsconts + 1;
// //Responsesd info = SMSinfo.SMSNotify();
// }
// }
//}
//if (smsconts >= 10)
//{
// Responsesd responsesd = SMSinfo.SMSNotify();
// if (responsesd.SendStatusSet[0].Code == "ok" || responsesd.SendStatusSet[0].Code == "Ok")
// {
// GetProcess();
// smsconts = 0;
// }
//}
#endregion
UdpCommunication.QueueSend(sendMsg);
Errormessageinfo errorinfo = new Errormessageinfo();
errorinfo.Errormessage(pmsid, log.message);
result.Status = 200;
result.Message = "退房成功";
//每次调用都会记录FaceIssue日志
foreach (var item in message)
{
SqlSugarBase.Db.Updateable<Face.Domain.Entities.FaceIssue>().SetColumns(x => x.pmsid == pmsid.ToString()).Where(x => x.messageid == item).ExecuteCommand();
}
return Json(result);
}//end of if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 306,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 307,
Data = "",
message = $"无需处理,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 200;
result.Message = "退房成功";
return Json(result);
} //end of else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
#endregion
}
//有关联公区
else
{
//删除公区用户人的信息
List<string> ints = new List<string>();
string guanlian = tbl_room_basic_info.AssociatedPublicArea;
string[] arr = guanlian.Split(',');
//ints.Add(da.roomid);
ints.AddRange(arr);
for (int j = 0; j < ints.Count(); j++)
{
#region
List<string> sdres = SqlOperationsData.getCheck(data.HotelCode, ints[j]);
sn = SqlOperationsData.selectFace(data.HotelCode, ints[j].ToString());
Face.Domain.Entities.DeviceManage deviceds = SqlSugarBase.GesmartDb().Queryable<Face.Domain.Entities.DeviceManage>().First(x => x.SerialNo == sn);
tbl_room_basic_info tbbasicinfo = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().First(x => x.IsDel == 0 && x.ROOM_OLD_ID == int.Parse(ints[j]));
string Factorysds = "";
if (deviceds != null)
{
if (deviceds.Factory == "移海")
{
Factorysds = "yh";
}
else if (deviceds.Factory == "实义德")
{
Factorysds = "devs";
}
else if (deviceds.Factory == "深圳嘉禾兴")
{
Factorysds = "szjhx";
}
else
{
Factorysds = " ";
}
}
Face.Domain.Entities.pmsInterface pmss = new Face.Domain.Entities.pmsInterface
{
faceSN = sn,
hotelid = int.Parse(data.HotelCode),
room = int.Parse(ints[j]),
messageid = messageid,
pmsId = pmsid,
};
SqlOperationsData.revisepms(pmss);
//住客错误。直接返回。跟踪记录到 step 8 返回无客人错误。
if (sdres.Count == 0)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 308,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + tbbasicinfo.ROOM_NUMBER + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = tbbasicinfo.ROOM_NUMBER
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 309,
Data = "",
message = $"无需处理,房间无客人入住,房号" + tbbasicinfo.ROOM_NUMBER + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = tbbasicinfo.ROOM_NUMBER
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 404;
result.Message = "此房间无客人入住,房号" + tbbasicinfo.ROOM_NUMBER + ",SN:" + sn + ",是否公区:是";
return Json(result);
}
if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
{
Entity.Rootinfo msgx = new Entity.Rootinfo();
Entity.msgx mx = new Entity.msgx();
//mx.msgid = Guid.NewGuid().ToString();
//messageid = mx.msgid;//保存信息id
mx.msgid = messageid;
mx.sn = sn;
mx.cmd = "removePerson";
StringBuilder builder = new StringBuilder();
builder.Append("key=abc");
builder.Append("&id=[]");
builder.Append("&HotelID=" + data.HotelCode);
builder.Append("&RoomID=" + ints[j]);
builder.Append("&Groupid=1");
//协议里面没有的字段是否公区
builder.Append("&isPublicArea=1");
mx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString());
msgx.pmsid = pmsid;
msgx.msgx = mx;
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx);
string Number = sdres[0];
var sdete = SqlSugarBase.Db.Queryable<Face.Domain.Entities.CheckInInfo>().First(x => x.IdNumber == Number).picture;
Face.Domain.Entities.FaceIssue issue = new Face.Domain.Entities.FaceIssue()
{
faceSn = sn,
creationtime = DateTime.Now,
messageid = messageid,
issuestate = 0,
picture = "http://face.blv-oa.com/ImgServer/FileImage?url=" + sdete,
Factory = Factorysds,
APKVersion = deviceds.APKVersion
};
SqlSugarBase.Db.Insertable(issue).ExecuteCommand();
message.Add(messageid);
Face.Domain.Entities.pmsLog log = new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 310,
Data = sendMsg,
message = "已校验数据,准备向控制台发送,房号" + tbbasicinfo.ROOM_NUMBER + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = tbbasicinfo.ROOM_NUMBER
};
SqlSugarBase.Db.Insertable(log).ExecuteCommand();
#region
/*改成MSMQ消息队列*/
//UdpCommunication.UdpState(sendMsg);
//Thread.Sleep(100);
//DateTime dateTimess = DateTime.Now;
//DateTime dateTime = DateTime.Now;
//TimeSpan ss = dateTime - dateTimess;
//string times = ss.TotalSeconds.ToString();
//float ssd = float.Parse(times);
//if (ssd > 4)
//{
// if (log.message == "已校验数据,准备向控制台发送")
// {
// DateTime nowtime = DateTime.Now.AddDays(-1);
// string infos = "已校验数据,准备向控制台发送";
// var logspms = SqlSugarBase.Db.Queryable<pmsLog>().Where(x => x.step == 2 && x.Creationtime >= nowtime && x.message.Contains(infos)).ToList();
// if (logspms.Count() > 10)
// {
// smsconts = smsconts + 1;
// //Responsesd info = SMSinfo.SMSNotify();
// }
// }
//}
//if (smsconts >= 10)
//{
// Responsesd responsesd = SMSinfo.SMSNotify();
// if (responsesd.SendStatusSet[0].Code == "ok" || responsesd.SendStatusSet[0].Code == "Ok")
// {
// GetProcess();
// smsconts = 0;
// }
//}
#endregion
UdpCommunication.QueueSend(sendMsg);
Errormessageinfo errorinfo = new Errormessageinfo();
errorinfo.Errormessage(pmsid, log.message);
result.Status = 200;
result.Message = "退房成功";
//每次调用都会记录FaceIssue日志
foreach (var item in message)
{
SqlSugarBase.Db.Updateable<Face.Domain.Entities.FaceIssue>().SetColumns(x => x.pmsid == pmsid.ToString()).Where(x => x.messageid == item).ExecuteCommand();
}
//return Json(result);
}//end of if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 311,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + tbbasicinfo.ROOM_NUMBER + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = tbbasicinfo.ROOM_NUMBER
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 312,
Data = "",
message = $"无需处理,此房间无人脸机,房号" + tbbasicinfo.ROOM_NUMBER + ",SN:" + sn + ",是否公区:是",
HotelCode = hc,
roomid = tbbasicinfo.ROOM_NUMBER
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 200;
result.Message = "退房成功";
//return Json(result);
} //end of else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
#endregion
}
#region
//删除房间所有人信息
List<string> sdre = SqlOperationsData.getCheck(data.HotelCode, data.roomid);
sn = SqlOperationsData.selectFace(data.HotelCode, data.roomid.ToString());
Face.Domain.Entities.DeviceManage deviced = SqlSugarBase.GesmartDb().Queryable<Face.Domain.Entities.DeviceManage>().First(x => x.SerialNo == sn);
string Factorysd = "";
if (deviced != null)
{
if (deviced.Factory == "移海")
{
Factorysd = "yh";
}
else if (deviced.Factory == "实义德")
{
Factorysd = "devs";
}
else if (deviced.Factory == "深圳嘉禾兴")
{
Factorysd = "szjhx";
}
else
{
Factorysd = " ";
}
}
Face.Domain.Entities.pmsInterface pms = new Face.Domain.Entities.pmsInterface
{
faceSN = sn,
hotelid = int.Parse(data.HotelCode),
room = int.Parse(data.roomid),
messageid = messageid,
pmsId = pmsid,
};
SqlOperationsData.revisepms(pms);
//住客错误。直接返回。跟踪记录到 step 8 返回无客人错误。
if (sdre.Count == 0)
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 313,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 314,
Data = "",
message = $"无需处理,房间无客人入住,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 404;
result.Message = "此房间无客人入住";
return Json(result);
}
if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
{
Entity.Rootinfo msgx = new Entity.Rootinfo();
Entity.msgx mx = new Entity.msgx();
//mx.msgid = Guid.NewGuid().ToString();
//messageid = mx.msgid;//保存信息id
mx.msgid = messageid;
mx.sn = sn;
mx.cmd = "removeGroup";
StringBuilder builder = new StringBuilder();
builder.Append("key=abc");
//builder.Append("&id=[]");
builder.Append("&Group=1");
//协议里面没有的字段是否公区
builder.Append("&isPublicArea=0");
//builder.Append("&RoomID=" + da.roomid);
mx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString());
msgx.pmsid = pmsid;
msgx.msgx = mx;
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx);
string Number = sdre[0];
var sdete = SqlSugarBase.Db.Queryable<Face.Domain.Entities.CheckInInfo>().First(x => x.IdNumber == Number).picture;
Face.Domain.Entities.FaceIssue issue = new Face.Domain.Entities.FaceIssue()
{
faceSn = sn,
creationtime = DateTime.Now,
messageid = messageid,
issuestate = 0,
picture = "http://face.blv-oa.com/ImgServer/FileImage?url=" + sdete
};
SqlSugarBase.Db.Insertable(issue).ExecuteCommand();
message.Add(messageid);
Face.Domain.Entities.pmsLog log = new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 315,
Data = sendMsg,
message = "已校验数据,准备向控制台发送,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
};
SqlSugarBase.Db.Insertable(log).ExecuteCommand();
#region
/*改成MSMQ消息队列*/
//UdpCommunication.UdpState(sendMsg);
//Thread.Sleep(100);
//DateTime dateTimess = DateTime.Now;
//DateTime dateTime = DateTime.Now;
//TimeSpan ss = dateTime - dateTimess;
//string times = ss.TotalSeconds.ToString();
//float ssd = float.Parse(times);
//if (ssd > 4)
//{
// if (log.message == "已校验数据,准备向控制台发送")
// {
// DateTime nowtime = DateTime.Now.AddDays(-1);
// string infos = "已校验数据,准备向控制台发送";
// var logspms = SqlSugarBase.Db.Queryable<pmsLog>().Where(x => x.step == 2 && x.Creationtime >= nowtime && x.message.Contains(infos)).ToList();
// if (logspms.Count() > 10)
// {
// smsconts = smsconts + 1;
// //Responsesd info = SMSinfo.SMSNotify();
// }
// }
//}
//if (smsconts >= 10)
//{
// Responsesd responsesd = SMSinfo.SMSNotify();
// if (responsesd.SendStatusSet[0].Code == "ok" || responsesd.SendStatusSet[0].Code == "Ok")
// {
// GetProcess();
// smsconts = 0;
// }
//}
#endregion
UdpCommunication.QueueSend(sendMsg);
Errormessageinfo errorinfo = new Errormessageinfo();
errorinfo.Errormessage(pmsid, log.message);
result.Status = 200;
result.Message = "退房成功";
//每次调用都会记录FaceIssue日志
foreach (var item in message)
{
SqlSugarBase.Db.Updateable<Face.Domain.Entities.FaceIssue>().SetColumns(x => x.pmsid == pmsid.ToString()).Where(x => x.messageid == item).ExecuteCommand();
}
return Json(result);
}//end of if (sn != null && sn != "")// 有人脸机退房。跟踪记录到 step 2 返回退房成功。
else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
{
logList.Clear();
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 316,
Data = "",
message = "已校验数据,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
logList.Add(new Face.Domain.Entities.pmsLog
{
pmsid = pmsid,
app = 1,
Creationtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
step = 317,
Data = "",
message = $"无需处理,此房间无人脸机,房号" + data.roomid + ",SN:" + sn + ",是否公区:否",
HotelCode = hc,
roomid = data.roomid
});
SqlSugarBase.Db.Insertable(logList).ExecuteCommand();
result.Status = 200;
result.Message = "退房成功";
return Json(result);
} //end of else // 普通退房,没有人脸机。跟踪记录到 step 8 返回退房成功。
}
#endregion
}
#endregion
}
catch (Exception e)
{
LogHelp.WriteExceptionLog(e);
result.Status = 500;
result.Message = e.Message;
}
return Json(result);
}
}
public class data
{
public string HotelCode { get; set; }
public string roomid { get; set; }
public string checkOutTime { get; set; }
}
public class cmdinfo
{
public string msgid { get; set; }
public string sn { get; set; }
public string cmd { get; set; }
public msgxinfo msg { get; set; }
}
public class msgxinfo
{
/// <summary>
/// 消息ID
/// </summary>
public string status { get; set; }
/// <summary>
/// 消息类型: setPerson/removePerson、open/reboot开门重启
/// </summary>
public string msg { get; set; }
/// <summary>
/// pmsid
/// </summary>
/// <summary>
/// 消息主体Content-Type: application/x-www-formurlencoded
/// </summary>
public msginfo data { get; set; }
}
public class msginfo
{
public string total_number { get; set; }
public string offset { get; set; }
public string person_number { get; set; }
public List<personinfo> person { get; set; }
}
public class personinfo
{
public string id { get; set; }
public string name { get; set; }
public string ID_NO { get; set; }
public string IC_NO { get; set; }
public string HotelID { get; set;}
public string RoomID { get; set; }
}
}