Ver código fonte

更新订单统计问题

master
fyf 2 anos atrás
pai
commit
214a7b3afe
2 arquivos alterados com 8 adições e 8 exclusões
  1. +3
    -3
      DataVAPI/Controllers/DeviceStatsController.cs
  2. +5
    -5
      DataVApi.Order/OrderProvider.cs

+ 3
- 3
DataVAPI/Controllers/DeviceStatsController.cs Ver arquivo

@@ -129,10 +129,10 @@ namespace DataVAPI.Controllers
List<LogTable> log = mglog.ALLData(clientId);
List<AlarmTable> alarm = mggj.ALLData(clientId);
List<object> list = new List<object>();
list.Add(new { Name = "运行次数", Count = log?.FindAll(par => par.LogMessage.Contains("设备在线了")).Count.ToString() });
int? count = log?.FindAll(par => par.LogMessage.Contains("设备在线了")).Count;
list.Add(new { Name = "运行次数", Count = count?.ToString()});
list.Add(new { Name = "故障次数", Count = alarm?.Count.ToString() });
list.Add(new { Name = "故障率", Count = $"{(alarm?.Count * 100) / 100}%" });
list.Add(new { Name = "故障率", Count = $"{(alarm?.Count * 100) / 400}%" });

return JsonMsg<object>.OK(list, st);
}


+ 5
- 5
DataVApi.Order/OrderProvider.cs Ver arquivo

@@ -51,7 +51,7 @@ WHERE
{
Total = data.Sum(t => t.Money).ToString(),
OrderCount = data.Count().ToString(),
MoneyM = data.Where(t => t.Time.Month == DateTime.Now.Month).Sum(t => t.Money).ToString(),
MoneyM = data.Where(t => t.Time.Year == DateTime.Now.Year && t.Time.Month == DateTime.Now.Month).Sum(t => t.Money).ToString(),
MoneyD = data.Where(t => t.Time >= DateTime.Parse(DateTime.Now.ToShortDateString()) && t.Time < DateTime.Parse(DateTime.Now.ToShortDateString()).AddDays(1)).Sum(t => t.Money).ToString(),
StoreCount = data.GroupBy(t => t.Id).Count()
};
@@ -193,11 +193,11 @@ WHERE
var sql = sb.ToString();
var data = db.SqlQueryable<OrderNumberDto>(sql).ToList();
int Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count();
int Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.Month).Count();
int Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.Day).Count();
int Month = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year && t.CreatedAt.Month == DateTime.Now.Month).Count();
int Day = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year && t.CreatedAt.Month == DateTime.Now.Month && t.CreatedAt.Day == DateTime.Now.Day).Count();
int L_Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.AddYears(-1).Year).Count();
int L_Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.AddMonths(-1).Month).Count();
int L_Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.AddDays(-1).Day).Count();
int L_Month = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year && t.CreatedAt.Month == DateTime.Now.AddMonths(-1).Month).Count();
int L_Day = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year && t.CreatedAt.Month == DateTime.Now.Month && t.CreatedAt.Day == DateTime.Now.AddDays(-1).Day).Count();

return new
{


Carregando…
Cancelar
Salvar