diff --git a/langguanApi.xml b/langguanApi.xml index 4b7afed..5724e09 100644 --- a/langguanApi.xml +++ b/langguanApi.xml @@ -1820,6 +1820,11 @@ 苯 + + + 二 甲苯 + + 检测仪器数据标记 @@ -2926,7 +2931,7 @@ - + 一周之内的排放数据 diff --git a/langguanApi/Model/HJ212.cs b/langguanApi/Model/HJ212.cs index 4566360..acb0c8a 100644 --- a/langguanApi/Model/HJ212.cs +++ b/langguanApi/Model/HJ212.cs @@ -160,7 +160,10 @@ namespace langguanApi.Model /// 苯 /// public double a25002_Cou { get; set; } - + /// + ///二 甲苯 + /// + public double a25005_Cou { get; set; } #endregion diff --git a/langguanApi/Service/HJ212/NetSession.cs b/langguanApi/Service/HJ212/NetSession.cs index 286022e..7a3c6bd 100644 --- a/langguanApi/Service/HJ212/NetSession.cs +++ b/langguanApi/Service/HJ212/NetSession.cs @@ -51,9 +51,8 @@ namespace langguanApi.Service.HJ212 try { byte[] data = ReadBuffer.ReadLine(); - - Console.WriteLine($"原始数据:{data}----------"); - Console.WriteLine($"原始数据HexString:{data.ToHexString()}--------------------"); + //Console.WriteLine($"原始数据:{data}----------"); + //Console.WriteLine($"原始数据HexString:{data.ToHexString()}--------------------"); //Console.WriteLine($"原始数据ASCII:{Encoding.ASCII.GetString(data)}-"); //Position position = ParsePosition(data); diff --git a/langguanApi/Service/Hj212Service.cs b/langguanApi/Service/Hj212Service.cs index a9aa861..aa6474d 100644 --- a/langguanApi/Service/Hj212Service.cs +++ b/langguanApi/Service/Hj212Service.cs @@ -73,51 +73,45 @@ namespace langguanApi.Service return new { today = new { voc, cems }, - week = await GetWeekData(vocList, cemsList) + week = await GetWeekData() }; } /// /// 一周之内的排放数据 /// /// - public async Task GetWeekData(List vocList, List cemsList) + public async Task GetWeekData() { // Expression> exp = filter => filter.CreateDateTime >= DateTime.Now.AddDays(-7); // CN = 2031是日数据 - //Expression> exp = filter => filter.CN == 2031 && filter.CreateDateTime >= DateTime.Now.AddDays(-7); + Expression> exp = filter => filter.ST == 31 || filter.ST == 27 && filter.CN == 2031 && filter.CreateDateTime >= DateTime.Now.AddDays(-7); ////a21026_Cou,a21002_Cou,a34013_Cou - //var result = (await base.GetListWithExp(exp)).ToList().Select(s => new - //{ - // // - //}); - - - - - - var filter = Builders.Filter.In(s => s.deviceMN, vocList.Concat(cemsList)) - & Builders.Filter.Gte(s => s.CreateDateTime, DateTime.Now.AddDays(-3)); - var result = await base.FindListyFilter(filter); - var voc = result.Where(s => vocList.Contains(s.deviceMN)).Select(s => new + var result = (await base.GetListWithExp(exp)).ToList(); + //cems + var cems = result.Where(s => s.ST == 31).Select(s => new { - s.a34001, + s.a21002_Cou, + s.a21026_Cou, + s.a34013_Cou, + s.a00000_Cou, date = s.CreateDateTime.ToString("MM-dd") - }).GroupBy(s => s.date) - .Select(s => new - { - s.Key, - value = Math.Round(s.Sum(t => t.a34001)) + }).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)) }); - - var cems = result.Where(s => cemsList.Contains(s.deviceMN)).Select(s => new + //voc + var voc = result.Where(s => s.ST == 27).Select(s => new { - s.a34002, + s.a05002_Cou, + s.a24087_Cou, + s.a24088_Cou, + s.a25002_Cou, + s.a25005_Cou, + s.a00000_Cou, date = s.CreateDateTime.ToString("MM-dd") - }).GroupBy(s => s.date) - .Select(s => new - { + }).GroupBy(g => g.date).Select(s => new { s.Key, - value = Math.Round(s.Sum(t => t.a34002)) + 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 bada33e..e917044 100644 --- a/langguanApi/Service/HomeService.cs +++ b/langguanApi/Service/HomeService.cs @@ -87,8 +87,10 @@ namespace langguanApi.Service yesterday = 0.8, lastWeek = 0.6 }; + var today = await _hj212Service.GetTodayData(); Func> getTodayFunc = async () => await _hj212Service.GetTodayData(); - var today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30); + today = await _cacheManager.GetConvertVale(RedisKeylist.Today, getTodayFunc, 60 * 60 * 24 * 30); + return new ApiResult { code = 0,