zhuangpei-mesbackend/DOAN.Service/MES/dev/DeviceUptimeService.cs
2025-04-27 17:52:53 +08:00

89 lines
2.5 KiB
C#

using Aliyun.OSS;
using DOAN.Model;
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
{
/// <summary>
/// 设备保全率Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IDeviceUptimeService), ServiceLifetime = LifeTime.Transient)]
public class DeviceUptimeService : BaseService<DeviceUptime>, IDeviceUptimeService
{
/// <summary>
/// 查询设备保全率列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<DeviceUptimeDto> GetList(DeviceUptimeQueryDto parm)
{
var predicate = Expressionable.Create<DeviceUptime>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<DeviceUptime, DeviceUptimeDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public DeviceUptime GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加设备保全率
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DeviceUptime AddDeviceUptime(DeviceUptime model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改设备保全率
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateDeviceUptime(DeviceUptime model)
{
var response = Update(w => w.Id == model.Id, it => new DeviceUptime()
{
targetValue = model.targetValue,
ActualValue = model.ActualValue,
Workshop = model.Workshop,
FillTime = model.FillTime,
CreatedBy = model.CreatedBy,
CreatedTime = model.CreatedTime,
UpdatedBy = model.UpdatedBy,
Type = model.Type,
UpdatedTime = model.UpdatedTime,
});
return response;
//return Update(model, true);
}
}
}