修改一些BUG
修改碳达人问题,增加小数,增加门锁的支持
This commit is contained in:
@@ -85,10 +85,10 @@ namespace RCUHost.Implement
|
||||
|
||||
int startIndex = StructConverter.SizeOf(context.SystemHeader);
|
||||
SearchHostPacketReply? reply = DecodeSearchHostPacketReply(context.Data, startIndex);
|
||||
SearchHostPacketReplyV2? reply2 = null;
|
||||
SearchHostPacketReplyV2? C_Xilie_zhuji = null;
|
||||
if (context.Data.Length > 100)//V2版本新补充的内容
|
||||
{
|
||||
reply2 = DecodeSearchHostPacketReplyV2(context.Data, 58);
|
||||
C_Xilie_zhuji = DecodeSearchHostPacketReplyV2(context.Data, 58);
|
||||
}
|
||||
if (reply.HasValue)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ namespace RCUHost.Implement
|
||||
Host exitEntity = null;
|
||||
StringBuilder sbSQL = new StringBuilder();
|
||||
sbSQL.Append("UPDATE tb_Hosts SET ");
|
||||
if (reply2.HasValue)//C系列主机处理:只能靠后台手工添加
|
||||
if (C_Xilie_zhuji.HasValue)//C系列主机处理:只能靠后台手工添加
|
||||
{
|
||||
#region C系列主要
|
||||
if (string.IsNullOrEmpty(context.SystemHeader.Value.HostNumber.ToString()))
|
||||
@@ -140,7 +140,7 @@ namespace RCUHost.Implement
|
||||
MemoryCacheHelper.Set(KKK1, EEE);
|
||||
MemoryCacheHelper.SlideSet(KKK2, EEE);
|
||||
}
|
||||
exitEntity.DNS = string.Join(".", reply2.Value.DNS);
|
||||
exitEntity.DNS = string.Join(".", C_Xilie_zhuji.Value.DNS);
|
||||
sbSQL.Append("DNS='" + exitEntity.DNS + "'");
|
||||
if (!version.ToUpper().StartsWith("C"))
|
||||
{
|
||||
|
||||
@@ -1231,6 +1231,15 @@ namespace RCUHost.Implement
|
||||
}, TS);
|
||||
}
|
||||
|
||||
public static SearchHostPacketReply? DecodeSearchHostPacketReply(byte[] data, int startIndex)
|
||||
{
|
||||
return StructConverter.BytesToStruct(data, startIndex, typeof(SearchHostPacketReply)) as SearchHostPacketReply?;
|
||||
}
|
||||
|
||||
public static SearchHostPacketReplyV2? DecodeSearchHostPacketReplyV2(byte[] data, int startIndex)
|
||||
{
|
||||
return StructConverter.BytesToStruct(data, startIndex, typeof(SearchHostPacketReplyV2)) as SearchHostPacketReplyV2?;
|
||||
}
|
||||
//private static readonly RecyclableMemoryStreamManager manager = new RecyclableMemoryStreamManager();
|
||||
/// <summary>
|
||||
/// 处理数据
|
||||
@@ -1335,6 +1344,45 @@ namespace RCUHost.Implement
|
||||
}
|
||||
#endregion
|
||||
|
||||
///注册指令 也要推送
|
||||
if (cmdType == 0x01)
|
||||
{
|
||||
string RoomNUMBER = CSRedisCacheHelper.HMGet<string>(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0];
|
||||
if (string.IsNullOrEmpty(RoomNUMBER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int startIndex = StructConverter.SizeOf(context111.SystemHeader);
|
||||
SearchHostPacketReply? reply = DecodeSearchHostPacketReply(context111.Data, startIndex);
|
||||
//SearchHostPacketReplyV2? C_Xilie_zhuji = null;
|
||||
//if (context111.Data.Length > 100)//V2版本新补充的内容
|
||||
//{
|
||||
// C_Xilie_zhuji = DecodeSearchHostPacketReplyV2(context111.Data, 58);
|
||||
//}
|
||||
string MAC = "";
|
||||
if (reply.HasValue)
|
||||
{
|
||||
MAC = BitConverter.ToString(reply.Value.MAC);
|
||||
//string version = reply.Value.Version;
|
||||
//var ConfigVersion = String.Join(".", reply.Value.ConfigVersion);
|
||||
//var SubnetMask = String.Join(".", reply.Value.SubnetMask);
|
||||
//var Gateway = String.Join(".", reply.Value.Gateway);
|
||||
}
|
||||
|
||||
LMRegisterInfo lma = new LMRegisterInfo();
|
||||
lma.HotelCode = CODE;
|
||||
lma.RoomNumber = RoomNUMBER;
|
||||
lma.HostNumber = HostNNN;
|
||||
lma.MAC = MAC;
|
||||
lma.Original_Data = context111.Data;
|
||||
|
||||
string ti = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
lma.CurrentDateTime = ti;
|
||||
lma.UnixTime = Tools.GetUnixTime();
|
||||
|
||||
string sss = Newtonsoft.Json.JsonConvert.SerializeObject(lma);
|
||||
CSRedisCacheHelper.Publish("redis-0X01", sss);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2286,7 +2334,7 @@ namespace RCUHost.Implement
|
||||
var CarbonVIP = reader.ReadByte();
|
||||
|
||||
int Bright_Va = -1;
|
||||
if (Version == 0x03)
|
||||
if (Version == 0x03 || Version == 0x04)
|
||||
{
|
||||
var LiangDu = reader.ReadBytes(4);
|
||||
Bright_Va = (int)LiangDu[0];
|
||||
@@ -2298,6 +2346,40 @@ namespace RCUHost.Implement
|
||||
{
|
||||
CarbonVIP = 0x00;
|
||||
}
|
||||
|
||||
///碳达人状态更新
|
||||
if (!string.IsNullOrEmpty(HostID))
|
||||
{
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + "054000001";
|
||||
//var OldHostModal = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
|
||||
//OldHostModal.Status = CarbonVIP;
|
||||
|
||||
//CSRedisCacheHelper.Set_Partition<HostModal_Cache>(KKey,OldHostModal);
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(CacheKey.CarbonVIP_Prefix);
|
||||
sb.Append("_");
|
||||
sb.Append(HostID.ToString());
|
||||
string Key = sb.ToString();
|
||||
|
||||
string current_status_new = "";
|
||||
if (CarbonVIP == 0x01)
|
||||
{
|
||||
current_status_new = "open";
|
||||
}
|
||||
else if (CarbonVIP == 0x02)
|
||||
{
|
||||
current_status_new = "close";
|
||||
}
|
||||
else
|
||||
{
|
||||
current_status_new = "unknow";
|
||||
}
|
||||
|
||||
CSRedisCacheHelper.Set(Key, current_status_new);
|
||||
}
|
||||
|
||||
var DeviceCount = reader.ReadByte();
|
||||
int DeviceCount_I = (int)DeviceCount;
|
||||
|
||||
@@ -2307,7 +2389,11 @@ namespace RCUHost.Implement
|
||||
List<KongTiao> kongtiaoList = new List<KongTiao>();
|
||||
for (int i = 0; i < DeviceCount_I; i++)
|
||||
{
|
||||
var QA = reader.ReadBytes(4);
|
||||
byte[] QA = reader.ReadBytes(4);
|
||||
//if (Version == 0x04)
|
||||
//{
|
||||
// QA = reader.ReadBytes(5);
|
||||
//}
|
||||
//说明是能耗设备
|
||||
#region 能耗
|
||||
if (QA[0] == 0x39)
|
||||
@@ -2413,6 +2499,14 @@ namespace RCUHost.Implement
|
||||
|
||||
///ushort StatusReceiver = reader.ReadUInt16();
|
||||
ushort StatusReceiver = BitConverter.ToUInt16(reader.ReadBytes(2).Reverse().ToArray(), 0);
|
||||
int XiaoShu_BuFen = 0;
|
||||
float xiaoshu_l = 0.0f;
|
||||
if (Version == 0x04)
|
||||
{
|
||||
var XiaoShu = reader.ReadByte();
|
||||
XiaoShu_BuFen = XiaoShu;
|
||||
xiaoshu_l = XiaoShu_BuFen / 10;
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
@@ -2436,7 +2530,7 @@ namespace RCUHost.Implement
|
||||
kkk.address = address;
|
||||
kkk.model = mode;
|
||||
kkk.speed = fanspeed;
|
||||
kkk.now_temp = currentTemp;
|
||||
kkk.now_temp = Convert.ToInt32((currentTemp + xiaoshu_l) * 10);
|
||||
kkk.set_temp = temperature;
|
||||
kkk.solenoid_valve = valve;
|
||||
kongtiaoList.Add(kkk);
|
||||
@@ -2556,8 +2650,9 @@ namespace RCUHost.Implement
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error("定是上报出错:" + ex.Message);
|
||||
logger.Error("定是上报出错:" + ex.StackTrace);
|
||||
logger.Error("定时上报出错:" + Tools.ByteToString(context111.Data));
|
||||
logger.Error("定时上报出错:" + ex.Message);
|
||||
logger.Error("定时上报出错:" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -583,7 +583,6 @@ namespace RCUHost.Implement
|
||||
if (!string.IsNullOrEmpty(ebell_rtsp))
|
||||
{
|
||||
ddd.Add("url",ebell_rtsp);
|
||||
ddd.Add("display_duration",du.ToString());
|
||||
}
|
||||
|
||||
TCLCommon.SendData(hotelcode, roomnum, TCLcuid, skillid, "DOORBELL",0,ddd);
|
||||
|
||||
Reference in New Issue
Block a user