using Infrastructure.Attribute; using MDM.Model; using MDM.Model.Process; using MDM.Model.Process.Dto; using MDM.Repository; using MDM.Service; using MDM.Services.IProcessService; namespace MDM.Services.Process { /// /// 工序返工规则Service业务层处理 /// [AppService(ServiceType = typeof(IProcessOperationReworkRuleService), ServiceLifetime = LifeTime.Transient)] public class ProcessOperationReworkRuleService : BaseService, IProcessOperationReworkRuleService { /// /// 查询工序返工规则列表 /// /// /// public PagedInfo GetList(ProcessOperationReworkRuleQueryDto parm) { var predicate = Expressionable.Create() .AndIF(!string.IsNullOrEmpty(parm.FkRoutingCode), m => m.FkRoutingCode.Contains(parm.FkRoutingCode)) .AndIF(!string.IsNullOrEmpty(parm.FkOperationCode), m => m.FkOperationCode.Contains(parm.FkOperationCode)) ; var response = Queryable() .Where(predicate.ToExpression()) .ToPage(parm); return response; } /// /// 获取详情 /// /// /// public ProcessOperationReworkRule GetInfo(int ReworkRuleId) { var response = Queryable() .Where(x => x.ReworkRuleId == ReworkRuleId) .First(); return response; } /// /// 添加工序返工规则 /// /// /// public ProcessOperationReworkRule AddProcessOperationReworkRule(ProcessOperationReworkRule model) { return Context.Insertable(model).ExecuteReturnEntity(); } /// /// 修改工序返工规则 /// /// /// public int UpdateProcessOperationReworkRule(ProcessOperationReworkRule model) { //var response = Update(w => w.ReworkRuleId == model.ReworkRuleId, it => new ProcessOperationReworkRule() //{ // FkRoutingCode = model.FkRoutingCode, // FkOperationCode = model.FkOperationCode, // IsReworkAllowed = model.IsReworkAllowed, // MaxReworkTimes = model.MaxReworkTimes, // ReworkTargetOperationCode = model.ReworkTargetOperationCode, // ReworkCondition = model.ReworkCondition, // Description = model.Description, // CreatedBy = model.CreatedBy, // CreatedTime = model.CreatedTime, // UpdatedBy = model.UpdatedBy, // UpdatedTime = model.UpdatedTime, //}); //return response; return Update(model, true); } } }