diff --git a/CRICS_V3_1124.suo b/CRICS_V3_1124.suo index 465329a..b226b7d 100644 Binary files a/CRICS_V3_1124.suo and b/CRICS_V3_1124.suo differ diff --git a/CommonEntity/CacheKey.cs b/CommonEntity/CacheKey.cs index 7bd5d48..d3b2626 100644 --- a/CommonEntity/CacheKey.cs +++ b/CommonEntity/CacheKey.cs @@ -132,6 +132,11 @@ namespace CommonEntity /// 济南同派 特殊处理 /// public static string JiNan_TongPai_Spec = "jntp_spec"; + + /// + /// 微信 锁电量 + /// + public static string DianLiang = "DL"; } public class ChangLiangValue { diff --git a/CommonEntity/DataTongJi.cs b/CommonEntity/DataTongJi.cs index b9c0872..859813b 100644 --- a/CommonEntity/DataTongJi.cs +++ b/CommonEntity/DataTongJi.cs @@ -270,6 +270,11 @@ namespace CommonEntity /// public int IdentityInfo { get; set; } public int Bright_G { get; set; } + + /// + /// 微信锁电量 + /// + public int WeiXinSuo_DianLiang { get; set; } } /// diff --git a/ConsoleApplication666/Program.cs b/ConsoleApplication666/Program.cs index c0927de..fccdc67 100644 --- a/ConsoleApplication666/Program.cs +++ b/ConsoleApplication666/Program.cs @@ -25,6 +25,11 @@ namespace ConsoleApplication666 static void Main(string[] args) { + ushort abb=0x6440; + var gs1= BitConverter.GetBytes(abb); + var f1= gs1[0]; + var f2= gs1[1]; + bool NewResult = true || false; BigInteger hugeNumber = BigInteger.Parse("1234567890123456789012345678901234567890"); var H= hugeNumber.ToByteArray(); diff --git a/RCUHost/Implement/HostServer.cs b/RCUHost/Implement/HostServer.cs index 6d9906d..a085467 100644 --- a/RCUHost/Implement/HostServer.cs +++ b/RCUHost/Implement/HostServer.cs @@ -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 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(context, hotelCode); - //Task.Factory.StartNew((actor_state) => - // { - // var gg = actor_state as Tuple; - // 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(context, hotelCode); - //Task.Factory.StartNew((actor_state) => - // { - // var gg = actor_state as Tuple; - // ProcessData(gg.Item1, gg.Item2); - // }, ts1); } } #endregion @@ -1325,7 +1285,7 @@ namespace RCUHost.Implement //var TTT111= CSRedisCacheHelper.Get_Partition(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(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(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(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(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 /// /// /// - 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(KKey); if (OldHostModal != null) { diff --git a/RCUHost/Implement/New_RoomStatusReceiver.cs b/RCUHost/Implement/New_RoomStatusReceiver.cs index 54ca2c3..6345b9b 100644 --- a/RCUHost/Implement/New_RoomStatusReceiver.cs +++ b/RCUHost/Implement/New_RoomStatusReceiver.cs @@ -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 devices, bool IsTriggerWelcomeMsg, string ContextMessageId, bool ismonitor,string EEndPoint) + private void ProcessModal_NEW_NEW(Host host, ConcurrentDictionary 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") { diff --git a/WebSite/Controllers/IoTController.cs b/WebSite/Controllers/IoTController.cs index a12f134..48d806d 100644 --- a/WebSite/Controllers/IoTController.cs +++ b/WebSite/Controllers/IoTController.cs @@ -7460,7 +7460,7 @@ namespace WebSite.Controllers var name = item.applianceName; var area = item.area; List q1 = new List(); - if (name.Equals("灯")) + if (name.Equals("灯")||name.Equals("所有灯")) { q1 = hostModals.Where(A => A.Modal.Name.Contains("灯")).ToList(); } diff --git a/WebSite/Controllers/RoomStatusController.cs b/WebSite/Controllers/RoomStatusController.cs index b251f38..a1d64c1 100644 --- a/WebSite/Controllers/RoomStatusController.cs +++ b/WebSite/Controllers/RoomStatusController.cs @@ -362,6 +362,22 @@ namespace WebSite.Controllers var roomnum = room.RoomNumber; var roomModel = new RoomModel(); + #region 电量 + + string DLKey = CacheKey.DianLiang + "_" + room.HostNumber; + string dianliang = CSRedisCacheHelper.Get_Partition(DLKey, 5); + if (!string.IsNullOrEmpty(dianliang)) + { + ushort usa = 0; + ushort.TryParse(dianliang, out usa); + roomModel.WeiXinSuo_DianLiang = usa.ToString(); + } + else + { + roomModel.WeiXinSuo_DianLiang = ""; + } + #endregion + #region 碳达人 StringBuilder sb = new StringBuilder(); sb.Append(CacheKey.CarbonVIP_Prefix); diff --git a/WebSite/Models/RoomStatusModels.cs b/WebSite/Models/RoomStatusModels.cs index 242bba5..ca6a87a 100644 --- a/WebSite/Models/RoomStatusModels.cs +++ b/WebSite/Models/RoomStatusModels.cs @@ -114,6 +114,11 @@ namespace WebSite.Models /// public string CarbonVIP { get; set; } + /// + /// 微信锁电量 + /// + public string WeiXinSuo_DianLiang { get; set; } + /// /// 功率 /// diff --git a/WebSite/Scripts/simon-room-status-index.js b/WebSite/Scripts/simon-room-status-index.js index b1872ef..4ceb259 100644 --- a/WebSite/Scripts/simon-room-status-index.js +++ b/WebSite/Scripts/simon-room-status-index.js @@ -231,7 +231,8 @@ function loadRooms(opts, callback) { strHtml += "
" + r.Data[i].FloorRooms[j].RoomNumber; var CarbonVIP_Status = r.Data[i].FloorRooms[j].CarbonVIP; - console.log("VIP:"+CarbonVIP_Status); + var WeiXinSuo_DianLiang = r.Data[i].FloorRooms[j].WeiXinSuo_DianLiang; + console.log("VIP:" + WeiXinSuo_DianLiang); if (CarbonVIP_Status == "open") { strHtml += "" + r.Data[i].FloorRooms[j].RoomNumber + "
"; @@ -261,7 +262,14 @@ function loadRooms(opts, callback) { { //strHtml += "
" + r.Data[i].FloorRooms[j].Power + "
"; strHtml += "
" + r.Data[i].FloorRooms[j].RoomStatus + " " + r.Data[i].FloorRooms[j].Power + "
"; - strHtml += "
" + lang.Identity + ":" + r.Data[i].FloorRooms[j].Identity + " " + r.Data[i].FloorRooms[j].PowerSupplyName + "
"; + if (WeiXinSuo_DianLiang != "") + { + strHtml += "
" + lang.Identity + ":" + r.Data[i].FloorRooms[j].Identity + " " + r.Data[i].FloorRooms[j].PowerSupplyName + " E:" + r.Data[i].FloorRooms[j].WeiXinSuo_DianLiang + "
"; + } + else + { + strHtml += "
" + lang.Identity + ":" + r.Data[i].FloorRooms[j].Identity + " " + r.Data[i].FloorRooms[j].PowerSupplyName + "
"; + } strHtml += "
" + r.Data[i].FloorRooms[j].AirStatusName + " " + strRoomTemp + r.Data[i].FloorRooms[j].RoomTemp + "℃ " + r.Data[i].FloorRooms[j].SettingTemp + "℃" + "
"; strHtml += "
" + r.Data[i].FloorRooms[j].ValveName + " " + airMode(r.Data[i].FloorRooms[j].Mode) + " " + fanSpeed(r.Data[i].FloorRooms[j].FanSpeed) + "
"; if (r.Data[i].FloorRooms[j].Peripheral != "")