87 lines
2.9 KiB
C#
87 lines
2.9 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(IBillofmaterialsService), ServiceLifetime = LifeTime.Transient)]
|
|
public class BillofmaterialsService : BaseService<Billofmaterials>, IBillofmaterialsService
|
|
{
|
|
/// <summary>
|
|
/// 查询物料清单列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<BillofmaterialsDto> GetList(BillofmaterialsQueryDto parm)
|
|
{
|
|
var predicate = QueryExp(parm);
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<Billofmaterials, BillofmaterialsDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public Billofmaterials GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加物料清单
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public Billofmaterials AddBillofmaterials(Billofmaterials model)
|
|
{
|
|
return Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改物料清单
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateBillofmaterials(Billofmaterials model)
|
|
{
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询导出表达式
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
private static Expressionable<Billofmaterials> QueryExp(BillofmaterialsQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<Billofmaterials>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.Productname), it => it.Productname.Contains(parm.Productname))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Productcode), it => it.Productcode.Contains(parm.Productcode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.MirrorshellName), it => it.MirrorshellName.Contains(parm.MirrorshellName))
|
|
.AndIF(!string.IsNullOrEmpty(parm.MirrorshellCode), it => it.MirrorshellCode.Contains(parm.MirrorshellCode))
|
|
.AndIF(!string.IsNullOrEmpty(parm.MirrorbodyName), it => it.MirrorbodyName.Contains(parm.MirrorbodyName))
|
|
.AndIF(!string.IsNullOrEmpty(parm.MirrorbodyCode), it => it.MirrorbodyCode.Contains(parm.MirrorbodyCode))
|
|
;
|
|
|
|
return predicate;
|
|
}
|
|
}
|
|
} |