using System; using SqlSugar; using Infrastructure.Attribute; using Infrastructure.Extensions; using DOAN.Model; using DOAN.Model.Dto; using DOAN.Repository; using DOAN.Model.MES.dev.Dto; using DOAN.Model.MES.dev; using System.Linq; using DOAN.Service.MES.dev.IService; namespace DOAN.Service.MES.dev { /// /// 库存信息表Service业务层处理 /// [AppService(ServiceType = typeof(IDevicePartsInventoryService), ServiceLifetime = LifeTime.Transient)] public class DevicePartsInventoryService : BaseService, IDevicePartsInventoryService { /// /// 查询库存信息表列表 /// /// /// public PagedInfo GetList(DevicePartsInventoryQueryDto parm) { var predicate = Expressionable.Create(); var response = Queryable() .Where(predicate.ToExpression()); var result= Context.Queryable(response).LeftJoin((r, s) => r.PartId == s.PartId) .Select((r, s) => new DevicePartsInventoryDto2(), true) .ToPage_NO_Convert(parm); return result; } /// /// 获取详情 /// /// /// public DevicePartsInventory GetInfo(int InventoryId) { var response = Queryable() .Where(x => x.InventoryId == InventoryId) .First(); return response; } /// /// 添加库存信息表 /// /// /// public DevicePartsInventory AddDevicePartsInventory(DevicePartsInventory model) { return Context.Insertable(model).ExecuteReturnEntity(); } /// /// 修改库存信息表 /// /// /// public int UpdateDevicePartsInventory(DevicePartsInventory model) { //var response = Update(w => w.InventoryId == model.InventoryId, it => new DevicePartsInventory() //{ // Quantity = model.Quantity, // Location = model.Location, // LastInventoryCheck = model.LastInventoryCheck, // CreatedAt = model.CreatedAt, // UpdatedAt = model.UpdatedAt, //}); //return response; return Update(model, true); } } }