首页voc,cems数据处理

This commit is contained in:
yanghongwei 2024-08-21 00:05:39 +08:00
parent 32f9e8a1f5
commit d4cf5fcfa0
5 changed files with 49 additions and 17 deletions

View File

@ -1825,6 +1825,11 @@
二 甲苯
</summary>
</member>
<member name="P:langguanApi.Model.HJ212.a25003_Cou">
<summary>
甲苯
</summary>
</member>
<member name="T:langguanApi.Model.InstrumentationDataFlag">
<summary>
检测仪器数据标记

View File

@ -418,7 +418,21 @@
a99049,
LA,
a99054
a99054,
a25003_Cou,
a25005_Cou,
a25007_Cou,
a25002_Cou,
a24088_Cou,
a24087_Cou,
a05002_Cou,
a00000_Cou,
a34013_Cou,
a21002_Cou,
a21026_Cou,
a21002_ZsRtd,
a21026_ZsRtd,
a34013_ZsRtd,
//a99051,
#endregion
}

View File

@ -164,6 +164,10 @@ namespace langguanApi.Model
///二 甲苯
/// </summary>
public double a25005_Cou { get; set; }
/// <summary>
///甲苯
/// </summary>
public double a25003_Cou { get; set; }
#endregion

View File

@ -61,15 +61,21 @@ namespace langguanApi.Service
/// <returns></returns>
public async Task<object> GetTodayData()
{
Expression<Func<Model.Device, bool>> exp = filter => filter.DeviceType == 1 || filter.DeviceType == 2;
var devices = (await _deviceSerive.GetListWithExp(exp)).ToList();
var tody = Convert.ToDateTime(DateTime.Now.ToString("D").ToString());
Expression<Func<Model.HJ212, bool>> expall = filter => devices.Select(s => s.deviceMN).Contains(filter.deviceMN) && filter.CreateDateTime >= tody;
var result = (await base.GetListWithExp(expall)).ToList();
var vocList = devices.Where(s => s.DeviceType == 1).Select(s => s.deviceMN).ToList();
var cemsList = devices.Where(s => s.DeviceType == 2).Select(s => s.deviceMN).ToList();
var voc = Math.Round(result.Where(s => vocList.Contains(s.deviceMN)).ToList().Select(s => s.a34004).Sum(), 2);
var cems = Math.Round(result.Where(s => vocList.Contains(s.deviceMN)).ToList().Select(s => s.a34002).Sum(), 2);
// 只取当天的日数据
Expression<Func<Model.HJ212, bool>> exp = filter => filter.ST == 31 || filter.ST == 27 && filter.CN == 2031 && filter.CreateDateTime >= DateTime.Now.Date;
var result = (await base.GetListWithExp(exp)).ToList();
// 过滤掉voc设备
var voc = result.Where(s => s.ST == 31).ToList().Select(s => s.a05002_Cou +
s.a24087_Cou +
s.a24088_Cou +
s.a25002_Cou +
s.a25003_Cou +
s.a25005_Cou +
s.a00000_Cou).Sum();
var cems = result.Where(s => s.ST == 27).ToList().Select(s => s.a21002_Cou +
s.a21026_Cou +
s.a34013_Cou +
s.a00000_Cou).Sum();
return new
{
today = new { voc, cems },
@ -95,7 +101,8 @@ namespace langguanApi.Service
s.a34013_Cou,
s.a00000_Cou,
date = s.CreateDateTime.ToString("MM-dd")
}).GroupBy(g => g.date).Select(s => new {
}).GroupBy(g => g.date).Select(s => new
{
s.Key,
value = Math.Round(s.Sum(t => t.a21002_Cou + t.a21026_Cou + t.a34013_Cou + t.a00000_Cou))
});
@ -106,10 +113,12 @@ namespace langguanApi.Service
s.a24087_Cou,
s.a24088_Cou,
s.a25002_Cou,
s.a25003_Cou,
s.a25005_Cou,
s.a00000_Cou,
date = s.CreateDateTime.ToString("MM-dd")
}).GroupBy(g => g.date).Select(s => new {
}).GroupBy(g => g.date).Select(s => new
{
s.Key,
value = Math.Round(s.Sum(t => t.a05002_Cou + t.a24087_Cou + t.a24088_Cou + t.a25002_Cou + t.a25005_Cou + t.a00000_Cou))
});

View File

@ -88,8 +88,8 @@ namespace langguanApi.Service
lastWeek = 0.6
};
var today = await _hj212Service.GetTodayData();
Func<Task<object>> getTodayFunc = async () => await _hj212Service.GetTodayData();
today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30);
//Func<Task<object>> getTodayFunc = async () => await _hj212Service.GetTodayData();
// today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30);
return new ApiResult
{