fix 数据添加有误处理,展示排序
This commit is contained in:
@@ -22,6 +22,8 @@ public class BusinessPlaceShiftTinyResponse
|
||||
/// </summary>
|
||||
public TimeOnly End { get; set; }
|
||||
|
||||
public int Sequence { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间段描述
|
||||
/// </summary>
|
||||
|
||||
@@ -163,7 +163,8 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
CustomCode = shiftinfo.Id.ToString(),
|
||||
Name = shiftinfo.ShiftType.GetDescription(),
|
||||
Start = shiftinfo.Start,
|
||||
End = shiftinfo.End
|
||||
End = shiftinfo.End,
|
||||
Sequence = shiftinfo.Sequence
|
||||
};
|
||||
|
||||
list.Add(shift);
|
||||
@@ -175,7 +176,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
Name = place.Name,
|
||||
TenantCode = tenantInfo.Code,
|
||||
TenantName = tenantInfo.Name,
|
||||
Shifts = list
|
||||
Shifts = list.OrderBy(x => x.Sequence).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
if (request.BusinessPlaceCode.HasValue)
|
||||
{
|
||||
var businessPlace = await _dbContext.Queryable<BusinessPlaceEntity>().Where(x => x.Code == request.BusinessPlaceCode).FirstAsync();
|
||||
businessPlace.ThrowIfNull("营业点不存在,无法设置到设备注册信息中");
|
||||
businessPlace.ThrowIfNull("营业点不存在,无法设置到设备注册信息中");
|
||||
}
|
||||
|
||||
//更新营业点信息
|
||||
@@ -123,8 +123,8 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
private async Task<DeviceEntity> GetEnableDeviceAsync(string uniqueNo, bool checkExists = true, string deployPlace = "", string tenantId = "")
|
||||
{
|
||||
var device = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Where(x => x.UniqueNo == uniqueNo)
|
||||
.FirstAsync();
|
||||
.Where(x => x.UniqueNo == uniqueNo)
|
||||
.FirstAsync();
|
||||
|
||||
if (checkExists)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
{
|
||||
if (device == null)
|
||||
{
|
||||
device = new DeviceEntity()
|
||||
device = new DeviceEntity
|
||||
{
|
||||
Code = Guid.NewGuid(),
|
||||
ConnectionInfo = string.Empty,
|
||||
@@ -144,10 +144,12 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
TenantId = tenantId,
|
||||
Supplier = string.Empty,
|
||||
Funcs = new List<DeviceFuncEnumType>(),
|
||||
Type = DeviceTypeEnumType.Meal,
|
||||
DeployPlace = deployPlace,
|
||||
HeartbeatInterval = 0,
|
||||
HeartbeatInterval = 30,
|
||||
DeployDirection = string.Empty,
|
||||
Enable = true,
|
||||
AsAttendance = false,
|
||||
DeployPosition = string.Empty,
|
||||
CreatedBy = 1,
|
||||
CreateTime = DateTime.Now,
|
||||
@@ -161,4 +163,4 @@ public class DeviceConnectService : IDeviceConnectService
|
||||
|
||||
return device;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
@@ -42,7 +42,7 @@ public class DeviceService : IDeviceService
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.WhereIF(request.Type.HasValue, (d, dt) => d.Type == request.Type)
|
||||
.WhereIF(request.Enable.HasValue, (d, dt) => d.Enable == request.Enable)
|
||||
.WhereIF(request.Search.IsPresent(), (d) => d.UniqueNo == request.Search || d.DeployPlace.Contains(request.Search))
|
||||
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search || d.DeployPlace.Contains(request.Search))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
@@ -57,6 +57,7 @@ public class DeviceService : IDeviceService
|
||||
var deviceUniqueNos = page.Data.Select(x => x.UniqueNo).ToList();
|
||||
|
||||
var balanceInfos = await _dbContext.Queryable<BalanceRecordEntity>().Where(x => x.Type == BalanceRecordTypeEnumType.Out)
|
||||
.Where(x=>x.Status == BalanceRecordStatusEnumType.Valid)
|
||||
.Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
|
||||
.Select(x => new
|
||||
{
|
||||
@@ -87,7 +88,7 @@ public class DeviceService : IDeviceService
|
||||
var template = await CheckTemplateExistsAsync(request.TemplateCode);
|
||||
await CheckTemplateFieldAsync(request.TemplateCode, request.ConnectionInfo);
|
||||
|
||||
DeviceEntity entity = null;
|
||||
DeviceEntity entity;
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
entity = request.Adapt<DeviceEntity>();
|
||||
@@ -525,7 +526,7 @@ public class DeviceService : IDeviceService
|
||||
var list = new List<RecentNumberResponse>();
|
||||
times.ForEach(time =>
|
||||
{
|
||||
var count = devices.Where(x => x.CreateTime.ToString("yyyy-MM-dd") == time).Count();
|
||||
var count = devices.Count(x => x.CreateTime.ToString("yyyy-MM-dd") == time);
|
||||
var res = new RecentNumberResponse
|
||||
{
|
||||
Date = time,
|
||||
|
||||
Reference in New Issue
Block a user