using Infrastructure.Attribute; using Infrastructure.Extensions; using DOAN.Model.BZFM.Dto; using DOAN.Model.BZFM; using DOAN.Repository; using DOAN.Service.BZFM.IBZFMService; namespace DOAN.Service.BZFM { /// /// 库位表Service业务层处理 /// [AppService(ServiceType = typeof(IMmLocationService), ServiceLifetime = LifeTime.Transient)] public class MmLocationService : BaseService, IMmLocationService { /// /// 查询库位表列表 /// /// /// public PagedInfo GetList(MmLocationQueryDto parm) { var predicate = QueryExp(parm); var response = Queryable() .Where(predicate.ToExpression()) .OrderBy(it => it.LocationCode) .ToPage(parm); return response; } /// /// 获取详情 /// /// /// public MmLocation GetInfo(int Id) { var response = Queryable() .Where(x => x.Id == Id) .First(); return response; } /// /// 添加库位表 /// /// /// public MmLocation AddMmLocation(MmLocation model) { return Insertable(model).ExecuteReturnEntity(); } /// /// 修改库位表 /// /// /// public int UpdateMmLocation(MmLocation model) { return Update(model, true); } /// /// 查询导出表达式 /// /// /// private static Expressionable QueryExp(MmLocationQueryDto parm) { var predicate = Expressionable.Create() .AndIF(!string.IsNullOrEmpty(parm.LocationCode), it => it.LocationCode.Contains(parm.LocationCode)) .AndIF(!string.IsNullOrEmpty(parm.WarehouseCode), it => it.WarehouseCode.Contains(parm.WarehouseCode)); return predicate; } } }