格式清理

This commit is contained in:
2248356998 qq.com
2023-03-19 23:12:58 +08:00
parent f22a3e0955
commit 4b6d8733c6
11 changed files with 17 additions and 24 deletions

View File

@@ -62,7 +62,7 @@ namespace ThingsGateway.Foundation.Adapter.Modbus
return new OperResult<byte[]>(GetDescriptionByErrorCode(response[2]));
if (send.Length == 0)
{
var result= OperResult.CreateSuccessResult(GenericHelper.ArrayRemoveBegin(response, 3));
var result = OperResult.CreateSuccessResult(GenericHelper.ArrayRemoveBegin(response, 3));
result.Message = "接收数据正确,但主机并没有主动请求数据";
result.ResultCode = ResultCode.Canceled;
return result;

View File

@@ -9,8 +9,6 @@ using System.Timers;
using ThingsGateway.Foundation.Extension;
using ThingsGateway.Foundation.Extension.Json;
using TouchSocket.Core;
using Timer = System.Timers.Timer;
//部分非托管交互代码来自https://gitee.com/Zer0Day/opc-client与OPC基金会opcnet库更改部分逻辑

View File

@@ -158,7 +158,7 @@ namespace ThingsGateway.Foundation.Tests
private void ModbusRtuClient()
{
config = new TouchSocketConfig();
config.SetSerialProperty(new() { PortName="COM6"})
config.SetSerialProperty(new() { PortName = "COM6" })
.SetBufferLength(300);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
serialClient = config.Container.Resolve<SerialClient>();

View File

@@ -53,12 +53,13 @@ namespace ThingsGateway.Modbus
{
if (client == null)
{
TouchSocketConfig.SetSerialProperty(new() {
PortName= PortName,
BaudRate= BaudRate,
DataBits= DataBits,
Parity= Parity,
StopBits= StopBits,
TouchSocketConfig.SetSerialProperty(new()
{
PortName = PortName,
BaudRate = BaudRate,
DataBits = DataBits,
Parity = Parity,
StopBits = StopBits,
})
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<SerialClient>();

View File

@@ -119,7 +119,7 @@ namespace ThingsGateway.Mqtt
using var serviceScope = _scopeFactory.CreateScope();
_globalCollectDeviceData = serviceScope.ServiceProvider.GetService<GlobalCollectDeviceData>();
_rpcCore = serviceScope.ServiceProvider.GetService<RpcCore>();
_globalCollectDeviceData.CollectDevices.ForEach(a =>
{
a.DeviceStatusCahnge += DeviceStatusCahnge;

View File

@@ -244,11 +244,11 @@ namespace ThingsGateway.RabbitMQ
_logger?.LogError(ex, ToString());
}
if( CycleInterval>500+50)
if (CycleInterval > 500 + 50)
{
await Task.Delay(CycleInterval-500);
await Task.Delay(CycleInterval - 500);
}
else
else
{
}

View File

@@ -13,6 +13,6 @@
public abstract void SetDataAdapter(SocketClient client);
}
}

View File

@@ -1,7 +1,5 @@
using System.Net;
using TouchSocket.Sockets;
namespace ThingsGateway.Foundation
{
public abstract class ReadWriteDevicesUdpDataHandleAdapter<TRequest> : UdpDataHandlingAdapter where TRequest : class, IMessage

View File

@@ -1,6 +1,4 @@
using AspNetCoreRateLimit;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.WebEncoders;
using Newtonsoft.Json;

View File

@@ -12,8 +12,6 @@ using ThingsGateway.Foundation;
using TouchSocket.Core;
using UAParser;
namespace ThingsGateway.Web.Foundation;
/// <summary>

View File

@@ -61,7 +61,7 @@ namespace ThingsGateway.Web.Foundation
public List<DeviceTree> GetTree()
{
var data = GetCacheList();
var trees= GetTree(data);
var trees = GetTree(data);
return trees;
}
@@ -135,7 +135,7 @@ namespace ThingsGateway.Web.Foundation
}
var query = Context.Queryable<CollectDevice>()
.WhereIF(!string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name))
.WhereIF(!string.IsNullOrEmpty(input.DeviceGroup), u => u.DeviceGroup==input.DeviceGroup)
.WhereIF(!string.IsNullOrEmpty(input.DeviceGroup), u => u.DeviceGroup == input.DeviceGroup)
.WhereIF(!string.IsNullOrEmpty(input.PluginName), u => u.PluginId == (pluginid ?? 0))
.OrderByIF(!string.IsNullOrEmpty(input.SortField), $"{input.SortField} {input.SortOrder}")
.OrderBy(u => u.Id)//排序