using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Repository;
using DOAN.Service.PBL.IService;
namespace DOAN.Service.PBL
{
///
/// 料架表Service业务层处理
///
[AppService(ServiceType = typeof(IStoragelocationService), ServiceLifetime = LifeTime.Transient)]
public class StoragelocationService : BaseService, IStoragelocationService
{
///
/// 查询料架表列表
///
///
///
public PagedInfo GetList(StoragelocationQueryDto parm)
{
var predicate = QueryExp(parm);
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage(parm);
return response;
}
///
/// 获取详情
///
///
///
public Storagelocation GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
///
/// 添加料架表
///
///
///
public Storagelocation AddStoragelocation(Storagelocation model)
{
return Insertable(model).ExecuteReturnEntity();
}
///
/// 修改料架表
///
///
///
public int UpdateStoragelocation(Storagelocation model)
{
return Update(model, true);
}
///
/// 查询导出表达式
///
///
///
private static Expressionable QueryExp(StoragelocationQueryDto parm)
{
var predicate = Expressionable.Create()
.AndIF(!string.IsNullOrEmpty(parm.Partnumber),it=>it.Partnumber.Contains( parm.Partnumber))
.AndIF(!string.IsNullOrEmpty(parm.RackCode),it=>it.RackCode.Contains( parm.RackCode))
;
return predicate;
}
}
}