83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 料架表Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IStoragelocationService), ServiceLifetime = LifeTime.Transient)]
|
|
public class StoragelocationService : BaseService<Storagelocation>, IStoragelocationService
|
|
{
|
|
/// <summary>
|
|
/// 查询料架表列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<StoragelocationDto> GetList(StoragelocationQueryDto parm)
|
|
{
|
|
var predicate = QueryExp(parm);
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<Storagelocation, StoragelocationDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public Storagelocation GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加料架表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public Storagelocation AddStoragelocation(Storagelocation model)
|
|
{
|
|
return Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改料架表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateStoragelocation(Storagelocation model)
|
|
{
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询导出表达式
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
private static Expressionable<Storagelocation> QueryExp(StoragelocationQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<Storagelocation>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.Partnumber),it=>it.Partnumber.Contains( parm.Partnumber))
|
|
.AndIF(!string.IsNullOrEmpty(parm.RackCode),it=>it.RackCode.Contains( parm.RackCode))
|
|
;
|
|
|
|
return predicate;
|
|
}
|
|
}
|
|
} |