示例#1
0
        /// <summary>
        /// 查询可用于报损的仓库数据
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <LocalProductEntity> GetBadAbleList(LocalProductEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(item => item.CompanyID == this.CompanyID).And(item => item.Num > 0);
            entity.OrderBy(item => item.ID, EOrderBy.DESC);

            entity.AndBegin <LocalProductEntity>()
            .Or <LocalProductEntity>(item => item.LocalType == (int)ELocalType.Normal)
            .Or <LocalProductEntity>(item => item.LocalType == (int)ELocalType.WaitIn)
            .Or <LocalProductEntity>(item => item.LocalType == (int)ELocalType.WaitCheck)
            .End();

            if (entity.StorageNum.IsNotEmpty())
            {
                entity.And(item => item.StorageNum == entity.StorageNum);
            }
            if (entity.LocalType > 0)
            {
                entity.And(item => item.LocalType == entity.LocalType);
            }
            if (entity.LocalNum.IsNotEmpty())
            {
                entity.And(item => item.LocalNum == entity.LocalNum);
            }
            if (entity.BarCode.IsNotEmpty())
            {
                entity.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%");
            }
            if (entity.ProductName.IsNotEmpty())
            {
                entity.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%");
            }
            if (entity.BatchNum.IsNotEmpty())
            {
                entity.And("BatchNum", ECondition.Like, "%" + entity.BatchNum + "%");
            }

            int rowCount = 0;
            List <LocalProductEntity> listResult = this.LocalProduct.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;

            if (!listResult.IsNullOrEmpty())
            {
                ProductProvider productProvider = new ProductProvider(this.CompanyID);
                foreach (LocalProductEntity item in listResult)
                {
                    ProductEntity product = productProvider.GetProduct(item.ProductNum);
                    if (product != null)
                    {
                        item.Size     = product.Size;
                        item.CateNum  = product.CateNum;
                        item.CateName = product.CateName;
                        item.AvgPrice = product.AvgPrice;
                        item.MinNum   = product.MinNum;
                        item.MaxNum   = product.MaxNum;
                    }
                }
            }
            return(listResult);
        }