/// <summary> /// 下单订单数(未确认) /// </summary> /// <param name="query"></param> /// <returns></returns> public int Get_Y_OrderQuantity(TransactionRecordCompute query) { DateTime dtStart = query.YearMonth; DateTime endStart = query.YearMonth.AddMonths(1); int val = 0; if (query.CurveType == 0) { //代理采购 var list = (from p in context.OrderPurchasing where p.OrderTime >= dtStart && p.OrderTime < endStart && p.Status == 0 select p).ToList(); foreach (var item in list) { val += item.ProductCount; } } else { //定制合成 var list = (from p in context.OrderSynthesis where p.OrderTime >= dtStart && p.OrderTime < endStart && p.Status == 0 select p).ToList(); foreach (var item in list) { val += Convert.ToInt32(item.ProductCount); } } return(val); }
/// <summary> /// 根据参数,统计指定的实时交易数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Result_Model <TransactionRecord> ComputeFun(TransactionRecordCompute query) { Result_Model <TransactionRecord> res = new Result_Model <TransactionRecord>() { Msg = new Result_Msg(), Model = new TransactionRecord() }; try { res.Model = new TransactionRecord() { CurveType = query.CurveType, YearMonth = query.YearMonth, Y_CompleteAmount = Get_Y_CompleteAmount(query), Y_OrderAmount = Get_Y_OrderAmount(query), Y_CompleteNumber = Get_Y_CompleteNumber(query), Y_OrderQuantity = Get_Y_OrderQuantity(query) }; res.Msg.IsSuccess = true; } catch (Exception ex) { res.Msg.IsSuccess = false; res.Msg.Message = ex.Message; } return(res); }
/// <summary> /// 完成总金额(已确认) /// </summary> /// <param name="query"></param> /// <returns></returns> public decimal Get_Y_CompleteAmount(TransactionRecordCompute query) { DateTime dtStart = query.YearMonth; DateTime endStart = query.YearMonth.AddMonths(1); decimal val = 0; if (query.CurveType == 0) { //代理采购 var list = (from p in context.OrderPurchasing where p.OrderTime >= dtStart && p.OrderTime < endStart && p.Status == 1 select p).ToList(); foreach (var item in list) { val += (item.ProductCount * Convert.ToDecimal(item.ProductPrice)); } } else { //定制合成 var list = (from p in context.OrderSynthesis where p.OrderTime >= dtStart && p.OrderTime < endStart && p.Status == 1 select p).ToList(); foreach (var item in list) { val += (Convert.ToInt32(item.ProductCount) * Convert.ToDecimal(item.Price)); } } return(val); }
/// <summary> /// 统计计算数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public string ComputeFun(TransactionRecordCompute query) { Result_Model <TransactionRecord> res = new Result_Model <TransactionRecord>(); if (base.CurrentManager != null && base.CurrentManager.Id > 0) { long userId = base.CurrentManager.Id; res = bannerIndexService.ComputeFun(query); } else { res.Msg.IsSuccess = false; res.Msg.Message = "计算" + query.YearMonth + "数据失败"; } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }