zhuangpei-mesbackend/DOAN.Service/MES/dev/DeviceMaintenancePerformanceService.cs

34 lines
1.2 KiB
C#
Raw Normal View History

2025-04-27 17:52:53 +08:00
using Aliyun.OSS;
using DOAN.Model.MES.dev;
using DOAN.Model.MES.dev.Dto;
using DOAN.Repository;
using DOAN.Service.MES.dev.IService;
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DOAN.Service.MES.dev
{
[AppService(ServiceType = typeof(IDeviceMaintenancePerformanceService), ServiceLifetime = LifeTime.Transient)]
public class DeviceMaintenancePerformanceService:BaseService<DeviceUptime>,IDeviceMaintenancePerformanceService
{
public async Task<Dictionary<string, List<DeviceUptime>>> DeviceUptimesAsync(string startTime, string endTime,string workshop)
{
var query = Context.Queryable<DeviceUptime>()
.Where(x => x.Workshop == workshop)
.Where(x => x.FillTime.CompareTo($"{startTime}") >= 0)
.Where(x => x.FillTime.CompareTo($"{endTime}") <= 0)
.OrderBy(x=>x.FillTime);
var result = (await query.ToListAsync()).GroupBy(x => x.Type)
.ToDictionary(g => g.Key, g => g.ToList());
return result;
}
}
}