Example #1
0
        /// <summary>
        /// 根据产品的SKU的BarCode查询产品信息
        /// </summary>
        /// <param name="BarCode"></param>
        /// <returns></returns>
        public ProductEntity GetSkuBarCode(string BarCode)
        {
            V_SkuEntity entity = new V_SkuEntity();

            entity.IncludeAll();
            entity.Where(item => item.BarCode == BarCode)
            .And(item => item.IsDelete == (int)EIsDelete.NotDelete)
            .And(item => item.CompanyID == this.CompanyID)
            ;
            ProductEntity result = this.V_Sku.GetSingle <ProductEntity>(entity);

            return(result);
        }
Example #2
0
        /// <summary>
        /// 查询SKU产品分页信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <ProductEntity> GetSkuList(ProductEntity entity, ref PageInfo pageInfo)
        {
            V_SkuEntity product = new V_SkuEntity();

            product.IncludeAll();
            product.OrderBy(item => item.ID, EOrderBy.DESC);
            product.Where(item => item.CompanyID == this.CompanyID)
            .And(item => item.IsDelete == (int)EIsDelete.NotDelete)
            ;

            if (entity.BarCode.IsNotEmpty())
            {
                product.And("BarCode", ECondition.In, "%" + entity.BarCode + "%");
            }
            if (entity.FactoryNum.IsNotEmpty())
            {
                product.And("FactoryNum", ECondition.In, "%" + entity.FactoryNum + "%");
            }
            if (entity.InCode.IsNotEmpty())
            {
                product.And("InCode", ECondition.In, "%" + entity.InCode + "%");
            }
            if (entity.ProductName.IsNotEmpty())
            {
                product.And("ProductName", ECondition.In, "%" + entity.ProductName + "%");
            }
            if (entity.CateNum.IsNotEmpty())
            {
                product.And(item => item.CateNum == entity.CateNum);
            }
            if (entity.UnitNum.IsNotEmpty())
            {
                product.And(item => item.UnitNum == entity.UnitNum);
            }
            if (entity.Color.IsNotEmpty())
            {
                product.And("Color", ECondition.In, "%" + entity.Color + "%");
            }
            if (entity.Size.IsNotEmpty())
            {
                product.And("Size", ECondition.In, "%" + entity.Size + "%");
            }
            if (entity.CusNum.IsNotEmpty())
            {
                product.And(item => item.CusNum == entity.CusNum);
            }
            if (entity.CusName.IsNotEmpty())
            {
                product.And("CusName", ECondition.In, "%" + entity.CusName + "%");
            }
            if (entity.SupNum.IsNotEmpty())
            {
                product.And(item => item.SupNum == entity.SupNum);
            }
            if (entity.SupName.IsNotEmpty())
            {
                product.And("SupName", ECondition.In, "%" + entity.SupName + "%");
            }
            int rowCount = 0;
            List <ProductEntity> listResult = this.V_Sku.GetList <ProductEntity>(product, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;

            return(listResult);
        }