195 lines
6.8 KiB
C#
195 lines
6.8 KiB
C#
using InSituLaboratory.Entities.ExperimentalStationEntities;
|
|
using InSituLaboratory.Entities.Sensor;
|
|
using InSituLaboratory.Entities.SysData;
|
|
using InSituLaboratory.IService;
|
|
using InSituLaboratory.IService.Sensor;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace InSituLaboratory.Service.Sensor
|
|
{
|
|
/// <summary>
|
|
/// 传感器服务层
|
|
/// </summary>
|
|
public class SensorService : BaseService, ISensorService
|
|
{
|
|
public SensorService(DbContext context) : base(context) { }
|
|
|
|
#region MEMS色谱仪
|
|
|
|
/// <summary>
|
|
/// 获取MEMS色谱仪数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerable<MEMSSpModel> GetMEMSSP()
|
|
{
|
|
return this.Query<MEMSSpModel>(m => true).OrderByDescending(n => n.CreateTime).AsNoTracking();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取MEMS色谱仪数据---图表
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<MEMSSpModel> GetMemsSPData()
|
|
{
|
|
return this.Query<MEMSSpModel>(m => true).OrderBy(m => m.CreateTime).AsNoTracking().ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取MEMS色谱仪数据--分页 按时间倒序排序
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<MEMSSpModel> GetMemsSPData(string key, int pageSize, int pageIndex, out int totalCount)
|
|
{
|
|
var pResult = this.QueryPage<MEMSSpModel, string>(m => string.IsNullOrEmpty(key) || m.SamplingTime.ToString().Contains(key), pageSize, pageIndex, order => order.SamplingTime.ToString(), false);
|
|
|
|
totalCount = pResult.TotalCount;
|
|
|
|
return pResult.DataList;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region MEMS质谱仪
|
|
/// <summary>
|
|
/// 获取MEMS质谱仪数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerable<MEMSZpModel> GetMEMSZP()
|
|
{
|
|
return this.Query<MEMSZpModel>(m => true).OrderByDescending(n => n.CreateTime).AsNoTracking();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取MEMS质谱仪数据---图表
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<MEMSZpModel> GetMemsZPData()
|
|
{
|
|
return this.Query<MEMSZpModel>(m => true).OrderBy(m => m.CreateTime).AsNoTracking().ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取MEMS质谱仪数据--分页 按时间倒序排序
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<MEMSZpModel> GetMemsZPData(string key, int pageSize, int pageIndex, out int totalCount)
|
|
{
|
|
var pResult = this.QueryPage<MEMSZpModel, string>(m => string.IsNullOrEmpty(key) || m.SamplingTime.ToString().Contains(key), pageSize, pageIndex, order => order.SamplingTime.ToString(), false);
|
|
|
|
totalCount = pResult.TotalCount;
|
|
|
|
return pResult.DataList;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region 色质联用仪
|
|
/// <summary>
|
|
/// 获取色质联用仪数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerable<ColorMSModel> GetColorMS()
|
|
{
|
|
return this.Query<ColorMSModel>(m => true).OrderByDescending(n => n.CreateTime).AsNoTracking();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取色质联用仪---图表
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<ColorMSModel> GetColorMSData()
|
|
{
|
|
return this.Query<ColorMSModel>(m => true).OrderBy(m => m.CreateTime).AsNoTracking().ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取色质联用仪数据--分页 按时间倒序排序
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<ColorMSModel> GetColorMSData(string key, int pageSize, int pageIndex, out int totalCount)
|
|
{
|
|
var pResult = this.QueryPage<ColorMSModel, string>(m => string.IsNullOrEmpty(key) || m.SamplingTime.ToString().Contains(key), pageSize, pageIndex, order => order.SamplingTime.ToString(), false);
|
|
|
|
totalCount = pResult.TotalCount;
|
|
|
|
return pResult.DataList;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region 甲烷同位素分析仪
|
|
|
|
/// <summary>
|
|
/// 获取甲烷同位素分析仪数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerable<CH4IsotopeModel> GetCh4Isotope()
|
|
{
|
|
return this.Query<CH4IsotopeModel>(m => true).OrderByDescending(n => n.CreateTime).AsNoTracking();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取甲烷同位素分析仪数据---图表
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<CH4IsotopeModel> GetCh4ISotopeData()
|
|
{
|
|
return this.Query<CH4IsotopeModel>(m => true).OrderBy(m => m.CreateTime).AsNoTracking().ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取甲烷同位素分析仪数据--分页 按时间倒序排序
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="totalCount"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<CH4IsotopeModel> GetCh4ISotopeData(string key, int pageSize, int pageIndex, out int totalCount)
|
|
{
|
|
var pResult = this.QueryPage<CH4IsotopeModel, string>(m => string.IsNullOrEmpty(key) || m.SamplingTime.ToString().Contains(key), pageSize, pageIndex, order => order.SamplingTime.ToString(), false);
|
|
|
|
totalCount = pResult.TotalCount;
|
|
|
|
return pResult.DataList;
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|