Преглед изворни кода

添加告警上报

样式分支
fyf пре 2 година
родитељ
комит
04d20d6748
4 измењених фајлова са 43 додато и 9 уклоњено
  1. +21
    -6
      BPASmartClient.IoT/DataVClient.cs
  2. +8
    -0
      BPASmartClient.IoT/Model/AlarmTable.cs
  3. +4
    -0
      BPASmartClient.IoT/Model/BaseEntity.cs
  4. +10
    -3
      BPASmartClient/DeviceInfo.xml

+ 21
- 6
BPASmartClient.IoT/DataVClient.cs Прегледај датотеку

@@ -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>


+ 8
- 0
BPASmartClient.IoT/Model/AlarmTable.cs Прегледај датотеку

@@ -31,5 +31,13 @@ namespace BPASmartClient.IoT
/// IP 地址
/// </summary>
public string IP { get; set; }
/// <summary>
/// 状态描述
/// </summary>
public string StatusMS { get; set; }
/// <summary>
/// 状态颜色
/// </summary>
public object StatusColor { get; set; }
}
}

+ 4
- 0
BPASmartClient.IoT/Model/BaseEntity.cs Прегледај датотеку

@@ -39,5 +39,9 @@ namespace BPASmartClient.IoT
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// key
/// </summary>
public string KeyID { get; set; }
}
}

+ 10
- 3
BPASmartClient/DeviceInfo.xml Прегледај датотеку

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<BPADevices>
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Peripherals>
<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters>
@@ -16,8 +16,15 @@
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>

<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine">
<Parameters>
<PortName>COM5</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->
</Device>

<!--<Device Name="MorkF" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="2">
<Peripherals>
@@ -31,7 +38,7 @@
</Peripherals>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="1">
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="2">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.MorksMachine">
<Parameters>


Loading…
Откажи
Сачувај