zhuangpei-mesbackend/DOAN.Service/MES/mm/line/MmLineLocationService.cs
2025-03-21 13:29:56 +08:00

83 lines
2.5 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Repository;
using System.Linq;
using DOAN.Model.MES.mm.line;
using DOAN.Model.MES.mm.line.Dto;
using DOAN.Service.MES.mm.line.IService;
namespace DOAN.Service.MES.mm.line
{
/// <summary>
/// mm_line_locationService业务层处理
/// </summary>
[AppService(ServiceType = typeof(IMmLineLocationService), ServiceLifetime = LifeTime.Transient)]
public class MmLineLocationService : BaseService<MmLineLocation>, IMmLineLocationService
{
/// <summary>
/// 查询mm_line_location列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<MmLineLocationDto> GetList(MmLineLocationQueryDto parm)
{
var predicate = Expressionable.Create<MmLineLocation>().AndIF(!string.IsNullOrEmpty(parm.Line_Code), o => o.Line_Code == parm.Line_Code);
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<MmLineLocation, MmLineLocationDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public MmLineLocation GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加mm_line_location
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MmLineLocation AddMmLineLocation(MmLineLocation model)
{
model.Id = XueHua;
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改mm_line_location
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateMmLineLocation(MmLineLocation model)
{
//var response = Update(w => w.Id == model.Id, it => new MmLineLocation()
//{
// LocationName = model.LocationName,
// LocationCode = model.LocationCode,
// Linecode = model.Linecode,
// Description = model.Description,
// Capacity = model.Capacity,
// Status = model.Status,
//});
//return response;
return Update(model, true);
}
}
}