diff --git a/langguanApi.xml b/langguanApi.xml index 5724e09..afba94c 100644 --- a/langguanApi.xml +++ b/langguanApi.xml @@ -1825,6 +1825,11 @@ 二 甲苯 + + + 甲苯 + + 检测仪器数据标记 diff --git a/langguanApi/Model/FactorCode.cs b/langguanApi/Model/FactorCode.cs index 7fa4758..b8a213b 100644 --- a/langguanApi/Model/FactorCode.cs +++ b/langguanApi/Model/FactorCode.cs @@ -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 } diff --git a/langguanApi/Model/HJ212.cs b/langguanApi/Model/HJ212.cs index acb0c8a..ef38f86 100644 --- a/langguanApi/Model/HJ212.cs +++ b/langguanApi/Model/HJ212.cs @@ -164,6 +164,10 @@ namespace langguanApi.Model ///二 甲苯 /// public double a25005_Cou { get; set; } + /// + ///甲苯 + /// + public double a25003_Cou { get; set; } #endregion diff --git a/langguanApi/Service/Hj212Service.cs b/langguanApi/Service/Hj212Service.cs index aa6474d..eccf609 100644 --- a/langguanApi/Service/Hj212Service.cs +++ b/langguanApi/Service/Hj212Service.cs @@ -61,15 +61,21 @@ namespace langguanApi.Service /// public async Task GetTodayData() { - Expression> 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> 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> 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,9 +101,10 @@ namespace langguanApi.Service s.a34013_Cou, s.a00000_Cou, date = s.CreateDateTime.ToString("MM-dd") - }).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)) + }).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)) }); //voc var voc = result.Where(s => s.ST == 27).Select(s => new @@ -106,12 +113,14 @@ 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)) + value = Math.Round(s.Sum(t => t.a05002_Cou + t.a24087_Cou + t.a24088_Cou + t.a25002_Cou + t.a25005_Cou + t.a00000_Cou)) }); return new { voc, cems }; } diff --git a/langguanApi/Service/HomeService.cs b/langguanApi/Service/HomeService.cs index e917044..77099d7 100644 --- a/langguanApi/Service/HomeService.cs +++ b/langguanApi/Service/HomeService.cs @@ -88,8 +88,8 @@ namespace langguanApi.Service lastWeek = 0.6 }; var today = await _hj212Service.GetTodayData(); - Func> getTodayFunc = async () => await _hj212Service.GetTodayData(); - today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30); + //Func> getTodayFunc = async () => await _hj212Service.GetTodayData(); + // today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30); return new ApiResult {