2025-02-25 14:24:21 +08:00

42 lines
1.4 KiB
C#

using DOAN.Model.MES.api.Dto;
using DOAN.Model.MES.base_;
using DOAN.Service.MES.base_.IService;
using Infrastructure.Attribute;
namespace DOAN.Service.MES.base_
{
/// <summary>
/// 工艺路线Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IBaseLineCodeService), ServiceLifetime = LifeTime.Transient)]
public class BaseLineCodeService : BaseService<BaseWorkRoute>, IBaseLineCodeService
{
public List<RestLineCodeDto> GetLineCodeOptions(RestLineCodeDto parm)
{
try
{
var predicate = Expressionable
.Create<BaseWorkRoute>()
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
.AndIF(parm.Status > -1, it => it.Status == parm.Status);
var response = Queryable()
.Where(predicate.ToExpression())
.Select(it => new RestLineCodeDto
{
Name = it.Name,
Code = it.Code,
Remark = it.Remark,
Status = it.Status,
})
.ToList();
return response;
}
catch (Exception)
{
throw;
}
}
}
}