/// <summary> /// 根据集合获取完整商品属性集合 /// </summary> /// <returns></returns> public List <GoodDto> GetGoodDto(GetGoodApo pageDataApo, out int totalCount) { totalCount = 0; List <GoodDto> data; //查询语句 var queryable = Db.Queryable <Goods>() .Where(it => pageDataApo.goodsEpsDatas.Contains(it.code)) .WhereIF(!string.IsNullOrWhiteSpace(pageDataApo.name), it => it.name.Contains(pageDataApo.name)) .WhereIF(!string.IsNullOrWhiteSpace(pageDataApo.code), it => it.goods_code.Contains(pageDataApo.code)) .GroupBy(it => it.goods_code) .OrderBy(it => it.expire_date, OrderByType.Asc) .Select(it => new GoodDto { name = it.name, goods_code = it.goods_code, amount = SqlFunc.AggregateCount(it.id), expire_time = SqlFunc.AggregateMin(it.expire_date), position = it.position }); //如果小于0,默认查全部 if (pageDataApo.PageSize > 0) { data = queryable.ToPageList(pageDataApo.PageIndex, pageDataApo.PageSize, ref totalCount); } else { data = queryable.ToList(); totalCount = data.Count(); } return(data); }
/// <summary> /// 库存快照 /// </summary> /// <param name="getGoodApo"></param> /// <param name="totalCount"></param> /// <returns></returns> public List <GoodDto> GetStockGoodsDto(GetGoodApo getGoodApo, out int totalCount) { return(GoodsDal.GetGoodDto(getGoodApo, out totalCount)); }