Parcourir la source

提交

样式分支
fyf il y a 2 ans
Parent
révision
867614d126
2 fichiers modifiés avec 76 ajouts et 4 suppressions
  1. +33
    -4
      BPASmartClient.IoT/DataVClient.cs
  2. +43
    -0
      BPASmartClient.IoT/Model/MaintainTable.cs

+ 33
- 4
BPASmartClient.IoT/DataVClient.cs Voir le fichier

@@ -35,14 +35,13 @@ namespace BPASmartClient.IoT
public DataVClient()
{
DataVApiAddress = InternetInfo.DataVApiAddress;
//DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString();
ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString();
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString();
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString();
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString();
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString();
BroadcastPubTopic = InternetInfo.BroadcastPubTopic;
//BroadcastPubTopic = System.Configuration.ConfigurationManager.AppSettings["BroadcastPubTopic"].ToString();
BroadcastMaintainPubTopic = $"{InternetInfo.BroadcastPubTopic}Maintain";
}
#endregion

@@ -52,6 +51,7 @@ namespace BPASmartClient.IoT
public string ProductKey { set; get; }
public string DeviceSecret { set; get; }
public string BroadcastPubTopic { set; get; }
public string BroadcastMaintainPubTopic { set; get; }
/// <summary>
/// DataV 服务地址
/// </summary>
@@ -97,6 +97,37 @@ namespace BPASmartClient.IoT
}
return alarmTable.KeyID;
}
/// <summary>
/// 增加维保信息
/// </summary>
/// <param name="maintainTable"></param>
/// <returns></returns>
public string HttpAddMaintain(MaintainTable maintainTable)
{
try
{
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null)
{
// AlarmTime = GetPropertyValue(obj, "Time").ToString(),
//AlarmType = GetPropertyValue(obj, "Type").ToString(),
//AlarmMessage = GetPropertyValue(obj, "Text").ToString(),
//AlarmVla = "告警",
//DeviceId = Devid.ToString(),
//KeyID = id,
maintainTable.MaintainTime = DateTime.Now.ToString();
maintainTable.MaintainType = "一般";
maintainTable.MaintainVla = "维修";
maintainTable.ClientId = ClientId;
maintainTable.devicename = DeviceDataV.deviceTable.devicename;
DeviceDataV.IOT_Publish(BroadcastMaintainPubTopic, Tools.JsonConvertTools(maintainTable));
}
}
catch (Exception ex)
{
MessageLog.GetInstance.Show(ex.Message);
}
return maintainTable.KeyID;
}

/// <summary>
/// 增加日志信息
@@ -254,7 +285,6 @@ namespace BPASmartClient.IoT
});
keyValues[GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString()] = id;
//MessageLog.GetInstance.AddDeviceAlarmLogShow(GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(),id);

}

/// <summary>
@@ -277,7 +307,6 @@ namespace BPASmartClient.IoT
State = "n"
});
//MessageLog.GetInstance.DeleteDeviceAlarmLogShow(message, keyValues[message]);

}
}



+ 43
- 0
BPASmartClient.IoT/Model/MaintainTable.cs Voir le fichier

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.IoT.Model
{
/// <summary>
/// 维保
/// </summary>
public class MaintainTable : BaseEntity
{
/// <summary>
/// 维修时间
/// </summary>
public string MaintainTime { get; set; }
/// <summary>
/// 维修类型:1 轻微 2:一般 3 严重
/// </summary>
public string MaintainType { get; set; }
/// <summary>
/// 维修消息
/// </summary>
public string MaintainMessage { get; set; }
/// <summary>
/// 维修值
/// </summary>
public string MaintainVla { get; set; }
/// <summary>
/// IP 地址
/// </summary>
public string IP { get; set; }
/// <summary>
/// 状态描述
/// </summary>
public string StatusMS { get; set; }
/// <summary>
/// 状态颜色
/// </summary>
public object StatusColor { get; set; }
}
}

Chargement…
Annuler
Enregistrer