using System; using SqlSugar; using Infrastructure.Attribute; using Infrastructure.Extensions; using DOAN.Model; using DOAN.Model.Dto; using DOAN.Model.MES.material.Dto; using DOAN.Model.MES.material; using DOAN.Repository; using DOAN.Service.MES.material.IService; using System.Linq; namespace DOAN.Service.MES.material { /// /// 北泽线边库库位Service业务层处理 /// [AppService(ServiceType = typeof(IMaterialPartsStorageLocationsService), ServiceLifetime = LifeTime.Transient)] public class MaterialPartsStorageLocationsService : BaseService, IMaterialPartsStorageLocationsService { /// /// 查询北泽线边库库位列表 /// /// /// public PagedInfo GetList(MaterialPartsStorageLocationsQueryDto parm) { var predicate = Expressionable.Create(); var response = Queryable() .Where(predicate.ToExpression()) .ToPage(parm); return response; } public string[] QueryMaterialPartsStorageLocationsLocationCode(string query) { return Queryable() .WhereIF(!string.IsNullOrEmpty(query),x => x.LocationCode.Contains(query)) .Select(x => x.LocationCode) .ToArray(); } /// /// 获取详情 /// /// /// public MaterialPartsStorageLocations GetInfo(int LocationId) { var response = Queryable() .Where(x => x.LocationId == LocationId) .First(); return response; } /// /// 添加北泽线边库库位 /// /// /// public MaterialPartsStorageLocations AddMaterialPartsStorageLocations(MaterialPartsStorageLocations model) { return Context.Insertable(model).ExecuteReturnEntity(); } /// /// 修改北泽线边库库位 /// /// /// public int UpdateMaterialPartsStorageLocations(MaterialPartsStorageLocations model) { //var response = Update(w => w.LocationId == model.LocationId, it => new MaterialPartsStorageLocations() //{ // LocationCode = model.LocationCode, // Description = model.Description, // CreatedAt = model.CreatedAt, // UpdatedAt = model.UpdatedAt, //}); //return response; return Update(model, true); } } }