diff --git a/BPASmartClient.Device/DeviceStatus.cs b/BPASmartClient.Device/DeviceStatus.cs index f60f10ba..9d11ba41 100644 --- a/BPASmartClient.Device/DeviceStatus.cs +++ b/BPASmartClient.Device/DeviceStatus.cs @@ -60,12 +60,13 @@ namespace BPASmartClient.Device List StatusALL = new List(); foreach (var item in status) { + string sta = string.Empty; string name = item.Key; string Ms = string.Empty; string id = string.Empty; if (item.Key.Contains(".")) { - string sta = item.Key.Split('.')[0]; + sta = item.Key.Split('.')[0]; string sop = item.Key.Split('.')[item.Key.Split('.').Length - 1]; name = sop; string value = item.Value.ToString(); if (keyValues.ContainsKey(sta)) sta = keyValues[sta]; @@ -75,8 +76,9 @@ namespace BPASmartClient.Device Ms = $"[{sta}]-[{sop}]-[{value}]"; id = $"[{sta}]-[{sop}]"; } - StatusALL.Add(new DevStatus { id = id, Name = name, Status = item.Value.ToString(), Ms = Ms }); + StatusALL.Add(new DevStatus { id = id, Name = name, type = sta, Status = item.Value.ToString(), Ms = Ms }); } + StatusALL = StatusALL?.OrderBy(x => x.type).ToList(); return new { data = StatusALL }; } @@ -88,9 +90,10 @@ namespace BPASmartClient.Device string name = item.Key; string Ms = string.Empty; string id=string.Empty; + string sta=string.Empty; if (item.Key.Contains(".")) { - string sta = item.Key.Split('.')[0]; + sta = item.Key.Split('.')[0]; string sop = item.Key.Split('.')[item.Key.Split('.').Length - 1]; name = sop; string value = item.Value.ToString(); if (keyValues.ContainsKey(sta)) sta = keyValues[sta]; @@ -100,14 +103,16 @@ namespace BPASmartClient.Device Ms = $"[{sta}]-[{sop}]-[{value}]"; id= $"[{sta}]-[{sop}]"; } - StatusALL.Add(new DevStatus {id= id, Name = name, Status = item.Value.ToString(), Ms = Ms }); + StatusALL.Add(new DevStatus {id= id, Name = name,type=sta, Status = item.Value.ToString(), Ms = Ms }); } + StatusALL = StatusALL?.OrderBy(x => x.type).ToList(); return StatusALL; } } public class DevStatus { + public string type { get; set; } public string id { get; set; } public string Name { get; set; } private string _status { get; set; }