fix 批量导入修改
This commit is contained in:
@@ -224,7 +224,7 @@ public class DevicesController : ControllerBase
|
|||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("bulkUploads")]
|
[HttpPost("bulkUploads")]
|
||||||
public async Task BulkUploadsAsync([FromForm] BulkUploadsRequest request)
|
public async Task BulkUploadsAsync(ImportListRequest request)
|
||||||
{
|
{
|
||||||
await _deviceService.BulkUploadsAsync(request);
|
await _deviceService.BulkUploadsAsync(request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ namespace Dlhis.Basic.Device.Request
|
|||||||
{
|
{
|
||||||
public class ImportDeviceSaveRequest
|
public class ImportDeviceSaveRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
public long? Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备唯一号
|
/// 设备唯一号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
7
Src/Dlhis.Basic/Device/Request/ImportListRequest.cs
Normal file
7
Src/Dlhis.Basic/Device/Request/ImportListRequest.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Dlhis.Basic.Device.Request
|
||||||
|
{
|
||||||
|
public class ImportListRequest
|
||||||
|
{
|
||||||
|
public List<ImportDeviceSaveRequest> Imports { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ public interface IDeviceService : IScopeDependency
|
|||||||
|
|
||||||
Task<List<RecentNumberResponse>> GetRecentNumbersAsync();
|
Task<List<RecentNumberResponse>> GetRecentNumbersAsync();
|
||||||
|
|
||||||
Task BulkUploadsAsync(BulkUploadsRequest request);
|
Task BulkUploadsAsync(ImportListRequest request);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,8 @@ using Kurisu.Core.DataAccess.Dto;
|
|||||||
using Kurisu.SqlSugar.Extensions;
|
using Kurisu.SqlSugar.Extensions;
|
||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using MySqlX.XDevAPI.Relational;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NPOI.OpenXmlFormats;
|
|
||||||
using NPOI.SS.UserModel;
|
|
||||||
using NPOI.XSSF.UserModel;
|
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace Dlhis.Basic.Device.Services.Implements;
|
namespace Dlhis.Basic.Device.Services.Implements;
|
||||||
@@ -132,9 +127,9 @@ public class DeviceService : IDeviceService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task BulkUploadsAsync(BulkUploadsRequest request)
|
public async Task BulkUploadsAsync(ImportListRequest request)
|
||||||
{
|
{
|
||||||
var lst = ImportFromExcel(request.FormFile);
|
var lst = request.Imports;
|
||||||
var places = await _dbContext.Queryable<BusinessPlaceEntity>().ToListAsync();
|
var places = await _dbContext.Queryable<BusinessPlaceEntity>().ToListAsync();
|
||||||
|
|
||||||
foreach (var form in lst)
|
foreach (var form in lst)
|
||||||
@@ -500,67 +495,6 @@ public class DeviceService : IDeviceService
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
private List<ImportDeviceSaveRequest> ImportFromExcel(IFormFile formFile)
|
|
||||||
{
|
|
||||||
var requests = new List<ImportDeviceSaveRequest>();
|
|
||||||
|
|
||||||
using (var stream = formFile.OpenReadStream())
|
|
||||||
{
|
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook(stream);
|
|
||||||
ISheet sheet = workbook.GetSheetAt(0);
|
|
||||||
|
|
||||||
for (int rowIdx = 1; rowIdx <= sheet.LastRowNum; rowIdx++)
|
|
||||||
{
|
|
||||||
IRow row = sheet.GetRow(rowIdx);
|
|
||||||
if (row == null) continue;
|
|
||||||
|
|
||||||
var request = new ImportDeviceSaveRequest();
|
|
||||||
|
|
||||||
request.UniqueNo = row.GetCell(0).ToString();
|
|
||||||
request.TemplateCode = Guid.Parse(row.GetCell(1).ToString());
|
|
||||||
request.Supplier = row.GetCell(2).ToString();
|
|
||||||
|
|
||||||
var funs = new List<DeviceFuncEnumType>();
|
|
||||||
var fs = row.GetCell(3).ToString().Split(',');
|
|
||||||
foreach (string str in fs)
|
|
||||||
{
|
|
||||||
switch (str)
|
|
||||||
{
|
|
||||||
case "1":
|
|
||||||
funs.Add(DeviceFuncEnumType.Face);
|
|
||||||
break;
|
|
||||||
case "2":
|
|
||||||
funs.Add(DeviceFuncEnumType.Card);
|
|
||||||
break;
|
|
||||||
case "3":
|
|
||||||
funs.Add(DeviceFuncEnumType.QrCode);
|
|
||||||
break;
|
|
||||||
case "4":
|
|
||||||
funs.Add(DeviceFuncEnumType.Control);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
request.Funcs = funs;
|
|
||||||
request.Type = (DeviceTypeEnumType)Enum.Parse(typeof(DeviceTypeEnumType), row.GetCell(4).ToString());
|
|
||||||
request.HeartbeatInterval = int.Parse(row.GetCell(5).ToString());
|
|
||||||
request.DeployPlace = row.GetCell(6).ToString();
|
|
||||||
request.DeployPosition = row.GetCell(7).ToString();
|
|
||||||
request.DeployDirection = row.GetCell(8).ToString();
|
|
||||||
request.ConnectionInfo = row.GetCell(9).ToString();
|
|
||||||
request.Enable = Convert.ToBoolean(Convert.ToInt32(row.GetCell(10).ToString()));
|
|
||||||
request.AsAttendance = Convert.ToBoolean(Convert.ToInt32(row.GetCell(11).ToString()));
|
|
||||||
if (row.GetCell(12) != null)
|
|
||||||
{
|
|
||||||
request.PlaceeCode = Guid.Parse(row.GetCell(12)?.ToString());
|
|
||||||
}
|
|
||||||
requests.Add(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return requests;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.6.1" />
|
<PackageReference Include="Kurisu.AspNetCore" Version="0.6.1" />
|
||||||
<PackageReference Include="NPOI" Version="2.6.2" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -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.BreakfastNumberOfPeople = costIdGroup.Where(x => x.ShiftType == 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.LunchNumberOfPeople = costIdGroup.Where(x => x.ShiftType == 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.DinnerNumberOfPeople = costIdGroup.Where(x => x.ShiftType == 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.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.BreakfastAmount = Math.Abs(costIdGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
||||||
obj.LunchAmount = Math.Abs(costIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).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.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).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.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).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 = ""
|
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.BreakfastNumberOfPeople = departmentGroup.Where(x => x.ShiftType == 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.LunchNumberOfPeople = departmentGroup.Where(x => x.ShiftType == 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.DinnerNumberOfPeople = departmentGroup.Where(x => x.ShiftType == 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.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.BreakfastAmount = Math.Abs(departmentGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
||||||
obj.LunchAmount = Math.Abs(departmentGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).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.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).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.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).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);
|
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.BreakfastNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == 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.LunchNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == 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.DinnerNumberOfPeople = originTenantIdGroup.Where(x => x.ShiftType == 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.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.BreakfastAmount = Math.Abs(originTenantIdGroup.Where(x => x.ShiftType == shiftCodeDict["Breakfast"]).Sum(x => x.Amount));
|
||||||
obj.LunchAmount = Math.Abs(originTenantIdGroup.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).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.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).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.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).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.BreakfastNumberOfPeople = first.Where(x => x.ShiftType == 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.LunchNumberOfPeople = first.Where(x => x.ShiftType == 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.DinnerNumberOfPeople = first.Where(x => x.ShiftType == 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.LateNightNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
|
||||||
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
|
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
|
||||||
lst.Add(obj);
|
lst.Add(obj);
|
||||||
}
|
}
|
||||||
@@ -963,44 +963,15 @@ public class BalanceService : IBalanceService
|
|||||||
{
|
{
|
||||||
var shiftCodeDict = new Dictionary<string, string>();
|
var shiftCodeDict = new Dictionary<string, string>();
|
||||||
|
|
||||||
var shifts = await _dbContext.Queryable<BusinessShiftEntity>().ToListAsync();
|
var typs = await _dbContext.Queryable<BasicTypeEntity>()
|
||||||
//guid
|
.Where(x => x.Type == "mealshift")
|
||||||
//早餐
|
.ToListAsync();
|
||||||
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 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("Breakfast", codeBreakfast);
|
||||||
shiftCodeDict.Add("Lunch", codeLunch);
|
shiftCodeDict.Add("Lunch", codeLunch);
|
||||||
|
|||||||
Reference in New Issue
Block a user