shgx_tz_mom/ZR.Service/mes/Device/DeviceMaintenanceRecordService.cs
2025-09-23 15:11:18 +08:00

89 lines
2.7 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.Model;
using ZR.Repository;
using System.Linq;
using Aliyun.OSS;
using ZR.Model.MES.dev;
using ZR.Model.MES.dev.Dto;
using ZR.Service.MES.dev.IService;
namespace ZR.Service.MES.dev
{
/// <summary>
/// 维修记录Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IDeviceMaintenanceRecordService), ServiceLifetime = LifeTime.Transient)]
public class DeviceMaintenanceRecordService : BaseService<DeviceMaintenanceRecord>, IDeviceMaintenanceRecordService
{
/// <summary>
/// 查询维修记录列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<DeviceMaintenanceRecordDto> GetList(DeviceMaintenanceRecordQueryDto parm)
{
var predicate = Expressionable.Create<DeviceMaintenanceRecord>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<DeviceMaintenanceRecord, DeviceMaintenanceRecordDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public DeviceMaintenanceRecord GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加维修记录
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DeviceMaintenanceRecord AddDeviceMaintenanceRecord(DeviceMaintenanceRecord model)
{
model.Id = SnowFlakeSingle.Instance.NextId().ToString();
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改维修记录
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateDeviceMaintenanceRecord(DeviceMaintenanceRecord model)
{
//var response = Update(w => w.Id == model.Id, it => new DeviceMaintenanceRecord()
//{
// MaintanancePerson = model.MaintanancePerson,
// Phone = model.Phone,
// Result = model.Result,
// MaintenanceTime = model.MaintenanceTime,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}