Merge branch 'master' of https://gitee.com/dotnetchina/ThingsGateway
This commit is contained in:
@@ -22,7 +22,7 @@ public class LoginOpenApiEvent
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public DateTimeOffset DateTimeOffset = SysDateTimeExtensions.CurrentDateTime;
|
||||
public DateTime DateTime = SysDateTimeExtensions.CurrentDateTime;
|
||||
|
||||
/// <summary>
|
||||
/// 登录设备
|
||||
|
@@ -41,7 +41,7 @@ public class OpenApiAuthEventSubscriber : IEventSubscriber, ISingleton
|
||||
openApiUser.LastLoginTime = openApiUser.LatestLoginTime;
|
||||
openApiUser.LatestLoginDevice = loginEvent.Device.ToString();
|
||||
openApiUser.LatestLoginIp = loginEvent.Ip;
|
||||
openApiUser.LatestLoginTime = loginEvent.DateTimeOffset;
|
||||
openApiUser.LatestLoginTime = loginEvent.DateTime;
|
||||
|
||||
#endregion 重新赋值属性,设置本次登录信息为最新的信息
|
||||
|
||||
|
@@ -135,7 +135,7 @@ public class OpenApiAuthService : IOpenApiAuthService, ITransient
|
||||
{
|
||||
//获取verificat列表
|
||||
List<VerificatInfo> verificatInfos = await GetVerificatInfos(loginEvent.OpenApiUser.Id);
|
||||
var verificatTimeout = loginEvent.DateTimeOffset.AddMinutes(loginEvent.Expire);
|
||||
var verificatTimeout = loginEvent.DateTime.AddMinutes(loginEvent.Expire);
|
||||
//生成verificat信息
|
||||
var verificatInfo = new VerificatInfo
|
||||
{
|
||||
|
@@ -40,7 +40,7 @@ public class OpenApiSessionOutput : PrimaryKeyEntity
|
||||
///</summary>
|
||||
[Description("最新登录时间")]
|
||||
[DataTable(Order = 3, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset? LatestLoginTime { get; set; }
|
||||
public DateTime? LatestLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 令牌数量
|
||||
|
@@ -42,7 +42,7 @@ public class AuthEventSubscriber : IEventSubscriber, ISingleton
|
||||
sysUser.LastLoginTime = sysUser.LatestLoginTime;
|
||||
sysUser.LatestLoginDevice = loginEvent.Device.ToString();
|
||||
sysUser.LatestLoginIp = loginEvent.Ip;
|
||||
sysUser.LatestLoginTime = loginEvent.DateTimeOffset;
|
||||
sysUser.LatestLoginTime = loginEvent.DateTime;
|
||||
|
||||
#endregion 重新赋值属性,设置本次登录信息为最新的信息
|
||||
|
||||
|
@@ -202,7 +202,7 @@ public class AuthService : IAuthService
|
||||
{
|
||||
//获取verificat列表
|
||||
List<VerificatInfo> verificatInfos = await _verificatService.GetVerificatIdAsync(loginEvent.SysUser.Id);
|
||||
var verificatTimeout = loginEvent.DateTimeOffset.AddMinutes(loginEvent.Expire);
|
||||
var verificatTimeout = loginEvent.DateTime.AddMinutes(loginEvent.Expire);
|
||||
//生成verificat信息
|
||||
var verificatInfo = new VerificatInfo
|
||||
{
|
||||
|
@@ -22,7 +22,7 @@ public class LoginEvent
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public DateTimeOffset DateTimeOffset = SysDateTimeExtensions.CurrentDateTime;
|
||||
public DateTime DateTime = SysDateTimeExtensions.CurrentDateTime;
|
||||
|
||||
/// <summary>
|
||||
/// 登录设备
|
||||
|
@@ -40,7 +40,7 @@ public class SessionOutput : PrimaryKeyEntity
|
||||
///</summary>
|
||||
[Description("最新登录时间")]
|
||||
[DataTable(Order = 4, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset? LatestLoginTime { get; set; }
|
||||
public DateTime? LatestLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在线状态
|
||||
|
@@ -479,7 +479,7 @@
|
||||
登录事件参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ThingsGateway.Admin.Application.LoginOpenApiEvent.DateTimeOffset">
|
||||
<member name="F:ThingsGateway.Admin.Application.LoginOpenApiEvent.DateTime">
|
||||
<summary>
|
||||
时间
|
||||
</summary>
|
||||
@@ -1192,7 +1192,7 @@
|
||||
登录事件参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ThingsGateway.Admin.Application.LoginEvent.DateTimeOffset">
|
||||
<member name="F:ThingsGateway.Admin.Application.LoginEvent.DateTime">
|
||||
<summary>
|
||||
时间
|
||||
</summary>
|
||||
|
@@ -189,37 +189,38 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (context?.Value?.GetType() == typeof(DateTimeOffset))
|
||||
if (ItemColWithDTTemplate!=null)
|
||||
{
|
||||
<span>
|
||||
@(((DateTimeOffset)context.Value).ToOffset(InitTimezone.TimezoneOffset).ToDefaultDateTimeFormat())
|
||||
</span>
|
||||
}
|
||||
else if (context?.Value?.GetType() == typeof(DateTime))
|
||||
{
|
||||
<span>
|
||||
@(((DateTime)context.Value).Add(InitTimezone.TimezoneOffset).ToDefaultDateTimeFormat())
|
||||
</span>
|
||||
}
|
||||
else if (ItemColTemplate != null)
|
||||
{
|
||||
@ItemColTemplate(context)
|
||||
@ItemColWithDTTemplate(context)
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (context.Header.CellClass?.Contains("text-truncate") == true)
|
||||
if (context?.Value?.GetType() == typeof(DateTime))
|
||||
{
|
||||
<span title=@context.Value>
|
||||
@context.Value
|
||||
<span>
|
||||
@(((DateTime)context.Value).ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset))
|
||||
</span>
|
||||
}
|
||||
else if (ItemColTemplate != null)
|
||||
{
|
||||
@ItemColTemplate(context)
|
||||
}
|
||||
else
|
||||
{
|
||||
@context.Value
|
||||
}
|
||||
@if (context.Header.CellClass?.Contains("text-truncate") == true)
|
||||
{
|
||||
<span title=@context.Value>
|
||||
@context.Value
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@context.Value
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</ItemColContent>
|
||||
|
@@ -193,6 +193,13 @@ public partial class AppDataTable<TItem, SearchItem, AddItem, EditItem> : IAppDa
|
||||
[Parameter]
|
||||
public RenderFragment<ItemColProps<TItem>> ItemColTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 独立设置 Table Cols 模板,需自行实现DateTime类型的时区转换
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public RenderFragment<ItemColProps<TItem>> ItemColWithDTTemplate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当前显示项目
|
||||
/// </summary>
|
||||
@@ -457,13 +464,9 @@ public partial class AppDataTable<TItem, SearchItem, AddItem, EditItem> : IAppDa
|
||||
if (item != BlazorResourceConst.DataTableActions)
|
||||
{
|
||||
var value = typeof(TItem).GetMemberInfoValue(DetailModel, item);
|
||||
if (value is DateTimeOffset dt)
|
||||
if (value is DateTime dt2)
|
||||
{
|
||||
value = dt.ToOffset(InitTimezone.TimezoneOffset).ToDefaultDateTimeFormat();
|
||||
}
|
||||
else if (value is DateTime dt2)
|
||||
{
|
||||
value = dt2.Add(InitTimezone.TimezoneOffset).ToDefaultDateTimeFormat();
|
||||
value = dt2.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset);
|
||||
}
|
||||
keyValuePairs.Add(item, value?.ToString());
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@
|
||||
Small>
|
||||
<MRow Class="pt-1">
|
||||
<MCol Cols="4">
|
||||
<span class="text-caption">@item.OpTime.ToDefaultDateTimeFormat()</span>
|
||||
<span class="text-caption">@item.OpTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset)</span>
|
||||
</MCol>
|
||||
<MCol>
|
||||
<div class="text-body-1">@item.Name</div>
|
||||
@@ -93,7 +93,7 @@
|
||||
Small>
|
||||
<MRow Class="pt-1">
|
||||
<MCol Cols="4">
|
||||
<span class="text-caption">@item.OpTime.ToDefaultDateTimeFormat()</span>
|
||||
<span class="text-caption">@item.OpTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset)</span>
|
||||
</MCol>
|
||||
<MCol>
|
||||
<div class="text-body-1">@item.Name</div>
|
||||
|
@@ -148,6 +148,11 @@
|
||||
获得/设置 Table Cols 模板
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Admin.Blazor.Core.AppDataTable`4.ItemColWithDTTemplate">
|
||||
<summary>
|
||||
独立设置 Table Cols 模板,需自行实现DateTime类型的时区转换
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Admin.Blazor.Core.AppDataTable`4.Items">
|
||||
<summary>
|
||||
当前显示项目
|
||||
|
@@ -50,7 +50,7 @@ public abstract class BaseEntity : PrimaryKeyEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true, IsNullable = true)]
|
||||
[IgnoreExcel]
|
||||
public virtual DateTimeOffset? CreateTime { get; set; }
|
||||
public virtual DateTime? CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
@@ -78,7 +78,7 @@ public abstract class BaseEntity : PrimaryKeyEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "更新时间", IsOnlyIgnoreInsert = true, IsNullable = true)]
|
||||
[IgnoreExcel]
|
||||
public virtual DateTimeOffset? UpdateTime { get; set; }
|
||||
public virtual DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
|
@@ -54,7 +54,7 @@ public class OpenApiUser : BaseEntity
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LastLoginTime", ColumnDescription = "上次登录时间", IsNullable = true)]
|
||||
[DataTable(Order = 10, IsShow = true, Sortable = true, DefaultFilter = true)]
|
||||
public DateTimeOffset? LastLoginTime { get; set; }
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最新登录设备
|
||||
@@ -75,7 +75,7 @@ public class OpenApiUser : BaseEntity
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LatestLoginTime", ColumnDescription = "最新登录时间", IsNullable = true)]
|
||||
[DataTable(Order = 7, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset? LatestLoginTime { get; set; }
|
||||
public DateTime? LatestLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
|
@@ -60,7 +60,7 @@ public class SysUser : BaseEntity
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LastLoginTime", ColumnDescription = "上次登录时间", IsNullable = true)]
|
||||
[DataTable(Order = 5, IsShow = true, Sortable = true, DefaultFilter = true)]
|
||||
public DateTimeOffset? LastLoginTime { get; set; }
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最新登录设备
|
||||
@@ -81,7 +81,7 @@ public class SysUser : BaseEntity
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LatestLoginTime", ColumnDescription = "最新登录时间", IsNullable = true)]
|
||||
[DataTable(Order = 8, IsShow = true, Sortable = true, DefaultFilter = false)]
|
||||
public DateTimeOffset? LatestLoginTime { get; set; }
|
||||
public DateTime? LatestLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
|
@@ -100,5 +100,5 @@ public class VerificatInfo : PrimaryIdEntity
|
||||
/// </summary>
|
||||
[Description("超时时间")]
|
||||
[DataTable(Order = 5, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset VerificatTimeout { get; set; }
|
||||
public DateTime VerificatTimeout { get; set; }
|
||||
}
|
@@ -75,7 +75,7 @@ public class SysVisitLog : BaseEntity
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "OpTime", ColumnDescription = "操作时间")]
|
||||
[DataTable(Order = 8, IsShow = true, Sortable = true, DefaultFilter = false)]
|
||||
public DateTimeOffset OpTime { get; set; }
|
||||
public DateTime OpTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证Id
|
||||
|
@@ -21,26 +21,37 @@ namespace ThingsGateway.Admin.Core;
|
||||
public static class SysDateTimeExtensions
|
||||
{
|
||||
private static readonly DateTime _dt1970 = new(1970, 1, 1);
|
||||
private static readonly DateTimeOffset _dto1970 = new(new DateTime(1970, 1, 1));
|
||||
|
||||
/// <summary>
|
||||
/// 系统默认使用的当前时间
|
||||
/// </summary>
|
||||
public static DateTimeOffset CurrentDateTime => DateTimeOffset.Now;
|
||||
public static DateTime CurrentDateTime => DateTime.Now;
|
||||
/// <summary>
|
||||
/// 返回yyyy-MM-dd HH:mm:ss:fff zz时间格式字符串
|
||||
/// </summary>
|
||||
public static string ToDefaultDateTimeFormat(this in DateTime dt) => dt.ToString("yyyy-MM-dd HH:mm:ss:fff zz");
|
||||
|
||||
public static string ToDefaultDateTimeFormat(this in DateTime dt, TimeSpan offset)
|
||||
{
|
||||
if(dt.Kind==DateTimeKind.Utc)
|
||||
return new DateTimeOffset(dt.ToLocalTime(), offset).ToString("yyyy-MM-dd HH:mm:ss:fff zz");
|
||||
else
|
||||
return new DateTimeOffset(dt, offset).ToString("yyyy-MM-dd HH:mm:ss:fff zz");
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回yyyy-MM-dd HH:mm:ss:fff zz时间格式字符串
|
||||
/// </summary>
|
||||
public static string ToDefaultDateTimeFormat(this in DateTimeOffset dt) => dt.ToString("yyyy-MM-dd HH:mm:ss:fff zz");
|
||||
|
||||
public static string ToDefaultDateTimeFormat(this in DateTime dt)
|
||||
{
|
||||
return dt.ToString("yyyy-MM-dd HH:mm:ss:fff zz");
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回yyyy-MM-dd HH-mm-ss-fff zz时间格式字符串
|
||||
/// 返回yyyy-MM-dd HH:mm:ss:fff zz时间格式字符串
|
||||
/// </summary>
|
||||
public static string ToFileDateTimeFormat(this in DateTimeOffset dt) => dt.ToString("yyyy-MM-dd HH-mm-ss-fff zz");
|
||||
public static string ToFileDateTimeFormat(this in DateTime dt)
|
||||
{
|
||||
return dt.ToString("yyyy-MM-dd HH-mm-ss-fff zz");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -166,15 +177,5 @@ public static class SysDateTimeExtensions
|
||||
return (Int64)(value - _dt1970).TotalMilliseconds;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// ToLong
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static long ToLong(this DateTimeOffset value, long defaultValue = 0)
|
||||
{
|
||||
// 特殊处理时间,转Unix毫秒
|
||||
return value == DateTimeOffset.MinValue ? 0 : (Int64)(value - _dto1970).TotalMilliseconds;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1196,21 +1196,21 @@
|
||||
系统默认使用的当前时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.ToDefaultDateTimeFormat(System.DateTime@,System.TimeSpan)">
|
||||
<summary>
|
||||
返回yyyy-MM-dd HH:mm:ss:fff zz时间格式字符串
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.ToDefaultDateTimeFormat(System.DateTime@)">
|
||||
<summary>
|
||||
返回yyyy-MM-dd HH:mm:ss:fff zz时间格式字符串
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.ToDefaultDateTimeFormat(System.DateTimeOffset@)">
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.ToFileDateTimeFormat(System.DateTime@)">
|
||||
<summary>
|
||||
返回yyyy-MM-dd HH:mm:ss:fff zz时间格式字符串
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.ToFileDateTimeFormat(System.DateTimeOffset@)">
|
||||
<summary>
|
||||
返回yyyy-MM-dd HH-mm-ss-fff zz时间格式字符串
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.GetDiffTime(System.DateTime@,System.DateTime@)">
|
||||
<summary>
|
||||
计算2个时间差,返回文字描述
|
||||
@@ -1233,12 +1233,6 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Admin.Core.SysDateTimeExtensions.ToLong(System.DateTimeOffset,System.Int64)">
|
||||
<summary>
|
||||
ToLong
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ThingsGateway.Admin.Core.TextWriterExtensions">
|
||||
<summary>
|
||||
TextWriter扩展
|
||||
|
@@ -41,5 +41,5 @@ public class UnifyResult<T>
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public DateTimeOffset Time { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
}
|
@@ -34,13 +34,13 @@ public class TimerTick
|
||||
/// <summary>
|
||||
/// 上次操作时间
|
||||
/// </summary>
|
||||
public DateTimeOffset LastTime { get; private set; }
|
||||
public DateTime LastTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否触发时间刻度
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsTickHappen(DateTimeOffset currentTime)
|
||||
public bool IsTickHappen(DateTime currentTime)
|
||||
{
|
||||
var dateTime = LastTime.AddMilliseconds(milliSeconds);
|
||||
if (currentTime < dateTime)
|
||||
|
@@ -28,7 +28,7 @@ public class BackendLog : PrimaryIdEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "LogTime", ColumnDescription = "日志时间", IsNullable = false)]
|
||||
[DataTable(Order = 1, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset LogTime { get; set; }
|
||||
public DateTime LogTime { get; set; }
|
||||
/// <summary>
|
||||
/// 日志级别
|
||||
/// </summary>
|
||||
|
@@ -71,13 +71,13 @@ public class HistoryAlarm : PrimaryIdEntity
|
||||
/// <inheritdoc cref="DeviceVariableRunTime.AlarmTime"/>
|
||||
[SugarColumn(ColumnName = "AlarmTime", ColumnDescription = "报警时间", IsNullable = false)]
|
||||
[DataTable(Order = 8, IsShow = true, Sortable = true, CellClass = " table-text-truncate ")]
|
||||
public DateTimeOffset AlarmTime { get; set; }
|
||||
public DateTime AlarmTime { get; set; }
|
||||
|
||||
|
||||
/// <inheritdoc cref="DeviceVariableRunTime.EventTime"/>
|
||||
[SugarColumn(ColumnName = "EventTime", ColumnDescription = "事件时间", IsNullable = false)]
|
||||
[DataTable(Order = 8, IsShow = true, Sortable = true, CellClass = " table-text-truncate ")]
|
||||
public DateTimeOffset EventTime { get; set; }
|
||||
public DateTime EventTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@@ -24,7 +24,7 @@ public class RpcLog : PrimaryIdEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "LogTime", ColumnDescription = "日志时间", IsNullable = false)]
|
||||
[DataTable(Order = 1, IsShow = true, Sortable = true, CellClass = " table-text-truncate ")]
|
||||
public DateTimeOffset LogTime { get; set; }
|
||||
public DateTime LogTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作源
|
||||
|
@@ -44,7 +44,7 @@ public class BackendLogDatabaseLoggingWriter : IDatabaseLoggingWriter
|
||||
LogLevel = logMsg.LogLevel,
|
||||
LogMessage = logMsg.State.ToString(),
|
||||
LogSource = logMsg.LogName,
|
||||
LogTime = logMsg.LogDateTime.ToUniversalTime(),
|
||||
LogTime = logMsg.LogDateTime,
|
||||
Exception = logMsg.Exception?.ToString(),
|
||||
};
|
||||
_logQueues.Enqueue(logRuntime);
|
||||
|
@@ -55,7 +55,7 @@ public class CollectDeviceRunTime : CollectDevice
|
||||
/// 设备活跃时间
|
||||
/// </summary>
|
||||
[Description("活跃时间")]
|
||||
public DateTimeOffset ActiveTime { get; private set; } = DateTimeOffset.MinValue;
|
||||
public DateTime ActiveTime { get; private set; } = DateTime.MinValue;
|
||||
/// <summary>
|
||||
/// 设备状态
|
||||
/// </summary>
|
||||
@@ -121,7 +121,7 @@ public class CollectDeviceRunTime : CollectDevice
|
||||
/// <param name="activeTime"></param>
|
||||
/// <param name="errorCount"></param>
|
||||
/// <param name="lastErrorMessage"></param>
|
||||
public void SetDeviceStatus(DateTimeOffset? activeTime = null, int? errorCount = null, string lastErrorMessage = null)
|
||||
public void SetDeviceStatus(DateTime? activeTime = null, int? errorCount = null, string lastErrorMessage = null)
|
||||
{
|
||||
if (activeTime != null)
|
||||
ActiveTime = activeTime.Value;
|
||||
|
@@ -23,7 +23,7 @@ public class DeviceData
|
||||
/// <inheritdoc cref="CollectDeviceRunTime.DeviceVariableCount"/>
|
||||
public int DeviceVariablesCount { get; set; }
|
||||
/// <inheritdoc cref="CollectDeviceRunTime.ActiveTime"/>
|
||||
public DateTimeOffset ActiveTime { get; set; }
|
||||
public DateTime ActiveTime { get; set; }
|
||||
/// <inheritdoc cref="CollectDeviceRunTime.DeviceStatus"/>
|
||||
public int DeviceStatus { get; set; }
|
||||
/// <inheritdoc cref="CollectDeviceRunTime.LastErrorMessage"/>
|
||||
|
@@ -64,7 +64,7 @@ public class DeviceVariableMethodSource
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckIfRequestAndUpdateTime(DateTimeOffset time) => exTimerTick.IsTickHappen(time);
|
||||
public bool CheckIfRequestAndUpdateTime(DateTime time) => exTimerTick.IsTickHappen(time);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,7 @@ public class DeviceVariableRunTime : DeviceVariable
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dateTime"></param>
|
||||
public OperResult SetValue(object value, DateTimeOffset dateTime = default)
|
||||
public OperResult SetValue(object value, DateTime dateTime = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -129,7 +129,7 @@ public class DeviceVariableRunTime : DeviceVariable
|
||||
|
||||
void Set(object data)
|
||||
{
|
||||
DateTimeOffset time;
|
||||
DateTime time;
|
||||
if (dateTime == default)
|
||||
{
|
||||
time = SysDateTimeExtensions.CurrentDateTime;
|
||||
@@ -139,22 +139,8 @@ public class DeviceVariableRunTime : DeviceVariable
|
||||
time = dateTime;
|
||||
}
|
||||
CollectTime = time;
|
||||
if (data?.GetType().IsValueType == true)
|
||||
{
|
||||
if (data != _value && LastSetValue != data || isOnlineChanged)
|
||||
{
|
||||
ChangeTime = time;
|
||||
if (IsOnline)
|
||||
{
|
||||
_value = data;
|
||||
}
|
||||
LastSetValue = data;
|
||||
VariableValueChange?.Invoke(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data?.ToString() != _value?.ToString() && LastSetValue?.ToString() != data?.ToString() || isOnlineChanged)
|
||||
if ((data?.ToString() != _value?.ToString() && LastSetValue?.ToString() != data?.ToString()) || isOnlineChanged)
|
||||
{
|
||||
ChangeTime = time;
|
||||
if (IsOnline)
|
||||
@@ -175,13 +161,13 @@ public class DeviceVariableRunTime : DeviceVariable
|
||||
/// </summary>
|
||||
[Description("变化时间")]
|
||||
[DataTable(Order = 2, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset ChangeTime { get; private set; }
|
||||
public DateTime ChangeTime { get; private set; }
|
||||
/// <summary>
|
||||
/// 采集时间
|
||||
/// </summary>
|
||||
[Description("采集时间")]
|
||||
[DataTable(Order = 2, IsShow = true, Sortable = true)]
|
||||
public DateTimeOffset CollectTime { get; private set; }
|
||||
public DateTime CollectTime { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -255,11 +241,11 @@ public class DeviceVariableRunTime : DeviceVariable
|
||||
/// <summary>
|
||||
/// 报警时间
|
||||
/// </summary>
|
||||
public DateTimeOffset AlarmTime { get; set; }
|
||||
public DateTime AlarmTime { get; set; }
|
||||
/// <summary>
|
||||
/// 事件时间
|
||||
/// </summary>
|
||||
public DateTimeOffset EventTime { get; set; }
|
||||
public DateTime EventTime { get; set; }
|
||||
/// <summary>
|
||||
/// 报警类型
|
||||
/// </summary>
|
||||
|
@@ -55,6 +55,6 @@ public class DeviceVariableSourceRead
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckIfRequestAndUpdateTime(DateTimeOffset time) => exTimerTick.IsTickHappen(time);
|
||||
public bool CheckIfRequestAndUpdateTime(DateTime time) => exTimerTick.IsTickHappen(time);
|
||||
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public class UploadDeviceRunTime : UploadDevice
|
||||
/// 设备活跃时间
|
||||
/// </summary>
|
||||
[Description("活跃时间")]
|
||||
public DateTimeOffset ActiveTime { get; private set; } = DateTimeOffset.MinValue;
|
||||
public DateTime ActiveTime { get; private set; } = DateTime.MinValue;
|
||||
/// <summary>
|
||||
/// 设备状态
|
||||
/// </summary>
|
||||
@@ -113,7 +113,7 @@ public class UploadDeviceRunTime : UploadDevice
|
||||
/// <param name="activeTime"></param>
|
||||
/// <param name="errorCount"></param>
|
||||
/// <param name="lastErrorMessage"></param>
|
||||
public void SetDeviceStatus(DateTimeOffset? activeTime = null, int? errorCount = null, string lastErrorMessage = null)
|
||||
public void SetDeviceStatus(DateTime? activeTime = null, int? errorCount = null, string lastErrorMessage = null)
|
||||
{
|
||||
if (activeTime != null)
|
||||
ActiveTime = activeTime.Value;
|
||||
|
@@ -29,9 +29,9 @@ public class VariableData
|
||||
/// <inheritdoc cref="DeviceVariableRunTime.Value"/>
|
||||
public object Value { get; set; }
|
||||
/// <inheritdoc cref="DeviceVariableRunTime.ChangeTime"/>
|
||||
public DateTimeOffset ChangeTime { get; set; }
|
||||
public DateTime ChangeTime { get; set; }
|
||||
/// <inheritdoc cref="DeviceVariableRunTime.CollectTime"/>
|
||||
public DateTimeOffset CollectTime { get; set; }
|
||||
public DateTime CollectTime { get; set; }
|
||||
/// <inheritdoc cref="DeviceVariableRunTime.IsOnline"/>
|
||||
public bool IsOnline { get; set; }
|
||||
/// <inheritdoc cref="MemoryVariable.ReadExpressions"/>
|
||||
|
@@ -48,7 +48,7 @@ public abstract class DriverBase : DisposableObject
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
/// <summary>
|
||||
/// 调试UI Type,继承实现<see cref="DriverDebugUIBase"/>后,返回继承类的Type,如果不存在,返回null
|
||||
/// 调试UI Type,如果不存在,返回null
|
||||
/// </summary>
|
||||
public abstract Type DriverDebugUIType { get; }
|
||||
|
||||
|
@@ -44,9 +44,5 @@
|
||||
<ProjectReference Include="..\ThingsGateway.Admin.Application\ThingsGateway.Admin.Application.csproj" />
|
||||
<ProjectReference Include="..\ThingsGateway.Foundation\ThingsGateway.Foundation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Workers\Helper\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@@ -184,7 +184,7 @@
|
||||
上次操作时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.TimerTick.IsTickHappen(System.DateTimeOffset)">
|
||||
<member name="M:ThingsGateway.Application.TimerTick.IsTickHappen(System.DateTime)">
|
||||
<summary>
|
||||
是否触发时间刻度
|
||||
</summary>
|
||||
@@ -1457,7 +1457,7 @@
|
||||
距上次成功时的读取失败次数,超过3次设备更新为离线,等于0时设备更新为在线
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.CollectDeviceRunTime.SetDeviceStatus(System.Nullable{System.DateTimeOffset},System.Nullable{System.Int32},System.String)">
|
||||
<member name="M:ThingsGateway.Application.CollectDeviceRunTime.SetDeviceStatus(System.Nullable{System.DateTime},System.Nullable{System.Int32},System.String)">
|
||||
<summary>
|
||||
传入设备的状态信息
|
||||
</summary>
|
||||
@@ -1559,7 +1559,7 @@
|
||||
地址参数,以;分割参数值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DeviceVariableMethodSource.CheckIfRequestAndUpdateTime(System.DateTimeOffset)">
|
||||
<member name="M:ThingsGateway.Application.DeviceVariableMethodSource.CheckIfRequestAndUpdateTime(System.DateTime)">
|
||||
<summary>
|
||||
检测是否达到读取间隔
|
||||
</summary>
|
||||
@@ -1601,7 +1601,7 @@
|
||||
最近一次值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DeviceVariableRunTime.SetValue(System.Object,System.DateTimeOffset)">
|
||||
<member name="M:ThingsGateway.Application.DeviceVariableRunTime.SetValue(System.Object,System.DateTime)">
|
||||
<summary>
|
||||
设置变量值与时间,设置为null时只更改质量戳状态
|
||||
</summary>
|
||||
@@ -1725,7 +1725,7 @@
|
||||
读取长度
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DeviceVariableSourceRead.CheckIfRequestAndUpdateTime(System.DateTimeOffset)">
|
||||
<member name="M:ThingsGateway.Application.DeviceVariableSourceRead.CheckIfRequestAndUpdateTime(System.DateTime)">
|
||||
<summary>
|
||||
检测是否达到读取间隔
|
||||
</summary>
|
||||
@@ -1772,7 +1772,7 @@
|
||||
距上次成功时的读取失败次数,超过3次设备更新为离线,等于0时设备更新为在线
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.UploadDeviceRunTime.SetDeviceStatus(System.Nullable{System.DateTimeOffset},System.Nullable{System.Int32},System.String)">
|
||||
<member name="M:ThingsGateway.Application.UploadDeviceRunTime.SetDeviceStatus(System.Nullable{System.DateTime},System.Nullable{System.Int32},System.String)">
|
||||
<summary>
|
||||
传入设备的状态信息
|
||||
</summary>
|
||||
@@ -1951,7 +1951,7 @@
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverBase.DriverDebugUIType">
|
||||
<summary>
|
||||
调试UI Type,继承实现<see cref="T:ThingsGateway.Application.DriverDebugUIBase"/>后,返回继承类的Type,如果不存在,返回null
|
||||
调试UI Type,如果不存在,返回null
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverBase.DriverPlugin">
|
||||
@@ -1995,78 +1995,6 @@
|
||||
底层日志输出
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:ThingsGateway.Application.DriverDebugUIBase">
|
||||
<summary>
|
||||
调试UI
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ThingsGateway.Application.DriverDebugUIBase.isDownExport">
|
||||
<summary>
|
||||
导出提示
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ThingsGateway.Application.DriverDebugUIBase.Messages">
|
||||
<summary>
|
||||
日志缓存
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.Plc">
|
||||
<summary>
|
||||
默认读写设备
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.Address">
|
||||
<summary>
|
||||
变量地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.DataTypeEnum">
|
||||
<summary>
|
||||
数据类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.JS">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.WriteValue">
|
||||
<summary>
|
||||
写入值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.Dispose">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.ReadAsync">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.WriteAsync">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.DownDeviceExportAsync(ThingsGateway.Application.CollectDevice)">
|
||||
<summary>
|
||||
导入设备
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.DownDeviceExportAsync(System.Collections.Generic.List{ThingsGateway.Application.DeviceVariable})">
|
||||
<summary>
|
||||
导入变量
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.DownDeviceMessageExportAsync(System.Collections.Generic.IEnumerable{System.String})">
|
||||
<summary>
|
||||
导出
|
||||
</summary>
|
||||
<param name="values"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.LogOut(TouchSocket.Core.LogLevel,System.Object,System.String,System.Exception)">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.OnInitialized">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="T:ThingsGateway.Application.PluginSingletonService">
|
||||
<summary>
|
||||
驱动插件服务
|
||||
|
@@ -496,7 +496,7 @@ public class CollectDeviceWorker : BackgroundService
|
||||
{
|
||||
//超过30分钟,或者(初始化失败并超过10分钟)会重启
|
||||
if (
|
||||
(devcore.Device.ActiveTime != DateTimeOffset.MinValue &&
|
||||
(devcore.Device.ActiveTime != DateTime.MinValue &&
|
||||
devcore.Device.ActiveTime.AddMinutes(30) <= SysDateTimeExtensions.CurrentDateTime)
|
||||
|| (devcore.IsInitSuccess == false && devcore.Device.ActiveTime.AddMinutes(10) <= SysDateTimeExtensions.CurrentDateTime)
|
||||
)
|
||||
|
@@ -451,7 +451,7 @@ public class HistoryValueMapper : IRegister
|
||||
{
|
||||
config.ForType<DeviceVariableRunTime, HistoryValue>()
|
||||
.Map(dest => dest.Value, (src) => ValueReturn(src))
|
||||
.Map(dest => dest.CollectTime, (src) => src.CollectTime.UtcDateTime);
|
||||
.Map(dest => dest.CollectTime, (src) => src.CollectTime.ToUniversalTime());//注意sqlsugar插入时无时区,直接utc时间
|
||||
}
|
||||
|
||||
private static object ValueReturn(DeviceVariableRunTime src)
|
||||
|
@@ -373,7 +373,7 @@ public class UploadDeviceWorker : BackgroundService
|
||||
{
|
||||
//超过30分钟,或者(初始化失败并超过10分钟)会重启
|
||||
if (
|
||||
(devcore.Device.ActiveTime != DateTimeOffset.MinValue
|
||||
(devcore.Device.ActiveTime != DateTime.MinValue
|
||||
&& devcore.Device.ActiveTime.AddMinutes(30) <= SysDateTimeExtensions.CurrentDateTime)
|
||||
|| (devcore.IsInitSuccess == false && devcore.Device.ActiveTime.AddMinutes(10) <= SysDateTimeExtensions.CurrentDateTime)
|
||||
)
|
||||
|
@@ -14,6 +14,11 @@ using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
using ThingsGateway.Admin.Blazor.Core;
|
||||
using ThingsGateway.Admin.Core;
|
||||
using ThingsGateway.Application.Extensions;
|
||||
using ThingsGateway.Foundation;
|
||||
|
||||
@@ -65,6 +70,8 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
|
||||
[Inject]
|
||||
private IVariableService VariableService { get; set; }
|
||||
[Inject]
|
||||
private InitTimezone InitTimezone { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual void Dispose()
|
||||
@@ -80,18 +87,18 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
var data = await Plc.ReadAsync(Address, DataTypeEnum.GetSystemType());
|
||||
if (data.IsSuccess)
|
||||
{
|
||||
Messages.Add((LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - 对应类型值:" + data.Content));
|
||||
Messages.Add((LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - 对应类型值:" + data.Content));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add((LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + data.Message));
|
||||
Messages.Add((LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + data.Message));
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Messages.Add((LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + "错误:" + ex.Message));
|
||||
Messages.Add((LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + "错误:" + ex.Message));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,16 +111,16 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
var data = await Plc.WriteAsync(Address, DataTypeEnum.GetSystemType(), WriteValue);
|
||||
if (data.IsSuccess)
|
||||
{
|
||||
Messages.Add((LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + data.Message));
|
||||
Messages.Add((LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + data.Message));
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add((LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + data.Message));
|
||||
Messages.Add((LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + data.Message));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Messages.Add((LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + "写入前失败:" + ex.Message));
|
||||
Messages.Add((LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + "写入前失败:" + ex.Message));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -183,7 +190,7 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
/// <inheritdoc/>
|
||||
public void LogOut(TouchSocket.Core.LogLevel logLevel, object source, string message, Exception exception)
|
||||
{
|
||||
Messages.Add(((LogLevel)logLevel, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + message + (exception != null ? exception.Message : "")));
|
||||
Messages.Add(((LogLevel)logLevel, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + message + (exception != null ? exception.Message : "")));
|
||||
if (Messages.Count > 2500)
|
||||
{
|
||||
Messages.Clear();
|
@@ -95,7 +95,7 @@
|
||||
<MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
|
||||
<div class="mt-1 d-flex align-center justify-space-between" title=@item.Device?.Name>
|
||||
<span>@item.Device?.Name</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat() + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
</div>
|
||||
</MLabel>
|
||||
</MListItemTitle>
|
||||
@@ -127,7 +127,7 @@
|
||||
<MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
|
||||
<div class="mt-1 d-flex align-center justify-space-between">
|
||||
<span class="mx-3">@item.Device?.Name</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption mx-3">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat() + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption mx-3">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
</div>
|
||||
</MLabel>
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
<MRow Class="ml-2 mr-2 d-flex" NoGutters>
|
||||
<MCol Md=6 Cols="12" Class="px-4 mt-1 d-flex align-center justify-space-between">
|
||||
<span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.ActiveTime)</span>
|
||||
<span class="text-caption">@item.Device?.ActiveTime.ToDefaultDateTimeFormat()</span>
|
||||
<span class="text-caption">@item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset)</span>
|
||||
</MCol>
|
||||
<MCol Md=6 Cols="12" Class="px-4 mt-1 d-flex align-center justify-space-between">
|
||||
<span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.SourceVariableCount)</span>
|
||||
@@ -346,7 +346,7 @@
|
||||
<MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
|
||||
<div class="mt-1 d-flex align-center justify-space-between" title=@item.Device?.Name>
|
||||
<span>@item.Device?.Name</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat() + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
</div>
|
||||
</MLabel>
|
||||
</MListItemTitle>
|
||||
@@ -378,7 +378,7 @@
|
||||
<MLabel Class=@((item.Device?.DeviceStatus==DeviceStatusEnum.OnLine?"green--text":"red--text")+$" text-h6")>
|
||||
<div class="mt-1 d-flex align-center justify-space-between">
|
||||
<span class="mx-3">@item.Device?.Name</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption mx-3">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat() + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
<span style="white-space: nowrap !important;overflow: hidden !important; text-overflow: ellipsis !important;" class="text-caption mx-3">@(item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " " + typeof(DeviceStatusEnum).GetDescription(item.Device?.DeviceStatus.ToString()))</span>
|
||||
</div>
|
||||
</MLabel>
|
||||
|
||||
@@ -432,7 +432,7 @@
|
||||
<MRow Class="ml-2 mr-2 d-flex" NoGutters>
|
||||
<MCol Md=6 Cols="12" Class="px-4 mt-1 d-flex align-center justify-space-between">
|
||||
<span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.ActiveTime)</span>
|
||||
<span class="text-caption">@item.Device?.ActiveTime.ToDefaultDateTimeFormat()</span>
|
||||
<span class="text-caption">@item.Device?.ActiveTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset)</span>
|
||||
</MCol>
|
||||
<MCol Md=6 Cols="12" Class="px-4 mt-1 d-flex align-center justify-space-between">
|
||||
<span class="text-subtitle-2 grey--text">@item.Device?.Description(a=>a.UploadVariableCount)</span>
|
||||
|
@@ -30,6 +30,7 @@
|
||||
@inherits BaseComponentBase
|
||||
@inject UserResoures UserResoures
|
||||
@layout MainLayout
|
||||
@inject InitTimezone InitTimezone
|
||||
<AppDataTable @ref="_datatable" TItem="HistoryValue" SearchItem="HisPageInput"
|
||||
AddItem="object" EditItem="object" IsShowSelect=false
|
||||
IsMenuOperTemplate=false
|
||||
@@ -68,28 +69,38 @@
|
||||
|
||||
</SearchTemplate>
|
||||
|
||||
<ItemColTemplate>
|
||||
@switch (context.Header.Value)
|
||||
<ItemColWithDTTemplate>
|
||||
@if (context?.Value?.GetType() == typeof(DateTime))
|
||||
{
|
||||
case nameof(context.Item.IsOnline):
|
||||
<EnableChip Value="context.Item.IsOnline" DisabledLabel="离线" EnabledLabel="在线">
|
||||
</EnableChip>
|
||||
break;
|
||||
default:
|
||||
@if (context.Header.CellClass?.Contains("text-truncate") == true)
|
||||
{
|
||||
<span title=@context.Value>
|
||||
<span>
|
||||
@((DateTime.SpecifyKind((DateTime)context.Value, DateTimeKind.Utc)).ToLocalTime().ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset))
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@switch (context.Header.Value)
|
||||
{
|
||||
case nameof(context.Item.IsOnline):
|
||||
<EnableChip Value="context.Item.IsOnline" DisabledLabel="离线" EnabledLabel="在线">
|
||||
</EnableChip>
|
||||
break;
|
||||
default:
|
||||
@if (context.Header.CellClass?.Contains("text-truncate") == true)
|
||||
{
|
||||
<span title=@context.Value>
|
||||
@context.Value
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@context.Value
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@context.Value
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</ItemColTemplate>
|
||||
</ItemColWithDTTemplate>
|
||||
|
||||
</AppDataTable>
|
||||
|
||||
|
@@ -61,8 +61,8 @@ public partial class HistoryValuePage
|
||||
{
|
||||
var query = result.Content.CopyNew().Queryable<HistoryValue>()
|
||||
.WhereIF(!input.Name.IsNullOrEmpty(), a => a.Name.Contains(input.Name))
|
||||
.WhereIF(input.StartTime != null, a => a.CollectTime >= input.StartTime.Value.ToUniversalTime())
|
||||
.WhereIF(input.EndTime != null, a => a.CollectTime <= input.EndTime.Value.ToUniversalTime());
|
||||
.WhereIF(input.StartTime != null, a => a.CollectTime >= input.StartTime.Value)
|
||||
.WhereIF(input.EndTime != null, a => a.CollectTime <= input.EndTime.Value);
|
||||
|
||||
for (int i = 0; i < input.SortField.Count; i++)
|
||||
{
|
||||
|
@@ -381,5 +381,77 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ThingsGateway.Application.DriverDebugUIBase">
|
||||
<summary>
|
||||
调试UI
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ThingsGateway.Application.DriverDebugUIBase.isDownExport">
|
||||
<summary>
|
||||
导出提示
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:ThingsGateway.Application.DriverDebugUIBase.Messages">
|
||||
<summary>
|
||||
日志缓存
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.Plc">
|
||||
<summary>
|
||||
默认读写设备
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.Address">
|
||||
<summary>
|
||||
变量地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.DataTypeEnum">
|
||||
<summary>
|
||||
数据类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.JS">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="P:ThingsGateway.Application.DriverDebugUIBase.WriteValue">
|
||||
<summary>
|
||||
写入值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.Dispose">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.ReadAsync">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.WriteAsync">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.DownDeviceExportAsync(ThingsGateway.Application.CollectDevice)">
|
||||
<summary>
|
||||
导入设备
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.DownDeviceExportAsync(System.Collections.Generic.List{ThingsGateway.Application.DeviceVariable})">
|
||||
<summary>
|
||||
导入变量
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.DownDeviceMessageExportAsync(System.Collections.Generic.IEnumerable{System.String})">
|
||||
<summary>
|
||||
导出
|
||||
</summary>
|
||||
<param name="values"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.LogOut(TouchSocket.Core.LogLevel,System.Object,System.String,System.Exception)">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.Application.DriverDebugUIBase.OnInitialized">
|
||||
<inheritdoc/>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
@@ -799,7 +799,7 @@ public class Interop
|
||||
if (input.GetType() == typeof(DateTime))
|
||||
{
|
||||
DateTime dateTime = (DateTime)input;
|
||||
return dateTime != DateTime.MinValue ? (object)dateTime.ToUniversalTime() : (object)dateTime;
|
||||
return dateTime != DateTime.MinValue ? (object)dateTime.ToLocalTime() : (object)dateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
@namespace ThingsGateway.Modbus
|
||||
@using Masa.Blazor
|
||||
@using ThingsGateway.Application;
|
||||
@inherits DriverDebugUIBase
|
||||
|
||||
<DefalutDebugDriverPage Channel="ChannelEnum.SerialPort" @ref=defalutDebugDriverPage>
|
||||
<MCard Flat Elevation="0">
|
||||
|
@@ -174,7 +174,7 @@ public class OPCDAClient : CollectBase
|
||||
{
|
||||
var value = data.Value;
|
||||
var quality = data.Quality;
|
||||
var time = new DateTimeOffset(data.TimeStamp);
|
||||
var time = data.TimeStamp.ToLocalTime();
|
||||
if (value != null && quality == 192)
|
||||
{
|
||||
if (item.DataTypeEnum == DataTypeEnum.Object)
|
||||
|
@@ -20,6 +20,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ThingsGateway.Admin.Blazor.Core;
|
||||
using ThingsGateway.Admin.Core;
|
||||
using ThingsGateway.Blazor;
|
||||
using ThingsGateway.Foundation.Adapter.OPCDA.Da;
|
||||
@@ -70,7 +71,8 @@ public partial class OPCDAClientDebugDriverPage : IDisposable
|
||||
|
||||
base.OnAfterRender(firstRender);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
private InitTimezone InitTimezone { get; set; }
|
||||
private void Add()
|
||||
{
|
||||
var tags = new Dictionary<string, List<OpcItem>>();
|
||||
@@ -79,7 +81,7 @@ public partial class OPCDAClientDebugDriverPage : IDisposable
|
||||
var result = _plc.AddItems(tags);
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + result.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + result.Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@ public partial class OPCDAClientDebugDriverPage : IDisposable
|
||||
}
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + data.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + data.Message));
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
@@ -119,7 +121,7 @@ public partial class OPCDAClientDebugDriverPage : IDisposable
|
||||
|
||||
private void ValueOut(List<ItemReadResult> values)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + values.ToJson()));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + values.ToJson()));
|
||||
if (defalutDebugDriverPage.Messages.Count > 2500)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Clear();
|
||||
@@ -133,16 +135,16 @@ public partial class OPCDAClientDebugDriverPage : IDisposable
|
||||
var data = _plc.WriteItem(defalutDebugDriverPage.Address, defalutDebugDriverPage.WriteValue);
|
||||
if (data.IsSuccess)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - д<><D0B4>" + data.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - д<><D0B4>" + data.Message));
|
||||
}
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + data.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + data.Message));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + "д<><D0B4>ʧ<EFBFBD>ܣ<EFBFBD>" + ex.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + "д<><D0B4>ʧ<EFBFBD>ܣ<EFBFBD>" + ex.Message));
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
|
@@ -235,7 +235,7 @@ public class OPCUAClient : CollectBase
|
||||
}
|
||||
var quality = StatusCode.IsGood(data.dataValue.StatusCode);
|
||||
|
||||
var time = new DateTimeOffset(data.dataValue.SourceTimestamp);
|
||||
var time = data.dataValue.SourceTimestamp.ToLocalTime();
|
||||
foreach (var item in itemReads)
|
||||
{
|
||||
if (item.DataTypeEnum == DataTypeEnum.Object)
|
||||
|
@@ -23,6 +23,7 @@ using Opc.Ua;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ThingsGateway.Admin.Blazor.Core;
|
||||
using ThingsGateway.Admin.Core;
|
||||
using ThingsGateway.Blazor;
|
||||
|
||||
@@ -41,6 +42,12 @@ public partial class OPCUAClientDebugDriverPage
|
||||
bool IsShowImportVariableList;
|
||||
private OPCUAClientPage opcUAClientPage;
|
||||
private ImportVariable ImportVariable { get; set; }
|
||||
[Inject]
|
||||
private InitTimezone InitTimezone { get; set; }
|
||||
|
||||
[Inject]
|
||||
IPopupService PopupService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
@@ -70,18 +77,15 @@ public partial class OPCUAClientDebugDriverPage
|
||||
|
||||
base.OnAfterRender(firstRender);
|
||||
}
|
||||
|
||||
private void Add()
|
||||
{
|
||||
if (_plc.Connected)
|
||||
_plc.AddSubscription(YitIdHelper.NextId().ToString(), new[] { defalutDebugDriverPage.Address });
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
}
|
||||
}
|
||||
[Inject]
|
||||
IPopupService PopupService { get; set; }
|
||||
private async Task DownDeviceExport()
|
||||
{
|
||||
var data = await ImportVariable?.GetImportVariableListAsync();
|
||||
@@ -97,7 +101,7 @@ public partial class OPCUAClientDebugDriverPage
|
||||
|
||||
private void Plc_DataChangedHandler((VariableNode variableNode, DataValue dataValue, Newtonsoft.Json.Linq.JToken jToken) item)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + (item.variableNode.NodeId + ":" + item.jToken)));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + (item.variableNode.NodeId + ":" + item.jToken)));
|
||||
if (defalutDebugDriverPage.Messages.Count > 2500)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Clear();
|
||||
@@ -111,17 +115,17 @@ public partial class OPCUAClientDebugDriverPage
|
||||
try
|
||||
{
|
||||
var data = await _plc.ReadJTokenValueAsync(new string[] { defalutDebugDriverPage.Address });
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + data.ToJson()));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Debug, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + data.ToJson()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + ex.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + ex.Message));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
}
|
||||
}
|
||||
private void Remove()
|
||||
@@ -130,7 +134,7 @@ public partial class OPCUAClientDebugDriverPage
|
||||
_plc.RemoveSubscription("");
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,21 +147,21 @@ public partial class OPCUAClientDebugDriverPage
|
||||
var data = await _plc.WriteNodeAsync(defalutDebugDriverPage.Address, JToken.Parse(defalutDebugDriverPage.WriteValue));
|
||||
if (data.IsSuccess)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + " - д<><D0B4><EFBFBD>ɹ<EFBFBD>"));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Information, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + " - д<><D0B4><EFBFBD>ɹ<EFBFBD>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + " - д<><D0B4>ʧ<EFBFBD><CAA7> " + data.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + " - д<><D0B4>ʧ<EFBFBD><CAA7> " + data.Message));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Warning, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + "δ<><CEB4><EFBFBD><EFBFBD>"));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat() + " - " + " - " + "д<><D0B4>ʧ<EFBFBD>ܣ<EFBFBD>" + ex.Message));
|
||||
defalutDebugDriverPage.Messages.Add((Microsoft.Extensions.Logging.LogLevel.Error, SysDateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat(InitTimezone.TimezoneOffset) + " - " + " - " + "д<><D0B4>ʧ<EFBFBD>ܣ<EFBFBD>" + ex.Message));
|
||||
}
|
||||
}
|
||||
}
|
@@ -165,8 +165,8 @@ src.IsOnline ? StatusCodes.Good : StatusCodes.Bad);
|
||||
errors[0] = StatusCodes.BadHistoryOperationUnsupported;
|
||||
return;
|
||||
}
|
||||
var startTime = readDetail.StartTime.ToUniversalTime();
|
||||
var endTime = readDetail.EndTime.ToUniversalTime();
|
||||
var startTime = readDetail.StartTime;
|
||||
var endTime = readDetail.EndTime;
|
||||
|
||||
for (int i = 0; i < nodesToRead.Count; i++)
|
||||
{
|
||||
@@ -314,7 +314,7 @@ src.IsOnline ? StatusCodes.Good : StatusCodes.Bad);
|
||||
/// <summary>
|
||||
/// 在服务器端直接更改对应数据节点的值
|
||||
/// </summary>
|
||||
private void ChangeNodeData(OPCUATag tag, object value, DateTimeOffset dateTime)
|
||||
private void ChangeNodeData(OPCUATag tag, object value, DateTime dateTime)
|
||||
{
|
||||
object newValue;
|
||||
try
|
||||
@@ -349,7 +349,7 @@ src.IsOnline ? StatusCodes.Good : StatusCodes.Bad);
|
||||
newValue = value;
|
||||
}
|
||||
tag.Value = newValue;
|
||||
tag.Timestamp = dateTime.UtcDateTime;
|
||||
tag.Timestamp = dateTime;
|
||||
|
||||
|
||||
void SetDataType(OPCUATag tag, object value)
|
||||
@@ -447,7 +447,7 @@ src.IsOnline ? StatusCodes.Good : StatusCodes.Bad);
|
||||
variable.Value = Opc.Ua.TypeInfo.GetDefaultValue(variable.DataType, ValueRanks.Any, Server.TypeTree);
|
||||
var code = variableRunTime.IsOnline ? StatusCodes.Good : StatusCodes.Bad;
|
||||
variable.StatusCode = code;
|
||||
variable.Timestamp = variableRunTime.CollectTime.UtcDateTime;
|
||||
variable.Timestamp = variableRunTime.CollectTime;
|
||||
variable.OnWriteValue = OnWriteDataValue;
|
||||
parent?.AddChild(variable);
|
||||
NodeIdTags.AddOrUpdate(variable.NodeId, variable);
|
||||
|
@@ -290,7 +290,7 @@
|
||||
<param name="fs">设备组节点</param>
|
||||
<param name="name">设备名称</param>
|
||||
</member>
|
||||
<member name="M:ThingsGateway.OPCUA.ThingsGatewayNodeManager.ChangeNodeData(ThingsGateway.OPCUA.OPCUATag,System.Object,System.DateTimeOffset)">
|
||||
<member name="M:ThingsGateway.OPCUA.ThingsGatewayNodeManager.ChangeNodeData(ThingsGateway.OPCUA.OPCUATag,System.Object,System.DateTime)">
|
||||
<summary>
|
||||
在服务器端直接更改对应数据节点的值
|
||||
</summary>
|
||||
|
@@ -37,7 +37,7 @@ public class DatabaseLoggingWriter : IDatabaseLoggingWriter
|
||||
//转成实体
|
||||
var loggingMonitor = jsonString.ToJsonWithT<LoggingMonitorJson>();
|
||||
//日志时间赋值
|
||||
loggingMonitor.LogDateTime = logMsg.LogDateTime.ToUniversalTime();
|
||||
loggingMonitor.LogDateTime = logMsg.LogDateTime;
|
||||
{
|
||||
var operation = logMsg.Context.Get(LoggingConst.Operation).ToString();//获取操作名称
|
||||
var client = (ClientInfo)logMsg.Context.Get(LoggingConst.Client);//获取客户端信息
|
||||
@@ -102,7 +102,7 @@ public class DatabaseLoggingWriter : IDatabaseLoggingWriter
|
||||
OpIp = loggingMonitor.RemoteIPv4,
|
||||
OpBrowser = clientInfo.UA.Family + clientInfo.UA.Major,
|
||||
OpOs = clientInfo.OS.Family + clientInfo.OS.Major,
|
||||
OpTime = loggingMonitor.LogDateTime,
|
||||
OpTime = loggingMonitor.LogDateTime.LocalDateTime,
|
||||
OpAccount = opAccount,
|
||||
ReqMethod = loggingMonitor.HttpMethod,
|
||||
ReqUrl = path,
|
||||
@@ -179,7 +179,7 @@ public class DatabaseLoggingWriter : IDatabaseLoggingWriter
|
||||
OpIp = loggingMonitor.RemoteIPv4,
|
||||
OpBrowser = clientInfo.UA.Family + clientInfo.UA.Major,
|
||||
OpOs = clientInfo.OS.Family + clientInfo.OS.Major,
|
||||
OpTime = loggingMonitor.LogDateTime,
|
||||
OpTime = loggingMonitor.LogDateTime.LocalDateTime,
|
||||
OpAccount = opAccount,
|
||||
VerificatId = verificatId,
|
||||
};
|
||||
|
@@ -26,6 +26,8 @@ import Tag from "@site/src/components/Tag.js";
|
||||
|
||||
- <Tag>新增</Tag> 添加采集数据延时确认逻辑
|
||||
|
||||
- <Tag>优化</Tag> 去除DateTimeOffset类型
|
||||
|
||||
|
||||
## v2.0.0(已发布)
|
||||
|
||||
|
Reference in New Issue
Block a user