diff --git a/CRICS_V3_1124.suo b/CRICS_V3_1124.suo index 7911c4f..5d3a9c6 100644 Binary files a/CRICS_V3_1124.suo and b/CRICS_V3_1124.suo differ diff --git a/Common/StructConverter.cs b/Common/StructConverter.cs index 0981aed..393b2a3 100644 --- a/Common/StructConverter.cs +++ b/Common/StructConverter.cs @@ -77,6 +77,9 @@ namespace Common Marshal.Copy(bytes, startIndex, structPtr, size); structObj = Marshal.PtrToStructure(structPtr, type); } + catch (Exception) + { + } finally { Marshal.FreeHGlobal(structPtr); diff --git a/CommonEntity/DataTongJi.cs b/CommonEntity/DataTongJi.cs index 4a828b6..edaa65c 100644 --- a/CommonEntity/DataTongJi.cs +++ b/CommonEntity/DataTongJi.cs @@ -236,7 +236,7 @@ namespace CommonEntity /// /// 这个叫是否 取电 取断电状态 /// - public bool IsTakeCard { get; set; } + public int IsTakeCard { get; set; } /// /// 是否插卡 @@ -269,6 +269,7 @@ namespace CommonEntity /// 卡身份 /// public int IdentityInfo { get; set; } + public int Bright_G { get; set; } } /// @@ -293,6 +294,60 @@ namespace CommonEntity public List air_conditioner { get; set; } public extra_data extra { get; set; } + + public int insert_card { get; set; } + public int bright_g { get; set; } + public int version { get; set; } + } + + public class ts_deviceitem + { + public short dev_type { get; set; } + public short dev_addr { get; set; } + public short dev_loop { get; set; } + public int dev_data { get; set; } + } + public class ts_faultitem + { + public short dev_type { get; set; } + public short dev_addr { get; set; } + public short dev_loop { get; set; } + public short error_type { get; set; } + public int error_data { get; set; } + } + public class ts_controlitem + { + public short dev_type { get; set; } + public short dev_addr { get; set; } + public short dev_loop { get; set; } + public short type_l { get; set; } + public int type_h { get; set; } + } + /// + /// 0x36 + /// + public class DeviceActionData + { + public long ts_ms { get; set; } + public string hotel_id { get; set; } + public string room_id { get; set; } + public string device_id { get; set; } + /// + /// "上报" 或 "下发" + /// + public string direction { get; set; } + + public string cmd_word { get; set; } + public int frame_id { get; set; } + public string udp_raw { get; set; } + public int sys_lock_status { get; set; } + + public int report_count { get; set; } + public int fault_count { get; set; } + public List device_list { get; set; } + public List fault_list { get; set; } + public List control_list { get; set; } + } public class NengHaolog { diff --git a/ConsoleApplication2/Program.cs b/ConsoleApplication2/Program.cs index 9385689..7526bcc 100644 --- a/ConsoleApplication2/Program.cs +++ b/ConsoleApplication2/Program.cs @@ -97,8 +97,8 @@ namespace ConsoleApplication2 { NewVersionLog s = new NewVersionLog(); - var nas= JsonConvert.SerializeObject(s); - var data= Encoding.UTF8.GetBytes(nas); + var nas = JsonConvert.SerializeObject(s); + var data = Encoding.UTF8.GetBytes(nas); Encoding.UTF8.GetString(data); @@ -250,21 +250,73 @@ namespace ConsoleApplication2 } static void RedisTest() { - var redis_webchat = new CSRedisClient(string.Format("47.119.147.104:26379" + ",password={0},defaultDatabase=0", "1001^_^lool")); - redis_webchat.HMSet("a","b","c"); + var redis_webchat = new CSRedisClient(string.Format("47.119.147.104:26379" + ",password={0},defaultDatabase=0", "1001^_^lool")); + redis_webchat.HMSet("a", "b", "c"); + } + static void AAA() + { + string nnn = "AA 55 30 00 54 33 53 41 0F 15 71 FF FF FF FF 05 07 01 00 00 00 80 07 02 00 00 00 80 07 03 00 00 00 80 07 04 00 00 00 80 07 05 00 00 00 80 CA 7C"; + var data = Tools.GetBytesFromString(nnn.Replace(" ", "")); + string hostNumber = "233003055055"; + var cmdtype = data[8]; + var device_count = data[15]; + if (cmdtype == 0x0F) + { + byte[] framenolist = data.Skip(7).Take(2).ToArray(); + var zhenhao = BitConverter.ToUInt16(framenolist, 0); + string RoomNUMBER = CSRedisCacheHelper.HMGet(5, CacheKey.RoomNumber_HostNumber, hostNumber)[0]; + if (!string.IsNullOrEmpty(RoomNUMBER)) + { + var code = Tools.HostNumberToHotelCode(hostNumber); + DeviceActionData d1 = new DeviceActionData(); + d1.ts_ms = Tools.GetUnixTime(); + d1.hotel_id = code.ToString(); + d1.room_id = RoomNUMBER; + d1.device_id = hostNumber; + d1.frame_id = zhenhao; + d1.cmd_word = "0F"; + d1.udp_raw = Tools.ByteToString(data); + d1.direction = "下发"; + + List lll1 = new List(); + List lll2 = new List(); + List lll3 = new List(); + + int skip = 16; + for (int i = 1; i <= device_count; i++) + { + var t1 = data.Skip(skip + (i - 1) * 6).Take(6).ToArray(); + ts_controlitem ts = new ts_controlitem(); + ts.dev_addr = t1[0]; + ts.dev_type = t1[1]; + ts.dev_loop = t1[2]; + ts.type_h = t1[3]; + ts.type_l = BitConverter.ToInt16(new byte[] { t1[5], t1[4] }, 0); + lll3.Add(ts); + } + d1.control_list = lll3; + } + } } static void Main(string[] args) { + AAA(); + string aaa111 = "233003"; + var bj1 = aaa111.Substring(0, 3); + var a1 = int.Parse(bj1); + var a2 = int.Parse(aaa111.Substring(3, 3)); + var a3 = new byte[] { Convert.ToByte(a1), Convert.ToByte(a2) }; + var uuua = BitConverter.ToUInt16(a3, 0); - BitArray bit_a = new BitArray(new byte[] { 0xAA}); + BitArray bit_a = new BitArray(new byte[] { 0xAA }); - bool bfa= bit_a.Get(0); - bool bfaa= bit_a.Get(1); + bool bfa = bit_a.Get(0); + bool bfaa = bit_a.Get(1); var DDD = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff"); Console.WriteLine(DDD); var qqqhj = CSRedisCacheHelper.Get_Partition("HostModalStatusReceiver_13_000000001"); - var qq223= JsonConvert.DeserializeObject(File.ReadAllText("3.txt")); + var qq223 = JsonConvert.DeserializeObject(File.ReadAllText("3.txt")); RedisTest(); Data(); Console.ReadLine(); diff --git a/RCUHost/Implement/GenericReceiverBase.cs b/RCUHost/Implement/GenericReceiverBase.cs index 66a064b..b2380f2 100644 --- a/RCUHost/Implement/GenericReceiverBase.cs +++ b/RCUHost/Implement/GenericReceiverBase.cs @@ -214,18 +214,72 @@ namespace RCUHost.Implement /// protected void Send(byte[] data, string hostNumber, string mac) { - string ipAndPort = CSRedisCacheHelper.Get(hostNumber, mac); - if (!string.IsNullOrEmpty(ipAndPort)) + try { - //if (HostServer!=null) - //{ - // logger.Error("1111111111"); - //} - //else - //{ - // logger.Error("222222222222222222222"); - //} - HostServer.Send(data, ipAndPort.ToString().Split(':')[0], int.Parse(ipAndPort.ToString().Split(':')[1])); + string ipAndPort = CSRedisCacheHelper.Get(hostNumber, mac); + if (!string.IsNullOrEmpty(ipAndPort)) + { + //这里判断0x0F + //AA 55 30 00 54 33 53 41 0F 15 71 FF FF FF FF + //05 + //07 01 00 00 00 80 + //07 02 00 00 00 80 + //07 03 00 00 00 80 + //07 04 00 00 00 80 + //07 05 00 00 00 80 CA 7C + //AA 55 11 00 54 33 53 41 0F 15 71 3D 04 92 D0 6B 15 + + var cmdtype = data[8]; + var device_count = data[15]; + if (cmdtype == 0x0F) + { + byte[] framenolist = data.Skip(7).Take(2).ToArray(); + var zhenhao = BitConverter.ToUInt16(framenolist, 0); + string RoomNUMBER = CSRedisCacheHelper.HMGet(5, CacheKey.RoomNumber_HostNumber, hostNumber)[0]; + if (!string.IsNullOrEmpty(RoomNUMBER)) + { + var code = Tools.HostNumberToHotelCode(hostNumber); + DeviceActionData d1 = new DeviceActionData(); + d1.ts_ms = Tools.GetUnixTime(); + d1.hotel_id = code.ToString(); + d1.room_id = RoomNUMBER; + d1.device_id = hostNumber; + d1.frame_id = zhenhao; + d1.cmd_word = "0F"; + d1.udp_raw = Tools.ByteToString(data); + d1.direction = "下发"; + + List lll3 = new List(); + + int skip = 16; + for (int i = 1; i <= device_count; i++) + { + var t1 = data.Skip(skip + (i - 1) * 6).Take(6).ToArray(); + ts_controlitem ts = new ts_controlitem(); + ts.dev_addr = t1[0]; + ts.dev_type = t1[1]; + ts.dev_loop = t1[2]; + ts.type_h = t1[3]; + ts.type_l = BitConverter.ToInt16(new byte[] { t1[5], t1[4] }, 0); + lll3.Add(ts); + } + d1.control_list = lll3; + d1.report_count = lll3.Count; + + + string sss = Newtonsoft.Json.JsonConvert.SerializeObject(d1); + CSRedisCacheHelper.Publish("redis-0X36-0X0F", sss); + } + } + + + HostServer.Send(data, ipAndPort.ToString().Split(':')[0], int.Parse(ipAndPort.ToString().Split(':')[1])); + } + } + catch (Exception ex) + { + logger.Error("发送:"+ex.Message); + logger.Error(ex.StackTrace); } } /// diff --git a/RCUHost/Implement/HostServer.cs b/RCUHost/Implement/HostServer.cs index 80b2a06..b211629 100644 --- a/RCUHost/Implement/HostServer.cs +++ b/RCUHost/Implement/HostServer.cs @@ -357,6 +357,7 @@ namespace RCUHost.Implement /// 是否需要将命令放入队列 public void Send(byte[] data, IPEndPoint endPoint, bool needPushCommandQueue) { + if (udpClient != null) { #region 去掉lock @@ -831,6 +832,30 @@ namespace RCUHost.Implement reader.BaseStream.Position = originalPosition; //logger.Error("device_count error"); } + + try + { + //故障数量,默认0 + int faultNumber = reader.ReadByte(); + for (int i = 0; i < faultNumber; i++) + { + string faultNo = new DeviceAddress(reader.ReadBytes(4)).ToString();//设备类型1、设备地址1、回路地址2 + byte type = reader.ReadByte(); + if (!roomStatus.Faults.ContainsKey(faultNo + type.ToString())) + { + roomStatus.Faults[faultNo + type.ToString()] = new FaultStaus(); + } + roomStatus.Faults[faultNo + type.ToString()].FaultNo = faultNo; + roomStatus.Faults[faultNo + type.ToString()].Type = type;//类型:1在线状态(0在线,1离线),2电量(0~100%),3电流,4 1901故障检测次数 + roomStatus.Faults[faultNo + type.ToString()].Data = reader.ReadByte();//内容 + } + } + catch (Exception) + { + + } + + return roomStatus; } } @@ -1320,6 +1345,26 @@ namespace RCUHost.Implement } else { + if (cmdType == 0x0F) + { + string RoomNUMBER = CSRedisCacheHelper.HMGet(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0]; + if (!string.IsNullOrEmpty(RoomNUMBER)) + { + //控制回复 + DeviceActionData d1 = new DeviceActionData(); + d1.ts_ms = Tools.GetUnixTime(); + d1.hotel_id = hotelCode; + d1.room_id = RoomNUMBER; + d1.device_id = HostNNN; + d1.frame_id = MyFrameNO; + d1.cmd_word = "0F"; + d1.udp_raw = Tools.ByteToString(OriginalByte); + d1.direction = "上报"; + string sss = Newtonsoft.Json.JsonConvert.SerializeObject(d1); + CSRedisCacheHelper.Publish("redis-0X36-0X0F", sss); + + } + } #region 01指令 if (cmdType == 0x01) { @@ -1794,16 +1839,96 @@ namespace RCUHost.Implement if (cmdType == 0x36) { - //Reply(context111); - string hexdata = Tools.ByteToString(context111.Data); - NewVersionHexData ns = new NewVersionHexData(); - ns.CmdType = 0x36; - ns.HotelCode = hotelCode; - ns.HostNumber = HostNNN; - ns.RemoteEndPoint = EndPoint; - ns.CurrentTime = DateTime.Now; - ns.HexData = Tools.ByteToString(context111.Data); + string RoomNUMBER = CSRedisCacheHelper.HMGet(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0]; + if (string.IsNullOrEmpty(RoomNUMBER)) + { + return; + } + + byte[] OriginalByte = context111.Data; + int offset = StructConverter.SizeOf(context111.SystemHeader); + int length = context111.Data.Length - offset - 2; + + DeviceActionData d1 = new DeviceActionData(); + d1.ts_ms = Tools.GetUnixTime(); + d1.hotel_id = hotelCode; + d1.room_id = RoomNUMBER; + d1.device_id = HostNNN; + d1.frame_id = MyFrameNO; + d1.cmd_word = "36"; + d1.udp_raw = Tools.ByteToString(OriginalByte); + d1.direction = "上报"; + + List lll1 = new List(); + List lll2 = new List(); + + + + using (MemoryStream stream = new MemoryStream(context111.Data, offset, length)) + { + Status status = NewStatusParse(stream); + if (status.SysLock) + { + d1.sys_lock_status = 1; + } + else + { + d1.sys_lock_status = 2; + } + + if (status != null && status.Devices.Count > 0) + { + foreach (var item in status.Devices) + { + string ItemKKK = item.Key; + Device VVV = item.Value; + + ts_deviceitem t1 = new ts_deviceitem(); + + string dizhi = VVV.Address; + t1.dev_type = short.Parse(dizhi.Substring(0, 3)); + t1.dev_addr = short.Parse(dizhi.Substring(3, 3)); + t1.dev_loop = short.Parse(dizhi.Substring(6, 3)); + t1.dev_data = VVV.StatusReceiver; + lll1.Add(t1); + } + } + + if (status.Faults != null && status.Faults.Count > 0) + { + var F1 = status.Faults; + foreach (var item in F1) + { + string dizhi = item.Value.FaultNo; + ts_faultitem t1 = new ts_faultitem(); + t1.dev_type = short.Parse(dizhi.Substring(0, 3)); + t1.dev_addr = short.Parse(dizhi.Substring(3, 3)); + t1.dev_loop = short.Parse(dizhi.Substring(6, 3)); + t1.error_type = item.Value.Type; + t1.error_data = item.Value.Data; + lll2.Add(t1); + } + } + } + + d1.device_list = lll1; + d1.fault_list = lll2; + d1.report_count = lll1.Count; + d1.fault_count = lll2.Count; + + string sss = Newtonsoft.Json.JsonConvert.SerializeObject(d1); + CSRedisCacheHelper.Publish("redis-0X36-0X0F", sss); + //Reply(context111); + //string hexdata = Tools.ByteToString(context111.Data); + + //NewVersionHexData ns = new NewVersionHexData(); + //ns.CmdType = 0x36; + //ns.HotelCode = hotelCode; + //ns.HostNumber = HostNNN; + //ns.RemoteEndPoint = EndPoint; + //ns.CurrentTime = DateTime.Now; + //ns.HexData = Tools.ByteToString(context111.Data); //CSRedisCacheHelper.Publish("redis-rcu-hexdata", Newtonsoft.Json.JsonConvert.SerializeObject(ns)); } if (cmdType == 0x34) @@ -1921,7 +2046,7 @@ namespace RCUHost.Implement bool 是否取电 = false; ushort 是否取电_Int = 0; int 是否插卡 = 0; - if (Version == 0x02) + if (Version == 0x02 || Version == 0x03) { BitArray bit_a = new BitArray(new byte[] { TakeCardStatus }); bool b0 = bit_a.Get(0); @@ -1930,16 +2055,24 @@ namespace RCUHost.Implement bool b3 = bit_a.Get(3); if (b0 == false && b1 == false) { - 是否取电 = false; + //是否取电 = false; + 是否取电_Int = 0; + } + else if (b0 == false && b1 == true) + { 是否取电_Int = 2; } else if (b0 == true && b1 == false) { - 是否取电 = true; + //是否取电 = true; 是否取电_Int = 1; } if (b2 == false && b3 == false) + { + 是否插卡 = 0; + } + else if (b2 == false && b3 == true) { 是否插卡 = 2; } @@ -1977,11 +2110,10 @@ namespace RCUHost.Implement } - //身份 var IdentityInfo = reader.ReadByte(); - byte[] nocard_enum = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; + byte[] nocard_enum = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A }; //无卡逻辑状态(对应事件状态) //0x01:开门进入事件 //0x02:卡在人离事件 @@ -1991,6 +2123,8 @@ namespace RCUHost.Implement //0x06:室内按键触发 //0x07:短暂人离事件 //0x08:长时间人离事件 + //0x09:短暂人离超时 + //0x0A:长时间人离超时 var NOCardInfo = reader.ReadByte(); var NOCardInfo_NoFilter = NOCardInfo; if (!nocard_enum.Contains(NOCardInfo)) @@ -2125,6 +2259,13 @@ namespace RCUHost.Implement //碳达人 var CarbonVIP = reader.ReadByte(); + int Bright_Va = -1; + if (Version == 0x03) + { + var LiangDu = reader.ReadBytes(4); + Bright_Va = (int)LiangDu[0]; + } + var CarbonVIP_NoFilter = CarbonVIP; byte[] carbon_enum = new byte[] { 0x01, 0x02 }; if (!carbon_enum.Contains(CarbonVIP)) @@ -2332,7 +2473,7 @@ namespace RCUHost.Implement Mac = "", EndPoint = EndPoint, Version = ((int)Version).ToString(), - IsTakeCard = 是否取电, + IsTakeCard = 是否取电_Int, IsInsertCard = 是否插卡, CarbonVIP = CarbonVIP, NengHaoList = nenghaoList, @@ -2347,7 +2488,8 @@ namespace RCUHost.Implement IdentityInfo = IdentityInfo, //CardID = IdentityInfo, CardEvent = NOCardInfo, - PMS_Status = PMS_CurrentStatus + PMS_Status = PMS_CurrentStatus, + Bright_G = Bright_Va }; string mns = Newtonsoft.Json.JsonConvert.SerializeObject(ns2); @@ -2358,11 +2500,14 @@ namespace RCUHost.Implement #region TSlog NewVersionLog tslog = new NewVersionLog() { + version = (int)Version, hotel_id = hotelCode, room_id = RoomNUMBER, device_id = HostNNN, ip = EndPoint, power_state = 是否取电_Int, + insert_card = 是否插卡, + bright_g = Bright_Va, cardless_state = Convert.ToUInt16(NOCardInfo_NoFilter), guest_type = Convert.ToUInt16(IdentityInfo), service_mask = BitConverter.ToUInt64(N, 0), diff --git a/RCUHost/Implement/UpdateHostReceiver.cs b/RCUHost/Implement/UpdateHostReceiver.cs index e133a5a..e13c7c3 100644 --- a/RCUHost/Implement/UpdateHostReceiver.cs +++ b/RCUHost/Implement/UpdateHostReceiver.cs @@ -58,6 +58,7 @@ namespace RCUHost.Implement foreach (var host in hosts) { SendUpdateRequest(host, fileMd5, blockNum, (byte)fileType, fileHref.Substring(fileHref.IndexOf("/")));//发送升级通知 + Thread.Sleep(300); this.updateHostList.Add(new UpdateHostWorker(host, hostUpdate, MessageIP, fileHref, updateFile)); if (hostUpdate == null)//从api获取升级文件方式为null,保存主机表升级状态信息 { @@ -214,8 +215,10 @@ namespace RCUHost.Implement /// 升级文件MD5值 private void SendUpdateRequest(Host host, string updateFileMd5, ushort blockNum, byte fileType, string fileName) { - logger.Error("主机升级:"+host.SysHotel.Code+":"+host.RoomNumber); + logger.Error("主机升级:"+host.SysHotel.Code+":"+host.RoomNumber+" FileMd5:"+updateFileMd5+" FileName:"+fileName); byte[] data = CreateUpdateRequestPacket(updateFileMd5, blockNum, fileType, fileName); + logger.Error("升级HostNumber为:"+host.HostNumber); + logger.Error("升级指令为:"+Tools.ByteToString(data)); Send(data, host.HostNumber, host.MAC);// host.IP, host.Port); } /// diff --git a/WebSite/Controllers/HostUpdateController.cs b/WebSite/Controllers/HostUpdateController.cs index 078a807..461bdb5 100644 --- a/WebSite/Controllers/HostUpdateController.cs +++ b/WebSite/Controllers/HostUpdateController.cs @@ -345,12 +345,31 @@ namespace WebSite.Controllers return Json(new { IsSuccess = false, Message = "升级文件不合法!" }); } string fileHref = "Uploads/room_type/" + hosts[hosts.Count - 1].RoomType.ID + "/" + fileName;//升级文件相对路径 + //string fileMd5 = ""; + //using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open)) + //{ + // fileMd5 = Tools.ComputeFileHash(stream); + // stream.Close(); + //} + + string fileMd5 = ""; - using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open)) + string FileKey = "FileMD5_" + fileHref; + string kkka = CSRedisCacheHelper.Get_Partition(FileKey, 3); + if (!string.IsNullOrEmpty(kkka)) { - fileMd5 = Tools.ComputeFileHash(stream); - stream.Close(); + fileMd5 = kkka; } + else + { + using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + fileMd5 = Tools.ComputeFileHash(stream); + CSRedisCacheHelper.Set_PartitionWithTime(FileKey, fileMd5, 5, 3); + stream.Close(); + } + } + //HostUpdate hostUpdate = HostUpdateManager.Get(fileMd5, CurrentHotelID); //if (null == hostUpdate) //{ @@ -423,7 +442,7 @@ namespace WebSite.Controllers using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { fileMd5 = Tools.ComputeFileHash(stream); - CSRedisCacheHelper.Set_PartitionWithTime(FileKey, fileMd5, 60 * 60, 3); + CSRedisCacheHelper.Set_PartitionWithTime(FileKey, fileMd5, 5, 3); stream.Close(); } } @@ -472,12 +491,30 @@ namespace WebSite.Controllers } //string fileHref = "Uploads/room_type/" + hosts[hosts.Count - 1].RoomType.ID + "/" + fileName;//升级文件相对路径 string fileHref = "Uploads/room_type/" + RoomTypeID + "/" + fileName;//升级文件相对路径 + //string fileMd5 = ""; + //using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open)) + //{ + // fileMd5 = Tools.ComputeFileHash(stream); + // stream.Close(); + //} + string fileMd5 = ""; - using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open)) + string FileKey = "FileMD5_" + fileHref; + string kkka = CSRedisCacheHelper.Get_Partition(FileKey, 3); + if (!string.IsNullOrEmpty(kkka)) { - fileMd5 = Tools.ComputeFileHash(stream); - stream.Close(); + fileMd5 = kkka; } + else + { + using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + fileMd5 = Tools.ComputeFileHash(stream); + CSRedisCacheHelper.Set_PartitionWithTime(FileKey, fileMd5, 6, 3); + stream.Close(); + } + } + HostManager1.UpdateHostC(null, fileType, fileHref, fileMd5, hosts); IList hostNumberList = new List(); foreach (Host h in hosts) diff --git a/WebSite/Controllers/IoTController.cs b/WebSite/Controllers/IoTController.cs index 40f7fd4..db1be93 100644 --- a/WebSite/Controllers/IoTController.cs +++ b/WebSite/Controllers/IoTController.cs @@ -7433,6 +7433,7 @@ namespace WebSite.Controllers { var action = item.action; var name = item.applianceName; + //var area = item.area; List q1 = new List(); if (name.Equals("灯")) { @@ -7440,6 +7441,10 @@ namespace WebSite.Controllers } else { + //if (!string.IsNullOrEmpty(area)) + //{ + // name = area+ name; + //} q1 = hostModals.Where(A => A.Modal.Name.Equals(name) || A.Modal.AliasName.Equals(name)).ToList(); } if (q1 != null && q1.Count > 0) @@ -7473,8 +7478,14 @@ namespace WebSite.Controllers { var action = item.action; var name = item.applianceName; + //var area = item.area; var value = item.value; - var q1 = hostModals.Where(A => A.Modal.Type == DeviceType.AirConditioner && (A.Modal.Name.Equals(name)||A.Modal.AliasName.Equals(name))); + //if (!string.IsNullOrEmpty(area)) + //{ + // name = area + name; + //} + + var q1 = hostModals.Where(A => A.Modal.Type == DeviceType.AirConditioner && (A.Modal.Name.Equals(name) || A.Modal.AliasName.Equals(name))); foreach (var item_inter in q1) { int status = 0; @@ -7553,7 +7564,12 @@ namespace WebSite.Controllers { var action = item.action; var name = item.applianceName; + //var area = item.area; int hid = int.Parse(hotelid); + //if (!string.IsNullOrEmpty(area)) + //{ + // name = area + name; + //} var scene = RoomTypeSceneManager.LoadAll().Where(A => A.HotelID == hid && A.Name.Equals(name)).FirstOrDefault(); if (scene != null) { @@ -7581,7 +7597,7 @@ namespace WebSite.Controllers i.RequestId = msgid; i.Platform = "ETV"; - i.CommandDescription = "success: 控制设备"+JsonConvert.SerializeObject(lla); + i.CommandDescription = "success: 控制设备" + JsonConvert.SerializeObject(lla); SendMQTTData.Send(i); } return Json(new { code = 200, msg = "控制成功" }, JsonRequestBehavior.AllowGet); @@ -7607,6 +7623,7 @@ namespace WebSite.Controllers public string action { get; set; } public string applianceName { get; set; } public string value { get; set; } + //public string area { get; set; } } public class TV_ResponseData { diff --git a/WebSite/Global.asax.cs b/WebSite/Global.asax.cs index dadc4a7..2b9a109 100644 --- a/WebSite/Global.asax.cs +++ b/WebSite/Global.asax.cs @@ -57,7 +57,7 @@ namespace WebSite private object _lock = new object(), _lock1 = new object(); //private List _hosts = null;//西软pms对接使用 - public static int TimeInterval = 10; + public static int TimeInterval = 1; public static string IntervalKey = "TimeInterval"; /// /// 凌晨ECO diff --git a/WebSite/Uploads/V2/room_type/3/C1F_A_L4_43_260102_NM.bin b/WebSite/Uploads/V2/room_type/3/C1F_A_L4_43_260102_NM.bin new file mode 100644 index 0000000..64885d5 Binary files /dev/null and b/WebSite/Uploads/V2/room_type/3/C1F_A_L4_43_260102_NM.bin differ