首页voc,cems数据处理
This commit is contained in:
		
							parent
							
								
									32f9e8a1f5
								
							
						
					
					
						commit
						d4cf5fcfa0
					
				| 
						 | 
					@ -1825,6 +1825,11 @@
 | 
				
			||||||
            二 甲苯
 | 
					            二 甲苯
 | 
				
			||||||
             </summary>
 | 
					             </summary>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
 | 
					        <member name="P:langguanApi.Model.HJ212.a25003_Cou">
 | 
				
			||||||
 | 
					             <summary>
 | 
				
			||||||
 | 
					            甲苯
 | 
				
			||||||
 | 
					             </summary>
 | 
				
			||||||
 | 
					        </member>
 | 
				
			||||||
        <member name="T:langguanApi.Model.InstrumentationDataFlag">
 | 
					        <member name="T:langguanApi.Model.InstrumentationDataFlag">
 | 
				
			||||||
            <summary>
 | 
					            <summary>
 | 
				
			||||||
            检测仪器数据标记
 | 
					            检测仪器数据标记
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -418,7 +418,21 @@
 | 
				
			||||||
        a99049,
 | 
					        a99049,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        LA,
 | 
					        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,
 | 
					        //a99051,
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,6 +164,10 @@ namespace langguanApi.Model
 | 
				
			||||||
        ///二 甲苯
 | 
					        ///二 甲苯
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public double a25005_Cou { get; set; }
 | 
					        public double a25005_Cou { get; set; }
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        ///甲苯
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public double a25003_Cou { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,15 +61,21 @@ namespace langguanApi.Service
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        public async Task<object> GetTodayData()
 | 
					        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();
 | 
					            Expression<Func<Model.HJ212, bool>> exp = filter => filter.ST == 31 || filter.ST == 27 && filter.CN == 2031 && filter.CreateDateTime >= DateTime.Now.Date;
 | 
				
			||||||
            var tody = Convert.ToDateTime(DateTime.Now.ToString("D").ToString());
 | 
					            var result = (await base.GetListWithExp(exp)).ToList();
 | 
				
			||||||
            Expression<Func<Model.HJ212, bool>> expall = filter => devices.Select(s => s.deviceMN).Contains(filter.deviceMN) && filter.CreateDateTime >= tody;
 | 
					            // 过滤掉voc设备
 | 
				
			||||||
            var result = (await base.GetListWithExp(expall)).ToList();
 | 
					            var voc = result.Where(s => s.ST == 31).ToList().Select(s => s.a05002_Cou +
 | 
				
			||||||
            var vocList = devices.Where(s => s.DeviceType == 1).Select(s => s.deviceMN).ToList();
 | 
					                s.a24087_Cou +
 | 
				
			||||||
            var cemsList = devices.Where(s => s.DeviceType == 2).Select(s => s.deviceMN).ToList();
 | 
					                s.a24088_Cou +
 | 
				
			||||||
            var voc = Math.Round(result.Where(s => vocList.Contains(s.deviceMN)).ToList().Select(s => s.a34004).Sum(), 2);
 | 
					                s.a25002_Cou +
 | 
				
			||||||
            var cems = Math.Round(result.Where(s => vocList.Contains(s.deviceMN)).ToList().Select(s => s.a34002).Sum(), 2);
 | 
					                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
 | 
					            return new
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                today = new { voc, cems },
 | 
					                today = new { voc, cems },
 | 
				
			||||||
| 
						 | 
					@ -95,9 +101,10 @@ namespace langguanApi.Service
 | 
				
			||||||
                s.a34013_Cou,
 | 
					                s.a34013_Cou,
 | 
				
			||||||
                s.a00000_Cou,
 | 
					                s.a00000_Cou,
 | 
				
			||||||
                date = s.CreateDateTime.ToString("MM-dd")
 | 
					                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))
 | 
					                s.Key,
 | 
				
			||||||
 | 
					                value = Math.Round(s.Sum(t => t.a21002_Cou + t.a21026_Cou + t.a34013_Cou + t.a00000_Cou))
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            //voc
 | 
					            //voc
 | 
				
			||||||
            var voc = result.Where(s => s.ST == 27).Select(s => new
 | 
					            var voc = result.Where(s => s.ST == 27).Select(s => new
 | 
				
			||||||
| 
						 | 
					@ -106,12 +113,14 @@ namespace langguanApi.Service
 | 
				
			||||||
                s.a24087_Cou,
 | 
					                s.a24087_Cou,
 | 
				
			||||||
                s.a24088_Cou,
 | 
					                s.a24088_Cou,
 | 
				
			||||||
                s.a25002_Cou,
 | 
					                s.a25002_Cou,
 | 
				
			||||||
 | 
					                s.a25003_Cou,
 | 
				
			||||||
                s.a25005_Cou,
 | 
					                s.a25005_Cou,
 | 
				
			||||||
                s.a00000_Cou,
 | 
					                s.a00000_Cou,
 | 
				
			||||||
                date = s.CreateDateTime.ToString("MM-dd")
 | 
					                date = s.CreateDateTime.ToString("MM-dd")
 | 
				
			||||||
            }).GroupBy(g => g.date).Select(s => new {
 | 
					            }).GroupBy(g => g.date).Select(s => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                s.Key,
 | 
					                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 };
 | 
					            return new { voc, cems };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,8 +88,8 @@ namespace langguanApi.Service
 | 
				
			||||||
                lastWeek = 0.6
 | 
					                lastWeek = 0.6
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            var today = await _hj212Service.GetTodayData();
 | 
					            var today = await _hj212Service.GetTodayData();
 | 
				
			||||||
            Func<Task<object>> getTodayFunc = async () => await _hj212Service.GetTodayData();
 | 
					            //Func<Task<object>> getTodayFunc = async () => await _hj212Service.GetTodayData();
 | 
				
			||||||
             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
 | 
					            return new ApiResult
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue