|
|
@@ -153,10 +153,22 @@ namespace DataVAPI.Controllers |
|
|
|
} |
|
|
|
List<object> list = new List<object>(); |
|
|
|
int? count = log?.FindAll(par => par.LogMessage.Contains("设备在线了")).Count; |
|
|
|
list.Add(new { Name = "运行次数", Count = count?.ToString()}); |
|
|
|
list.Add(new { Name = "故障次数", Count = alarm?.Count.ToString() }); |
|
|
|
list.Add(new { Name = "故障率", Count = $"{(alarm?.Count * 100) / 400}%" }); |
|
|
|
|
|
|
|
//LogTable log1 = log?.Find(par => par.LogMessage.Contains("设备在线了")); |
|
|
|
//LogTable log2 = log?.Find(par => par.LogMessage.Contains("设备离线了")); |
|
|
|
|
|
|
|
list.Add(new { Name = "运行次数", Count = count?.ToString()}); |
|
|
|
//if (log1 != null && log2 != null) |
|
|
|
//{ |
|
|
|
// double dob = Math.Abs((log1.CreateTime - log2.CreateTime).TotalMinutes); |
|
|
|
// list.Add(new { Name = "故障次数", Count = 0 }); |
|
|
|
// list.Add(new { Name = "故障率", Count = $"{(dob / 120)*100/100}%" }); |
|
|
|
//} |
|
|
|
//else |
|
|
|
{ |
|
|
|
list.Add(new { Name = "故障次数", Count = 0 }); |
|
|
|
list.Add(new { Name = "故障率", Count = $"0%" }); |
|
|
|
} |
|
|
|
return JsonMsg<object>.OK(list, st); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|