diff --git a/CRICS_V3_1124.suo b/CRICS_V3_1124.suo
index f464c84..f5de050 100644
Binary files a/CRICS_V3_1124.suo and b/CRICS_V3_1124.suo differ
diff --git a/CommonEntity/CommonEntity.csproj b/CommonEntity/CommonEntity.csproj
index c026d6e..96ffe9a 100644
--- a/CommonEntity/CommonEntity.csproj
+++ b/CommonEntity/CommonEntity.csproj
@@ -78,6 +78,7 @@
+
diff --git a/CommonEntity/DataTongJi.cs b/CommonEntity/DataTongJi.cs
index 208e72b..4a828b6 100644
--- a/CommonEntity/DataTongJi.cs
+++ b/CommonEntity/DataTongJi.cs
@@ -238,32 +238,90 @@ namespace CommonEntity
///
public bool IsTakeCard { get; set; }
+ ///
+ /// 是否插卡
+ ///
+ public int IsInsertCard { get; set; }
+
///
///短离长离
///我们这里叫卡事件
///
public ushort CardEvent { get; set; }
- ///
- /// 卡身份
- ///
- public ushort CardID { get; set; }
-
///
/// PMS 状态
///
public string PMS_Status { get; set; }
public int CarbonVIP { get; set; }
- public double V { get; set; }
- public double A { get; set; }
- public double P { get; set; }
- public double Energy_Consumption { get; set; }
- public double Sum_Energy_Consumption { get; set; }
+ public List NengHaoList { get; set; }
+ //public double V { get; set; }
+ //public double A { get; set; }
+ //public double P { get; set; }
+ //public double Energy_Consumption { get; set; }
+ //public double Sum_Energy_Consumption { get; set; }
public long CreateTime { get; set; }
public string ReportTime { get; set; }
public List AllDeviceData { get; set; }
- public int IdentityInfo {get;set;}
+
+ ///
+ /// 卡身份
+ ///
+ public int IdentityInfo { get; set; }
+ }
+
+ ///
+ /// ts 日志
+ ///
+ public class NewVersionLog
+ {
+ public string hotel_id { get; set; }
+ public string room_id { get; set; }
+ public string device_id { get; set; }
+ public string ip { get; set; }
+
+ public ushort power_state { get; set; }
+ public ushort guest_type { get; set; }
+ public ushort cardless_state { get; set; }
+ public ulong service_mask { get; set; }
+ public ushort pms_state { get; set; }
+ public ushort carbon_state { get; set; }
+ public int device_count { get; set; }
+ public ushort comm_seq { get; set; }
+ public List electricity { get; set; }
+ public List air_conditioner { get; set; }
+ public extra_data extra { get; set; }
+
+ }
+ public class NengHaolog
+ {
+ public string address { get; set; }
+ public double voltage { get; set; }
+ public double ampere { get; set; }
+ public double power { get; set; }
+ //public double watt { get; set; }
+ public double energy { get; set; }
+ public double sum_energy { get; set; }
+ public string phase { get; set; }
+ }
+ public class KongTiao
+ {
+ public string address { get; set; }
+ public int state { get; set; }
+ public int model { get; set; }
+ public int speed { get; set; }
+ public int set_temp { get; set; }
+ public int now_temp { get; set; }
+ public int solenoid_valve { get; set; }
+ }
+ public class extra_data
+ {
+ public byte[] original_byte { get; set; }
+ public string source { get; set; }
+ public string ver { get; set; }
+ public object ac { get; set; }
+ public object meter { get; set; }
}
public class Interface3Log
diff --git a/CommonEntity/NengHao_Repeat.cs b/CommonEntity/NengHao_Repeat.cs
new file mode 100644
index 0000000..e5ab293
--- /dev/null
+++ b/CommonEntity/NengHao_Repeat.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace CommonEntity
+{
+ public class NengHao_Repeat
+ {
+ public string address { get; set; }
+ public double dianya { get; set; }
+ public double dianliu { get; set; }
+ public double gonglv { get; set; }
+ public double nenghao { get; set; }
+ public double zongnenghao { get; set; }
+ }
+}
diff --git a/ConsoleApplication2/Program.cs b/ConsoleApplication2/Program.cs
index 3d50bf8..9385689 100644
--- a/ConsoleApplication2/Program.cs
+++ b/ConsoleApplication2/Program.cs
@@ -96,6 +96,12 @@ namespace ConsoleApplication2
static void JieXi()
{
+ NewVersionLog s = new NewVersionLog();
+ var nas= JsonConvert.SerializeObject(s);
+ var data= Encoding.UTF8.GetBytes(nas);
+
+ Encoding.UTF8.GetString(data);
+
string strnn1 = "AA 55 2F 00 54 33 53 41 02 34 80 EB 03 6B 24 34 D0 B8 11 6B 24 01 01 01 39 01 01 00 10 F0 55 E8 03 E8 03 00 00 E8 03 00 00 E8 03 00 00 9E 00";
@@ -249,6 +255,12 @@ namespace ConsoleApplication2
}
static void Main(string[] args)
{
+
+ BitArray bit_a = new BitArray(new byte[] { 0xAA});
+
+ bool bfa= bit_a.Get(0);
+ bool bfaa= bit_a.Get(1);
+
var DDD = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff");
Console.WriteLine(DDD);
var qqqhj = CSRedisCacheHelper.Get_Partition("HostModalStatusReceiver_13_000000001");
diff --git a/RCUHost/Implement/HostServer.cs b/RCUHost/Implement/HostServer.cs
index dafae84..01f7a24 100644
--- a/RCUHost/Implement/HostServer.cs
+++ b/RCUHost/Implement/HostServer.cs
@@ -1314,7 +1314,7 @@ namespace RCUHost.Implement
#region 新版协议
if (cmdType == 0x32 || cmdType == 0x33 || cmdType == 0x34 || cmdType == 0x35 || cmdType == 0x36)
{
- NewXieYi(context111, hotelCode, HostNNN, framenolist, cmdType, EndPoint);
+ NewXieYi(context111, hotelCode, HostNNN, framenolist, cmdType, EndPoint, MyFrameNO);
}
else
{
@@ -1632,8 +1632,10 @@ namespace RCUHost.Implement
}
}
+
+ public static byte[] nocard_enum = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
public static object oo = new object();
- private void NewXieYi(ReceiverContext context_1, string hotelCode_1, string HostNNN_1, byte[] framenolist_1, byte cmdType_1, string EndPoint_1)
+ private void NewXieYi(ReceiverContext context_1, string hotelCode_1, string HostNNN_1, byte[] framenolist_1, byte cmdType_1, string EndPoint_1, ushort MyFrameNO)
{
var Tuple = new Tuple(context_1, hotelCode_1, HostNNN_1, framenolist_1, cmdType_1, EndPoint_1);
Task.Factory.StartNew((state) =>
@@ -1895,14 +1897,81 @@ namespace RCUHost.Implement
using (BinaryReader reader = new BinaryReader(stream))
{
//版本
+ //默认是02
var Version = reader.ReadByte();
//取电
+ //P1:插卡与取电状态设备类型(1Byte)
+ //bit0-bit1
+ //00 当前未取电
+ //01 当前已经取电
+ //bit2-bit3
+ //00 无插卡
+ //01 已经插卡
+
+ //下面的是是否取电
var TakeCardStatus = reader.ReadByte();
+ bool 是否取电 = false;
+ ushort 是否取电_Int = 0;
+ int 是否插卡 = 0;
+ if (Version == 0x02)
+ {
+ BitArray bit_a = new BitArray(new byte[] { TakeCardStatus });
+ bool b0 = bit_a.Get(0);
+ bool b1 = bit_a.Get(1);
+ bool b2 = bit_a.Get(2);
+ bool b3 = bit_a.Get(3);
+ if (b0 == false && b1 == false)
+ {
+ 是否取电 = false;
+ 是否取电_Int = 2;
+ }
+ else if (b0 == true && b1 == false)
+ {
+ 是否取电 = true;
+ 是否取电_Int = 1;
+ }
+
+ if (b2 == false && b3 == false)
+ {
+ 是否插卡 = 2;
+ }
+ else if (b2 == true && b3 == false)
+ {
+ 是否插卡 = 1;
+ }
+ }
+ //如果是01就只有取电
+ //从取电动作那里取数据
+ if (Version == 0x01)
+ {
+ string HostID_redis = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0];
+ if (!string.IsNullOrEmpty(HostID))
+ {
+ string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + "004000001";
+ var OldHostModal = CSRedisCacheHelper.Get_Partition(KKey);
+ if (OldHostModal != null)
+ {
+ var aaa = OldHostModal.Status;
+ if (aaa == 01)
+ {
+ 是否取电 = true;
+ }
+ else if (aaa == 02)
+ {
+ 是否取电 = false;
+ }
+ }
+ }
+ }
+
+
+
//身份
var IdentityInfo = reader.ReadByte();
+ byte[] nocard_enum = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
//无卡逻辑状态(对应事件状态)
//0x01:开门进入事件
//0x02:卡在人离事件
@@ -1914,6 +1983,21 @@ namespace RCUHost.Implement
//0x08:长时间人离事件
var NOCardInfo = reader.ReadByte();
+ if (!nocard_enum.Contains(NOCardInfo))
+ {
+ NOCardInfo = 0x00;
+ }
+ #region BUG处理
+ //只有同派酒店做这个处理
+ if (hotelCode.Equals("2144"))
+ {
+ if (NOCardInfo == 0x03)
+ {
+ 是否插卡 = 2;
+ }
+ }
+ #endregion
+
//服务信息全部回路状态 1~64 64Bit 0 :关 1:开
//把8个字节转换成64个二进制位
var N = reader.ReadBytes(8);
@@ -2010,9 +2094,19 @@ namespace RCUHost.Implement
//碳达人
var CarbonVIP = reader.ReadByte();
+
+ byte[] carbon_enum = new byte[] { 0x01, 0x02 };
+ if (!carbon_enum.Contains(CarbonVIP))
+ {
+ CarbonVIP = 0x00;
+ }
var DeviceCount = reader.ReadByte();
int DeviceCount_I = (int)DeviceCount;
+
+ List nenghaoList = new List();
+ List nenghaoList1 = new List();
+ List kongtiaoList = new List();
for (int i = 0; i < DeviceCount_I; i++)
{
var QA = reader.ReadBytes(4);
@@ -2020,6 +2114,8 @@ namespace RCUHost.Implement
#region 能耗
if (QA[0] == 0x39)
{
+ NengHao_Repeat nr = new NengHao_Repeat();
+ NengHaolog nr1 = new NengHaolog();
string address = new DeviceAddress(QA).ToString();
//设备数据长度
var DeviceInfoLen = reader.ReadByte();
@@ -2055,14 +2151,15 @@ namespace RCUHost.Implement
n.Mac = "";
n.EndPoint = EndPoint;
n.Version = ((int)Version).ToString();
- if (TakeCardStatus == 0x01)
- {
- n.IsTakeCard = true;
- }
- else
- {
- n.IsTakeCard = false;
- }
+ //if (TakeCardStatus == 0x01)
+ //{
+ // n.IsTakeCard = true;
+ //}
+ //else
+ //{
+ // n.IsTakeCard = false;
+ //}
+ n.IsTakeCard = 是否取电;
n.V = Math.Round(V, 2);
n.A = Math.Round(A, 2);
n.P = Math.Round(P, 2);
@@ -2077,33 +2174,21 @@ namespace RCUHost.Implement
//这里不再发送这个了,改发送全部的数据
- NengHao4BaoJing ns2 = new NengHao4BaoJing()
- {
- HotelCode = n.HotelCode,
- HostNumber = n.HostNumber,
- RoomNumber = n.RoomNumber,
- Mac = n.Mac,
- EndPoint = n.EndPoint,
- Version = n.Version,
- IsTakeCard = n.IsTakeCard,
- CarbonVIP = n.CarbonVIP,
- V = dianya,
- A = dianliu,
- P = gonglv,
- Energy_Consumption = nenghao,
- Sum_Energy_Consumption = zongnenghao,
- CreateTime = n.CreateTime,
- ReportTime = n.ReportTime.ToString("yyyy-MM-dd HH:mm:ss"),
- AllDeviceData = DeviceStatusList,
- IdentityInfo = IdentityInfo,
- CardID = IdentityInfo,
- CardEvent = NOCardInfo,
- PMS_Status = PMS_CurrentStatus
- };
-
- string mns = Newtonsoft.Json.JsonConvert.SerializeObject(ns2);
- CSRedisCacheHelper.Publish("redis-power", mns);
+ nr.address = address;
+ nr.dianya = n.V;
+ nr.dianliu = n.A;
+ nr.gonglv = n.P;
+ nr.nenghao = n.KW_H;
+ nr.zongnenghao = n.Sum_KW_H;
+ nenghaoList.Add(nr);
+ nr1.address = address;
+ nr1.voltage = n.V;
+ nr1.ampere = n.A;
+ nr1.power = n.P;
+ nr1.energy = n.KW_H;
+ nr1.sum_energy = n.Sum_KW_H;
+ nenghaoList1.Add(nr1);
string KeyFilter = "能耗";
RCUHost.RCUHostCommon.tools.LanJieData(KeyFilter, hotelCode.ToString());
@@ -2147,6 +2232,16 @@ namespace RCUHost.Implement
int temperature = 0;//设定温度
int currentTemp = 0;//当前温度(室内温度)
KongTiaoReport(StatusReceiver, out status, out temperature, out mode, out fanspeed, out currentTemp);
+
+ KongTiao kkk = new KongTiao();
+ kkk.state = status;
+ kkk.address = address;
+ kkk.model = mode;
+ kkk.speed = fanspeed;
+ kkk.now_temp = currentTemp;
+ kkk.set_temp = temperature;
+ kkk.solenoid_valve = valve;
+ kongtiaoList.Add(kkk);
if (!string.IsNullOrEmpty(HostID))
{
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + address;
@@ -2195,6 +2290,63 @@ namespace RCUHost.Implement
}
#endregion
}
+
+ long tf0 = Tools.GetUnixTime();
+ NengHao4BaoJing ns2 = new NengHao4BaoJing()
+ {
+ HotelCode = long.Parse(hotelCode),
+ HostNumber = HostNNN,
+ RoomNumber = RoomNUMBER,
+ Mac = "",
+ EndPoint = EndPoint,
+ Version = ((int)Version).ToString(),
+ IsTakeCard = 是否取电,
+ IsInsertCard = 是否插卡,
+ CarbonVIP = CarbonVIP,
+ NengHaoList = nenghaoList,
+ //V = dianya,
+ //A = dianliu,
+ //P = gonglv,
+ //Energy_Consumption = nenghao,
+ //Sum_Energy_Consumption = zongnenghao,
+ CreateTime = tf0,
+ ReportTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ AllDeviceData = DeviceStatusList,
+ IdentityInfo = IdentityInfo,
+ //CardID = IdentityInfo,
+ CardEvent = NOCardInfo,
+ PMS_Status = PMS_CurrentStatus
+ };
+
+ string mns = Newtonsoft.Json.JsonConvert.SerializeObject(ns2);
+ CSRedisCacheHelper.Publish("redis-power", mns);
+
+
+ #region TSlog
+ NewVersionLog tslog = new NewVersionLog()
+ {
+ hotel_id = hotelCode,
+ room_id = RoomNUMBER,
+ device_id = HostNNN,
+ ip = EndPoint,
+ power_state = 是否取电_Int,
+ cardless_state = Convert.ToUInt16(NOCardInfo),
+ guest_type = Convert.ToUInt16(IdentityInfo),
+ service_mask = BitConverter.ToUInt64(N, 0),
+ pms_state = Convert.ToUInt16(PMS),
+ carbon_state = Convert.ToUInt16(CarbonVIP),
+ device_count = DeviceCount_I,
+ comm_seq = MyFrameNO,
+ electricity=nenghaoList1,
+ air_conditioner=kongtiaoList,
+ extra = new extra_data()
+ {
+ original_byte = OriginalByte
+ }
+ };
+ string mns111 = Newtonsoft.Json.JsonConvert.SerializeObject(tslog);
+ CSRedisCacheHelper.Publish("redis-tslog", mns111);
+ #endregion
}
}
}
diff --git a/RCUHost/Implement/New_RoomStatusReceiver.cs b/RCUHost/Implement/New_RoomStatusReceiver.cs
index ad5c7b0..9a4368c 100644
--- a/RCUHost/Implement/New_RoomStatusReceiver.cs
+++ b/RCUHost/Implement/New_RoomStatusReceiver.cs
@@ -550,6 +550,13 @@ namespace RCUHost.Implement
{
TCLCommon.SendData(hotelcode, roomnum, TCLcuid, skillid, "SIP");
}
+ if (hotelcode.Equals("1085"))
+ {
+ if (hostModal.Modal.ModalAddress.Equals("004000021"))
+ {
+ TCLCommon.SendData(hotelcode, roomnum, TCLcuid, skillid, "ROMANTIC");
+ }
+ }
}
#endregion
diff --git a/RCUHost/Implement/RoomStatusReceiver.cs b/RCUHost/Implement/RoomStatusReceiver.cs
index e274273..6f53963 100644
--- a/RCUHost/Implement/RoomStatusReceiver.cs
+++ b/RCUHost/Implement/RoomStatusReceiver.cs
@@ -628,7 +628,13 @@ namespace RCUHost.Implement
{
TCLCommon.SendData(hotelcode, roomnum, TCLcuid, skillid, "SIP");
}
-
+ if (hotelcode.Equals("1085"))
+ {
+ if (hostModal.Modal.ModalAddress.Equals("004000023"))
+ {
+ TCLCommon.SendData(hotelcode, roomnum, TCLcuid, skillid, "ROMANTIC");
+ }
+ }
}
#endregion
@@ -2221,7 +2227,7 @@ namespace RCUHost.Implement
var DDD = State as Tuple;
string Res_P = MyHttp.SendHttpData(DDD.Item1, DDD.Item1);
//XuanZhuOperation.ReportService(DDD.Item1, DDD.Item2);
- logger.Error("Fault Return:" + "");
+ //logger.Error("Fault Return:" + "");
}, fault_data);
}
}
diff --git a/WebSite/Controllers/ApiController.cs b/WebSite/Controllers/ApiController.cs
index b0b6e62..3463010 100644
--- a/WebSite/Controllers/ApiController.cs
+++ b/WebSite/Controllers/ApiController.cs
@@ -3819,20 +3819,7 @@ namespace WebSite.Controllers
{
return Json(new { IsSuccess = false, Data = "hostid_lists不能为空" });
}
- int roomTypeID = 0;
- int.TryParse(b, out roomTypeID);
-
- logger.Error("微信端开始升级: " + fileName + " " + roomTypeID + " host_list: " + host_list_str);
- var host_list = Newtonsoft.Json.JsonConvert.DeserializeObject>(host_list_str);
-
- //让服务器获取升级文件
- HostUpdateController.GetUpdateFileByRoomTypeID(roomTypeID);
-
- string lll = JsonConvert.SerializeObject(host_list);
- HostUpdateController hh = new HostUpdateController();
- logger.Error("开始升级: " + fileName + " host_list: " + lll);
- //升级
- hh.ShengJI_NEW(host_list, fileName, HostManager);
+ ReallyUpgrade(b, host_list_str, fileName);
return Json(new { IsSuccess = true, Data = "正在升级,请等待……" });
}
catch (Exception ex)
@@ -3841,6 +3828,52 @@ namespace WebSite.Controllers
}
}
+ [HttpPost()]
+ public ActionResult WebChatUpgradeTimer()
+ {
+ try
+ {
+ string b = Request.Form["roomTypeID"].ToString();
+ if (string.IsNullOrEmpty(b))
+ {
+ return Json(new { IsSuccess = false, Data = "roomTypeID不能为空" });
+ }
+
+ string host_list_str = Request.Form["hostid_lists"].ToString();
+ string fileName = Request.Form["upgradefileName"].ToString();
+
+ if (string.IsNullOrEmpty(host_list_str))
+ {
+ return Json(new { IsSuccess = false, Data = "hostid_lists不能为空" });
+ }
+ ReallyUpgrade(b, host_list_str, fileName);
+ return Json(new { IsSuccess = true, Data = "正在升级,请等待……" });
+ }
+ catch (Exception ex)
+ {
+ return Json(new { IsSuccess = false, Data = ex.Message });
+ }
+ }
+
+
+ private void ReallyUpgrade(string 房型ID, string host_list_str, string fileName)
+ {
+ int roomTypeID = 0;
+ int.TryParse(房型ID, out roomTypeID);
+
+ logger.Error("微信端开始升级: " + fileName + " " + roomTypeID + " host_list: " + host_list_str);
+ var host_list = Newtonsoft.Json.JsonConvert.DeserializeObject>(host_list_str);
+
+ //让服务器获取升级文件
+ HostUpdateController.GetUpdateFileByRoomTypeID(roomTypeID);
+
+ string lll = JsonConvert.SerializeObject(host_list);
+ HostUpdateController hh = new HostUpdateController();
+ logger.Error("开始升级: " + fileName + " host_list: " + lll);
+ //升级
+ hh.ShengJI_NEW(host_list, fileName, HostManager);
+ }
+
[HttpPost()]
public ActionResult QueryUpdateHostProgressBar(string HostIDList)
{