diff --git a/.gitignore b/.gitignore index 58e2e5f..66e6574 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ MvcApplication1 ConsoleApplication4 RCUHost内存泄漏分析报告.md CRICS_V3_1124.suo +ConsoleApplication5 diff --git a/CRICS_V3_1124.sln b/CRICS_V3_1124.sln index 79b4e51..b3ea1ff 100644 --- a/CRICS_V3_1124.sln +++ b/CRICS_V3_1124.sln @@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcApplication1", "MvcAppli EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication4", "ConsoleApplication4\ConsoleApplication4.csproj", "{85BC55B1-083D-4AE9-8DE8-3DE59B654990}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication5", "ConsoleApplication5\ConsoleApplication5.csproj", "{346B2008-1D95-4604-84A8-247D33FB8DED}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -203,6 +205,16 @@ Global {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|Mixed Platforms.Build.0 = Release|x86 {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|x86.ActiveCfg = Release|x86 {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|x86.Build.0 = Release|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Debug|Any CPU.ActiveCfg = Debug|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Debug|x86.ActiveCfg = Debug|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Debug|x86.Build.0 = Debug|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Release|Any CPU.ActiveCfg = Release|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Release|Mixed Platforms.Build.0 = Release|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Release|x86.ActiveCfg = Release|x86 + {346B2008-1D95-4604-84A8-247D33FB8DED}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CommonEntity/CommonEntity.csproj b/CommonEntity/CommonEntity.csproj index 9ac461d..1cdfe3b 100644 --- a/CommonEntity/CommonEntity.csproj +++ b/CommonEntity/CommonEntity.csproj @@ -84,6 +84,7 @@ + diff --git a/CommonEntity/HostMappingData.cs b/CommonEntity/HostMappingData.cs index 399e442..78a7dbb 100644 --- a/CommonEntity/HostMappingData.cs +++ b/CommonEntity/HostMappingData.cs @@ -9,6 +9,7 @@ namespace CommonEntity { public int Id { get; set; } public string HostNumber { get; set; } + public int RoomTypeId { get; set; } } public class HostRoomNumberMapping { diff --git a/CommonEntity/QuanJuVar.cs b/CommonEntity/QuanJuVar.cs new file mode 100644 index 0000000..1bdad24 --- /dev/null +++ b/CommonEntity/QuanJuVar.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Domain; + +namespace CommonEntity +{ + public class QuanJuVar + { + public static IList BaoJingUpLoad = new List(); + } +} diff --git a/Dao/Implement/HostRepository.cs b/Dao/Implement/HostRepository.cs index 7e213bf..8e43e20 100644 --- a/Dao/Implement/HostRepository.cs +++ b/Dao/Implement/HostRepository.cs @@ -788,7 +788,7 @@ namespace Dao.Implement /// public IList LoadAllID_HostNumberMapping() { - return base.LoadAll().Where(A => A.SysHotel.IsNewVersionProtocol == true && A.IsDeleted == false).Select(A => new HostMappingData() { Id = A.ID, HostNumber = A.HostNumber }).ToList(); + return base.LoadAll().Where(A => A.SysHotel.IsNewVersionProtocol == true && A.IsDeleted == false).Select(A => new HostMappingData() { Id = A.ID, HostNumber = A.HostNumber,RoomTypeId=A.RoomType.ID }).ToList(); } diff --git a/RCUHost/Implement/HostSearchReceiver.cs b/RCUHost/Implement/HostSearchReceiver.cs index 4fe787d..db5caa1 100644 --- a/RCUHost/Implement/HostSearchReceiver.cs +++ b/RCUHost/Implement/HostSearchReceiver.cs @@ -299,20 +299,6 @@ namespace RCUHost.Implement } else { - - //string KKK = "RegisterKey_" + hhostnumber; - //object OOO = MemoryCacheHelper.Get(KKK); - //if (OOO != null) - //{ - // RCUHost.RCUHostCommon.tools.LanJieData(RegisterKey2, hotelCode); - //} - //else - //{ - // string ti = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - // MemoryCacheHelper.Set(KKK, ti, DateTimeOffset.Now.AddMinutes(5)); - // HostRepository.Update(sbSQL.ToString());//更新主机,用sql语句更新更高效 - // RCUHost.RCUHostCommon.tools.LanJieData(RegisterKey1, hotelCode); - //} HostRepository.Update(sbSQL.ToString());//更新主机,用sql语句更新更高效 //有升级的时候,不能被跳过 @@ -363,7 +349,7 @@ namespace RCUHost.Implement string YiJingChuLiGuo = CacheKey.AllReadyDealWith01_Prefix + "_" + hostNumber; - MemoryCacheHelper.Set(YiJingChuLiGuo, A1, DateTimeOffset.Now.AddMinutes(5)); + MemoryCacheHelper.Set(YiJingChuLiGuo, A1, DateTimeOffset.Now.AddSeconds(10)); StepTongJi.SendInfo(5, "注册命令Task内部执行完毕", context.MessageID, context.IsMonitor); } catch (Exception ex) diff --git a/RCUHost/Implement/HostServer.cs b/RCUHost/Implement/HostServer.cs index c253a42..f973b69 100644 --- a/RCUHost/Implement/HostServer.cs +++ b/RCUHost/Implement/HostServer.cs @@ -118,6 +118,19 @@ namespace RCUHost.Implement } public static string UDPAllDataKey = "All_UDPPackage_Data"; + + private void EnsureConsumerGroup(string group) + { + try + { + // 检查或创建消费者组 + var groups = CSRedisCacheHelper.redis1.XInfoGroups(UDPAllDataKey); + } + catch (Exception ex) + { + logger.Warn("创建消费者组失败:" + ex.Message); + } + } public void StreamConsume(string group = "UDPData", string consumer = "Crics1", string task_key = "task1") { try @@ -133,7 +146,7 @@ namespace RCUHost.Implement { var idarray = item.Item2; string nsa = string.Concat(task_key, "#", idarray.Count().ToString()); - CSRedisCacheHelper.Publish("udp_package_consumer", nsa); + //CSRedisCacheHelper.Publish("udp_package_consumer", nsa); foreach (var SerializeNo in idarray) { var id1 = SerializeNo.Item1; @@ -141,7 +154,6 @@ namespace RCUHost.Implement redis.XAck(UDPAllDataKey, group, id1); redis.XDel(UDPAllDataKey, id1); - //var GGG = JsonConvert.DeserializeObject(str); ProcessData(str); } } @@ -155,16 +167,19 @@ namespace RCUHost.Implement // 静态CancellationTokenSource和CancellationToken public static CancellationTokenSource source = new CancellationTokenSource(); public static CancellationToken token = source.Token; - // 存储长时间运行的Task - private static List _consumerTasks = new List(); /// /// 启动 HostServer /// public void Start() { + source.Cancel(); + Thread.Sleep(5000); CSRedisCacheHelper.redis1.Del(UDPAllDataKey); CSRedisCacheHelper.redis1.XGroupCreate(UDPAllDataKey, "UDPData", "0", true); + source = new CancellationTokenSource(); + token = source.Token; + var DDD = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"); CSRedisCacheHelper.Forever(CacheKey.ServerStartTime, DDD); @@ -184,14 +199,14 @@ namespace RCUHost.Implement // 创建15个消费者Task for (int i = 1; i <= 15; i++) { - var task = Task.Factory.StartNew((state) => + Task.Factory.StartNew((state) => { string osos = state.ToString(); - while (true) + while (source.IsCancellationRequested == false) { StreamConsume("UDPData", "Crics" + osos, "task" + osos); } - }, i, TaskCreationOptions.LongRunning); + }, i, token); } } catch (Exception ex) @@ -202,32 +217,6 @@ namespace RCUHost.Implement } } - /// - /// 停止消费者Task - /// - public static void StopConsumerTasks() - { - if (source != null) - { - try - { - // 取消所有Task - source.Cancel(); - // 等待Task完成 - //Task.WaitAll(_consumerTasks.ToArray(), TimeSpan.FromSeconds(1)); - } - catch (Exception ex) - { - logger.Error("停止消费者Task错误:" + ex.Message); - } - finally - { - source.Dispose(); - _consumerTasks.Clear(); - } - } - } - /// /// 关闭 HostServer /// @@ -667,7 +656,10 @@ namespace RCUHost.Implement string s1 = Tools.ByteToString(receiveBuffer111); string data = s1 + "#" + remoteEP111.ToString(); - CSRedisCacheHelper.StreamAdd(1, "All_UDPPackage_Data", data); + + + //ProcessData(data); + CSRedisCacheHelper.StreamAdd(1, UDPAllDataKey, data); } } else @@ -691,7 +683,9 @@ namespace RCUHost.Implement string s1 = Tools.ByteToString_NoWhiteSpace(receiveBuffer111); string data = s1 + "#" + remoteEP111.ToString(); - CSRedisCacheHelper.StreamAdd(1, "All_UDPPackage_Data", data); + + //ProcessData(data); + CSRedisCacheHelper.StreamAdd(1, UDPAllDataKey, data); } } #endregion @@ -1399,6 +1393,12 @@ namespace RCUHost.Implement int length = context111.Data.Length - offset - 2; string HostNUMBER = HostNNN; + + //询问房态没有 数据体 + if (cmdType == 0x32 && length == 0) + { + NewXieYi(context111, hotelCode, HostNNN, framenolist, cmdType, EndPoint, MyFrameNO); + } if (length > 0) { #region 新版协议 @@ -1758,6 +1758,7 @@ namespace RCUHost.Implement byte[] framenolist = ts.Item4; byte cmdType = ts.Item5; string EndPoint = ts.Item6; + #region 主机重启 if (cmdType == 0x33) { @@ -1855,11 +1856,12 @@ namespace RCUHost.Implement string mns1 = Newtonsoft.Json.JsonConvert.SerializeObject(ns); CSRedisCacheHelper.Publish("redis-rcu-card_action", mns1); - string HostID = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; + string HostID_O = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; - if (!string.IsNullOrEmpty(HostID)) + if (!string.IsNullOrEmpty(HostID_O)) { + string HostID = HostID_O.Split('#')[0]; string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + "004000001"; var OldHostModal = CSRedisCacheHelper.Get_Partition(KKey); if (OldHostModal != null) @@ -1882,6 +1884,7 @@ namespace RCUHost.Implement } #endregion + #region 定时上报 // AA 55 35 00 54 33 53 41 34 10 80 EB 03 6B 24 // 01 //协议版本 // 01 //取电状态 @@ -1917,7 +1920,6 @@ namespace RCUHost.Implement //P26~P29:通道能耗,单位:Wh(1度电 = 1KWh) //P30~P33:通道总能耗,单位:Wh(1度电 = 1KWh) - #region 定时上报 if (cmdType == 0x36) { @@ -2042,7 +2044,15 @@ namespace RCUHost.Implement //CSRedisCacheHelper.Publish("redis-rcu-timer_data", Newtonsoft.Json.JsonConvert.SerializeObject(ns)); - string HostID = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; + string HostID_O = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; + if (string.IsNullOrEmpty(HostID_O)) + { + return; + } + string[] NNN111 = HostID_O.Split('#'); + string HostID = NNN111[0]; + string RoomTypeID = NNN111[1]; + int room_type_id = int.Parse(RoomTypeID); string RoomNUMBER = CSRedisCacheHelper.HMGet(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0]; if (string.IsNullOrEmpty(RoomNUMBER)) { @@ -2050,40 +2060,65 @@ namespace RCUHost.Implement } + //List DeviceList = new List(); + //var DS1 = CSRedisCacheHelper.Get_Partition>(CacheKey.DingShiReportData + "_" + HostID, 3); + //if (DS1 != null) + //{ + // DeviceList = DS1; + //} + //else + //{ + // //logger.Error("定时上报的HostId:" + HostID); + // //定时上报要查询 当前房间配置了哪些设备 + // //这里根据主机Id 号查询当前房间,有哪些设备 + // if (!string.IsNullOrEmpty(HostID)) + // { + // lock (oo) + // { + // //var list2 = HostModalRepository.LoadByHostID(int.Parse(HostID)); + // //var list = list2.Where(r => r.Modal.IsUploadBaoJing).OrderBy(r => r.Modal.ModalAddress);//只装置标志启动的 + // var qs= QuanJuVar.BaoJingUpLoad.Where(A=>A.RoomType.ID==room_type_id); + // List dingls = new List(); + // //foreach (HostModal item in list) + // //{ + // // DingShiReportDate ddd = new DingShiReportDate(); + // // ddd.HostID = item.HostID; + // // ddd.Address = item.Modal.ModalAddress; + // // ddd.DeviceType = item.Modal.Type.ToString(); + // // dingls.Add(ddd); + // //} + // foreach (var item in qs) + // { + // DingShiReportDate ddd = new DingShiReportDate(); + // ddd.HostID = int.Parse(HostID); + // ddd.Address = item.ModalAddress; + // ddd.DeviceType = item.Type.ToString(); + // dingls.Add(ddd); + // } + // DeviceList = dingls; + // CSRedisCacheHelper.Set_PartitionWithForever>(CacheKey.DingShiReportData + "_" + HostID, dingls, 3); + // } + + // } + //} + + + List DeviceList = new List(); - var DS1 = CSRedisCacheHelper.Get_Partition>(CacheKey.DingShiReportData + "_" + HostID, 3); - if (DS1 != null) + //定时上报要查询 当前房间配置了哪些设备 + //这里根据主机Id 号查询当前房间,有哪些设备 + if (!string.IsNullOrEmpty(HostID)) { - DeviceList = DS1; - } - else - { - //logger.Error("定时上报的HostId:" + HostID); - //定时上报要查询 当前房间配置了哪些设备 - //这里根据主机Id 号查询当前房间,有哪些设备 - if (!string.IsNullOrEmpty(HostID)) + var qs = QuanJuVar.BaoJingUpLoad.Where(A => A.RoomType.ID == room_type_id); + foreach (var item in qs) { - lock (oo) - { - var list2 = HostModalRepository.LoadByHostID(int.Parse(HostID)); - var list = list2.Where(r => r.Modal.IsUploadBaoJing).OrderBy(r => r.Modal.ModalAddress);//只装置标志启动的 - - List dingls = new List(); - foreach (HostModal item in list) - { - DingShiReportDate ddd = new DingShiReportDate(); - ddd.HostID = item.HostID; - ddd.Address = item.Modal.ModalAddress; - ddd.DeviceType = item.Modal.Type.ToString(); - dingls.Add(ddd); - } - DeviceList = dingls; - CSRedisCacheHelper.Set_PartitionWithForever>(CacheKey.DingShiReportData + "_" + HostID, dingls, 3); - } - + DingShiReportDate ddd = new DingShiReportDate(); + ddd.HostID = int.Parse(HostID); + ddd.Address = item.ModalAddress; + ddd.DeviceType = item.Type.ToString(); + DeviceList.Add(ddd); } } - List DeviceStatusList = new List(); foreach (DingShiReportDate item in DeviceList) { @@ -2170,7 +2205,7 @@ namespace RCUHost.Implement //从取电动作那里取数据 if (Version == 0x01) { - string HostID_redis = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; + //string HostID_redis = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; if (!string.IsNullOrEmpty(HostID)) { string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + "004000001"; diff --git a/RCUHost/Implement/RoomStatusReceiver.cs b/RCUHost/Implement/RoomStatusReceiver.cs index c7491b2..db1c636 100644 --- a/RCUHost/Implement/RoomStatusReceiver.cs +++ b/RCUHost/Implement/RoomStatusReceiver.cs @@ -157,7 +157,7 @@ namespace RCUHost.Implement //来一个数据,把所有的地址拼接起来 string YiJingChuLiGuo = CacheKey.AllReadyDealWith0E_Prefix + "_" + HostNumberOnly; MemoryCacheHelper.Delete(YiJingChuLiGuo); - ProcessModal_NEW_NEW(host, status.Devices, isTriggerWelcomeMsg, context.MessageID, context.IsMonitor, context.Data, status,context.RemoteEndPoint.ToString());//更新灯光及其他回路状态 + ProcessModal_NEW_NEW(host, status.Devices, isTriggerWelcomeMsg, context.MessageID, context.IsMonitor, context.Data, status, context.RemoteEndPoint.ToString());//更新灯光及其他回路状态 string nnn = VVV1 + VVV2; if (!string.IsNullOrEmpty(nnn)) { @@ -224,7 +224,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, byte[] OriginalByteList, Status yuanshidata,string EEndPoint) + private void ProcessModal_NEW_NEW(Host host, ConcurrentDictionary devices, bool IsTriggerWelcomeMsg, string ContextMessageId, bool ismonitor, byte[] OriginalByteList, Status yuanshidata, string EEndPoint) { string UUID = "9dc6a0ee-dcf1-4385-b05f-09cb463838cd"; UUID = host.FCS_locationUUID; @@ -747,83 +747,60 @@ namespace RCUHost.Implement break; case "004000001"://取电 #region 取电开关 - - #region 这个逻辑可能会用到 - //0关闭设备, - //1打开设备且当前设备处于关闭状态, - //取电 - //CommonEntity.DataTongJi.MTakeCardData t = new DataTongJi.MTakeCardData(); - //t.HostNUMBER = HOSTNUMBER; - //t.HotelCode = HOTEL_CODE; - //t.Status = Convert.ToByte(device.Value.StatusReceiver); - //t.LastUpdateTime = DateTime.Now; - ////不管是断电还是取电都要记录 - //if (flag == 1||flag==0) - //{ - // string sss = Newtonsoft.Json.JsonConvert.SerializeObject(t); - // CSRedisCacheHelper.Publish("redis-takecard_change", sss); - //} - //断电 - //if (flag == 0) - //{ - // string sss = Newtonsoft.Json.JsonConvert.SerializeObject(t); - // CSRedisCacheHelper.Publish("redis-takecard_change", sss); - //} - #endregion //拨卡操作 if (flag == 0 && host.RoomCard != null) { - host.RoomCard = null; - HostRepository.SetRoomCard(host, null);//拔卡操作 + //host.RoomCard = null; + //HostRepository.SetRoomCard(host, null);//拔卡操作 } else if (flag == 1 && host.RoomCard == null) { //CSRedisCacheHelper.HMSet(CacheKey.TakeCardOnLine,host.SysHotel.Code+"###"+ host.RoomNumber); - RoomCardType roomCardType = null; + //RoomCardType roomCardType = null; - #region 获取有人房卡类型 - string MemoryCardKey = "MemoryRoomCardPrefix_1"; - object ooo = MemoryCacheHelper.Get(MemoryCardKey); - if (ooo != null) - { - roomCardType = ooo as RoomCardType; - } - else - { - roomCardType = RoomCardTypeRepository.Get(1);//获取有人房卡类型 - MemoryCacheHelper.SlideSet(MemoryCardKey, roomCardType); - } - #endregion + //#region 获取有人房卡类型 + //string MemoryCardKey = "MemoryRoomCardPrefix_1"; + //object ooo = MemoryCacheHelper.Get(MemoryCardKey); + //if (ooo != null) + //{ + // roomCardType = ooo as RoomCardType; + //} + //else + //{ + // roomCardType = RoomCardTypeRepository.Get(1);//获取有人房卡类型 + // MemoryCacheHelper.SlideSet(MemoryCardKey, roomCardType); + //} + //#endregion - #region 获取当前酒店独属 这个房间的卡 - RoomCard roomCard = null; - string GetRoomCardBy = "GetRoomCardBy_" + roomCardType.ID + "_" + host.SysHotel.ID; - object ooo1 = MemoryCacheHelper.Get(GetRoomCardBy); - if (ooo1 != null) - { - roomCard = ooo as RoomCard; - } - else - { - roomCard = RoomCardRepository.Get(roomCardType, host.SysHotel.ID); - if (roomCard != null) - { - MemoryCacheHelper.Set(GetRoomCardBy, roomCard); - } - } - #endregion + //#region 获取当前酒店独属 这个房间的卡 + //RoomCard roomCard = null; + //string GetRoomCardBy = "GetRoomCardBy_" + roomCardType.ID + "_" + host.SysHotel.ID; + //object ooo1 = MemoryCacheHelper.Get(GetRoomCardBy); + //if (ooo1 != null) + //{ + // roomCard = ooo as RoomCard; + //} + //else + //{ + // roomCard = RoomCardRepository.Get(roomCardType, host.SysHotel.ID); + // if (roomCard != null) + // { + // MemoryCacheHelper.Set(GetRoomCardBy, roomCard); + // } + //} + //#endregion - if (roomCard == null)//如果该房卡类型未创建记录,自动创建 - { - roomCard = new RoomCard(); - roomCard.CardNumber = "1"; - roomCard.RoomCardType = roomCardType; - roomCard.HotelID = host.SysHotel.ID; - RoomCardRepository.Save(roomCard); - } - host.RoomCard = roomCard; - HostRepository.SetRoomCard(host, roomCard);//插卡操作 + //if (roomCard == null)//如果该房卡类型未创建记录,自动创建 + //{ + // roomCard = new RoomCard(); + // roomCard.CardNumber = "1"; + // roomCard.RoomCardType = roomCardType; + // roomCard.HotelID = host.SysHotel.ID; + // RoomCardRepository.Save(roomCard); + //} + //host.RoomCard = roomCard; + //HostRepository.SetRoomCard(host, roomCard);//插卡操作 } #region 语音机器人 @@ -1722,8 +1699,8 @@ namespace RCUHost.Implement //只有服务信息才会入库 //bool isonly_serviceinfo = true; - if (hostModal.ModalType == DeviceType.ServiceInfo) - //if (isonly_serviceinfo) + bool bbbaaa = hostModal.Modal.Name.Contains("红外") || hostModal.Modal.Name.Contains("infrared") || hostModal.Modal.Name.Contains("雷达") || hostModal.Modal.Name.Contains("radar"); + if (hostModal.ModalType == DeviceType.ServiceInfo && bbbaaa == false) { HostModal FinallyData = new HostModal(); diff --git a/Service/IRoomTypeModalManager.cs b/Service/IRoomTypeModalManager.cs index d15b3ec..0da7c85 100644 --- a/Service/IRoomTypeModalManager.cs +++ b/Service/IRoomTypeModalManager.cs @@ -31,6 +31,12 @@ namespace Service /// -1全部删除,0后台,1宝易 /// IList LoadAll(RoomType roomType, DeviceType deviceType, int sourceType); + + /// + /// 宝镜上传数据 + /// + /// + IList LoadAllBaoJingUpload(); /// /// 删除房型回路 /// diff --git a/Service/Implement/RoomTypeModalManager.cs b/Service/Implement/RoomTypeModalManager.cs index eca27d2..69a3746 100644 --- a/Service/Implement/RoomTypeModalManager.cs +++ b/Service/Implement/RoomTypeModalManager.cs @@ -38,6 +38,12 @@ namespace Service.Implement } } + public IList LoadAllBaoJingUpload() + { + return CurrentRepository.LoadAll().Where(r => r.IsUploadBaoJing == true).ToList(); + } + + public IList LoadAll(RoomType roomType, DeviceType deviceType, int sourceType) { if (sourceType == -1) diff --git a/WebSite/Controllers/ApiController.cs b/WebSite/Controllers/ApiController.cs index d74bbee..b833658 100644 --- a/WebSite/Controllers/ApiController.cs +++ b/WebSite/Controllers/ApiController.cs @@ -801,7 +801,10 @@ namespace WebSite.Controllers /// public ActionResult GetRoomSceneList(string jsonData) { - + if (string.IsNullOrEmpty(jsonData.Trim())) + { + return Json(new { IsSuccess = false, Result = "非法调用" }, JsonRequestBehavior.AllowGet); + } Interlocked.Increment(ref WebAPI_TongJi.GetRoomSceneList); string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); try @@ -5327,7 +5330,7 @@ namespace WebSite.Controllers } long jishu_error = Interlocked.Read(ref MvcApplication.UDPServerErrorCount); - if (jishu_error >= 3) + if (jishu_error >= 5) { logger.Error("重启了UDP服务器"); Interlocked.Exchange(ref MvcApplication.UDPServerErrorCount, 0); @@ -6421,7 +6424,7 @@ namespace WebSite.Controllers } catch (Exception ex) { - logger.Error("同派出错:"+ex.Message); + logger.Error("同派出错:" + ex.Message); return Json(new { IsSuccess = false, Message = HttpContext.InnerLanguage("SaveFailedBecause") + ex.Message }); } } @@ -6480,13 +6483,14 @@ namespace WebSite.Controllers foreach (Host host in hosts)//该房型下所有主机关联回路 { //删除掉上报的 - CSRedisCacheHelper.Del_Partition(CacheKey.DingShiReportData + "_" + host.ID, 3); + //CSRedisCacheHelper.Del_Partition(CacheKey.DingShiReportData + "_" + host.ID, 3); var hostModal = HostModalManager.GetByModalAddress(host.ID, roomTypeModal.ModalAddress); if (null == hostModal) { HostModalManager.Save(new HostModal { HostID = host.ID, Modal = roomTypeModal, Status = 2, Time = 0, UpdateTime = DateTime.Now }); } } + QuanJuVar.BaoJingUpLoad = RoomTypeModalManager.LoadAllBaoJingUpload(); return true; } #endregion @@ -6642,7 +6646,7 @@ namespace WebSite.Controllers try { var qqq = HostManager.LoadAllID_HostNumberMapping(); - var qqq1 = qqq.Select(a => new { a.HostNumber, a.Id }).ToList(); + var qqq1 = qqq.Select(a => new { a.HostNumber, a.Id, a.RoomTypeId }).ToList(); if (qqq1.Count > 0) @@ -6653,7 +6657,7 @@ namespace WebSite.Controllers if (!string.IsNullOrEmpty(item.HostNumber)) { //CSRedisCacheHelper.HMSet(5, CacheKey.RoomNumber_HostNumber, item.HostNumber, item.RoomNumber); - CSRedisCacheHelper.HMSet(5, CacheKey.HostId_HostNumber, item.HostNumber, item.Id); + CSRedisCacheHelper.HMSet(5, CacheKey.HostId_HostNumber, item.HostNumber, item.Id + "#" + item.RoomTypeId); } } } @@ -6815,7 +6819,7 @@ namespace WebSite.Controllers { try { - HostServer.StopConsumerTasks(); + //HostServer.StopConsumerTasks(); if (key.Equals("blw^_^wlb")) { var hostServer = (IHostServer)MvcApplication.cxt.GetObject("RCUHost.HostServer"); diff --git a/WebSite/Controllers/HomeController.cs b/WebSite/Controllers/HomeController.cs index 99f7d8e..876b483 100644 --- a/WebSite/Controllers/HomeController.cs +++ b/WebSite/Controllers/HomeController.cs @@ -35,10 +35,29 @@ namespace WebSite.Controllers [Authorize] public ActionResult Index() { - //ViewData["Account"] = User.Identity.Name; + ViewData["Account"] = User.Identity.Name; return View("SimonIndex"); } + public ActionResult III() + { + return View("DencyLogin"); + } + + public ActionResult Loo() + { + var name = Request.Form["username"].ToString(); + var pwd = Request.Form["password"].ToString(); + if (name.Equals("mima") && pwd.Equals("3dfc3922112f460e81c2b7b7221bd9ad")) + { + return View("LogOn"); + } + else + { + return View("DencyLogin"); + } + } + [Authorize] public ActionResult MenuIndex() { @@ -114,6 +133,7 @@ namespace WebSite.Controllers return Redirect("/");//Request.UrlReferrer.ToString()); } + [Authorize()] public ActionResult LogOn() { string result = ""; diff --git a/WebSite/Controllers/RoomStatusController.cs b/WebSite/Controllers/RoomStatusController.cs index a1d64c1..24e1e9b 100644 --- a/WebSite/Controllers/RoomStatusController.cs +++ b/WebSite/Controllers/RoomStatusController.cs @@ -1081,10 +1081,16 @@ namespace WebSite.Controllers //"Color": "#FF8C69", //"Beep": false string Address = row["Code"].ToString(); + string Name1 = ReturnNameByLanguage(row["Name"].ToString(), row["EName"].ToString(), row["TWName"].ToString()); + if (Name1.Contains("红外")||Name1.Contains("infrared")||Name1.Contains("雷达")||Name1.Contains("radar")) + { + continue; + } + services.Add(new { Code = row["Code"], - Name = ReturnNameByLanguage(row["Name"].ToString(), row["EName"].ToString(), row["TWName"].ToString()),// (bool)Session["isCN"] ? row["Name"] : row["EName"], + Name=Name1, Value = row["Number"], Color = row["Color"], Beep = row["Beep"] diff --git a/WebSite/Global.asax.cs b/WebSite/Global.asax.cs index 4c94780..e9d788f 100644 --- a/WebSite/Global.asax.cs +++ b/WebSite/Global.asax.cs @@ -47,9 +47,10 @@ namespace WebSite private IRoomStatusManager RoomStatusManager; private IDeviceControlReceiver DeviceControlReceiver; private IOverviewManager OverviewManager { get; set; } - public IHostModalManager HostModalManager { get; set; } + private IHostModalManager HostModalManager { get; set; } public static IHostServer hostServer { get; set; } + public IRoomTypeModalManager RoomTypeModalManager { get; set; } //private IGroupManager GroupManager; //private IHostRoomCardManager HostRoomCardManager; private syncstatus.syncstatusSoapClient _client = null;//房态同步接口 @@ -95,6 +96,8 @@ namespace WebSite } protected override void Application_Start(object sender, EventArgs e) { + //CSRedisCacheHelper.redis1.Del(UDPAllDataKey); + //CSRedisCacheHelper.redis1.XGroupCreate(UDPAllDataKey, "UDPData", "0", true); logger.Error("Web重启了"); // 在应用程序启动时调用 PreHot(); @@ -122,10 +125,9 @@ namespace WebSite } catch { } }; + + SetInitAccount(); - StartHostServer(); - //StartHostServerNew(); - BLWMQTT.StartMqtt(); //if ("1" == send_to_debugger) //{ // UDPLogServer.Init(); @@ -137,6 +139,10 @@ namespace WebSite } //HeartBeat(); + QuanJuVar.BaoJingUpLoad = RoomTypeModalManager.LoadAllBaoJingUpload(); + + StartHostServer(); + BLWMQTT.StartMqtt(); long ll1 = CSRedisCacheHelper.ForeverGet(UDPLostKey); @@ -519,6 +525,7 @@ namespace WebSite DeviceControlReceiver = (IDeviceControlReceiver)cxt.GetObject("RCUHost.DeviceControlReceiver"); OverviewManager = (IOverviewManager)cxt.GetObject("Manager.Overview"); HostModalManager = (IHostModalManager)cxt.GetObject("Manager.HostModal"); + RoomTypeModalManager = (IRoomTypeModalManager)cxt.GetObject("Manager.RoomTypeModal"); _client = new syncstatus.syncstatusSoapClient(); Timer timer2 = new Timer(20000);//每20秒扫描一次 @@ -739,7 +746,7 @@ namespace WebSite int status_id16 = host.SysHotel.SwitchRoomStatus_PowerOff16; if (status_id2 != 0 || status_id4 != 0 || status_id8 != 0 || status_id16 != 0) { - if (status_id2 == roomStatus.ID||status_id4==roomStatus.ID||status_id8==roomStatus.ID||status_id16==roomStatus.ID) + if (status_id2 == roomStatus.ID || status_id4 == roomStatus.ID || status_id8 == roomStatus.ID || status_id16 == roomStatus.ID) { HostModal h1 = new HostModal(); h1.Modal = new RoomTypeModal() { ModalAddress = "004000001", Type = DeviceType.ServiceInfo }; diff --git a/WebSite/Resource/en-US.Designer.cs b/WebSite/Resource/en-US.Designer.cs index 58a489e..ea43fe2 100644 --- a/WebSite/Resource/en-US.Designer.cs +++ b/WebSite/Resource/en-US.Designer.cs @@ -1312,6 +1312,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 CheckIn 的本地化字符串。 + /// + internal static string ChuZuHou { + get { + return ResourceManager.GetString("ChuZuHou", resourceCulture); + } + } + /// /// 查找类似 Circuit 的本地化字符串。 /// @@ -3022,6 +3031,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 Close air condition 的本地化字符串。 + /// + internal static string GuanKongTiao { + get { + return ResourceManager.GetString("GuanKongTiao", resourceCulture); + } + } + /// /// 查找类似 Guest Room 的本地化字符串。 /// @@ -4462,6 +4480,24 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 No Action 的本地化字符串。 + /// + internal static string MeiDongZuo { + get { + return ResourceManager.GetString("MeiDongZuo", resourceCulture); + } + } + + /// + /// 查找类似 Minute when nobody 的本地化字符串。 + /// + internal static string MeiYouRen { + get { + return ResourceManager.GetString("MeiYouRen", resourceCulture); + } + } + /// /// 查找类似 Menu 的本地化字符串。 /// @@ -7486,6 +7522,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 attemperation 的本地化字符串。 + /// + internal static string TiaoWen { + get { + return ResourceManager.GetString("TiaoWen", resourceCulture); + } + } + /// /// 查找类似 Tidy Up The Plate 的本地化字符串。 /// diff --git a/WebSite/Resource/en-US.resx b/WebSite/Resource/en-US.resx index 0f3cca2..46063e5 100644 --- a/WebSite/Resource/en-US.resx +++ b/WebSite/Resource/en-US.resx @@ -2914,4 +2914,19 @@ Single circuit status Doorlockbattery + + CheckIn + + + Close air condition + + + No Action + + + Minute when nobody + + + attemperation + \ No newline at end of file diff --git a/WebSite/Resource/zh-CN.Designer.cs b/WebSite/Resource/zh-CN.Designer.cs index 562d796..3f2e990 100644 --- a/WebSite/Resource/zh-CN.Designer.cs +++ b/WebSite/Resource/zh-CN.Designer.cs @@ -1311,6 +1311,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 出租后 的本地化字符串。 + /// + internal static string ChuZuHou { + get { + return ResourceManager.GetString("ChuZuHou", resourceCulture); + } + } + /// /// 查找类似 回路 的本地化字符串。 /// @@ -3021,6 +3030,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 关空调 的本地化字符串。 + /// + internal static string GuanKongTiao { + get { + return ResourceManager.GetString("GuanKongTiao", resourceCulture); + } + } + /// /// 查找类似 客房 的本地化字符串。 /// @@ -4461,6 +4479,24 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 无动作 的本地化字符串。 + /// + internal static string MeiDongZuo { + get { + return ResourceManager.GetString("MeiDongZuo", resourceCulture); + } + } + + /// + /// 查找类似 分钟无人入住 的本地化字符串。 + /// + internal static string MeiYouRen { + get { + return ResourceManager.GetString("MeiYouRen", resourceCulture); + } + } + /// /// 查找类似 菜单 的本地化字符串。 /// @@ -7494,6 +7530,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 调温 的本地化字符串。 + /// + internal static string TiaoWen { + get { + return ResourceManager.GetString("TiaoWen", resourceCulture); + } + } + /// /// 查找类似 收拾餐盘 的本地化字符串。 /// diff --git a/WebSite/Resource/zh-CN.resx b/WebSite/Resource/zh-CN.resx index 5e191eb..81231e3 100644 --- a/WebSite/Resource/zh-CN.resx +++ b/WebSite/Resource/zh-CN.resx @@ -2916,4 +2916,19 @@ 门锁电量 + + 出租后 + + + 关空调 + + + 无动作 + + + 分钟无人入住 + + + 调温 + \ No newline at end of file diff --git a/WebSite/Resource/zh-TW.Designer.cs b/WebSite/Resource/zh-TW.Designer.cs index f5f01f3..f1ede7e 100644 --- a/WebSite/Resource/zh-TW.Designer.cs +++ b/WebSite/Resource/zh-TW.Designer.cs @@ -1311,6 +1311,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 出租后 的本地化字符串。 + /// + internal static string ChuZuHou { + get { + return ResourceManager.GetString("ChuZuHou", resourceCulture); + } + } + /// /// 查找类似 回路 的本地化字符串。 /// @@ -3021,6 +3030,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 关空调 的本地化字符串。 + /// + internal static string GuanKongTiao { + get { + return ResourceManager.GetString("GuanKongTiao", resourceCulture); + } + } + /// /// 查找类似 客房 的本地化字符串。 /// @@ -4461,6 +4479,24 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 无动作 的本地化字符串。 + /// + internal static string MeiDongZuo { + get { + return ResourceManager.GetString("MeiDongZuo", resourceCulture); + } + } + + /// + /// 查找类似 分钟无人入住 的本地化字符串。 + /// + internal static string MeiYouRen { + get { + return ResourceManager.GetString("MeiYouRen", resourceCulture); + } + } + /// /// 查找类似 菜單 的本地化字符串。 /// @@ -7496,6 +7532,15 @@ namespace WebSite.Resource { } } + /// + /// 查找类似 调温 的本地化字符串。 + /// + internal static string TiaoWen { + get { + return ResourceManager.GetString("TiaoWen", resourceCulture); + } + } + /// /// 查找类似 收拾餐盤 的本地化字符串。 /// diff --git a/WebSite/Resource/zh-TW.resx b/WebSite/Resource/zh-TW.resx index 55dc893..1201104 100644 --- a/WebSite/Resource/zh-TW.resx +++ b/WebSite/Resource/zh-TW.resx @@ -2918,4 +2918,19 @@ 門鎖電量 + + 出租后 + + + 关空调 + + + 无动作 + + + 分钟无人入住 + + + 调温 + \ No newline at end of file diff --git a/WebSite/Views/AirConditionControl/SeasonControl.ascx b/WebSite/Views/AirConditionControl/SeasonControl.ascx index 3d98f13..e48c6cc 100644 --- a/WebSite/Views/AirConditionControl/SeasonControl.ascx +++ b/WebSite/Views/AirConditionControl/SeasonControl.ascx @@ -339,7 +339,7 @@ -   出租后  @@ -352,7 +352,7 @@ -  分钟无人入住 +  <%: Html.Language("ChuZuHou")%> @@ -404,7 +404,7 @@ +    <%: Html.Language("MeiDongZuo")%> @@ -459,7 +459,7 @@ +    <%: Html.Language("GuanKongTiao")%> @@ -483,11 +483,11 @@    +   <%: Html.Language("Temperature")%> + + + +
+ + +
+ + + + + + diff --git a/WebSite/Web.config b/WebSite/Web.config index d931d6f..01b5b65 100644 --- a/WebSite/Web.config +++ b/WebSite/Web.config @@ -218,7 +218,8 @@ - + + diff --git a/WebSite/WebSite.csproj b/WebSite/WebSite.csproj index d4426fe..ace090a 100644 --- a/WebSite/WebSite.csproj +++ b/WebSite/WebSite.csproj @@ -1541,6 +1541,7 @@ +