You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
6.4 KiB
C#
192 lines
6.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Haoliang.Models.Device;
|
|
|
|
namespace Haoliang.Models.DataCollection
|
|
{
|
|
public class CollectionTask
|
|
{
|
|
public int TaskId { get; set; }
|
|
public int DeviceId { get; set; }
|
|
public string TaskName { get; set; }
|
|
public string Status { get; set; } // Pending, Running, Completed, Failed
|
|
public DateTime ScheduledTime { get; set; }
|
|
public DateTime? StartTime { get; set; }
|
|
public DateTime? EndTime { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
public string ErrorMessage { get; set; }
|
|
public int RetryCount { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
}
|
|
|
|
public class CollectionResult
|
|
{
|
|
public int ResultId { get; set; }
|
|
public int TaskId { get; set; }
|
|
public int DeviceId { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
public string RawData { get; set; }
|
|
public string ParsedData { get; set; }
|
|
public DateTime CollectionTime { get; set; }
|
|
public int ResponseTimeMs { get; set; }
|
|
public string ErrorMessage { get; set; }
|
|
public Dictionary<string, object> Metadata { get; set; }
|
|
}
|
|
|
|
public class CollectionLog
|
|
{
|
|
public int LogId { get; set; }
|
|
public int DeviceId { get; set; }
|
|
public LogLevel LogLevel { get; set; }
|
|
public string Message { get; set; }
|
|
public string Exception { get; set; }
|
|
public DateTime Timestamp { get; set; }
|
|
public string Category { get; set; }
|
|
}
|
|
|
|
public class PingResult
|
|
{
|
|
public bool IsSuccess { get; set; }
|
|
public int PingTimeMs { get; set; }
|
|
public string ErrorMessage { get; set; }
|
|
public DateTime Timestamp { get; set; }
|
|
}
|
|
|
|
public class DeviceCurrentStatus
|
|
{
|
|
public int DeviceId { get; set; }
|
|
public string DeviceCode { get; set; }
|
|
public DeviceStatus Status { get; set; }
|
|
public string NCProgram { get; set; }
|
|
public int CumulativeCount { get; set; }
|
|
public DateTime RecordTime { get; set; }
|
|
public bool IsActive => Status == DeviceStatus.Online;
|
|
}
|
|
|
|
public class CollectionHealth
|
|
{
|
|
public int TotalDevices { get; set; }
|
|
public int OnlineDevices { get; set; }
|
|
public int ActiveCollections { get; set; }
|
|
public double AverageResponseTime { get; set; }
|
|
public double SuccessRate { get; set; }
|
|
public Dictionary<string, int> StatusCounts { get; set; }
|
|
}
|
|
|
|
public class CollectionStatistics
|
|
{
|
|
public DateTime Date { get; set; }
|
|
public int TotalCollections { get; set; }
|
|
public int SuccessfulCollections { get; set; }
|
|
public int FailedCollections { get; set; }
|
|
public double AverageResponseTime { get; set; }
|
|
public Dictionary<string, int> ErrorCounts { get; set; }
|
|
}
|
|
|
|
public class DeviceStatistics
|
|
{
|
|
public int DeviceId { get; set; }
|
|
public string DeviceCode { get; set; }
|
|
public int TotalRunTime { get; set; }
|
|
public int TotalProductionCount { get; set; }
|
|
public double EfficiencyRate { get; set; }
|
|
public DateTime LastActiveTime { get; set; }
|
|
public Dictionary<string, int> ProgramCounts { get; set; }
|
|
}
|
|
|
|
public class TagData
|
|
{
|
|
public string Id { get; set; }
|
|
public string Description { get; set; }
|
|
public int Quality { get; set; }
|
|
public object Value { get; set; }
|
|
public DateTime Time { get; set; }
|
|
}
|
|
}
|
|
|
|
public class CollectionResult
|
|
{
|
|
public int Id { get; set; }
|
|
public int DeviceId { get; set; }
|
|
public int TaskId { get; set; }
|
|
public DateTime CollectionTime { get; set; }
|
|
public string RawJson { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
public string ErrorMessage { get; set; }
|
|
public int RetryCount { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
public DeviceCurrentStatus ParsedData { get; set; }
|
|
}
|
|
|
|
public class CollectionLog
|
|
{
|
|
public int Id { get; set; }
|
|
public int DeviceId { get; set; }
|
|
public LogLevel LogLevel { get; set; }
|
|
public string LogCategory { get; set; }
|
|
public string LogMessage { get; set; }
|
|
public string LogData { get; set; }
|
|
public string SourceMethod { get; set; }
|
|
public string SourceFile { get; set; }
|
|
public DateTime LogTime { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
}
|
|
|
|
public enum LogLevel
|
|
{
|
|
Debug = 0,
|
|
Information = 1,
|
|
Warning = 2,
|
|
Error = 3,
|
|
Critical = 4
|
|
}
|
|
|
|
public class CollectionStatistics
|
|
{
|
|
public DateTime Date { get; set; }
|
|
public int TotalAttempts { get; set; }
|
|
public int SuccessCount { get; set; }
|
|
public int FailedCount { get; set; }
|
|
public decimal SuccessRate { get; set; }
|
|
public TimeSpan AverageResponseTime { get; set; }
|
|
public int DeviceCount { get; set; }
|
|
public int OnlineDeviceCount { get; set; }
|
|
public long TotalDataSize { get; set; }
|
|
}
|
|
|
|
public class CollectionConfig
|
|
{
|
|
public int Id { get; set; }
|
|
public string ConfigKey { get; set; }
|
|
public string ConfigValue { get; set; }
|
|
public string Description { get; set; }
|
|
public bool IsEnabled { get; set; }
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime UpdatedAt { get; set; }
|
|
}
|
|
|
|
public class CollectionHealth
|
|
{
|
|
public DateTime CheckTime { get; set; }
|
|
public int TotalDevices { get; set; }
|
|
public int OnlineDevices { get; set; }
|
|
public int ActiveCollectionTasks { get; set; }
|
|
public int FailedTasks { get; set; }
|
|
public double SuccessRate { get; set; }
|
|
public double AverageResponseTime { get; set; }
|
|
public long TotalCollectedData { get; set; }
|
|
public DateTime LastSuccessfulCollection { get; set; }
|
|
public DateTime LastFailedCollection { get; set; }
|
|
}
|
|
|
|
public class CollectionFilter
|
|
{
|
|
public List<int> DeviceIds { get; set; }
|
|
public DateTime? StartDate { get; set; }
|
|
public DateTime? EndDate { get; set; }
|
|
public bool? IsSuccess { get; set; }
|
|
public string Status { get; set; }
|
|
public int? RetryCount { get; set; }
|
|
public string SearchKeyword { get; set; }
|
|
}
|
|
} |