增加微信锁电量功能
This commit is contained in:
@@ -604,31 +604,6 @@ namespace RCUHost.Implement
|
||||
MemoryCacheHelper.Set(ShiJianLanJie, 1, DateTimeOffset.Now.AddSeconds(50));
|
||||
}
|
||||
|
||||
|
||||
if (VVV.CmdType == 0x01)
|
||||
{
|
||||
//后面出问题了,这个功能先不用
|
||||
//升级之后,会上报注册指令,不能被跳过
|
||||
//string Key = "Upgrade_UpdateSQL_" + hostnumber1;
|
||||
//object OOO1 = MemoryCacheHelper.Get(Key);
|
||||
//if (OOO1 == null)
|
||||
//{
|
||||
//string RegisterKey2 = "SearchHostFilter";
|
||||
|
||||
//上报注册指令太快会被拦截
|
||||
//string KKK = "RegisterKey_" + hostnumber1;
|
||||
//object OOO = MemoryCacheHelper.Get(KKK);
|
||||
//if (OOO != null)
|
||||
//{
|
||||
// RCUHost.RCUHostCommon.tools.LanJieData(RegisterKey2, hotelCode);
|
||||
// return;
|
||||
//}
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string LanJieKey = "Intercept";
|
||||
ConcurrentBag<string> RoomNumberList = null;
|
||||
bool isexists = DataTongJi.BlockLowerMachineList.TryGetValue(hotelCode, out RoomNumberList);
|
||||
@@ -652,19 +627,11 @@ namespace RCUHost.Implement
|
||||
//如果不存在就处理
|
||||
else
|
||||
{
|
||||
|
||||
GaiXie g = new GaiXie();
|
||||
g.Data = receiveBuffer111;
|
||||
g.IPEndPoint = remoteEP111.ToString();
|
||||
var data = Newtonsoft.Json.JsonConvert.SerializeObject(g);
|
||||
CSRedisCacheHelper.StreamAdd(1, "All_UDPPackage_Data", data);
|
||||
//ProcessData(context, hotelCode);
|
||||
//var ts1 = new Tuple<ReceiverContext, string>(context, hotelCode);
|
||||
//Task.Factory.StartNew((actor_state) =>
|
||||
// {
|
||||
// var gg = actor_state as Tuple<ReceiverContext, string>;
|
||||
// ProcessData(gg.Item1, gg.Item2);
|
||||
// }, ts1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -681,19 +648,12 @@ namespace RCUHost.Implement
|
||||
}
|
||||
else
|
||||
{
|
||||
//ProcessData(context, hotelCode);
|
||||
|
||||
GaiXie g = new GaiXie();
|
||||
g.Data = receiveBuffer111;
|
||||
g.IPEndPoint = remoteEP111.ToString();
|
||||
var data = Newtonsoft.Json.JsonConvert.SerializeObject(g);
|
||||
CSRedisCacheHelper.StreamAdd(1, "All_UDPPackage_Data", data);
|
||||
var ts1 = new Tuple<ReceiverContext, string>(context, hotelCode);
|
||||
//Task.Factory.StartNew((actor_state) =>
|
||||
// {
|
||||
// var gg = actor_state as Tuple<ReceiverContext, string>;
|
||||
// ProcessData(gg.Item1, gg.Item2);
|
||||
// }, ts1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -1325,7 +1285,7 @@ namespace RCUHost.Implement
|
||||
//var TTT111= CSRedisCacheHelper.Get_Partition<string>(HostNNN,7);
|
||||
//if ((string.IsNullOrEmpty(EEE) && ssspan.TotalMinutes > 5)||string.IsNullOrEmpty(TTT111))
|
||||
//if ((string.IsNullOrEmpty(EEE) && ssspan.TotalMinutes > 5))
|
||||
if (string.IsNullOrEmpty(EEE))
|
||||
if (string.IsNullOrEmpty(EEE))
|
||||
{
|
||||
CSRedisCacheHelper.Publish("redis-on_off_line", n);
|
||||
//CSRedisCacheHelper.Set_PartitionWithForever(HostNNN,"1",7);
|
||||
@@ -1376,41 +1336,41 @@ namespace RCUHost.Implement
|
||||
///注册指令 也要推送
|
||||
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版本新补充的内容
|
||||
//string RoomNUMBER = CSRedisCacheHelper.HMGet<string>(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0];
|
||||
//if (string.IsNullOrEmpty(RoomNUMBER))
|
||||
//{
|
||||
// C_Xilie_zhuji = DecodeSearchHostPacketReplyV2(context111.Data, 58);
|
||||
// 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);
|
||||
//}
|
||||
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;
|
||||
//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 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);
|
||||
//string sss = Newtonsoft.Json.JsonConvert.SerializeObject(lma);
|
||||
//CSRedisCacheHelper.Publish("redis-0X01", sss);
|
||||
}
|
||||
|
||||
try
|
||||
@@ -2389,8 +2349,8 @@ namespace RCUHost.Implement
|
||||
///碳达人状态更新
|
||||
if (!string.IsNullOrEmpty(HostID))
|
||||
{
|
||||
CarbonVIPReport(HostID, CarbonVIP,"054001000");
|
||||
CarbonVIPReport(HostID, CarbonVIP,"054000001");
|
||||
CarbonVIPReport(HostID, CarbonVIP, "054001000");
|
||||
CarbonVIPReport(HostID, CarbonVIP, "054000001");
|
||||
}
|
||||
|
||||
var DeviceCount = reader.ReadByte();
|
||||
@@ -2541,7 +2501,7 @@ namespace RCUHost.Implement
|
||||
{
|
||||
if (fanspeed == 2 || fanspeed == 3)
|
||||
{
|
||||
string KKKSpec = HostNNN + "_" + address+"_"+HostID;
|
||||
string KKKSpec = HostNNN + "_" + address + "_" + HostID;
|
||||
if (status == 1)
|
||||
{
|
||||
string ReportTime111 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -2573,7 +2533,7 @@ namespace RCUHost.Implement
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + address;
|
||||
var HHostModalData = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
|
||||
|
||||
if (HHostModalData==null)
|
||||
if (HHostModalData == null)
|
||||
{
|
||||
HHostModalData = new HostModal_Cache();
|
||||
HHostModalData.HostID = int.Parse(HostID);
|
||||
@@ -2582,7 +2542,7 @@ namespace RCUHost.Implement
|
||||
HHostModalData.Modal = new RoomTypeModalCache()
|
||||
{
|
||||
ModalAddress = address
|
||||
};
|
||||
};
|
||||
}
|
||||
if (HHostModalData != null)
|
||||
{
|
||||
@@ -2627,6 +2587,17 @@ namespace RCUHost.Implement
|
||||
}
|
||||
|
||||
#region 给宝镜推送的数据
|
||||
short usa = 0;
|
||||
string DLKey = CacheKey.DianLiang + "_" + HostNNN;
|
||||
string dianliang = CSRedisCacheHelper.Get_Partition<string>(DLKey, 5);
|
||||
if (!string.IsNullOrEmpty(dianliang))
|
||||
{
|
||||
short.TryParse(dianliang, out usa);
|
||||
}
|
||||
else
|
||||
{
|
||||
usa = -1;
|
||||
}
|
||||
long tf0 = Tools.GetUnixTime();
|
||||
NengHao4BaoJing ns2 = new NengHao4BaoJing()
|
||||
{
|
||||
@@ -2652,7 +2623,8 @@ namespace RCUHost.Implement
|
||||
//CardID = IdentityInfo,
|
||||
CardEvent = NOCardInfo,
|
||||
PMS_Status = PMS_CurrentStatus,
|
||||
Bright_G = Bright_Va
|
||||
Bright_G = Bright_Va,
|
||||
WeiXinSuo_DianLiang=usa
|
||||
};
|
||||
|
||||
string mns = Newtonsoft.Json.JsonConvert.SerializeObject(ns2);
|
||||
@@ -2743,9 +2715,9 @@ namespace RCUHost.Implement
|
||||
/// <param name="HostID"></param>
|
||||
/// <param name="CarbonVIP"></param>
|
||||
/// <param name="Address"></param>
|
||||
private static void CarbonVIPReport(string HostID, byte CarbonVIP,string Address)
|
||||
private static void CarbonVIPReport(string HostID, byte CarbonVIP, string Address)
|
||||
{
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" +Address;
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + Address;
|
||||
var OldHostModal = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
|
||||
if (OldHostModal != null)
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace RCUHost.Implement
|
||||
if (status.Devices != null && status.Devices.Count > 0)
|
||||
{
|
||||
//来一个数据,把所有的地址拼接起来
|
||||
ProcessModal_NEW_NEW(host, status.Devices, isTriggerWelcomeMsg, context.MessageID, context.IsMonitor,context.RemoteEndPoint.ToString());//更新灯光及其他回路状态
|
||||
ProcessModal_NEW_NEW(host, status.Devices, isTriggerWelcomeMsg, context.MessageID, context.IsMonitor, context.RemoteEndPoint.ToString());//更新灯光及其他回路状态
|
||||
}
|
||||
|
||||
if (status.Faults != null && status.Faults.Count > 0)
|
||||
@@ -183,7 +183,7 @@ namespace RCUHost.Implement
|
||||
public static string Missionsys_Address = ConfigurationManager.AppSettings["missionsys_address"];
|
||||
public static string MQTTInfo_report_url = ConfigurationManager.AppSettings["debug_log_report_url"].ToString();
|
||||
|
||||
private void ProcessModal_NEW_NEW(Host host, ConcurrentDictionary<string, Device> devices, bool IsTriggerWelcomeMsg, string ContextMessageId, bool ismonitor,string EEndPoint)
|
||||
private void ProcessModal_NEW_NEW(Host host, ConcurrentDictionary<string, Device> devices, bool IsTriggerWelcomeMsg, string ContextMessageId, bool ismonitor, string EEndPoint)
|
||||
{
|
||||
string UUID = "9dc6a0ee-dcf1-4385-b05f-09cb463838cd";
|
||||
UUID = host.FCS_locationUUID;
|
||||
@@ -1146,27 +1146,49 @@ namespace RCUHost.Implement
|
||||
//MemoryModal.Mode = mode;
|
||||
break;
|
||||
case DeviceType.WXLock://微信锁
|
||||
status = device.Value.StatusReceiver & 0x00FF;
|
||||
if (status == 1)//设备开
|
||||
//status = device.Value.StatusReceiver & 0x00FF;
|
||||
status = device.Value.StatusReceiver;
|
||||
var gs1 = BitConverter.GetBytes(status);
|
||||
var f1 = gs1[0];
|
||||
var f2 = gs1[1];
|
||||
if (f1 == 1)//设备开
|
||||
{
|
||||
if (hostModal.Status != 1)//设备有变化时才去更改状态
|
||||
{
|
||||
hostModal.Status = 1;
|
||||
//sbSQL.Append("Status=1,");
|
||||
|
||||
//MemoryModal.Status = 1;
|
||||
}
|
||||
}
|
||||
else//设备关
|
||||
else if (f1 == 2)//设备关
|
||||
{
|
||||
if (hostModal.Status != 2)//设备有变化时才去更改状态
|
||||
{
|
||||
hostModal.Status = 2;
|
||||
//sbSQL.Append("Status=2,");
|
||||
|
||||
//MemoryModal.Status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//2026-03-29 阿文说 电量上报动作和 开关动作分两包数据上报
|
||||
else if (f1 == 0x40)
|
||||
{
|
||||
//杨格锁:
|
||||
//P4:
|
||||
//Bit7:
|
||||
//门锁动作上报
|
||||
//Bit6:
|
||||
//门锁电量上报
|
||||
//P5:
|
||||
//门锁动作上报:
|
||||
//0xE1:防撬报警
|
||||
//0xE2:假锁
|
||||
//0xE3:反锁
|
||||
//0xE4:门磁
|
||||
//0xE5:钥匙开锁
|
||||
//0xE6:门锁常开
|
||||
//门锁电量报警:
|
||||
//电量:0-100
|
||||
ushort dianliang = (ushort)f2;
|
||||
string DLKey = CacheKey.DianLiang + "_" + HOSTNUMBER;
|
||||
CSRedisCacheHelper.Set_PartitionWithForever(DLKey,dianliang.ToString(),5);
|
||||
}
|
||||
//更新主机主表
|
||||
if (hostModal.Modal.Sort == 1)//.ModalAddress == "020001000")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user