fix 设备方向,代码格式化

This commit is contained in:
2024-05-21 17:09:54 +08:00
parent 234a5d2984
commit 03f732c412
9 changed files with 98 additions and 62 deletions

View File

@@ -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("营业点不存在,无法设置到设备注册信息中");
}
//更新营业点信息
@@ -98,8 +98,8 @@ public class DeviceConnectService : IDeviceConnectService
var ipInfo = request.ConnectionInfo.ToObject<IPPortDto>();
//超时时间
var CancellationTokenSource = new CancellationTokenSource(300);
await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port, CancellationTokenSource.Token);
var cancellationTokenSource = new CancellationTokenSource(300);
await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port, cancellationTokenSource.Token);
return true;
}
@@ -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,
@@ -146,7 +146,7 @@ public class DeviceConnectService : IDeviceConnectService
Funcs = new List<DeviceFuncEnumType>(),
DeployPlace = deployPlace,
HeartbeatInterval = 0,
DeployDirection = string.Empty,
DeployDirection = null,
Enable = true,
DeployPosition = string.Empty,
CreatedBy = 1,
@@ -161,4 +161,4 @@ public class DeviceConnectService : IDeviceConnectService
return device;
}
}
}