浏览代码

最新提交

master
fyf 2 年前
父节点
当前提交
bd4a8487a2
共有 1 个文件被更改,包括 15 次插入3 次删除
  1. +15
    -3
      DataVAPI/Controllers/DeviceStatsController.cs

+ 15
- 3
DataVAPI/Controllers/DeviceStatsController.cs 查看文件

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


正在加载...
取消
保存