|
|
|
|
@@ -127,24 +127,24 @@ public class BalanceService : IBalanceService
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 所有人次
|
|
|
|
|
var BreakfastNumberOfPeople = costIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]);
|
|
|
|
|
var BreakfastNumberOfPeople = costIdGroup.Count(x => x.ShiftType == shiftCodeDict["Breakfast"]);
|
|
|
|
|
|
|
|
|
|
var LunchNumberOfPeople = costIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]);
|
|
|
|
|
var LunchNumberOfPeople = costIdGroup.Count(x => x.ShiftType == shiftCodeDict["Lunch"]);
|
|
|
|
|
|
|
|
|
|
var DinnerNumberOfPeople = costIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]);
|
|
|
|
|
var DinnerNumberOfPeople = costIdGroup.Count(x => x.ShiftType == shiftCodeDict["Dinner"]);
|
|
|
|
|
|
|
|
|
|
var LateNightNumberOfPeople = costIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]);
|
|
|
|
|
var LateNightNumberOfPeople = costIdGroup.Count(x => x.ShiftType == shiftCodeDict["LateNight"]);
|
|
|
|
|
// 每个餐次人数
|
|
|
|
|
obj.BreakfastNumberOfPeople = costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.BreakfastNumberOfPeople = costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = costIdGroup.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
|
|
|
|
|
//餐次金额
|
|
|
|
|
obj.BreakfastAmount = Math.Abs(costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LunchAmount = Math.Abs(costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Sum(x => x.Amount));
|
|
|
|
|
obj.DinnerAmount = Math.Abs(costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LateNightAmount = Math.Abs(costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Sum(x => x.Amount));
|
|
|
|
|
obj.BreakfastAmount = Math.Abs(costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LunchAmount = Math.Abs(costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Sum(x => x.Amount));
|
|
|
|
|
obj.DinnerAmount = Math.Abs(costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LateNightAmount = Math.Abs(costIdGroup.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Sum(x => x.Amount));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 每个餐次单价
|
|
|
|
|
@@ -258,24 +258,24 @@ public class BalanceService : IBalanceService
|
|
|
|
|
OriginTenantId = ""
|
|
|
|
|
};
|
|
|
|
|
// 所有人次
|
|
|
|
|
var BreakfastNumberOfPeople = departmentGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]);
|
|
|
|
|
var BreakfastNumberOfPeople = departmentGroup.Count(x => x.ShiftType == shiftCodeDict["Breakfast"]);
|
|
|
|
|
|
|
|
|
|
var LunchNumberOfPeople = departmentGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]);
|
|
|
|
|
var LunchNumberOfPeople = departmentGroup.Count(x => x.ShiftType == shiftCodeDict["Lunch"]);
|
|
|
|
|
|
|
|
|
|
var DinnerNumberOfPeople = departmentGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]);
|
|
|
|
|
var DinnerNumberOfPeople = departmentGroup.Count(x => x.ShiftType == shiftCodeDict["Dinner"]);
|
|
|
|
|
|
|
|
|
|
var LateNightNumberOfPeople = departmentGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]);
|
|
|
|
|
var LateNightNumberOfPeople = departmentGroup.Count(x => x.ShiftType == shiftCodeDict["LateNight"]);
|
|
|
|
|
//每个餐次人数
|
|
|
|
|
obj.BreakfastNumberOfPeople = departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.BreakfastNumberOfPeople = departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = departmentGroup.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
|
|
|
|
|
//餐次金额
|
|
|
|
|
obj.BreakfastAmount = Math.Abs(departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LunchAmount = Math.Abs(departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Sum(x => x.Amount));
|
|
|
|
|
obj.DinnerAmount = Math.Abs(departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LateNightAmount = Math.Abs(departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Sum(x => x.Amount));
|
|
|
|
|
obj.BreakfastAmount = Math.Abs(departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LunchAmount = Math.Abs(departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Sum(x => x.Amount));
|
|
|
|
|
obj.DinnerAmount = Math.Abs(departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LateNightAmount = Math.Abs(departmentGroup.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Sum(x => x.Amount));
|
|
|
|
|
|
|
|
|
|
// 每个餐次单价
|
|
|
|
|
obj.BreakfastPrice = BreakfastNumberOfPeople == 0 ? 0 : Math.Round(obj.BreakfastAmount / BreakfastNumberOfPeople, 2);
|
|
|
|
|
@@ -337,24 +337,24 @@ public class BalanceService : IBalanceService
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 所有人次
|
|
|
|
|
var BreakfastNumberOfPeople = originTenantIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]);
|
|
|
|
|
var BreakfastNumberOfPeople = originTenantIdGroup.Count(x => x.ShiftType == shiftCodeDict["Breakfast"]);
|
|
|
|
|
|
|
|
|
|
var LunchNumberOfPeople = originTenantIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]);
|
|
|
|
|
var LunchNumberOfPeople = originTenantIdGroup.Count(x => x.ShiftType == shiftCodeDict["Lunch"]);
|
|
|
|
|
|
|
|
|
|
var DinnerNumberOfPeople = originTenantIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]);
|
|
|
|
|
var DinnerNumberOfPeople = originTenantIdGroup.Count(x => x.ShiftType == shiftCodeDict["Dinner"]);
|
|
|
|
|
|
|
|
|
|
var LateNightNumberOfPeople = originTenantIdGroup.Count(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]);
|
|
|
|
|
var LateNightNumberOfPeople = originTenantIdGroup.Count(x => x.ShiftType == shiftCodeDict["LateNight"]);
|
|
|
|
|
//每个餐次人数
|
|
|
|
|
obj.BreakfastNumberOfPeople = originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.BreakfastNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
|
|
|
|
|
//餐次金额
|
|
|
|
|
obj.BreakfastAmount = Math.Abs(originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LunchAmount = Math.Abs(originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Sum(x => x.Amount));
|
|
|
|
|
obj.DinnerAmount = Math.Abs(originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LateNightAmount = Math.Abs(originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Sum(x => x.Amount));
|
|
|
|
|
obj.BreakfastAmount = Math.Abs(originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LunchAmount = Math.Abs(originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Sum(x => x.Amount));
|
|
|
|
|
obj.DinnerAmount = Math.Abs(originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Sum(x => x.Amount));
|
|
|
|
|
obj.LateNightAmount = Math.Abs(originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Sum(x => x.Amount));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 每个餐次单价
|
|
|
|
|
@@ -409,10 +409,10 @@ public class BalanceService : IBalanceService
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//每个餐次人数
|
|
|
|
|
obj.BreakfastNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.BreakfastNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LunchNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.DinnerNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.LateNightNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
|
|
|
|
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
|
|
|
|
|
lst.Add(obj);
|
|
|
|
|
}
|
|
|
|
|
@@ -963,44 +963,15 @@ public class BalanceService : IBalanceService
|
|
|
|
|
{
|
|
|
|
|
var shiftCodeDict = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
var shifts = await _dbContext.Queryable<BusinessShiftEntity>().ToListAsync();
|
|
|
|
|
//guid
|
|
|
|
|
//早餐
|
|
|
|
|
var breakfast = shifts.Where(x => x.CustomCode == "shift-breakfast").FirstOrDefault();
|
|
|
|
|
var codeBreakfast = "Breakfast";
|
|
|
|
|
if (breakfast != null)
|
|
|
|
|
{
|
|
|
|
|
codeBreakfast = breakfast.Code.ToString();
|
|
|
|
|
}
|
|
|
|
|
//午餐
|
|
|
|
|
var lunch = shifts.Where(x => x.CustomCode == "shift-lunch").FirstOrDefault();
|
|
|
|
|
var codeLunch = "Lunch";
|
|
|
|
|
if (lunch != null)
|
|
|
|
|
{
|
|
|
|
|
codeLunch = lunch.Code.ToString();
|
|
|
|
|
}
|
|
|
|
|
//晚餐
|
|
|
|
|
var dinner = shifts.Where(x => x.CustomCode == "shift-dinner").FirstOrDefault();
|
|
|
|
|
var codeDinner = "Dinner";
|
|
|
|
|
if (dinner != null)
|
|
|
|
|
{
|
|
|
|
|
codeDinner = dinner.Code.ToString();
|
|
|
|
|
}
|
|
|
|
|
//宵夜
|
|
|
|
|
var nightsnack = shifts.Where(x => x.CustomCode == "shift-nightsnack").FirstOrDefault();
|
|
|
|
|
var codeNightsnack = "Nightsnack";
|
|
|
|
|
if (nightsnack != null)
|
|
|
|
|
{
|
|
|
|
|
codeNightsnack = nightsnack.Code.ToString();
|
|
|
|
|
}
|
|
|
|
|
//凌晨
|
|
|
|
|
var midnightsnack = shifts.Where(x => x.CustomCode == "shift-midnightsnack").FirstOrDefault();
|
|
|
|
|
var codeMidnightsnack = "Midnightsnack";
|
|
|
|
|
if (midnightsnack != null)
|
|
|
|
|
{
|
|
|
|
|
codeMidnightsnack = midnightsnack.Code.ToString();
|
|
|
|
|
}
|
|
|
|
|
var typs = await _dbContext.Queryable<BasicTypeEntity>()
|
|
|
|
|
.Where(x => x.Type == "mealshift")
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
var codeBreakfast = typs.Where(x => x.Display == "早餐").Select(x => x.Code).First();
|
|
|
|
|
var codeLunch = typs.Where(x => x.Display == "午餐").Select(x => x.Code).First();
|
|
|
|
|
var codeDinner = typs.Where(x => x.Display == "晚餐").Select(x => x.Code).First();
|
|
|
|
|
var codeNightsnack = typs.Where(x => x.Display == "宵夜").Select(x => x.Code).First();
|
|
|
|
|
var codeMidnightsnack = typs.Where(x => x.Display == "凌晨餐").Select(x => x.Code).First();
|
|
|
|
|
|
|
|
|
|
shiftCodeDict.Add("Breakfast", codeBreakfast);
|
|
|
|
|
shiftCodeDict.Add("Lunch", codeLunch);
|
|
|
|
|
|