using System; using SqlSugar; using Infrastructure.Attribute; using Infrastructure.Extensions; using DOAN.Model; using DOAN.Model.Dto; using DOAN.Model.MES.quality; using DOAN.Model.MES.quality.Dto; using DOAN.Repository; using System.Linq; namespace DOAN.Service.MES.quality { /// /// 缺陷收集Service业务层处理 /// [AppService(ServiceType = typeof(IQcDefectCollectionService), ServiceLifetime = LifeTime.Transient)] public class QcDefectCollectionService : BaseService, IQcDefectCollectionService { /// /// 查询缺陷收集列表 /// /// /// public PagedInfo GetList(QcDefectCollectionQueryDto parm) { var predicate = Expressionable.Create(); var response = Queryable() .Where(predicate.ToExpression()) .ToPage(parm); return response; } /// /// 获取详情 /// /// /// public QcDefectCollection GetInfo(string Id) { var response = Queryable() .Where(x => x.Id == Id) .First(); return response; } /// /// 添加缺陷收集 /// /// /// public QcDefectCollection AddQcDefectCollection(QcDefectCollection model) { return Context.Insertable(model).ExecuteReturnEntity(); } /// /// 修改缺陷收集 /// /// /// public int UpdateQcDefectCollection(QcDefectCollection model) { //var response = Update(w => w.Id == model.Id, it => new QcDefectCollection() //{ // MaterialCode = model.MaterialCode, // MaterialName = model.MaterialName, // BatchNumber = model.BatchNumber, // Unit = model.Unit, // Quantity = model.Quantity, // DateTime = model.DateTime, // GroupCode = model.GroupCode, // LineCode = model.LineCode, // ProcessName = model.ProcessName, // Superintendent = model.Superintendent, // DefectDescription = model.DefectDescription, // Tqm = model.Tqm, // Remark = model.Remark, // CreatedBy = model.CreatedBy, // CreatedTime = model.CreatedTime, // UpdatedBy = model.UpdatedBy, // UpdatedTime = model.UpdatedTime, //}); //return response; return Update(model, true); } } }