Files
FATrace/FATrace.Model/DownloadTask.cs
2025-10-29 11:42:58 +08:00

91 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using FreeSql.DataAnnotations;
namespace FATrace.Model
{
/// <summary>
/// 下载任务实体(持久化队列项)。
/// 表示一条从海康 NVR 下载视频的计划与执行状态。
/// </summary>
[Table(Name = "DownloadTask")]
public class DownloadTask
{
/// <summary>
/// 自增主键。
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 业务条码/编号(用于与 OEMRawUse/VideoAction 关联)。
/// </summary>
[Column(StringLength = 100, IsNullable = false)]
public string? Code { get; set; }
/// <summary>
/// 原料名称。
/// </summary>
[Column(StringLength = 100, IsNullable = false)]
public string? RawName { get; set; }
/// <summary>
/// 操作用户标识。
/// </summary>
[Column(StringLength = 100, IsNullable = false)]
public string? User { get; set; }
/// <summary>
/// 任务状态Pending/Running/Completed/Failed/Canceled。
/// </summary>
[Column(IsNullable = false)]
public TaskStatus Status { get; set; } = TaskStatus.Pending;
/// <summary>
/// 下载进度 0-100。
/// </summary>
[Column(IsNullable = false)]
public short Progress { get; set; } = 0;
/// <summary>
/// 目标视频保存路径(生成的本地文件全路径)。
/// </summary>
[Column(StringLength = 200)]
public string? VideoFilePath { get; set; }
/// <summary>
/// 失败时的错误信息。
/// </summary>
[Column(StringLength = 500)]
public string? Error { get; set; }
/// <summary>
/// 已尝试次数(每次 Running 前加一)。
/// </summary>
[Column(IsNullable = false)]
public int TryCount { get; set; } = 0;
/// <summary>
/// NVR 下载的开始时间(默认当前时间 - 5 分钟)。
/// </summary>
[Column(IsNullable = false)]
public DateTime NvrStartTime { get; set; }
/// <summary>
/// NVR 下载的结束时间(默认当前时间)。
/// </summary>
[Column(IsNullable = false)]
public DateTime NvrEndTime { get; set; }
/// <summary>
/// 创建时间。
/// </summary>
[Column(ServerTime = DateTimeKind.Local, CanUpdate = true)]
public DateTime CreateTime { get; set; }
/// <summary>
/// 最近一次更新时间。
/// </summary>
[Column(ServerTime = DateTimeKind.Local, CanUpdate = true)]
public DateTime UpdateTime { get; set; }
}
}