修改一些BUG
This commit is contained in:
@@ -1135,29 +1135,41 @@ namespace RCUHost.Implement
|
||||
if (list.Count > 0 && hostModals.Count > 0)
|
||||
{
|
||||
System.Reflection.PropertyInfo[] properties = typeof(HotelSeason).GetProperties();//获取所有属性
|
||||
Host pa = new Host();
|
||||
pa.HostNumber = host.HostNumber;
|
||||
pa.MAC = host.MAC;
|
||||
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);//延迟执行
|
||||
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)item.Status;
|
||||
device1.Brightness = 0;
|
||||
device1.Temperature = (byte)item.SettingTemp;
|
||||
device1.FanSpeed = (byte)item.FanSpeed;
|
||||
device1.Mode = (byte)item.Mode;
|
||||
device1.Valve = 0;
|
||||
device1.AirExecMode = (item.Status << 14) + (item.Mode << 12) + (item.FanSpeed << 10) + (0 << 8) + item.SettingTemp;//空调执行方式和内容
|
||||
//这里只需要host的mac和number或者 ip
|
||||
DeviceControlReceiver.Send(host, device1);
|
||||
}
|
||||
var VA = new Tuple<List<HostModal>,HotelAirControl,Host>(hostModals,item,pa);
|
||||
Task.Factory.StartNew((state) =>
|
||||
{
|
||||
var UUU =state as Tuple<List<HostModal>, HotelAirControl,Host>;
|
||||
System.Threading.Thread.Sleep(item.DelayTime * 1000);//延迟执行
|
||||
|
||||
var D1 = UUU.Item1;
|
||||
var D2 = UUU.Item2;
|
||||
var D3 = UUU.Item3;
|
||||
foreach (HostModal hostModal1 in D1)
|
||||
{
|
||||
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(D3, device1);
|
||||
}
|
||||
},VA);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1233,6 +1245,33 @@ namespace RCUHost.Implement
|
||||
|
||||
if (status == 1)//设备开
|
||||
{
|
||||
string ADDDDD = device.Value.Address;
|
||||
string Key = CacheKey.KongTiaoAlert + "_" + HOSTNUMBER + "_" + ADDDDD;
|
||||
AirConditionAlert alert_d = new AirConditionAlert();
|
||||
alert_d.HostNumber = HOSTNUMBER;
|
||||
alert_d.HotelCode = HOTEL_CODE;
|
||||
alert_d.DeviceAddress = ADDDDD;
|
||||
alert_d.SetTemperature = temperature;
|
||||
alert_d.CurrentTemperature = currentTemp;
|
||||
alert_d.UpdateDateTime = DateTime.Now;
|
||||
//if (temperature != currentTemp)
|
||||
//{
|
||||
// var take_air = CSRedisCacheHelper.Get_Partition<AirConditionAlert>(Key);
|
||||
// if (!take_air.Equals(default(AirConditionAlert)))
|
||||
// {
|
||||
// // 结构体为空(即所有字段都为默认值)
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CSRedisCacheHelper.Set_PartitionWithTime(Key, alert_d, 30);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// CSRedisCacheHelper.Del_Partition(Key);
|
||||
//}
|
||||
|
||||
|
||||
if (hostModal.Status != 1)//设备有变化时才去更改状态
|
||||
{
|
||||
flag = 1;
|
||||
@@ -1761,7 +1800,7 @@ namespace RCUHost.Implement
|
||||
|
||||
string StatusKey = "RoomStatus_ServerInfo";
|
||||
RCUHost.RCUHostCommon.tools.LanJieData(StatusKey, HOTEL_CODE);
|
||||
//CSRedisCacheHelper.Set_Partition<HostModal_Cache>(KKey, hostModal);
|
||||
CSRedisCacheHelper.Set_Partition<HostModal_Cache>(KKey, hostModal);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user