|
|
@@ -50,6 +50,10 @@ namespace BPASmartClient.IoT |
|
|
|
/// 广播 |
|
|
|
/// </summary> |
|
|
|
public string PubTopic = "/broadcast/" + "grgpECHSL7q" + "/" + "Transit_SetDevice"; |
|
|
|
/// <summary> |
|
|
|
/// key值 |
|
|
|
/// </summary> |
|
|
|
public Dictionary<string,string> keyValues = new Dictionary<string, string>(); |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region API调用 |
|
|
@@ -60,7 +64,6 @@ namespace BPASmartClient.IoT |
|
|
|
/// <returns>返回ID</returns> |
|
|
|
public string HttpAddAlarm(AlarmTable alarmTable) |
|
|
|
{ |
|
|
|
string id = string.Empty; |
|
|
|
try |
|
|
|
{ |
|
|
|
if (DeviceDataV != null && DeviceDataV.GetIsConnected()) |
|
|
@@ -74,7 +77,7 @@ namespace BPASmartClient.IoT |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show(ex.Message); |
|
|
|
} |
|
|
|
return id; |
|
|
|
return alarmTable.KeyID; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -181,13 +184,16 @@ namespace BPASmartClient.IoT |
|
|
|
/// <param name="obj"></param> |
|
|
|
private void AddErrorAction(object obj) |
|
|
|
{ |
|
|
|
string id = Guid.NewGuid().ToString(); |
|
|
|
HttpAddAlarm(new AlarmTable |
|
|
|
{ |
|
|
|
AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
AlarmTime = GetPropertyValue(obj, "Time").ToString(), |
|
|
|
AlarmType = GetPropertyValue(obj, "Type").ToString(), |
|
|
|
AlarmMessage = GetPropertyValue(obj, "Text").ToString(), |
|
|
|
AlarmVla = "告警", |
|
|
|
KeyID = id, |
|
|
|
}); |
|
|
|
keyValues[GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString()] =id ; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -196,10 +202,19 @@ namespace BPASmartClient.IoT |
|
|
|
/// <param name="obj"></param> |
|
|
|
private void DeleteErrorAction(object obj) |
|
|
|
{ |
|
|
|
HttpAddAlarm(new AlarmTable |
|
|
|
string message = GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(); |
|
|
|
if (keyValues.ContainsKey(message)) |
|
|
|
{ |
|
|
|
|
|
|
|
}); |
|
|
|
HttpAddAlarm(new AlarmTable |
|
|
|
{ |
|
|
|
AlarmTime = GetPropertyValue(obj, "Time").ToString(), |
|
|
|
AlarmType = GetPropertyValue(obj, "Type").ToString(), |
|
|
|
AlarmMessage = GetPropertyValue(obj, "Text").ToString(), |
|
|
|
AlarmVla = "告警", |
|
|
|
KeyID = keyValues[message], |
|
|
|
State="n" |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|