Files
shgx_tz_mes_backend_sync/ZR.Service/mes/mm/MmAgvLocationService.cs
2024-04-26 15:35:03 +08:00

87 lines
2.5 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.Model;
using ZR.Model.Dto;
using ZR.Repository;
using System.Linq;
using ZR.Model.MES.mm;
using ZR.Service.mes.mm.IService;
namespace ZR.Service.Business
{
/// <summary>
/// agv位置表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IMmAgvLocationService), ServiceLifetime = LifeTime.Transient)]
public class MmAgvLocationService : BaseService<MmAgvLocation>, IMmAgvLocationService
{
/// <summary>
/// 查询agv位置表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<MmAgvLocationDto> GetList(MmAgvLocationQueryDto parm)
{
var predicate = Expressionable.Create<MmAgvLocation>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<MmAgvLocation, MmAgvLocationDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public MmAgvLocation GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加agv位置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MmAgvLocation AddMmAgvLocation(MmAgvLocation model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改agv位置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateMmAgvLocation(MmAgvLocation model)
{
//var response = Update(w => w.Id == model.Id, it => new MmAgvLocation()
//{
// AreaCode = model.AreaCode,
// Area = model.Area,
// Type = model.Type,
// Coordinate = model.Coordinate,
// Status = model.Status,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}