public async Task <ResponsePagingBase> GetSaleGoodsLog([FromBody] GetSaleGoodsLogPageRequest request) { try { var action = new GetSaleGoodsLogAction(_goodsBll); return(await action.ProcessAction(HttpContext, request)); } catch (Exception ex) { Log.Error(request, ex, this.GetType()); return(new ResponsePagingBase().GetResponseCodeError()); } }
/// <summary> /// 处理请求参数 /// </summary> /// <param name="httpContext"></param> /// <param name="request"></param> private bool HandleRequest(HttpContext httpContext, GetSaleGoodsLogPageRequest request) { if (request.StartTime != null) { request.StartTimeStamp = request.StartTime.Value.ToTimestamp(); } if (request.EndTime != null) { request.EndTimeStamp = request.EndTime.Value.Date.AddDays(1).AddSeconds(-1).ToTimestamp(); } if (request.ShopId <= 0) { return(ComLib.HandleRequest(httpContext, request)); } return(true); }
/// <summary> /// 查询商品销售记录 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <Tuple <IEnumerable <SaleGoodsLogView>, int> > GetSaleGoodsLogPage(GetSaleGoodsLogPageRequest request) { return(await this.ExecutePageAsync <SaleGoodsLogView>(request.PageCurrent, request.PageSize, "d.shop_name as ShopName,e.goods_name as GoodsName,e.goods_spec as GoodsSpec,e.registration_number as RegistrationNumber, b.qty as Qty,c.member_name as MemberName,c.member_tel as MemberTel,a.bill_date as BillDate,a.bill_code as BillCode,c.identification as Identification,f.goods_category_name as GoodsCategoryName,g.unit_name as UnitName", "so_retail a INNER JOIN so_retail_detail b on a.retail_id=b.bill_id INNER join cm_shop d on a.shop_id=d.shop_id INNER JOIN sys_goods e on b.goods_id=e.goods_id inner join sys_goods_category f on e.goods_class_id = f.goods_category_id inner join sys_unit g on b.unit_id = g.unit_id LEFT JOIN mb_member_info c on a.member_id=c.member_id", request.GetQuerySql(), "a.bill_date desc")); }
/// <summary> /// 分页获取商品销售记录信息 /// </summary> /// <param name="httpContext"></param> /// <param name="request"></param> /// <returns></returns> public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetSaleGoodsLogPageRequest request) { if (!HandleRequest(httpContext, request)) { return(ResponsePagingBase.Success(new List <SaleGoodsLogView>(), 0)); } var result = await _goodsBll.GetSaleGoodsLogPage(request); result.Item1.ToList().ForEach(p => p.CreateTime = p.BillDate.ToDateTimeFromTimeStamp()); return(ResponsePagingBase.Success(result.Item1, result.Item2)); }
/// <summary> /// 查询商品销售记录 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <Tuple <IEnumerable <SaleGoodsLogView>, int> > GetSaleGoodsLogPage(GetSaleGoodsLogPageRequest request) { return(await _goodsDal.GetSaleGoodsLogPage(request)); }