Esempio n. 1
0
 /// <summary>
 /// 根据订单详细唯一编码号获取该订单详细信息以及产品信息
 /// </summary>
 /// <param name="sn"></param>
 /// <returns></returns>
 public OrderDetailEntity GetOrderDetailBySnNum(string snNum)
 {
     OrderDetailEntity entity = new OrderDetailEntity();
     entity.IncludeAll();
     ProductEntity ProEntity = new ProductEntity();
     ProEntity.Include(a => new { Size = a.Size});
     entity.Left<ProductEntity>(ProEntity, new Params<string, string>() { Item1 = "ProductNum", Item2 = "SnNum" });
     entity.Where("SnNum", ECondition.Eth, snNum);
     entity = this.OrderDetail.GetSingle(entity);
     return entity;
 }
Esempio n. 2
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="barCode"></param>
 /// <param name="productName"></param>
 /// <param name="unit"></param>
 /// <param name="snNum"></param>
 /// <returns></returns>
 public int Update(string barCode, string productName, string unit, string snNum)
 {
     ProductEntity entity = new ProductEntity();
     entity.BarCode = barCode;
     entity.ProductName = productName;
     entity.UnitNum = unit;
     entity.Include(a => new { a.ProductName, a.BarCode, a.UnitNum });
     entity.Where(a => a.SnNum == snNum);
     int line = this.Product.Update(entity);
     if (line > 0)
     {
         CacheHelper.Remove(CacheKey.JOOSHOW_PRODUCT_CACHE);
     }
     return line;
 }
Esempio n. 3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Update(ProductEntity entity)
 {
     entity.InPrice = entity.AvgPrice;
     entity.OutPrice = entity.AvgPrice;
     entity.Include(a => new { a.ProductName, a.BarCode, a.MinNum, a.MaxNum, a.UnitNum, a.UnitName, a.CateNum, a.CateName, a.Size, a.InPrice, a.OutPrice, a.AvgPrice, a.GrossWeight, a.NetWeight, a.StorageNum, a.DefaultLocal, a.CusNum, a.CusName, a.Description });
     entity.Where(a => a.SnNum == entity.SnNum);
     int line = this.Product.Update(entity);
     if (line > 0)
     {
         CacheHelper.Remove(CacheKey.JOOSHOW_PRODUCT_CACHE);
     }
     return line;
 }
        /// <summary>
        /// 获得满足条件的所有产品的总价格
        /// </summary>
        /// <param name="localName"></param>
        /// <param name="localType"></param>
        /// <param name="searchKey"></param>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public double GetAllTotalPrice(string localName, string localType, string searchKey, string storageNum)
        {
            LocalProductEntity entity = new LocalProductEntity();
            double allTotalPrice = 0;
            if (!storageNum.IsEmpty())
            {
                entity.Where("StorageNum", ECondition.Eth, storageNum);
            }
            if (!localType.IsEmpty())
            {
                entity.Where("LocalType", ECondition.Eth, localType);
            }
            if (!localName.IsEmpty())
            {
                entity.Where("LocalName", ECondition.Like, "%" + localName + "%");
                entity.Or("LocalNum", ECondition.Like, "%" + localName + "%");
            }

            if (!searchKey.IsEmpty())
            {
                entity.Begin<LocalProductEntity>()
                 .Where<LocalProductEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<LocalProductEntity>("ProductNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<LocalProductEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<LocalProductEntity>();
            }
            entity.IncludeNum(true);

            ProductEntity ProEntity = new ProductEntity();
            ProEntity.Include(a => new { AvgPrice = a.AvgPrice });
            entity.Left<ProductEntity>(ProEntity, new Params<string, string>() { Item1 = "ProductNum", Item2 = "SnNum" });
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            List<LocalProductEntity> listResult = this.LocalProduct.GetList(entity);
            if (!listResult.IsNullOrEmpty())
            {
                listResult.ForEach(a =>
                {
                    a.TotalPrice = a.Num * a.AvgPrice;
                    allTotalPrice += a.TotalPrice;
                });
            }
            return allTotalPrice;
        }
 /// <summary>
 /// 根据库存唯一编码号获取该位置的库存信息以及产品信息
 /// </summary>
 /// <param name="sn"></param>
 /// <returns></returns>
 public LocalProductEntity GetLocalProductBySn(string sn, string productNum = null)
 {
     LocalProductEntity entity = new LocalProductEntity();
     entity.IncludeAll();
     ProductEntity ProEntity = new ProductEntity();
     ProEntity.Include(a => new { Size = a.Size, InPrice = a.InPrice });
     entity.Left<ProductEntity>(ProEntity, new Params<string, string>() { Item1 = "ProductNum", Item2 = "SnNum" });
     entity.Where(a => a.Sn == sn);
     if (!productNum.IsEmpty())
     {
         entity.Where(a => a.ProductNum == productNum);
     }
     entity = this.LocalProduct.GetSingle(entity);
     return entity;
 }
        /// <summary>
        /// 在线库存报表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List<LocalProductEntity> GetList(LocalProductEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            ProductEntity ProEntity = new ProductEntity();
            ProEntity.Include(a => new { Size = a.Size, AvgPrice = a.AvgPrice,CateNum=a.CateNum, CateName = a.CateName, MinNum = a.MinNum, MaxNum = a.MaxNum });
            entity.Left<ProductEntity>(ProEntity, new Params<string, string>() { Item1 = "ProductNum", Item2 = "SnNum" });
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            int rowCount = 0;
            List<LocalProductEntity> listResult = this.LocalProduct.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
            pageInfo.RowCount = rowCount;

            List<ProductCategoryEntity> listCates = new ProductCategoryProvider().GetList();
            listCates = listCates.IsNull() ? new List<ProductCategoryEntity>() : listCates;
            if (!listResult.IsNullOrEmpty())
            {
                foreach (LocalProductEntity item in listResult)
                {
                    if (item.CateName.IsEmpty())
                    {
                        ProductCategoryEntity cate = listCates.FirstOrDefault(a => a.CateNum == item.CateNum);
                        item.CateName = cate == null ? "" : cate.CateName;
                    }
                }
            }
            return listResult;
        }
 /// <summary>
 /// 根据产品条码或者产品编号或者产品名称搜索库存产品数量以及库存位置
 /// 主要用于选择产品的界面中搜索功能。在搜索到相应产品之后查询库存信息
 /// </summary>
 /// <returns></returns>
 public List<LocalProductEntity> GetList(string barCode)
 {
     LocalProductEntity entity = new LocalProductEntity();
     entity.IncludeAll();
     ProductEntity ProEntity = new ProductEntity();
     ProEntity.Include(a => new { Size = a.Size, InPrice = a.InPrice });
     entity.Left<ProductEntity>(ProEntity, new Params<string, string>() { Item1 = "ProductNum", Item2 = "SnNum" });
     entity.Where(a => a.BarCode == barCode);
     entity.OrderBy(a => a.ID, EOrderBy.DESC);
     List<LocalProductEntity> listResult = this.LocalProduct.GetList(entity);
     return listResult;
 }