/// <summary> /// 查询产品列表 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo) { List <ProductEntity> listSource = GetList(); if (listSource.IsNullOrEmpty()) { return(listSource); } int rowCount = 0; List <ProductEntity> listResult = listSource; if (!entity.BarCode.IsEmpty()) { listResult = listResult.Where(a => a.BarCode.Contains(entity.BarCode)).ToList(); } if (!entity.ProductName.IsEmpty()) { listResult = listResult.Where(a => a.ProductName.Contains(entity.ProductName)).ToList(); } if (entity.FactoryNum.IsNotEmpty()) { listResult = listResult.Where(a => a.FactoryNum.Contains(entity.FactoryNum)).ToList(); } if (entity.InCode.IsNotEmpty()) { listResult = listResult.Where(a => a.InCode.Contains(entity.InCode)).ToList(); } if (!entity.Size.IsEmpty()) { listResult = listResult.Where(a => a.Size.Contains(entity.Size)).ToList(); } if (!entity.CateNum.IsEmpty()) { ProductCategoryProvider cateProvider = new ProductCategoryProvider(this.CompanyID); List <ProductCategoryEntity> listCate = cateProvider.GetChildList(entity.CateNum); listCate = listCate.IsNull() ? new List <ProductCategoryEntity>() : listCate; listResult = listResult.Where(a => listCate.Exists(item => item.SnNum == a.CateNum)).ToList(); } if (entity.IsSingle > 0) { listResult = listResult.Where(a => a.IsSingle == entity.IsSingle).ToList(); } rowCount = listResult.Count; pageInfo.RowCount = rowCount; return(listResult.Skip((pageInfo.PageIndex - 1) * pageInfo.PageSize).Take(pageInfo.PageSize).ToList()); }
/// <summary> /// 所有仓库的正式库位和待入库位货品数量的总和 /// 不区分仓库,不区分库位 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <V_LocalProductEntity> GetList(V_LocalProductEntity entity, ref PageInfo pageInfo) { V_LocalProductEntity Entity = new V_LocalProductEntity(); Entity.IncludeAll(); Entity.OrderBy(a => a.ID, EOrderBy.ASC); Entity.Where(a => a.CompanyID == this.CompanyID).And(item => item.Num > 0); if (entity.BarCode.IsNotEmpty()) { Entity.Where("BarCode", ECondition.Like, "%" + entity.BarCode + "%"); } if (entity.ProductName.IsNotEmpty()) { Entity.Where("ProductName", ECondition.Like, "%" + entity.ProductName + "%"); } if (entity.Size.IsNotEmpty()) { Entity.Where("Size", ECondition.Like, "%" + entity.Size + "%"); } if (entity.CateNum.IsNotEmpty()) { ProductCategoryProvider provider = new ProductCategoryProvider(this.CompanyID); List <ProductCategoryEntity> listCate = provider.GetChildList(entity.CateNum); string[] items = null; if (!listCate.IsNullOrEmpty()) { items = listCate.Select(item => item.SnNum).ToArray(); } else { items = new string[] { "" }; } Entity.And("CateNum", ECondition.In, items); } int rowCount = 0; List <V_LocalProductEntity> listResult = this.V_LocalProduct.GetList <V_LocalProductEntity>(Entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }