Files
jinko.yikatong/Src/Dlhis.Basic/Organization/Response/GainfoDevicePermissionResponse.cs
2024-12-13 16:32:26 +08:00

75 lines
1.6 KiB
C#

using Dlhis.Basic.Device.Dtos;
using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.Organization.Response;
public class GainfoDevicePermissionResponse
{
public long Id { get; set; }
/// <summary>
/// 设备code
/// </summary>
public Guid Code { get; set; }
/// <summary>
/// 设备码,IP/MAC/SNO
/// </summary>
public string UniqueNo { get; set; }
/// <summary>
/// 心跳间隔
/// </summary>
public int HeartbeatInterval { get; set; }
/// <summary>
/// 部署点
/// </summary>
public string DeployPlace { get; set; }
/// <summary>
/// 设备机功能类型
/// </summary>
public DeviceTypeEnumType Type { get; set; }
public string TypeDescription => Type.GetDescription();
/// <summary>
/// 是否启用
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// 厂区
/// </summary>
public string Factory { get; set; }
/// <summary>
/// 最后心跳时间
/// </summary>
public DateTime? LastHeartbeatTime { get; set; }
/// <summary>
/// 是否在线
/// </summary>
public bool IsOnline
{
get
{
if (!LastHeartbeatTime.HasValue)
return false;
if (HeartbeatInterval <= 0)
return true;
return LastHeartbeatTime.Value.AddSeconds(HeartbeatInterval) >= DateTime.Now;
}
}
/// <summary>
/// 分配来源
/// </summary>
public DevicePermissionSourceDto Source { get; set; }
}