Пример #1
0
 /// <summary>
 /// 存储过程查询在线产品库存
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <param name="ProductName"></param>
 /// <param name="begin"></param>
 /// <param name="end"></param>
 /// <returns></returns>
 public List<ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo, string searchKey, string begin, string end)
 {
     entity.IncludeAll();
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     entity.OrderBy(a => a.ID, EOrderBy.DESC);
     int rowCount = 0;
     List<ProductEntity> list = this.Product.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
     List<ProductEntity> listResult = new List<ProductEntity>();
     pageInfo.RowCount = rowCount;
     DateTime beginTime = ConvertHelper.ToType<DateTime>(begin, DateTime.Now.AddDays(-1));
     DateTime endTime = ConvertHelper.ToType<DateTime>(end, DateTime.Now);
     Proc_ProductReportEntity prEntity = new Proc_ProductReportEntity();
     prEntity.SearchKey = searchKey;
     prEntity.BeginTime = beginTime;
     prEntity.EndTime = endTime;
     if (!begin.IsEmpty() && !end.IsEmpty())
     {
         prEntity.IsTime = 1;//加上时间条件
     }
     else
     {
         prEntity.IsTime = 0;
     }
     if (!list.IsNullOrEmpty())
     {
         List<ProductCategoryEntity> listCates = new ProductCategoryProvider().GetList();
         listCates = listCates.IsNull() ? new List<ProductCategoryEntity>() : listCates;
         foreach (ProductEntity item in list)
         {
             if (item.CateName.IsEmpty())
             {
                 ProductCategoryEntity cate= listCates.FirstOrDefault(a => a.CateNum == item.CateNum);
                 item.CateName = cate == null ? "" : cate.CateName;
             }
             prEntity.ProductNum = item.SnNum;
             prEntity.IsDelete = (int)EIsDelete.NotDelete;
             prEntity.Status = (int)EAudite.Pass;
             int line = this.Proc_ProductReport.ExecuteNonQuery(prEntity);
             item.LocalProductNum = prEntity.LocalProductNum;
             item.InStorageNum = prEntity.InStorageNum;
             item.OutStorageNum = prEntity.OutStorageNum;
             item.BadReportNum = prEntity.BadReportNum;
             item.TotalLocalProductNum = prEntity.TotalLocalProductNum;
             item.TotalInStorageNum = prEntity.TotalInStorageNum;
             item.TotalOutStorageNum = prEntity.TotalOutStorageNum;
             item.TotalBadReportNum = prEntity.TotalBadReportNum;
             if (item.InStorageNum > 0 && item.TotalInStorageNum > 0)
             {
                 item.InStorageNumPCT = (item.InStorageNum * 100.00f) / item.TotalInStorageNum;
             }
             if (item.OutStorageNum > 0 && item.TotalOutStorageNum > 0)
             {
                 item.OutStorageNumPCT = (item.OutStorageNum * 100.00f) / item.TotalOutStorageNum;
             }
             listResult.Add(item);
         }
     }
     return listResult;
 }
Пример #2
0
 /// <summary>
 /// 查询产品列表
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List<ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo)
 {
     entity.IncludeAll();
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     entity.OrderBy(a => a.ID, EOrderBy.DESC);
     int rowCount = 0;
     List<ProductEntity> list = this.Product.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
     if (!list.IsNullOrEmpty())
     {
         List<ProductCategoryEntity> listCate = new ProductCategoryProvider().GetList();
         listCate = listCate.IsNull() ? new List<ProductCategoryEntity>() : listCate;
         foreach (ProductEntity item in list)
         {
             if (listCate.Exists(a => a.CateNum == item.CateNum))
             {
                 item.CateName = listCate.First(a => a.CateNum == item.CateNum).CateName;
             }
         }
     }
     pageInfo.RowCount = rowCount;
     return list;
 }