using Infrastructure.Attribute; using DOAN.Repository; using DOAN.Model.Factory_Model.Dto; using DOAN.Model.Factory_Model; using DOAN.Service.Factory_Model.IService; namespace DOAN.Service.Factory_Model { /// /// 产线Service业务层处理 /// [AppService(ServiceType = typeof(IBaseProductionLineService), ServiceLifetime = LifeTime.Transient)] public class BaseProductionLineService : BaseService, IBaseProductionLineService { /// /// 查询产线列表 /// /// /// public PagedInfo GetList(BaseProductionLineQueryDto parm) { var predicate = QueryExp(parm); var response = Queryable() .Where(predicate.ToExpression()) .ToPage(parm); return response; } /// /// 获取详情 /// /// /// public BaseProductionLine GetInfo(int Id) { var response = Queryable() .Where(x => x.Id == Id) .First(); return response; } /// /// 添加产线 /// /// /// public BaseProductionLine AddBaseProductionLine(BaseProductionLine model) { return Insertable(model).ExecuteReturnEntity(); } /// /// 修改产线 /// /// /// public int UpdateBaseProductionLine(BaseProductionLine model) { return Update(model, true); } /// /// 查询导出表达式 /// /// /// private static Expressionable QueryExp(BaseProductionLineQueryDto parm) { var predicate = Expressionable.Create() .AndIF(string.IsNullOrEmpty(parm.LineCode), it => it.LineCode.Contains(parm.LineCode)) .AndIF(string.IsNullOrEmpty(parm.LineName), it => it.LineName.Contains(parm.LineName)) .AndIF(parm.Status > -1, it => it.Status == parm.Status) .AndIF(parm.FkWorkshopId > -1, it => it.FkWorkshopId == parm.FkWorkshopId) ; return predicate; } } }