From 36c2fa4061782afcb2369095993df489058e3c7e Mon Sep 17 00:00:00 2001 From: TianMaiCheng <746290578@qq.com> Date: Thu, 9 Apr 2026 13:37:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E7=89=88=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E4=B8=BB=E6=9C=BA=20=E5=8D=8F=E8=AE=AE=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E7=9A=84=E6=9C=BA=E5=88=B6=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20=E7=BC=93=E5=AD=98=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + CommonEntity/QuanJuVar.cs | 3 + .../ConsoleApplication1.csproj | 128 -- ConsoleApplication1/Program.cs | 1156 ----------------- .../Properties/AssemblyInfo.cs | 36 - ConsoleApplication1/app.config | 18 - .../ConsoleApplication666.csproj | 58 - ConsoleApplication666/Program.cs | 64 - .../Properties/AssemblyInfo.cs | 36 - RCUHost/Config/Receiver.xml | 1 + RCUHost/IDeviceControlReceiver.cs | 4 + RCUHost/Implement/DeviceControlReceiver.cs | 18 +- RCUHost/Implement/GenericReceiverBase.cs | 6 +- RCUHost/Implement/HostServer.cs | 125 +- RCUHost/Implement/New_RoomStatusReceiver.cs | 340 ++--- RCUHost/Implement/RoomStatusReceiver.cs | 319 +++-- Service/Implement/RoomTypeModalManager.cs | 3 +- .../AirConditionControlController.cs | 13 +- WebSite/Controllers/ApiController.cs | 32 + WebSite/Controllers/HomeController.cs | 2 +- WebSite/Global.asax.cs | 11 +- WebSite/Web.config | 4 +- 22 files changed, 484 insertions(+), 1897 deletions(-) delete mode 100644 ConsoleApplication1/ConsoleApplication1.csproj delete mode 100644 ConsoleApplication1/Program.cs delete mode 100644 ConsoleApplication1/Properties/AssemblyInfo.cs delete mode 100644 ConsoleApplication1/app.config delete mode 100644 ConsoleApplication666/ConsoleApplication666.csproj delete mode 100644 ConsoleApplication666/Program.cs delete mode 100644 ConsoleApplication666/Properties/AssemblyInfo.cs diff --git a/.gitignore b/.gitignore index 66e6574..8cc181b 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,7 @@ ConsoleApplication4 RCUHost内存泄漏分析报告.md CRICS_V3_1124.suo ConsoleApplication5 +ConsoleApplication1 +ConsoleApplication666 +ConsoleApplication666 +ConsoleApplication1 diff --git a/CommonEntity/QuanJuVar.cs b/CommonEntity/QuanJuVar.cs index 1bdad24..c70e830 100644 --- a/CommonEntity/QuanJuVar.cs +++ b/CommonEntity/QuanJuVar.cs @@ -9,5 +9,8 @@ namespace CommonEntity public class QuanJuVar { public static IList BaoJingUpLoad = new List(); + public static IList RoomTypeDeviceModal = new List(); + public static IList HotelSeaon = new List(); + public static List HotelAirControl = new List(); } } diff --git a/ConsoleApplication1/ConsoleApplication1.csproj b/ConsoleApplication1/ConsoleApplication1.csproj deleted file mode 100644 index 16b53be..0000000 --- a/ConsoleApplication1/ConsoleApplication1.csproj +++ /dev/null @@ -1,128 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {BE0C3821-67F3-4FF5-B688-E727BD4C90AE} - Exe - Properties - ConsoleApplication1 - ConsoleApplication1 - v4.0 - - - 512 - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\..\lib\Quart\quartznet-2.3.3\quartznet-2.3.3\build\4.0\Debug\Quartz\C5.dll - - - False - ..\lib\CacheManager.Core.0.7.4\lib\net40\CacheManager.Core.dll - - - ..\lib\CacheManager.Memcached.0.7.4\lib\net40\CacheManager.Memcached.dll - - - ..\lib\CacheManager.SystemRuntimeCaching.0.7.4\lib\net40\CacheManager.SystemRuntimeCaching.dll - - - False - ..\..\..\..\lib\Quart\quartznet-2.3.3\quartznet-2.3.3\build\4.0\Debug\Quartz\Common.Logging.dll - - - ..\..\..\..\lib\Quart\quartznet-2.3.3\quartznet-2.3.3\build\4.0\Debug\Quartz\Common.Logging.Core.dll - - - False - ..\lib\Redis\CSRedisCore.dll - - - False - ..\lib\Newtonsoft.Json.dll - - - ..\..\..\..\lib\Quart\quartznet-2.3.3\quartznet-2.3.3\build\4.0\Debug\Quartz\Quartz.dll - - - ..\lib\RestSharp\RestSharp.dll - - - ..\lib\Redis\ServiceStack.Common.dll - - - ..\lib\Redis\ServiceStack.Interfaces.dll - - - ..\lib\Redis\ServiceStack.Redis.dll - - - ..\lib\Redis\ServiceStack.Text.dll - - - - - ..\lib\Redis\System.ValueTuple.dll - - - - - - - - - - - - - - {1D7073B2-4CC3-49F5-9F37-50A21D74A39D} - CommonEntity - - - {B3F29715-E925-4E56-9248-580F06C3BC11} - Common - - - {A42D287A-8EF4-48F6-B14C-7F9CA834F786} - Domain - - - {3AF4C628-0B47-412C-950A-DBC0161F2A7F} - RCUHost - - - - - - - - \ No newline at end of file diff --git a/ConsoleApplication1/Program.cs b/ConsoleApplication1/Program.cs deleted file mode 100644 index 9f3ea98..0000000 --- a/ConsoleApplication1/Program.cs +++ /dev/null @@ -1,1156 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using RestSharp; -using CommonEntity; -using RCUHost.Protocols; -using Common; -using RCUHost.Implement; -using System.Net; -using System.Collections; -using CacheManager.Core; -using CSRedis; -using System.Threading.Tasks; -using System.IO; -using System.Collections.Concurrent; -using System.Threading; -using Newtonsoft.Json.Linq; -using Domain; -using System.Diagnostics; -using Common.Logging; -using Quartz; -using Quartz.Impl; -using System.Net.Sockets; -using System.ComponentModel; -using SimpleUdp; - -namespace ConsoleApplication1 -{ - public enum FF - { - A = 0x01 | 0x02 | 0x03, - B = 0x05 - } - public class User : EqualityComparer - { - public string username { get; set; } - public string password { get; set; } - public int oauth_id { get; set; } - public override bool Equals(User x, User y) - { - if (x.username.Equals(y.username)) - { - return true; - } - return false; - } - public override int GetHashCode(User obj) - { - return obj.username.GetHashCode(); - } - } - public class FCS_ReturnInfo - { - public int success { get; set; } - public FCS_ReturnData data { get; set; } - } - // {"success": 1, "data": true, "rmsg": {"code": "s_job_orders", "param": ["JO-0001970-01"]}} - public class FCS_JobResponse - { - public int success { get; set; } - public bool data { get; set; } - //"rmsg": - //[ - //{ - // "code": "s_user_not_found", - // "param": [] - //} - //] - public List rmsg { get; set; } - - } - public class FCSJobResponseData - { - public string code { get; set; } - public List param { get; set; } - } - public class FCS_ReturnData - { - public bool is_authenticated { get; set; } - public string access_token { get; set; } - public string refresh_token { get; set; } - public bool show_password_expire { get; set; } - public string password_expired_date { get; set; } - public bool password_expired { get; set; } - public bool valid_license_access { get; set; } - public bool require_reset { get; set; } - public string property_config { get; set; } - public string show_pp { get; set; } - public int oauth_id { get; set; } - public bool is_ip_valid { get; set; } - public bool is_support_aliyun { get; set; } - } - - public class FCS_JobRequest - { - public List location_uuid { get; set; } - public List service_items { get; set; } - public string remark { get; set; } - public string assigned_to { get; set; } - public int user_type { get; set; } - } - public class FCS_service_items - { - public string item_uuid { get; set; } - public int quantity { get; set; } - } - class Program - { - public static byte ConvertLastFourBitsToByte(BitArray bitArray) - { - if (bitArray == null || bitArray.Count < 4) - throw new ArgumentException("BitArray is too short or null."); - - byte result = 0; - for (int i = bitArray.Count - 4, j = 0; i < bitArray.Count; i++, j++) - { - if (bitArray[i]) - { - result |= (byte)(1 << j); - } - } - return result; - } - - public static byte CombineBitsToByte(bool bit0, bool bit1, bool bit2, bool bit3) - { - byte result = (byte)((bit0 ? 1 : 0) << 3); // 将bit0移到第4位(高位) - result |= (byte)((bit1 ? 1 : 0) << 2); // 将bit1移到第3位 - result |= (byte)((bit2 ? 1 : 0) << 1); // 将bit2移到第2位 - result |= (byte)(bit3 ? 1 : 0); // 将bit3移到第1位(低位) - return result; - } - - public static string FCSLoginUrl = "https://api.fcs1cloud.com"; - public static void Login() - { - - byte gh = 0x05; - string HHH789 = gh.ToString("000"); - MemoryCacheHelper.Set("a", "0x19", DateTimeOffset.Now.AddSeconds(5)); - Thread.Sleep(6000); - var QQQQQ = MemoryCacheHelper.Get("a"); - string str = Newtonsoft.Json.JsonConvert.SerializeObject(""); - var client1 = new RestClient(FCSLoginUrl); - var request1 = new RestRequest("/api/security/authenticate", Method.POST); - - Dictionary dic = new Dictionary(); - User us = new User(); - - us.username = "hb.rcu"; - us.password = "abc123"; - us.oauth_id = 1; - request1.AddJsonBody(us); - - var QQQ = client1.Execute(request1); - HttpStatusCode HHH = QQQ.StatusCode; - string ddd = QQQ.Content; - JObject jsonObject = JObject.Parse(ddd); - - string city = (string)jsonObject.SelectToken("Person.Address.City"); - var FFFA = Newtonsoft.Json.JsonConvert.DeserializeObject(ddd); - //client1.ExecuteAsync(request1, (response) => - //{ - // Console.WriteLine(response.Content); - //}); - } - - - - public static void JobRequest() - { - var client1 = new RestClient(FCSLoginUrl); - var request1 = new RestRequest("/api-secure/job/request", Method.POST); - - FCS_JobRequest fff = new FCS_JobRequest(); - fff.location_uuid = new List() { "bd5bd36e-67a9-4a76-93ea-3e1acc8f5f1f" }; - fff.service_items = new List() - { - new FCS_service_items() - { - item_uuid="f905590d-cae7-4d07-8d0d-f88b5b44b786", - quantity=1 - } - }; - fff.remark = "test_remark"; - fff.assigned_to = "auto"; - fff.user_type = 1; - - - string WER = Newtonsoft.Json.JsonConvert.SerializeObject(fff); - - string Key = "FCS_Security_Authenticate"; - string NNN = CSRedisCacheHelper.Get_Partition(Key); - //这里不处理登录的逻辑 - //缓存里面只保存 登录成功的token - //只 处理 请求 失败的 - if (string.IsNullOrEmpty(NNN)) - { - //并且将Token写入到缓存 - } - else - { - - } - request1.AddHeader("token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI2NGZjYjhjMS1jZDZjLTRkMTktOTc3My05YzkxYmZhNjQ2YWQiLCJpYXQiOjE3NDI0MzU1NDYsImV4cCI6MTc0MjQ0NjM0Niwic2NoZW1hIjoibnhnXzcwNzA1OTEzX2VhcXoiLCJ1c2VyIjoiYWYwNzg3YTQtMmM2NC00NWRiLWEzMjktNzg0ZGYwZWRjOGZjIiwiZGVmYXVsdF9wcm9wZXJ0eSI6IjA3MTY3M2IzLWQ4OTMtNDQwYi1iM2YwLTY0YTBkOTY0ZWIyOSIsInRvX3JlZnJlc2giOnRydWUsInR5cGUiOiJhY2Nlc3MiLCJpbml0X2Vwb2NoIjoxNzQyNDM1NTQ2LCJtZWRpdW1fY29kZSI6IldFQiJ9.cuRCfgu2sT2cThnAMv2H8B-XRQiJWgFR25O95bZdVz0"); - request1.AddHeader("property", "071673b3-d893-440b-b3f0-64a0d964eb29"); - request1.AddParameter("payload", WER); - - var QQQ = client1.Execute(request1); - HttpStatusCode HHH = QQQ.StatusCode; - string ddd = QQQ.Content; - - JObject jsonObject = JObject.Parse(ddd); - var error = jsonObject.SelectToken("error"); - //如果有错 - if (error != null) - { - //重新登录 - //再次请求 - } - } - - - public class QianLiMa_PMS - { - public static string FCSLoginUrl = "http://blv-rd.tech:19056"; - public static void QiYong(string hotel_code, string add_or_remove) - { - var client1 = new RestClient(FCSLoginUrl); - var request1 = new RestRequest("/api/Values/PostData", Method.POST); - - //注意方法是POST - //两个参数名字必须是 topic 和payload ,区分大小写的 - request1.AddQueryParameter("hotelcode", hotel_code); - request1.AddQueryParameter("add_or_remove", add_or_remove); - - string str = client1.Execute(request1).Content; - //client1.ExecuteAsync(request1, (response) => - //{ - // string str = response.Content; - //}); - } - } - public class iotVoiceData - { - public string room { get; set; } - public int @event { get; set; } - } - public static void VVV_VVV() - { - - string result = string.Empty; - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;//设置这个安全协议必须在创建请求之前! - HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://skyworth-business.com//skill-api/web/sync/remoteControl"); - req.Method = "POST"; - req.ContentType = "application/json"; - var WER = new iotVoiceData() - { - room = "0EC0", - @event = 4 - }; - var postData = Newtonsoft.Json.JsonConvert.SerializeObject(WER); - byte[] data = Encoding.UTF8.GetBytes(postData); - req.ContentLength = data.Length; - using (Stream reqStream = req.GetRequestStream()) - { - reqStream.Write(data, 0, data.Length); - } - HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); - using (Stream stream = resp.GetResponseStream()) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - result = reader.ReadToEnd();//获取响应内容 - } - } - } - - public virtual void Run() - { - - long lll = 9223372036854775807; - lll = lll + 5; - Console.WriteLine(lll); - //log.Info("------- Initializing ----------------------"); - - //// First we must get a reference to a scheduler - ISchedulerFactory sf = new StdSchedulerFactory(); - IScheduler sched = sf.GetScheduler(); - - //log.Info("------- Initialization Complete -----------"); - - - //// computer a time that is on the next round minute - //DateTimeOffset runTime = DateBuilder.EvenMinuteDate(DateTimeOffset.UtcNow); - - //log.Info("------- Scheduling Job -------------------"); - - //// define the job and tie it to our HelloJob class - //IJobDetail job = JobBuilder.Create() - // .WithIdentity("job1", "group1") - // .Build(); - - //// Trigger the job to run on the next round minute - //ITrigger trigger = TriggerBuilder.Create() - // .WithIdentity("trigger1", "group1") - // .StartAt(runTime) - // .Build(); - - //// Tell quartz to schedule the job using our trigger - //sched.ScheduleJob(job, trigger); - //log.Info(string.Format("{0} will run at: {1}", job.Key, runTime.ToString("r"))); - - //// Start up the scheduler (nothing can actually run until the - //// scheduler has been started) - //sched.Start(); - //log.Info("------- Started Scheduler -----------------"); - - //// wait long enough so that the scheduler as an opportunity to - //// run the job! - //log.Info("------- Waiting 65 seconds... -------------"); - - //// wait 65 seconds to show jobs - //Thread.Sleep(TimeSpan.FromSeconds(65)); - - //// shut down the scheduler - //log.Info("------- Shutting Down ---------------------"); - //sched.Shutdown(true); - //log.Info("------- Shutdown Complete -----------------"); - } - - public static void FanHui() - { - try - { - - Console.WriteLine("111111111111111"); - } - catch (Exception) - { - - throw; - } - finally - { - } - } - - public class EMP - { - public virtual void AAA() - { - Console.WriteLine("nnnnnnnnnnnn"); - } - } - public class BOSS : EMP - { - public override void AAA() - { - Console.WriteLine("aaaaaaaaa"); - } - } - - public static void T_T() - { - Interlocked.Increment(ref DataTongJi.RecordLostPackage); - if (DataTongJi.RecordLostPackage == DataTongJi.DefineLostPackage) - { - Interlocked.Exchange(ref DataTongJi.RecordLostPackage, 0); - return; - } - else - { - } - } - - public static void TcpClientInvoke() - { - // 服务器IP和端口 - string serverIp = "127.0.0.1"; // 替换为你的服务器IP - int serverPort = 11000; // 替换为你的服务器端口 - - // 要发送的消息 - string message = "Hello, UDP Server!"; - - try - { - // 创建UDP客户端 - using (UdpClient client = new UdpClient()) - { - - Console.WriteLine("1111111111111"); - // 将消息转换为字节数组 - byte[] data = Encoding.ASCII.GetBytes(message); - - // 发送数据 - client.Send(data, data.Length, serverIp, serverPort); - - // 可选:接收服务器响应(如果需要) - // IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0); - // byte[] receivedData = client.Receive(ref remoteEP); - // string response = Encoding.ASCII.GetString(receivedData); - // Console.WriteLine($"收到来自 {remoteEP} 的响应: {response}"); - } - } - catch (Exception ex) - { - } - } - - public static long LLL333 = 0; - - public enum DeviceType - { - /// - /// 主机继电器 - /// - [Description("主机继电器")] - Relay = 1, - /// - /// 弱电输出 - /// - [Description("弱电输出")] - LVout = 3, - /// - /// 服务信息 - /// - [Description("服务信息")] - ServiceInfo = 4 - } - - public static void DuoGeTask() - { - var TotalKey = "UDPPackage_TotalRecvPackage"; - UDPPackageCount LLL_T = null; - DataTongJi.TotalCount.TryGetValue(TotalKey, out LLL_T); - if (LLL_T != null) - { - //LLL_T.Count = LC; - //Interlocked.Increment(ref LLL_T.Count); - } - else - { - UDPPackageCount u = new UDPPackageCount(); - u.Count = 1; - DataTongJi.TotalCount.TryAdd(TotalKey, u); - } - } - - - // 消费者组模式 - //static async Task ConsumerGroup(string name, CancellationToken token) - //{ - // var processed = 0; - // while (!token.IsCancellationRequested) - // { - // var messages = await _redis.XReadGroupAsync("mygroup", name, 1, 5000, (StreamKey, ">")); - // if (messages?.Length > 0) - // { - // foreach (var msg in messages[0].messages) - // { - // Console.WriteLine($"[{name}] 处理: {msg.field["content"]}"); - // await _redis.XAckAsync(StreamKey, "mygroup", msg.id); - // processed++; - // } - // } - // } - // Console.WriteLine($"[{name}] 处理了 {processed} 条消息"); - //} - public static void SC() - { - - CSRedisCacheHelper.redis.XAdd("MyStr", "*", new ValueTuple("d", "da")); - CSRedisCacheHelper.redis.XAdd("MyStr", "*", new ValueTuple("d", "da")); - CSRedisCacheHelper.redis.XAdd("MyStr", "*", new ValueTuple("d", "da")); - var str = CSRedisCacheHelper.redis.XRead(3, 10000, new ValueTuple("MyStr", "$")); - //CSRedisCacheHelper.redis.XGroupCreate("AAA","BBB"); - //CSRedisCacheHelper.redis.XAdd("AAA",new ValueTuple("1","一个数据")); - - //var messages= CSRedisCacheHelper.redis.XReadGroup("AA", "BBB", 10,5000,new ValueTuple("AA", ">")); - //foreach (var stream in messages) - //{ - // CSRedisCacheHelper.redis.XAck("AAA","BBB",stream.Item1); - // Console.WriteLine(stream.Item2); - //} - //await CSre _redis.XGroupCreateAsync(StreamKey, "competitors", "0-0", true); - CSRedisCacheHelper.StreamConsume(1, "", ""); - } - - static void FileRe() - { - string sourcePath = "1.txt"; - string destinationPath = "2.txt"; - - // 如果目标文件存在,先删除 - if (File.Exists(destinationPath)) - { - File.Delete(destinationPath); - } - - // 重命名/移动文件 - File.Move(sourcePath, destinationPath); - } - - static ConcurrentBag> aaH = new ConcurrentBag>(); - static ConcurrentDictionary> aaJ = new ConcurrentDictionary>(); - static void YiQianQueue() - { - aaJ.TryAdd("1", new ConcurrentQueue()); - Task.Factory.StartNew(() => - { - ConcurrentQueue a = null; - bool bf = aaJ.TryGetValue("1", out a); - if (bf) - { - for (int i = 0; i < 100; i++) - { - a.Enqueue(i.ToString()); - } - } - }); - Task.Factory.StartNew(() => - { - ConcurrentQueue a = null; - bool bf = aaJ.TryGetValue("1", out a); - if (bf) - { - string st = null; - a.TryDequeue(out st); - } - }); - } - - public static void UDPTTS() - { - UdpEndpoint u = new UdpEndpoint("127.0.0.1", 3350); - } - /// - /// 设置黑名单 - /// - public static void SetBlockData() - { - var DDD = File.ReadAllText("2.txt", Encoding.UTF8); - var QS = Newtonsoft.Json.JsonConvert.DeserializeObject>(DDD); - foreach (var item in QS) - { - var client1 = new RestClient("https://www.boonlive-rcu.com"); - var request1 = new RestRequest("/api/BlockLWSet", Method.POST); - - Block_NameList bas = new Block_NameList(); - bas.HostNumberList = new List(); - bas.HotelCode = item.Key; - request1.AddJsonBody(bas); - var QQQ = client1.Execute(request1); - HttpStatusCode HHH = QQQ.StatusCode; - string ddd = QQQ.Content; - } - } - - public class JiShu - { - public string Name { get; set; } - public int Count { get; set; } - } - - static void Main(string[] args) - { - - string RoomNUMBER = CSRedisCacheHelper.HMGet(5, CacheKey.RoomNumber_HostNumber, "254008128102")[0]; - Console.WriteLine("房间号:" + RoomNUMBER); - Console.ReadLine(); - int XiaoShu_BuFen = 0; - float xiaoshu_l = 0.0f; - - XiaoShu_BuFen = 5; - xiaoshu_l = (float)XiaoShu_BuFen / 10; - - SetBlockData(); - Console.ReadLine(); - - var redisusa = CSRedisCacheHelper.redis; - var key = "key_Issues457"; - var group = "group_Issues457"; - var consumer = "consumer_Issues457"; - var maxLen = 9999; - - //删除,重新创建,并加入数据,进行测试 - redisusa.Del(key); - redisusa.XGroupCreate(key, group, "0", true); - redisusa.XAdd(key, maxLen, "*", new ValueTuple("data", "my data1")); - - //检查pending表的长度 - //!!!!!!pending表不存在时,读取会报错!!!!!!!!! - var pending0 = redisusa.XPending(key, group); - //消费确认前,pending 应该等于0 - - //读取未阅读的消息1,读取2次 - var new1 = redisusa.XReadGroup(group, consumer, 1, 1, new ValueTuple(key, ">")); - var new2 = redisusa.XReadGroup(group, consumer, 1, 1, new ValueTuple(key, ">")); - - var ssa = new1[0].Item1; - //var id1 = new1[0].data[0].id; - redisusa.XAck(key, group, "1763536561353-0"); - - //string NSA1a= CSRedisCacheHelper.redis.BRPop(3,"a"); - //CSRedisCacheHelper.redis.LPush("a","bbb"); - //CSRedisCacheHelper.redis.LPush("a","111"); - //CSRedisCacheHelper.redis.LPush("a","222"); - //CSRedisCacheHelper.redis.LPush("a","333"); - //string NSA1= CSRedisCacheHelper.redis.BRPop(300,"a"); - //string NSA2= CSRedisCacheHelper.redis.BRPop(300,"a"); - //string NSA3= CSRedisCacheHelper.redis.BRPop(300,"a"); - UDPTTS(); - Console.ReadLine(); - //0011101000011100 - ushort StatusReceiver = 0x3A1C; - int status = StatusReceiver >> 15;//开关 - int modeas = (StatusReceiver >> 12) & 0x03;//模式 - int fanSpeed = (StatusReceiver >> 11) & 0x03;//风速 - int valve = (StatusReceiver >> 10) & 0x01;//阀门 - int temperature = (StatusReceiver >> 5) & 0x1F;//设定温度 - int currentTemp = StatusReceiver & 0x01F;//当前温度(室内温度) - - byte[] bbb111 = new byte[] { 0x1c, 0x3a }; - BitArray bit = new BitArray(bbb111); - - - BitArray bit2 = new BitArray(8); - bit2.SetAll(false); - for (int i = 0; i < bit2.Length; i++) - { - bit2.Set(i, bit[i]); - } - int[] array = new int[1]; - bit2.CopyTo(array, 0); - Console.WriteLine(array[0]); - foreach (var item in bit2) - { - Console.WriteLine(item.ToString()); - } - Console.WriteLine("*****************"); - - - - - bool b111 = bit[13]; - bool b222 = bit[12]; - - bool b333 = bit[11]; - bool b444 = bit[10]; - int mode = 0; - //1制冷,2制热,3送风 - if (b222 == true && b111 == false) - { - mode = 1; - } - else if (b222 == false && b111 == true) - { - mode = 2; - } - else if (b222 == true && b111 == true) - { - mode = 3; - } - else - { - - } - - int fanspeed = 0; - //0自动,1低速,2中速,3高速 - if (b444 == true && b333 == false) - { - fanspeed = 1; - } - else if (b444 == false && b333 == true) - { - fanspeed = 2; - } - else if (b444 == true && b333 == true) - { - fanspeed = 3; - } - else if (b444 == false && b333 == false) - { - fanspeed = 0; - } - else - { - - } - - - foreach (bool item in bit) - { - Console.WriteLine(item.ToString()); - } - - FileRe(); - Console.ReadKey(); - SC(); - var US = DeviceType.Relay; - var enumValue = (DeviceType)Enum.ToObject(typeof(Device), US); - - - byte Chakaffsdf = CSRedisCacheHelper.Get_Partition("NNNNNNNNNNN", 5); - long lll = -9223372036854775807; - lll = lll + 5; - Console.WriteLine(lll); - StepInfo s = new StepInfo(); - s.Step = 2; - s.StepDescription = "你好这是一个测试数据"; - string ti = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); - s.TriggerTime = ti; - - string NNN35 = Newtonsoft.Json.JsonConvert.SerializeObject(s); - CSRedisCacheHelper.Publish("redis-roomstatus-monitor", NNN35); - return; - - - Interlocked.Exchange(ref LLL333, 3333); - Interlocked.Exchange(ref LLL333, 5555); - for (int i = 0; i < 10; i++) - { - T_T(); - } - BOSS mnm = new BOSS(); - mnm.AAA(); - CSRedisCacheHelper.redis3.LPush("abc", "a1"); - CSRedisCacheHelper.redis3.LPush("abc", "a2"); - CSRedisCacheHelper.redis3.LPush("abc", "a3"); - var a23 = CSRedisCacheHelper.redis3.LPop("abc"); - var a24 = CSRedisCacheHelper.redis3.LPop("abc"); - var a25 = CSRedisCacheHelper.redis3.LPop("abc"); - - var Time = "*/10 * * * *"; - string[] datalll = Time.Split('/', ' '); - var ak47 = new ValueTuple>("__keyevent@3__:expired", (sube) => - { - var n = sube.Body; - Console.WriteLine("iiiiiiiiiiiiiiiiiiiii"); - }); - CSRedisCacheHelper.redis3.Subscribe(ak47); - CSRedisCacheHelper.redis3.Set("uuu", "xxxx", 5); - Console.ReadLine(); - CSRedisCacheHelper.Set_Partition("hello", 0x01, 5); - byte Chaka = CSRedisCacheHelper.Get_Partition("hello", 5); - RedisTakeCardStatus xxx = new RedisTakeCardStatus(); - xxx.HostNUMBER = "iiiii"; - xxx.OriginalDat = new List { 0x01, 0x02, 0x03, 0xff, 0xce }; - var X1 = Newtonsoft.Json.JsonConvert.SerializeObject(xxx); - DataTongJi.CeShi(); - - byte[] NU1 = new byte[] { 0x00, 0xbb, 0xcc }; - byte[] NU2 = new byte[] { 0xbb, 0xcc }; - - //bool GAB= ContainsSubsequence(NU1.ToList(),NU2.ToList()); - - Console.ReadLine(); - CSRedisCacheHelper.redis5.HMSet("TestHDel", "a", "b"); - CSRedisCacheHelper.redis5.Expire("TestHDel", 20); - - int I = CSRedisCacheHelper.redis5.HGetAll("TestHDel").Count; - FanHui(); - XuanZhuResponse x = new XuanZhuResponse(); - x.code = "1085"; - x.roomNumber = "8088"; - MyHttp.SendHttpData("http://f-xcx.blv-oa.com/rcu/report", x); - new Program().Run(); - - var uuu23 = Common.CPUData.GetCPU(); - Console.WriteLine(uuu23); - - string[] vvv = File.ReadAllLines("234.csv"); - foreach (var item in vvv) - { - var now = DateTime.Now; - //string strn = "00:00,00:15,00:30,00:45,01:00,01:15,01:30,01:45,02:00,02:15,02:30,02:45,03:00,03:15,03:30,03:45,04:00,04:15,04:30,04:45,05:00,05:15,05:30,05:45,06:00,06:15,06:30,06:45,07:00,07:15,07:30,07:45,08:00,08:15,08:30,08:45,09:00,09:15,09:30,09:45,10:00,10:15,10:30,10:45,11:00,11:15,11:30,11:45,12:00,12:15,12:30,12:45,13:00,13:15,13:30,13:45,14:00,14:15,14:30,14:45,15:00,15:15,15:30,15:45,16:00,16:15,16:30,16:45,17:00,17:15,17:30,17:45,18:00,18:15,18:30,18:45,19:00,19:15,19:30,19:45,20:00,20:15,20:30,20:45,21:00,21:15,21:30,21:45,22:00,22:15,22:30,22:45,23:00,23:15,23:30,23:45"; - foreach (string timing in item.Split(',')) - { - Console.WriteLine(item); - DateTime dtTiming = Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " " + timing);// row["Timing"].ToString()); - double totalMinutes = (now - dtTiming).TotalMinutes; - } - } - byte gh = 0x1b; - string HHH789 = gh.ToString("000"); - TCLCommon.SendData("1001", "1002", "111", "222", "30"); - - long NNN99 = CSRedisCacheHelper.Get_Partition("uuuuuuuuuuuuu", 1); - MemoryCacheHelper.Set("a", "0x19", DateTimeOffset.Now.AddSeconds(5)); - Thread.Sleep(6000); - var QQQQQ = MemoryCacheHelper.Get("a"); - VVV_VVV(); - - - var client1 = new RestClient("https://skyworth-business.com"); - var request1 = new RestRequest("/skill-api/web/sync/remoteControl", Method.POST); - - request1.AddHeader("authCode", "123e4567e89b12d3a456426614174003"); - //request1.AddJsonBody(Newtonsoft.Json.JsonConvert.SerializeObject(WER)); - //request1.AddJsonBody(WER); - - var Responsse = client1.Execute(request1); - var AAF = Responsse.Content; - Console.WriteLine(AAF); - - var client = new RestClient("https://pms.boonlive-rcu.com/"); - //var client = new RestClient(Currentsys_address); - var request = new RestRequest("api/GetRoomServiceList", Method.GET); - Dictionary dic111 = new Dictionary(); - dic111.Add("creatDate", "2021-03-29"); - dic111.Add("roomNumber", "二楼H区"); - dic111.Add("code", "1085"); - string jsstr = Newtonsoft.Json.JsonConvert.SerializeObject(dic111); - request.AddParameter("jsonData", jsstr); - var response = client.Execute(request); - string erlangstr = "中国abc"; - var q23 = Encoding.UTF8.GetBytes(erlangstr); - var q33 = Encoding.Unicode.GetBytes(erlangstr); - var q32 = Encoding.ASCII.GetBytes(erlangstr); - QianLiMa_PMS.QiYong("1008", "add"); - ushort aac = 50; - ushort bbc = 110; - double d = (double)aac; - double d2 = (double)bbc; - double uuu = (d / bbc) * 100; - int roundedNumber111 = (int)Math.Round(uuu); - string BaiFenBi = roundedNumber111.ToString() + "%"; - string Key = CacheKey.HostInfo_Key_HostNumber + "_" + "061004096203"; - object obj = MemoryCacheHelper.Get(Key); - if (obj != null) - { - Host host = obj as Host; - } - - List uuua = new List() { - new User() { username = "aaa", password = "ssss" }, - new User() { username = "aaa", password = "ssss" }, - new User() { username = "aaa", password = "ssss" }, - new User() { username = "aaa", password = "ssss" }, - new User() { username = "aaa", password = "ssss" } - }; - var VVV = uuua.Distinct(new User()).ToList(); - string uuid = Guid.NewGuid().ToString("N"); - JobRequest(); - - byte colorValue = 0x02; // 假设这是你想转换的字节值 - FF color = (FF)colorValue; // 直接转换 - - byte[] osk = new byte[] { 0xAA, 0x0c, 0x01, 0x01, 0x7a, 0x74, 0x01, 0x01, 0x10, 0x01, 0x00, 0x0a }; - - for (int i = 0; i < 1000000; i++) - { - var reader = StreamReaderPool.GetReader(osk); - bool nnn = reader.ReadBoolean(); - bool SysLock = reader.ReadBoolean(); - } - - Console.WriteLine("aaaaaaaaaaaaa"); - for (int i = 0; i < 1000000; i++) - { - - - byte[] bbbyyy = osk.Take(3).ToArray(); - Task.Factory.StartNew((state) => - { - var NNN = state as byte[]; - //byte[] bbbyyy = NNN.Take(3).ToArray(); - using (MemoryStream stream = new MemoryStream(NNN, 0, NNN.Length)) - { - using (BinaryReader reader = new BinaryReader(stream)) - { - bool nnn = reader.ReadBoolean(); //RCU是否锁定:0/否,1/是 - bool SysLock = reader.ReadBoolean(); //RCU是否锁定:0/否,1/是 - int CardType = reader.ReadByte(); //房卡类型:0/无人,1/有人,2/客人,3/经理,4/服务员 - bool Door = reader.ReadBoolean(); //门磁开关:1/开,2/关 - ushort ElecQty = reader.ReadUInt16(); //门锁电量,单位:MV - int HostTemp = reader.ReadByte(); //主机温 - } - } - }, osk); - } - for (int i = 0; i < 1000000; i++) - { - - using (MemoryStream stream = new MemoryStream(osk, 0, osk.Length)) - { - using (BinaryReader reader = new BinaryReader(stream)) - { - bool nnn = reader.ReadBoolean(); //RCU是否锁定:0/否,1/是 - bool SysLock = reader.ReadBoolean(); //RCU是否锁定:0/否,1/是 - int CardType = reader.ReadByte(); //房卡类型:0/无人,1/有人,2/客人,3/经理,4/服务员 - bool Door = reader.ReadBoolean(); //门磁开关:1/开,2/关 - ushort ElecQty = reader.ReadUInt16(); //门锁电量,单位:MV - int HostTemp = reader.ReadByte(); //主机温 - } - } - } - - Console.WriteLine("aaaaaaaaaaaaaaa"); - for (int i = 0; i < 100; i++) - { - Task.Factory.StartNew(() => - { - Console.WriteLine(i.ToString()); - }); - } - int rrr = 0; - int.TryParse("220", out rrr); - double everydata = rrr / 2.55; - int roundedNumber = (int)Math.Round(everydata); - try - { - bool bka = SmartRobotTest(); - Console.WriteLine(bka); - Task.Factory.StartNew(() => - { - int aaa = 3; - int bbb1 = 0; - int c = aaa / bbb1; - }).ContinueWith((ttt) => - { - if (ttt.IsFaulted) - { - var v = ttt.Exception.InnerExceptions; - foreach (var item in v) - { - Console.WriteLine(item.Message); - } - } - }); - } - catch (AggregateException) - { - Console.WriteLine(""); - } - int[] a = new int[] { 1, 2, 3, 4, 5 }; - var sum = a.Aggregate(new List(), (acc, current) => - { - if (current % 2 == 0) - { - acc.Add(current); - } - return acc; - }); - Console.WriteLine(sum); - Domain.IoTAliGenieEntity.Request req = new Domain.IoTAliGenieEntity.Request(); - req.baseInfo = new Domain.IoTAliGenieEntity.BaseInfo() - { - appName = "xiaodu", - hotelId = "1", - requestId = "eeee", - requestTime = 300000, - roomNo = "2001", - token = ")%(&$(*%&$U*(%R&$(*Y%$*(" - }; - req.command = new Domain.IoTAliGenieEntity.Command() - { - commandType = "devicecommand", - devices = new List() { } - - }; - - string hhg = Newtonsoft.Json.JsonConvert.SerializeObject(req); - - CSRedisCacheHelper.Forever("nnn", "ddd"); - string redisHostStr = "127.0.0.1:6379"; - var redis = new CSRedisClient(redisHostStr);//+ ",password=,defaultDatabase=0,poolsize=500,ssl=false,writeBuffer=10240,prefix="); - var redis1 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=1"); - var redis2 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=2"); - - redis.Set("11", "22"); - redis1.Set("22", "22"); - redis2.Set("33", "22"); - - var cache = CacheFactory.Build("getStartedCache", settings => - { - settings.WithSystemRuntimeCacheHandle("handleName"); - }); - cache.Add("keyA", "valueA"); - - cache.Put("keyB", 23); - - cache.Update("keyB", v => 42); - - for (int i = 0; i < 100; i++) - { - string ll = "hhh"; - switch (ll) - { - case "hhh": - Console.WriteLine("nnnnnnnn"); - break; - default: - break; - } - Console.WriteLine("1111111111111"); - } - DateTime dddv = DateTime.Now.ToLocalTime(); - ushort iii = 15; - // 假设我们有一个BitArray - - byte[] bbbddd = BitConverter.GetBytes(iii); - BitArray bitArray = new BitArray(bbbddd); - - var qqq1 = bitArray.Cast().Take(4).ToArray(); - var qqq2 = bitArray.Cast().Skip(4).Take(4).ToArray(); - byte hhhg = CombineBitsToByte(qqq1[0], qqq1[1], qqq1[2], qqq1[3]); - - ushort hhh = 75; - - BitArray bitnew = new BitArray(hhh); - foreach (bool item in bitnew) - { - Console.WriteLine(item); - } - byte bbb = (byte)hhh; - - TFTPReceiver tf = new TFTPReceiver(); - byte[] bbbbbb = tf.CreateDataPacket(); - string str = "AA 55 17 00 54 33 53 41 02 E5 94 3D 04 2B 1B 34 D0 B8 11 2B 1B C5 F9 "; - str = str.Replace(" ", ""); - byte[] data = TG(str); - - - - var SystemHeader = DecodeSystemHeader(data); - var cmdtype = (CommandType)SystemHeader.Value.CmdType; - long hotelCode = SystemHeader.Value.HostNumber.ToHotelCode();//获取酒店编码 - - int startIndex = StructConverter.SizeOf(SystemHeader); - SearchHostPacketReply? reply = StructConverter.BytesToStruct(data, startIndex, typeof(SearchHostPacketReply)) as SearchHostPacketReply?; - - - string mac = BitConverter.ToString(reply.Value.MAC); - string version = reply.Value.Version; - - - //string sss = "固件:BLV-C5 || Launcher_C1F_V04 || C1F_A_L4_3C_241206_NM.bin"; - //string[] ddd = sss.Split(new string[] { "||" }, StringSplitOptions.None); - //TimeSpan ts = DateTime.Now.ToLocalTime() - new DateTime(1970, 1, 1, 8, 0, 0, 0, DateTimeKind.Utc); - //string current_timestamp = Convert.ToInt64(ts.TotalSeconds).ToString(); - //KongQiReport re = new KongQiReport(); - //re.hotel_code = "1003"; - //re.room_no = "1002"; - //re.time = "2022-12-33"; - //var client1 = new RestClient("http://localhost:5026"); - //var request1 = new RestRequest("/rcu/vi/airjson", Method.POST); - ////request1.RequestFormat = DataFormat.Json; - ////request1.AddHeader("Context-Type", "application/json"); - - ////string sss = Newtonsoft.Json.JsonConvert.SerializeObject(re); - ////logger.Error("空气质量送了数据:" + AirReport_Address+" data: "+json); - - //request1.AddBody(re); - - //client1.ExecuteAsync(request1, (response) => - //{ - // string result = response.Content; - //}); - Console.ReadKey(); - } - - static public bool SmartRobotTest() - { - string st = "11:00"; - string et = "09:00"; - string[] st_a = st.Split(':'); - string[] et_a = et.Split(':'); - - int h_st = int.Parse(st_a[0]); - int M_st = int.Parse(st_a[1]); - - int h_et = int.Parse(et_a[0]); - int M_et = int.Parse(et_a[1]); - - int y = DateTime.Now.Year; - int m = DateTime.Now.Month; - int d = DateTime.Now.Day; - int hh = DateTime.Now.Hour; - int mm = DateTime.Now.Minute; - int ss = DateTime.Now.Second; - var t1 = new DateTime(y, m, d, h_st, M_st, ss); - var t2 = new DateTime(y, m, d, h_et, M_et, ss); - - bool ShiJian = false; - //正常逻辑 - if (t2 >= t1) - { - var ti = DateTime.Now; - //如果当前时间大于 起 小于 至,就代表 确实是 禁用 - if (ti >= t1 && ti <= t2) - { - ShiJian = true; - } - } - else - { - var ti = DateTime.Now; - var zero_ti = new DateTime(y, m, d, 23, 59, 59); - var t3 = t2.AddDays(1); - if (ti < zero_ti && ti >= t1 && ti <= t3) - { - return true; - } - } - - - bool dis = true; - return dis && ShiJian; - } - public static byte[] TG(string hexString) - { - - - char[] hexCharacters = hexString.ToCharArray(); - byte[] byteArray = new byte[hexCharacters.Length / 2]; - - for (int i = 0; i < byteArray.Length; i++) - { - string hexVal = string.Concat(hexCharacters[i * 2], hexCharacters[i * 2 + 1]); - byteArray[i] = Convert.ToByte(hexVal, 16); - } - return byteArray; - - } - private static SystemHeader? DecodeSystemHeader(byte[] data) - { - return StructConverter.BytesToStruct(data, typeof(SystemHeader)) as SystemHeader?; - } - } - public static class StreamReaderPool - { - // 线程安全的对象池(按字节数组长度区分) - private static readonly ConcurrentDictionary> _readers = - new ConcurrentDictionary>(); - - // 获取或创建与指定字节数组关联的 BinaryReader - public static BinaryReader GetReader(byte[] data) - { - var lazyReader = _readers.GetOrAdd(data.Length, length => - new Lazy(() => - { - var stream = new MemoryStream(data, 0, length); - return new BinaryReader(stream); - }, LazyThreadSafetyMode.ExecutionAndPublication)); - - // 重置流位置以便复用 - var reader = lazyReader.Value; - reader.BaseStream.Position = 0; - return reader; - } - } -} diff --git a/ConsoleApplication1/Properties/AssemblyInfo.cs b/ConsoleApplication1/Properties/AssemblyInfo.cs deleted file mode 100644 index c834f47..0000000 --- a/ConsoleApplication1/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("ConsoleApplication1")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ConsoleApplication1")] -[assembly: AssemblyCopyright("Copyright © 2024")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("294a52c2-b3d2-4af1-a63e-358eb085073d")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 内部版本号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ConsoleApplication1/app.config b/ConsoleApplication1/app.config deleted file mode 100644 index 6327709..0000000 --- a/ConsoleApplication1/app.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ConsoleApplication666/ConsoleApplication666.csproj b/ConsoleApplication666/ConsoleApplication666.csproj deleted file mode 100644 index ebeb87b..0000000 --- a/ConsoleApplication666/ConsoleApplication666.csproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {E5890D7A-EB40-4864-B6D8-5B74A443A3F2} - Exe - Properties - ConsoleApplication666 - ConsoleApplication666 - v4.0 - Client - 512 - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ConsoleApplication666/Program.cs b/ConsoleApplication666/Program.cs deleted file mode 100644 index fccdc67..0000000 --- a/ConsoleApplication666/Program.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; -using System.Numerics; -using System.Collections; - -namespace ConsoleApplication666 -{ - class Program - { - [DllImport("kernel32.dll")] - private static extern void GetSystemTimePreciseAsFileTime(out long fileTime); - - // 将 FILETIME (long) 转换为 DateTime - public static DateTime GetNowPrecise() - { - long fileTime; - GetSystemTimePreciseAsFileTime(out fileTime); - DateTime localTime = DateTime.FromFileTimeUtc(fileTime).ToLocalTime(); - return localTime; - - } - 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(); - - BitArray bi = new BitArray(H); - - - // 从字节数组创建 - byte[] bytes = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - BigInteger fromBytes = new BigInteger(bytes); - - // 基本运算 - BigInteger sum = hugeNumber + 1; - BigInteger product = hugeNumber * 2; - - Console.WriteLine("大数字: {0}", hugeNumber); - Console.WriteLine("加1: {0}", sum); - Console.WriteLine("乘2: {0}", product); - - // 比较操作 - if (hugeNumber > BigInteger.Parse("100000000000000000000")) - { - Console.WriteLine("这是一个非常大的数字"); - } - - DateTime ddd = GetNowPrecise(); - string tii = ddd.ToString("yyyy-MM-dd HH:mm:ss.ffffff"); - Console.WriteLine(tii); - Console.ReadLine(); - } - } -} diff --git a/ConsoleApplication666/Properties/AssemblyInfo.cs b/ConsoleApplication666/Properties/AssemblyInfo.cs deleted file mode 100644 index f960fea..0000000 --- a/ConsoleApplication666/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("ConsoleApplication666")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ConsoleApplication666")] -[assembly: AssemblyCopyright("Copyright © 2025")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("0182759e-6111-44df-967d-cf14ebab598e")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 内部版本号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/RCUHost/Config/Receiver.xml b/RCUHost/Config/Receiver.xml index f6f0a7b..0d161e2 100644 --- a/RCUHost/Config/Receiver.xml +++ b/RCUHost/Config/Receiver.xml @@ -178,6 +178,7 @@ + diff --git a/RCUHost/IDeviceControlReceiver.cs b/RCUHost/IDeviceControlReceiver.cs index fdbffc1..fbf9f19 100644 --- a/RCUHost/IDeviceControlReceiver.cs +++ b/RCUHost/IDeviceControlReceiver.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using Domain; using RCUHost.Protocols; +using System.Net; namespace RCUHost { @@ -15,6 +16,9 @@ namespace RCUHost /// /// void Send(Host host, Device device); + + void SendWithEndPoint( Device device,IPEndPoint endpoint); + void Send_Repeat(string Key,Host host, Device device); /// diff --git a/RCUHost/Implement/DeviceControlReceiver.cs b/RCUHost/Implement/DeviceControlReceiver.cs index 7b65483..595f165 100644 --- a/RCUHost/Implement/DeviceControlReceiver.cs +++ b/RCUHost/Implement/DeviceControlReceiver.cs @@ -7,6 +7,7 @@ using Common; using Domain; using RCUHost.Protocols; using CommonEntity; +using System.Net; namespace RCUHost.Implement { @@ -14,11 +15,21 @@ namespace RCUHost.Implement { private static log4net.ILog logger = log4net.LogManager.GetLogger(typeof(DeviceControlReceiver)); + + public void SendWithEndPoint(Device device, IPEndPoint endpoint) + { + SendWithEndPoint(new List { device }, endpoint); + } + public void SendWithEndPoint(IList devices, IPEndPoint endpoint) + { + var data = CreateDeviceControlPacket(devices); + SendAndPushCommandQueueWithEndPoint(data, endpoint);// host.IP, host.Port); + } + public void Send(Host host, Device device) { Send(host, new List { device }); } - public void Send(Host host, IList devices) { var data = CreateDeviceControlPacket(devices); @@ -33,9 +44,9 @@ namespace RCUHost.Implement //string nnn = builder.ToString().Trim(); //logger.Error(string.Format("给酒店({0})客房({1})发送控制命令{2}", host.SysHotel.Code, host.RoomNumber,builder.ToString())); } - public void Send_Repeat(string Key,Host host, Device device) + public void Send_Repeat(string Key, Host host, Device device) { - Send_Repeat(Key,host, new List { device }); + Send_Repeat(Key, host, new List { device }); } public void Send_Repeat(string PrefixKey, Host host, IList devices) { @@ -223,5 +234,6 @@ namespace RCUHost.Implement { get { return CommandType.DeviceControl; } } + } } diff --git a/RCUHost/Implement/GenericReceiverBase.cs b/RCUHost/Implement/GenericReceiverBase.cs index e070b22..a97308f 100644 --- a/RCUHost/Implement/GenericReceiverBase.cs +++ b/RCUHost/Implement/GenericReceiverBase.cs @@ -278,7 +278,7 @@ namespace RCUHost.Implement } catch (Exception ex) { - logger.Error("发送:"+ex.Message); + logger.Error("发送:" + ex.Message); logger.Error(ex.StackTrace); } } @@ -304,6 +304,10 @@ namespace RCUHost.Implement HostServer.SendAndPushCommandQueue(data, ipAndPort.ToString().Split(':')[0], Convert.ToInt32(ipAndPort.ToString().Split(':')[1])); } } + protected void SendAndPushCommandQueueWithEndPoint(byte[] data, IPEndPoint endpoint) + { + HostServer.SendAndPushCommandQueue(data, endpoint); + } /// /// 回复下位机命令 /// diff --git a/RCUHost/Implement/HostServer.cs b/RCUHost/Implement/HostServer.cs index f973b69..9cb1293 100644 --- a/RCUHost/Implement/HostServer.cs +++ b/RCUHost/Implement/HostServer.cs @@ -21,6 +21,7 @@ using System.Threading; using System.Collections; using Newtonsoft.Json; using Microsoft.IO; +using System.Reflection; namespace RCUHost.Implement { @@ -649,14 +650,15 @@ namespace RCUHost.Implement //如果不存在就处理 else { - //GaiXie g = new GaiXie(); - //g.Data = receiveBuffer111; - //g.IPEndPoint = remoteEP111.ToString(); - //var data = Newtonsoft.Json.JsonConvert.SerializeObject(g); - string s1 = Tools.ByteToString(receiveBuffer111); string data = s1 + "#" + remoteEP111.ToString(); + if (VVV.CmdType == 0x0E || VVV.CmdType == 0x01 || VVV.CmdType == 0x36) + { + ushort MyFrameNO = context.SystemHeader.Value.FrameNo; + byte[] framenolist = BitConverter.GetBytes(MyFrameNO); + Reply(context, framenolist); + } //ProcessData(data); CSRedisCacheHelper.StreamAdd(1, UDPAllDataKey, data); @@ -676,15 +678,15 @@ namespace RCUHost.Implement } else { - //GaiXie g = new GaiXie(); - //g.Data = receiveBuffer111; - //g.IPEndPoint = remoteEP111.ToString(); - //var data = Newtonsoft.Json.JsonConvert.SerializeObject(g); - string s1 = Tools.ByteToString_NoWhiteSpace(receiveBuffer111); string data = s1 + "#" + remoteEP111.ToString(); - //ProcessData(data); + if (VVV.CmdType == 0x0E || VVV.CmdType == 0x01 || VVV.CmdType == 0x36) + { + ushort MyFrameNO = context.SystemHeader.Value.FrameNo; + byte[] framenolist = BitConverter.GetBytes(MyFrameNO); + Reply(context, framenolist); + } CSRedisCacheHelper.StreamAdd(1, UDPAllDataKey, data); } } @@ -1221,8 +1223,6 @@ namespace RCUHost.Implement /// 处理数据 /// /// - //private void ProcessData(ReceiverContext context111, string hotelCode) - //private void ProcessData(GaiXie gga) private void ProcessData(string gga) { //GaiXie gga = new GaiXie(); @@ -1337,12 +1337,13 @@ namespace RCUHost.Implement #region 如果是0E 01就直接回复 //36 就是新版本的0E - if (cmdType == 0x0E || cmdType == 0x01 || cmdType == 0x36) - { - StepTongJi.SendInfo(1.1, "0E 01指令回复开始", context111.MessageID, context111.IsMonitor); - Reply(context111, framenolist); - StepTongJi.SendInfo(1.2, "0E 01指令回复结束", context111.MessageID, context111.IsMonitor); - } + //回复放到上面 + //if (cmdType == 0x0E || cmdType == 0x01 || cmdType == 0x36) + //{ + //StepTongJi.SendInfo(1.1, "0E 01指令回复开始", context111.MessageID, context111.IsMonitor); + //Reply(context111, framenolist); + //StepTongJi.SendInfo(1.2, "0E 01指令回复结束", context111.MessageID, context111.IsMonitor); + //} #endregion ///注册指令 也要推送 @@ -1743,7 +1744,8 @@ namespace RCUHost.Implement } } - + public IDeviceControlReceiver DeviceControlReceiver { get; set; } + public static System.Reflection.PropertyInfo[] properties = typeof(HotelSeason).GetProperties();//获取所有属性 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, ushort MyFrameNO) @@ -1836,6 +1838,8 @@ namespace RCUHost.Implement if (qudian == 0x01) { VoiceRobotTrigger(1, hotelCode, HostNNN); + + } else if (qudian == 0x02) { @@ -1846,6 +1850,18 @@ namespace RCUHost.Implement } + #region 季节触发 + + try + { + JiJieChuLi(hotelCode, HostNNN, EndPoint, qudian); + } + catch (Exception ex) + { + logger.Error("季节出错了:"+ex.Message); + } + #endregion + NewVersionHexData ns = new NewVersionHexData(); ns.CmdType = 0x35; ns.HotelCode = hotelCode; @@ -2029,7 +2045,7 @@ namespace RCUHost.Implement //给宝镜发送完整的数据 string hexdata = Tools.ByteToString(context111.Data); - CSRedisCacheHelper.Publish("redis-baojing-powerdata", hexdata); + //CSRedisCacheHelper.Publish("redis-baojing-powerdata", hexdata); try @@ -2762,6 +2778,73 @@ namespace RCUHost.Implement }, tuple); } + /// + /// 季节处理 + /// + /// + /// + /// + /// + private void JiJieChuLi(string hotelCode, string HostNNN, string EndPoint, byte qudian) + { + //3、取电或断电时季节空调处理 + HotelSeason hotelSeason = QuanJuVar.HotelSeaon.FirstOrDefault(A => A.SysHotel.Code.Equals(hotelCode)); + if (hotelSeason != null) + { + int conditonType = (qudian == 1 ? 2 : 3); + List list = QuanJuVar.HotelAirControl.Where(A => A.SysHotel!=null&&!string.IsNullOrEmpty(A.SysHotel.Code)&& A.SysHotel.Code.Equals(hotelCode) && A.ConditionType == conditonType && A.ActiveIndicator).ToList(); + string ttt = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HostNNN)[0]; + if (string.IsNullOrEmpty(ttt)) + { + return; + } + string[] NNN111 = ttt.Split('#'); + string HostID = NNN111[0]; + string RoomTypeID = NNN111[1]; + int room_type_id = int.Parse(RoomTypeID); + var hostModals = QuanJuVar.RoomTypeDeviceModal.Where(A => A.RoomType.ID == room_type_id && A.Type == DeviceType.AirConditioner && A.ActiveIndicator).ToList(); + if (list.Count > 0 && hostModals.Count > 0) + { + //System.Reflection.PropertyInfo[] properties = typeof(HotelSeason).GetProperties();//获取所有属性 + foreach (HotelAirControl item in list) + { + foreach (PropertyInfo prop in properties)//遍历属性 + { + if (prop.Name == "Month" + DateTime.Now.Month.ToString() && Convert.ToInt16(prop.GetValue(hotelSeason, null)) == item.Season)//当前月份所属该季节,则发送命令给rcu设置空调 + { + var D2 = item; + Task.Factory.StartNew(() => + { + System.Threading.Thread.Sleep(item.DelayTime * 1000);//延迟执行 + foreach (RoomTypeModal hostModal1 in hostModals) + { + Device device1 = new Device(); + device1.Address = hostModal1.ModalAddress; + device1.AddressType = AddressType.DeviceAddress; + device1.Type = DeviceType.AirConditioner; + device1.Status = (byte)D2.Status; + device1.Brightness = 0; + device1.Temperature = (byte)D2.SettingTemp; + device1.FanSpeed = (byte)D2.FanSpeed; + device1.Mode = (byte)D2.Mode; + device1.Valve = 0; + device1.AirExecMode = (D2.Status << 14) + (D2.Mode << 12) + (D2.FanSpeed << 10) + (0 << 8) + D2.SettingTemp;//空调执行方式和内容 + + var span = EndPoint.Split(':'); + string ip = span[0]; + string port = span[1]; + IPEndPoint eee = new IPEndPoint(IPAddress.Parse(ip), int.Parse(port)); + DeviceControlReceiver.SendWithEndPoint(device1, eee); + } + }); + break; + } + } + } + } + } + } + /// /// 碳达人上报 /// diff --git a/RCUHost/Implement/New_RoomStatusReceiver.cs b/RCUHost/Implement/New_RoomStatusReceiver.cs index 03e4292..d263a5c 100644 --- a/RCUHost/Implement/New_RoomStatusReceiver.cs +++ b/RCUHost/Implement/New_RoomStatusReceiver.cs @@ -418,21 +418,32 @@ namespace RCUHost.Implement else { //这里有点问题,如果一个Model删除了,又更新了,那它的ID就变了。但是内存中记录的没变,所以这里会出问题 - var hostModal_old = HostModalRepository.Get(host.ID, device.Value.Address); + //var hostModal_old = HostModalRepository.Get(host.ID, device.Value.Address); + string HostID_O = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HOSTNUMBER)[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); + var hostModal_old = QuanJuVar.RoomTypeDeviceModal.FirstOrDefault(A => A.RoomType.ID == room_type_id && A.ModalAddress.Equals(device.Value.Address)); + if (hostModal_old != null) { HostModal_Cache c = new HostModal_Cache(); - c.HostID = hostModal_old.HostID; - c.ModalType = hostModal_old.Modal.Type; + c.HostID = host.ID; + c.ModalType = hostModal_old.Type; c.AirConditionData = new AirConditionData(); c.Modal = new RoomTypeModalCache() { - RoomTypeID = hostModal_old.Modal.RoomType.ID, - ID = hostModal_old.Modal.ID, - Name = hostModal_old.Modal.Name, - ModalAddress = hostModal_old.Modal.ModalAddress, - ActiveIndicator = hostModal_old.Modal.ActiveIndicator, - Sort = hostModal_old.Modal.Sort + RoomTypeID = hostModal_old.RoomType.ID, + ID = hostModal_old.ID, + Name = hostModal_old.Name, + ModalAddress = hostModal_old.ModalAddress, + ActiveIndicator = hostModal_old.ActiveIndicator, + Sort = hostModal_old.Sort }; hostModal = c; } @@ -735,93 +746,6 @@ namespace RCUHost.Implement { } - #region 季节触发 - - //3、取电或断电时季节空调处理 - HotelSeason hotelSeason = null; - string KKKAAA = "Season_" + host.SysHotel.ID; - string KongZhi = "Season_WuKong" + host.SysHotel.ID; - object ShiFouWeiKong = MemoryCacheHelper.Get(KongZhi); - int bf = 1; - if (ShiFouWeiKong != null) - { - bf = (int)ShiFouWeiKong; - } - if (bf == 0) - { - var UIO = MemoryCacheHelper.Get(KKKAAA); - if (UIO != null) - { - hotelSeason = (HotelSeason)UIO; - } - else - { - hotelSeason = HotelSeasonRepository.LoadByHotelID(host.SysHotel.ID);//获取该酒店下季节设置记录 - if (hotelSeason != null) - { - MemoryCacheHelper.Set(KongZhi, 0, DateTimeOffset.Now.AddMinutes(20)); - MemoryCacheHelper.Set(KKKAAA, hotelSeason, DateTimeOffset.Now.AddMinutes(20)); - } - else - { - MemoryCacheHelper.Set(KongZhi, 1, DateTimeOffset.Now.AddMinutes(20)); - } - } - } - else - { - - hotelSeason = HotelSeasonRepository.LoadByHotelID(host.SysHotel.ID);//获取该酒店下季节设置记录 - if (hotelSeason != null) - { - MemoryCacheHelper.Set(KongZhi, 0, DateTimeOffset.Now.AddMinutes(20)); - MemoryCacheHelper.Set(KKKAAA, hotelSeason, DateTimeOffset.Now.AddMinutes(20)); - } - else - { - MemoryCacheHelper.Set(KongZhi, 1, DateTimeOffset.Now.AddMinutes(20)); - } - } - - if (hotelSeason != null) - { - int conditonType = (hostModal.Status == 1 ? 2 : 3); - List list = HotelAirControlRepository.LoadAll(host.SysHotel.ID, conditonType, true); - List hostModals = HostModalRepository.LoadByHostID(host.ID).Where(r => r.Modal.Type == DeviceType.AirConditioner && r.Modal.ActiveIndicator).ToList();//获取启用的空调回路 - if (list.Count > 0 && hostModals.Count > 0) - { - System.Reflection.PropertyInfo[] properties = typeof(HotelSeason).GetProperties();//获取所有属性 - foreach (HotelAirControl item in list) - { - foreach (System.Reflection.PropertyInfo prop in properties)//遍历属性 - { - if (prop.Name == "Month" + DateTime.Now.Month.ToString() && Convert.ToInt16(prop.GetValue(hotelSeason, null)) == item.Season)//当前月份所属该季节,则发送命令给rcu设置空调 - { - System.Threading.Thread.Sleep(item.DelayTime * 1000);//延迟执行 - var D2 = item; - foreach (HostModal hostModal1 in hostModals) - { - Device device1 = new Device(); - device1.Address = hostModal1.Modal.ModalAddress; - device1.AddressType = AddressType.DeviceAddress; - device1.Type = DeviceType.AirConditioner; - device1.Status = (byte)D2.Status; - device1.Brightness = 0; - device1.Temperature = (byte)D2.SettingTemp; - device1.FanSpeed = (byte)D2.FanSpeed; - device1.Mode = (byte)D2.Mode; - device1.Valve = 0; - device1.AirExecMode = (D2.Status << 14) + (D2.Mode << 12) + (D2.FanSpeed << 10) + (0 << 8) + D2.SettingTemp;//空调执行方式和内容 - //这里只需要host的mac和number或者 ip - DeviceControlReceiver.Send(host, device1); - } - break; - } - } - } - } - } - #endregion #endregion break; } @@ -1187,7 +1111,7 @@ namespace RCUHost.Implement //电量:0-100 ushort dianliang = (ushort)f2; string DLKey = CacheKey.DianLiang + "_" + HOSTNUMBER; - CSRedisCacheHelper.Set_PartitionWithForever(DLKey,dianliang.ToString(),5); + CSRedisCacheHelper.Set_PartitionWithForever(DLKey, dianliang.ToString(), 5); } //更新主机主表 if (hostModal.Modal.Sort == 1)//.ModalAddress == "020001000") @@ -1230,123 +1154,129 @@ namespace RCUHost.Implement if (hostModal.ModalType == DeviceType.ServiceInfo) //if (isonly_serviceinfo) { - int StatusFlag = hostModal.Status; - HostModal FinallyData = new HostModal(); - FinallyData.HostID = hostModal.HostID; - FinallyData.Status = hostModal.Status; - FinallyData.Brightness = hostModal.Brightness; - FinallyData.CurrentTemp = hostModal.AirConditionData.CurrentTemp; - FinallyData.FanSpeed = hostModal.AirConditionData.FanSpeed; - FinallyData.Mode = hostModal.AirConditionData.Mode; - FinallyData.SettingTemp = hostModal.AirConditionData.SettingTemp; - FinallyData.UpdateTime = hostModal.UpdateTime; - FinallyData.Valve = hostModal.AirConditionData.Valve; - - FinallyData.Modal = new RoomTypeModal() + if (!string.IsNullOrEmpty(hostModal.Modal.Name)) { - ID = hostModal.Modal.ID, - Name = hostModal.Modal.Name, - ModalAddress = hostModal.Modal.ModalAddress, - ActiveIndicator = hostModal.Modal.ActiveIndicator, - Sort = hostModal.Modal.Sort - }; - FinallyData.Modal.RoomType = new RoomType() - { - ID = hostModal.Modal.RoomTypeID - }; - FinallyData.Modal.ID = hostModal.Modal.ID; - FinallyData.UpdateTime = now; - - #region 有可能有异常 - try - { - HostModalRecord hostModalRecord; - switch (StatusFlag) + bool bbbaaa = hostModal.Modal.Name.Contains("红外") || hostModal.Modal.Name.Contains("infrared") || hostModal.Modal.Name.Contains("雷达") || hostModal.Modal.Name.Contains("radar"); + if (bbbaaa == false) { - case 2://关闭设备 - if (hostModal.UpdateTime.HasValue) - { - hostModal.Time += Convert.ToInt32((now - hostModal.UpdateTime.Value).TotalMinutes); - } - hostModal.UpdateTime = now; - FinallyData.UpdateTime = now; - //阿宝添加内存 - try - { - HostModalRepository.Update(FinallyData);//sbSQL.ToString()); - } - catch (Exception) - { - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 - { - hostModalRecord = new HostModalRecord(); - hostModalRecord.HostID = host.ID; - hostModalRecord.RoomNumber = host.RoomNumber; - hostModalRecord.RoomTypeID = host.RoomType.ID; - hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; - hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; - hostModalRecord.StartTime = now; - hostModalRecord.Status = 2; - try - { - HostModalRecordRepository.Save(hostModalRecord); - } - catch (Exception) - { + int StatusFlag = hostModal.Status; + HostModal FinallyData = new HostModal(); + FinallyData.HostID = hostModal.HostID; + FinallyData.Status = hostModal.Status; + FinallyData.Brightness = hostModal.Brightness; + FinallyData.CurrentTemp = hostModal.AirConditionData.CurrentTemp; + FinallyData.FanSpeed = hostModal.AirConditionData.FanSpeed; + FinallyData.Mode = hostModal.AirConditionData.Mode; + FinallyData.SettingTemp = hostModal.AirConditionData.SettingTemp; + FinallyData.UpdateTime = hostModal.UpdateTime; + FinallyData.Valve = hostModal.AirConditionData.Valve; - } - } - break; - case 1://1打开设备 - hostModal.UpdateTime = now; - FinallyData.UpdateTime = now; + FinallyData.Modal = new RoomTypeModal() + { + ID = hostModal.Modal.ID, + Name = hostModal.Modal.Name, + ModalAddress = hostModal.Modal.ModalAddress, + ActiveIndicator = hostModal.Modal.ActiveIndicator, + Sort = hostModal.Modal.Sort + }; + FinallyData.Modal.RoomType = new RoomType() + { + ID = hostModal.Modal.RoomTypeID + }; + FinallyData.Modal.ID = hostModal.Modal.ID; + FinallyData.UpdateTime = now; - //阿宝这里修改 - try + #region 有可能有异常 + try + { + HostModalRecord hostModalRecord; + switch (StatusFlag) { - HostModalRepository.Update(FinallyData);//sbSQL.ToString()); - } - catch (Exception ex) - { - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 - { - hostModalRecord = new HostModalRecord(); - hostModalRecord.HostID = host.ID; - hostModalRecord.RoomNumber = host.RoomNumber; - hostModalRecord.RoomTypeID = host.RoomType.ID; - hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; - hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; - hostModalRecord.StartTime = now; - hostModalRecord.Status = 1; - try - { - HostModalRecordRepository.Save(hostModalRecord); - } - catch (Exception) - { + case 2://关闭设备 + if (hostModal.UpdateTime.HasValue) + { + hostModal.Time += Convert.ToInt32((now - hostModal.UpdateTime.Value).TotalMinutes); + } + hostModal.UpdateTime = now; + FinallyData.UpdateTime = now; + //阿宝添加内存 + try + { + HostModalRepository.Update(FinallyData);//sbSQL.ToString()); + } + catch (Exception) + { + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 + { + hostModalRecord = new HostModalRecord(); + hostModalRecord.HostID = host.ID; + hostModalRecord.RoomNumber = host.RoomNumber; + hostModalRecord.RoomTypeID = host.RoomType.ID; + hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; + hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; + hostModalRecord.StartTime = now; + hostModalRecord.Status = 2; + try + { + HostModalRecordRepository.Save(hostModalRecord); + } + catch (Exception) + { - } + } + } + break; + case 1://1打开设备 + hostModal.UpdateTime = now; + FinallyData.UpdateTime = now; + + //阿宝这里修改 + try + { + HostModalRepository.Update(FinallyData);//sbSQL.ToString()); + } + catch (Exception ex) + { + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 + { + hostModalRecord = new HostModalRecord(); + hostModalRecord.HostID = host.ID; + hostModalRecord.RoomNumber = host.RoomNumber; + hostModalRecord.RoomTypeID = host.RoomType.ID; + hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; + hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; + hostModalRecord.StartTime = now; + hostModalRecord.Status = 1; + try + { + HostModalRecordRepository.Save(hostModalRecord); + } + catch (Exception) + { + + } + } + break; + default: + break; } - break; - default: - break; + + string StatusKey = "RoomStatus_ServerInfo"; + RCUHost.RCUHostCommon.tools.LanJieData(StatusKey, HOTEL_CODE); + CSRedisCacheHelper.Set_Partition(KKey, hostModal); + } + catch (Exception ex) + { + logger.Error("数据处理error: " + ex.Message); + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + #endregion } - - string StatusKey = "RoomStatus_ServerInfo"; - RCUHost.RCUHostCommon.tools.LanJieData(StatusKey, HOTEL_CODE); - CSRedisCacheHelper.Set_Partition(KKey, hostModal); } - catch (Exception ex) - { - logger.Error("数据处理error: " + ex.Message); - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - #endregion - } #region kafka队列 diff --git a/RCUHost/Implement/RoomStatusReceiver.cs b/RCUHost/Implement/RoomStatusReceiver.cs index db1c636..fc30ee4 100644 --- a/RCUHost/Implement/RoomStatusReceiver.cs +++ b/RCUHost/Implement/RoomStatusReceiver.cs @@ -402,26 +402,6 @@ namespace RCUHost.Implement } - //int hostid = host.ID; - //StringBuilder sb = new StringBuilder(); - //sb.Append(CacheKey.CarbonVIP_Prefix); - //sb.Append("_"); - //sb.Append(hostid.ToString()); - //string Key = sb.ToString(); - //CSRedisCacheHelper.Set(Key, current_status); - //var data = CSRedisCacheHelper.Get(Key); - //if (!string.IsNullOrEmpty(data)) - //{ - // if (!current_status.Equals(data)) - // { - // CarbonDataSend(host, hhhg1); - // } - //} - //else - //{ - // CarbonDataSend(host, hhhg1); - //} - CarbonDataSend(host, hhhg1); var nfc = CarbonScene_SetRepository.GetDataBy(host.ID); @@ -465,8 +445,6 @@ namespace RCUHost.Implement } string KKey = CacheKey.HostModalStatus_Prefix + "_" + host.ID + "_" + device.Value.Address; - - var hostModal = CSRedisCacheHelper.Get_Partition(KKey); if (hostModal != null) { @@ -475,21 +453,33 @@ namespace RCUHost.Implement else { //这里有点问题,如果一个Model删除了,又更新了,那它的ID就变了。但是内存中记录的没变,所以这里会出问题 - var hostModal_old = HostModalRepository.Get(host.ID, device.Value.Address); + //var hostModal_old = HostModalRepository.Get(host.ID, device.Value.Address); + + string HostID_O = CSRedisCacheHelper.HMGet(5, CacheKey.HostId_HostNumber, HOSTNUMBER)[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); + var hostModal_old= QuanJuVar.RoomTypeDeviceModal.FirstOrDefault(A=>A.RoomType.ID==room_type_id&&A.ModalAddress.Equals(device.Value.Address)); + if (hostModal_old != null) { HostModal_Cache c = new HostModal_Cache(); - c.HostID = hostModal_old.HostID; - c.ModalType = hostModal_old.Modal.Type; + c.HostID = host.ID; + c.ModalType = hostModal_old.Type; c.AirConditionData = new AirConditionData(); c.Modal = new RoomTypeModalCache() { - RoomTypeID = hostModal_old.Modal.RoomType.ID, - ID = hostModal_old.Modal.ID, - Name = hostModal_old.Modal.Name, - ModalAddress = hostModal_old.Modal.ModalAddress, - ActiveIndicator = hostModal_old.Modal.ActiveIndicator, - Sort = hostModal_old.Modal.Sort + RoomTypeID = hostModal_old.RoomType.ID, + ID = hostModal_old.ID, + Name = hostModal_old.Name, + ModalAddress = hostModal_old.ModalAddress, + ActiveIndicator = hostModal_old.ActiveIndicator, + Sort = hostModal_old.Sort }; hostModal = c; } @@ -694,6 +684,7 @@ namespace RCUHost.Implement } else//设备关 { + #region 设备关 if (hostModal.Status != status)//设备有变化时才去更改状态,窗帘6是停,其他是关 { flag = 0; @@ -712,6 +703,7 @@ namespace RCUHost.Implement hostModal.Status = status; hostModal.Brightness = 0; + #endregion } } catch (Exception ex) @@ -721,7 +713,7 @@ namespace RCUHost.Implement CSRedisCacheHelper.Set_Partition(KKey, hostModal); #endregion - #region 取电,门磁 + #region 取电门磁,触发特殊动作 switch (hostModal.Modal.ModalAddress) { case "004000013"://门磁 @@ -748,13 +740,13 @@ namespace RCUHost.Implement case "004000001"://取电 #region 取电开关 //拨卡操作 - if (flag == 0 && host.RoomCard != null) - { + //if (flag == 0 && host.RoomCard != null) + //{ //host.RoomCard = null; //HostRepository.SetRoomCard(host, null);//拔卡操作 - } - else if (flag == 1 && host.RoomCard == null) - { + //} + //else if (flag == 1 && host.RoomCard == null) + //{ //CSRedisCacheHelper.HMSet(CacheKey.TakeCardOnLine,host.SysHotel.Code+"###"+ host.RoomNumber); //RoomCardType roomCardType = null; @@ -801,7 +793,7 @@ namespace RCUHost.Implement //} //host.RoomCard = roomCard; //HostRepository.SetRoomCard(host, roomCard);//插卡操作 - } + //} #region 语音机器人 if (flag != 2)//取电或断电时处理 @@ -1699,138 +1691,143 @@ namespace RCUHost.Implement //只有服务信息才会入库 //bool isonly_serviceinfo = true; - 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) + if (hostModal.ModalType == DeviceType.ServiceInfo) { - - HostModal FinallyData = new HostModal(); - FinallyData.HostID = hostModal.HostID; - FinallyData.Status = hostModal.Status; - FinallyData.Brightness = hostModal.Brightness; - FinallyData.CurrentTemp = hostModal.AirConditionData.CurrentTemp; - FinallyData.FanSpeed = hostModal.AirConditionData.FanSpeed; - FinallyData.Mode = hostModal.AirConditionData.Mode; - FinallyData.SettingTemp = hostModal.AirConditionData.SettingTemp; - FinallyData.UpdateTime = hostModal.UpdateTime; - FinallyData.Valve = hostModal.AirConditionData.Valve; - - FinallyData.Modal = new RoomTypeModal() + if (!string.IsNullOrEmpty(hostModal.Modal.Name)) { - ID = hostModal.Modal.ID, - Name = hostModal.Modal.Name, - ModalAddress = hostModal.Modal.ModalAddress, - ActiveIndicator = hostModal.Modal.ActiveIndicator, - Sort = hostModal.Modal.Sort - }; - FinallyData.Modal.RoomType = new RoomType() - { - ID = hostModal.Modal.RoomTypeID - }; - FinallyData.Modal.ID = hostModal.Modal.ID; - FinallyData.UpdateTime = now; - - #region 有可能有异常 - try - { - HostModalRecord hostModalRecord; - switch (flag) + bool bbbaaa = hostModal.Modal.Name.Contains("红外") || hostModal.Modal.Name.Contains("infrared") || hostModal.Modal.Name.Contains("雷达") || hostModal.Modal.Name.Contains("radar"); + if (bbbaaa == false) { - case 0://0关闭设备 - if (hostModal.UpdateTime.HasValue) - { - hostModal.Time += Convert.ToInt32((now - hostModal.UpdateTime.Value).TotalMinutes); - } - hostModal.UpdateTime = now; - FinallyData.UpdateTime = now; - //阿宝添加内存 - try - { - HostModalRepository.Update(FinallyData);//sbSQL.ToString()); - } - catch (Exception) - { - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - //CSRedisCacheHelper.Set_Partition(KKey, hostModal); - if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 - { - hostModalRecord = new HostModalRecord(); - hostModalRecord.HostID = host.ID; - hostModalRecord.RoomNumber = host.RoomNumber; - hostModalRecord.RoomTypeID = host.RoomType.ID; - hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; - hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; - hostModalRecord.StartTime = now; - hostModalRecord.Status = 2; - try - { - HostModalRecordRepository.Save(hostModalRecord); - } - catch (Exception) - { + HostModal FinallyData = new HostModal(); + FinallyData.HostID = hostModal.HostID; + FinallyData.Status = hostModal.Status; + FinallyData.Brightness = hostModal.Brightness; + FinallyData.CurrentTemp = hostModal.AirConditionData.CurrentTemp; + FinallyData.FanSpeed = hostModal.AirConditionData.FanSpeed; + FinallyData.Mode = hostModal.AirConditionData.Mode; + FinallyData.SettingTemp = hostModal.AirConditionData.SettingTemp; + FinallyData.UpdateTime = hostModal.UpdateTime; + FinallyData.Valve = hostModal.AirConditionData.Valve; - } - } - break; - case 1://1打开设备且当前设备处于关闭状态 - hostModal.UpdateTime = now; - FinallyData.UpdateTime = now; - //阿宝这里修改 - try - { - HostModalRepository.Update(FinallyData);//sbSQL.ToString()); - } - catch (Exception ex) - { - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - //CSRedisCacheHelper.Set_Partition(KKey, hostModal); - if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 - { - hostModalRecord = new HostModalRecord(); - hostModalRecord.HostID = host.ID; - hostModalRecord.RoomNumber = host.RoomNumber; - hostModalRecord.RoomTypeID = host.RoomType.ID; - hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; - hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; - hostModalRecord.StartTime = now; - hostModalRecord.Status = 1; - try - { - HostModalRecordRepository.Save(hostModalRecord); - } - catch (Exception) - { + FinallyData.Modal = new RoomTypeModal() + { + ID = hostModal.Modal.ID, + Name = hostModal.Modal.Name, + ModalAddress = hostModal.Modal.ModalAddress, + ActiveIndicator = hostModal.Modal.ActiveIndicator, + Sort = hostModal.Modal.Sort + }; + FinallyData.Modal.RoomType = new RoomType() + { + ID = hostModal.Modal.RoomTypeID + }; + FinallyData.Modal.ID = hostModal.Modal.ID; + FinallyData.UpdateTime = now; - } - } - break; - case 2://2打开设备且当前设备处于打开状态 - hostModal.UpdateTime = now; - FinallyData.UpdateTime = now; - try + #region 有可能有异常 + try + { + HostModalRecord hostModalRecord; + switch (flag) { - HostModalRepository.Update(FinallyData); + case 0://0关闭设备 + if (hostModal.UpdateTime.HasValue) + { + hostModal.Time += Convert.ToInt32((now - hostModal.UpdateTime.Value).TotalMinutes); + } + hostModal.UpdateTime = now; + FinallyData.UpdateTime = now; + //阿宝添加内存 + try + { + HostModalRepository.Update(FinallyData);//sbSQL.ToString()); + } + catch (Exception) + { + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + //CSRedisCacheHelper.Set_Partition(KKey, hostModal); + if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 + { + hostModalRecord = new HostModalRecord(); + hostModalRecord.HostID = host.ID; + hostModalRecord.RoomNumber = host.RoomNumber; + hostModalRecord.RoomTypeID = host.RoomType.ID; + hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; + hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; + hostModalRecord.StartTime = now; + hostModalRecord.Status = 2; + try + { + HostModalRecordRepository.Save(hostModalRecord); + } + catch (Exception) + { + + } + } + break; + case 1://1打开设备且当前设备处于关闭状态 + hostModal.UpdateTime = now; + FinallyData.UpdateTime = now; + //阿宝这里修改 + try + { + HostModalRepository.Update(FinallyData);//sbSQL.ToString()); + } + catch (Exception ex) + { + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + //CSRedisCacheHelper.Set_Partition(KKey, hostModal); + if (hostModal.Modal.ActiveIndicator)//处理回路状态记录,只记录启用的回路 add by wuzhuihui 20190918 + { + hostModalRecord = new HostModalRecord(); + hostModalRecord.HostID = host.ID; + hostModalRecord.RoomNumber = host.RoomNumber; + hostModalRecord.RoomTypeID = host.RoomType.ID; + hostModalRecord.RoomTypeModalID = hostModal.Modal.ID; + hostModalRecord.ModalAddress = hostModal.Modal.ModalAddress; + hostModalRecord.StartTime = now; + hostModalRecord.Status = 1; + try + { + HostModalRecordRepository.Save(hostModalRecord); + } + catch (Exception) + { + + } + } + break; + case 2://2打开设备且当前设备处于打开状态 + hostModal.UpdateTime = now; + FinallyData.UpdateTime = now; + try + { + HostModalRepository.Update(FinallyData); + } + catch (Exception ex) + { + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + //CSRedisCacheHelper.Set_Partition(KKey, hostModal); + break; } - catch (Exception ex) - { - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - //CSRedisCacheHelper.Set_Partition(KKey, hostModal); - break; + + string StatusKey = "RoomStatus_ServerInfo"; + RCUHost.RCUHostCommon.tools.LanJieData(StatusKey, HOTEL_CODE); + CSRedisCacheHelper.Set_Partition(KKey, hostModal); + } + catch (Exception ex) + { + logger.Error("数据处理error: " + ex.Message); + logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); + } + #endregion + } - - string StatusKey = "RoomStatus_ServerInfo"; - RCUHost.RCUHostCommon.tools.LanJieData(StatusKey, HOTEL_CODE); - CSRedisCacheHelper.Set_Partition(KKey, hostModal); } - catch (Exception ex) - { - logger.Error("数据处理error: " + ex.Message); - logger.Error(FinallyData.HostID + ":" + host.SysHotel.Code + " " + hostModal.Modal.ModalAddress); - } - #endregion - } else { diff --git a/Service/Implement/RoomTypeModalManager.cs b/Service/Implement/RoomTypeModalManager.cs index 69a3746..482e1c0 100644 --- a/Service/Implement/RoomTypeModalManager.cs +++ b/Service/Implement/RoomTypeModalManager.cs @@ -40,7 +40,8 @@ namespace Service.Implement public IList LoadAllBaoJingUpload() { - return CurrentRepository.LoadAll().Where(r => r.IsUploadBaoJing == true).ToList(); + //return CurrentRepository.LoadAll().Where(r => r.IsUploadBaoJing == true).ToList(); + return CurrentRepository.LoadAll().ToList(); } diff --git a/WebSite/Controllers/AirConditionControlController.cs b/WebSite/Controllers/AirConditionControlController.cs index 2fbc564..6acbdfc 100644 --- a/WebSite/Controllers/AirConditionControlController.cs +++ b/WebSite/Controllers/AirConditionControlController.cs @@ -66,13 +66,13 @@ namespace WebSite.Controllers var LLL = LieECOManager.LoadAll().Where(A => A.HotelID == CurrentHotelID).OrderBy(A => A.ID).ToList(); string GGG = CacheKey.KT_Timer_Controller + "_" + CurrentHotelCode; - var LLL1= CSRedisCacheHelper.Get_Partition>(GGG, 5); + var LLL1 = CSRedisCacheHelper.Get_Partition>(GGG, 5); string LieKey = CacheKey.LieECOKey + "_" + CurrentHotelID; if (LLL != null && LLL.Count > 0) { var LLLData = LieECOManager.LoadAll().Where(A => A.HotelID == CurrentHotelID && A.IsEnable).ToList(); - CSRedisCacheHelper.Set_Partition>(LieKey,LLLData,1); + CSRedisCacheHelper.Set_Partition>(LieKey, LLLData, 1); } if (nn != null) { @@ -85,7 +85,7 @@ namespace WebSite.Controllers RoomNoBodyHowTo = nn, ECO_Setting = ECO, LieECOList = LLL, - TimerECO=LLL1 + TimerECO = LLL1 }, JsonRequestBehavior.AllowGet); } else @@ -98,7 +98,7 @@ namespace WebSite.Controllers HotelData = new { StartDayTime = hotelData.StartDayTime, EndDayTime = hotelData.EndDayTime }, ECO_Setting = ECO, LieECOList = LLL, - TimerECO=LLL1 + TimerECO = LLL1 }, JsonRequestBehavior.AllowGet); } } @@ -251,6 +251,11 @@ namespace WebSite.Controllers RoomNoBodyMananger.Update(no); id4 = id; } + + + QuanJuVar.HotelSeaon = HotelSeasonManager.LoadAll().Where(A => !A.IsDeleted).ToList(); + QuanJuVar.HotelAirControl = HotelAirControlManager.LoadAll().ToList(); + //string logDetail = "【" + String.Join(",", roomNumberList.ToArray()) + "】【" + HttpContext.InnerLanguage("AirProperty" + property.ToString()) + "】"; //SaveSystemLog(AUTHORITY_AirConditionControl, HttpContext.InnerLanguage("SetRoomAirProperty"), logDetail); return Json(new { IsSuccess = true, Message = HttpContext.InnerLanguage("SaveSuccess"), ID1 = id1, ID2 = id2, ID3 = id3, ID4 = id4 }); diff --git a/WebSite/Controllers/ApiController.cs b/WebSite/Controllers/ApiController.cs index b833658..f913263 100644 --- a/WebSite/Controllers/ApiController.cs +++ b/WebSite/Controllers/ApiController.cs @@ -5337,6 +5337,23 @@ namespace WebSite.Controllers var hostServer = (IHostServer)MvcApplication.cxt.GetObject("RCUHost.HostServer"); hostServer.Start(); } + + try + { + var len = CSRedisCacheHelper.redis1.XLen("All_UDPPackage_Data"); + if (len >= 20) + { + logger.Error("Redis积压数据太多,要重启一下"); + var hostServer = (IHostServer)MvcApplication.cxt.GetObject("RCUHost.HostServer"); + hostServer.Start(); + } + } + catch (Exception ex) + { + + } + + var TotalKey = "UDPPackage_TotalRecvPackage"; UDPPackageCount LLL_T = null; DataTongJi.TotalCount.TryGetValue(TotalKey, out LLL_T); @@ -6491,6 +6508,7 @@ namespace WebSite.Controllers } } QuanJuVar.BaoJingUpLoad = RoomTypeModalManager.LoadAllBaoJingUpload(); + QuanJuVar.BaoJingUpLoad = QuanJuVar.RoomTypeDeviceModal.Where(A => A.IsUploadBaoJing == true).ToList(); return true; } #endregion @@ -6834,6 +6852,20 @@ namespace WebSite.Controllers } } + [HttpPost()] + public ActionResult NewServerTest() + { + try + { + return Json(new { IsSuccess = true, Result = "success" }, JsonRequestBehavior.AllowGet); + } + catch (Exception ex) + { + logger.Error(ex.Message); + return Json(new { IsSuccess = false, Result = "操作异常:" + ex.Message }, JsonRequestBehavior.AllowGet); + } + } + } public class NReturnInfo { diff --git a/WebSite/Controllers/HomeController.cs b/WebSite/Controllers/HomeController.cs index 876b483..ee889a6 100644 --- a/WebSite/Controllers/HomeController.cs +++ b/WebSite/Controllers/HomeController.cs @@ -133,7 +133,7 @@ namespace WebSite.Controllers return Redirect("/");//Request.UrlReferrer.ToString()); } - [Authorize()] + //[Authorize()] public ActionResult LogOn() { string result = ""; diff --git a/WebSite/Global.asax.cs b/WebSite/Global.asax.cs index e9d788f..51a0de6 100644 --- a/WebSite/Global.asax.cs +++ b/WebSite/Global.asax.cs @@ -51,6 +51,9 @@ namespace WebSite public static IHostServer hostServer { get; set; } public IRoomTypeModalManager RoomTypeModalManager { get; set; } + + public IHotelSeasonManager HotelSeasonRepository { get; set; } + public IHotelAirControlManager HotelAirControlRepository { get; set; } //private IGroupManager GroupManager; //private IHostRoomCardManager HostRoomCardManager; private syncstatus.syncstatusSoapClient _client = null;//房态同步接口 @@ -139,8 +142,10 @@ namespace WebSite } //HeartBeat(); - QuanJuVar.BaoJingUpLoad = RoomTypeModalManager.LoadAllBaoJingUpload(); - + QuanJuVar.RoomTypeDeviceModal = RoomTypeModalManager.LoadAllBaoJingUpload(); + QuanJuVar.BaoJingUpLoad = QuanJuVar.RoomTypeDeviceModal.Where(A => A.IsUploadBaoJing == true).ToList(); + QuanJuVar.HotelSeaon = HotelSeasonRepository.LoadAll().Where(A => A.IsDeleted==false).ToList(); + QuanJuVar.HotelAirControl= HotelAirControlRepository.LoadAll().ToList(); StartHostServer(); BLWMQTT.StartMqtt(); @@ -526,6 +531,8 @@ namespace WebSite OverviewManager = (IOverviewManager)cxt.GetObject("Manager.Overview"); HostModalManager = (IHostModalManager)cxt.GetObject("Manager.HostModal"); RoomTypeModalManager = (IRoomTypeModalManager)cxt.GetObject("Manager.RoomTypeModal"); + HotelSeasonRepository = (IHotelSeasonManager)cxt.GetObject("Manager.HotelSeason"); + HotelAirControlRepository = (IHotelAirControlManager)cxt.GetObject("Manager.HotelAirControl"); _client = new syncstatus.syncstatusSoapClient(); Timer timer2 = new Timer(20000);//每20秒扫描一次 diff --git a/WebSite/Web.config b/WebSite/Web.config index 01b5b65..c95e37c 100644 --- a/WebSite/Web.config +++ b/WebSite/Web.config @@ -218,8 +218,8 @@ - - + +