格式清理

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

View File

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

View File

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

View File

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

View File

@@ -244,11 +244,11 @@ namespace ThingsGateway.RabbitMQ
_logger?.LogError(ex, ToString()); _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

@@ -1,7 +1,5 @@
using System.Net; using System.Net;
using TouchSocket.Sockets;
namespace ThingsGateway.Foundation namespace ThingsGateway.Foundation
{ {
public abstract class ReadWriteDevicesUdpDataHandleAdapter<TRequest> : UdpDataHandlingAdapter where TRequest : class, IMessage 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 Microsoft.Extensions.WebEncoders;
using Newtonsoft.Json; using Newtonsoft.Json;

View File

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

View File

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