using OrpaonVision.Core.Results; using OrpaonVision.Core.Common; namespace OrpaonVision.Core.HistoryTrace; /// /// 历史追溯服务接口。 /// public interface IHistoryTraceService { /// /// 获取产品会话历史记录。 /// /// 开始时间。 /// 结束时间。 /// 产品类型编码(可选)。 /// 会话状态(可选)。 /// 取消令牌。 /// 产品会话历史记录。 Task>> GetProductSessionHistoryAsync(DateTime startTime, DateTime endTime, string? productTypeCode = null, SessionStatus? sessionStatus = null, CancellationToken cancellationToken = default); /// /// 获取会话详细信息。 /// /// 会话ID。 /// 取消令牌。 /// 会话详细信息。 Task> GetSessionDetailAsync(Guid sessionId, CancellationToken cancellationToken = default); /// /// 获取层处理历史记录。 /// /// 会话ID。 /// 取消令牌。 /// 层处理历史记录。 Task>> GetLayerProcessingHistoryAsync(Guid sessionId, CancellationToken cancellationToken = default); /// /// 获取层详细信息。 /// /// 层ID。 /// 取消令牌。 /// 层详细信息。 Task> GetLayerDetailAsync(Guid layerId, CancellationToken cancellationToken = default); /// /// 获取截图历史记录。 /// /// 会话ID(可选)。 /// 层ID(可选)。 /// 开始时间(可选)。 /// 结束时间(可选)。 /// 截图类型(可选)。 /// 取消令牌。 /// 截图历史记录。 Task>> GetScreenshotHistoryAsync(Guid? sessionId = null, Guid? layerId = null, DateTime? startTime = null, DateTime? endTime = null, ScreenshotType? screenshotType = null, CancellationToken cancellationToken = default); /// /// 获取截图详细信息。 /// /// 截图ID。 /// 取消令牌。 /// 截图详细信息。 Task> GetScreenshotDetailAsync(Guid screenshotId, CancellationToken cancellationToken = default); /// /// 获取截图文件内容。 /// /// 截图ID。 /// 取消令牌。 /// 截图文件内容。 Task> GetScreenshotContentAsync(Guid screenshotId, CancellationToken cancellationToken = default); /// /// 获取证据链信息。 /// /// 会话ID。 /// 取消令牌。 /// 证据链信息。 Task> GetEvidenceChainAsync(Guid sessionId, CancellationToken cancellationToken = default); /// /// 获取层级证据回溯。 /// /// 会话ID。 /// 层序号(可选)。 /// 取消令牌。 /// 层级证据回溯。 Task> GetLayerEvidenceTracebackAsync(Guid sessionId, int? layerSequence = null, CancellationToken cancellationToken = default); /// /// 获取缺陷追溯信息。 /// /// 会话ID。 /// 缺陷类型(可选)。 /// 取消令牌。 /// 缺陷追溯信息。 Task> GetDefectTracebackAsync(Guid sessionId, DefectType? defectType = null, CancellationToken cancellationToken = default); /// /// 获取操作历史记录。 /// /// 会话ID(可选)。 /// 操作员ID(可选)。 /// 开始时间(可选)。 /// 结束时间(可选)。 /// 操作类型(可选)。 /// 取消令牌。 /// 操作历史记录。 Task>> GetOperationHistoryAsync(Guid? sessionId = null, string? operatorId = null, DateTime? startTime = null, DateTime? endTime = null, OperationType? operationType = null, CancellationToken cancellationToken = default); /// /// 获取综合追溯报告。 /// /// 会话ID。 /// 报告类型。 /// 取消令牌。 /// 综合追溯报告。 Task> GetComprehensiveTracebackReportAsync(Guid sessionId, TracebackReportType reportType, CancellationToken cancellationToken = default); /// /// 获取追溯统计数据。 /// /// 开始时间。 /// 结束时间。 /// 产品类型编码(可选)。 /// 取消令牌。 /// 追溯统计数据。 Task> GetTracebackStatisticsAsync(DateTime startTime, DateTime endTime, string? productTypeCode = null, CancellationToken cancellationToken = default); /// /// 搜索历史记录。 /// /// 搜索请求。 /// 取消令牌。 /// 搜索结果。 Task> SearchHistoryAsync(HistorySearchRequest searchRequest, CancellationToken cancellationToken = default); /// /// 导出追溯数据。 /// /// 导出请求。 /// 取消令牌。 /// 导出结果。 Task> ExportTracebackDataAsync(TracebackExportRequest exportRequest, CancellationToken cancellationToken = default); } /// /// 产品会话历史记录。 /// public sealed class ProductSessionHistory { /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 产品序列号。 /// public string ProductSerialNumber { get; init; } = string.Empty; /// /// 产品类型编码。 /// public string ProductTypeCode { get; init; } = string.Empty; /// /// 会话状态。 /// public SessionStatus SessionStatus { get; init; } /// /// 会话开始时间。 /// public DateTime SessionStartTimeUtc { get; init; } /// /// 会话结束时间。 /// public DateTime? SessionEndTimeUtc { get; init; } /// /// 会话持续时间(分钟)。 /// public double SessionDurationMinutes => SessionEndTimeUtc.HasValue ? (SessionEndTimeUtc.Value - SessionStartTimeUtc).TotalMinutes : (DateTime.UtcNow - SessionStartTimeUtc).TotalMinutes; /// /// 操作员ID。 /// public string? OperatorId { get; init; } /// /// 操作员姓名。 /// public string? OperatorName { get; init; } /// /// 工位ID。 /// public string? StationId { get; init; } /// /// 工位名称。 /// public string? StationName { get; init; } /// /// 总层数。 /// public int TotalLayerCount { get; init; } /// /// 已完成层数。 /// public int CompletedLayerCount { get; init; } /// /// 会话完成率。 /// public double SessionCompletionRate => TotalLayerCount > 0 ? (double)CompletedLayerCount / TotalLayerCount * 100 : 0.0; /// /// 最终判定结果。 /// public FinalJudgmentResult? FinalJudgmentResult { get; init; } /// /// 缺陷数量。 /// public int DefectCount { get; init; } /// /// 报警数量。 /// public int AlarmCount { get; init; } /// /// 截图数量。 /// public int ScreenshotCount { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 会话状态枚举。 /// public enum SessionStatus { /// /// 进行中。 /// InProgress = 0, /// /// 已完成。 /// Completed = 1, /// /// 已取消。 /// Cancelled = 2, /// /// 已暂停。 /// Paused = 3, /// /// 失败。 /// Failed = 4, /// /// 异常终止。 /// Aborted = 5 } /// /// 最终判定结果枚举。 /// public enum FinalJudgmentResult { /// /// 通过。 /// Pass = 0, /// /// 不通过。 /// Fail = 1, /// /// 待定。 /// Pending = 2, /// /// 人工判定。 /// ManualJudgment = 3 } /// /// 产品会话详细信息。 /// public sealed class ProductSessionDetail { /// /// 会话历史信息。 /// public ProductSessionHistory SessionHistory { get; init; } = new(); /// /// 层处理历史记录。 /// public IReadOnlyList LayerHistories { get; init; } = Array.Empty(); /// /// 截图历史记录。 /// public IReadOnlyList ScreenshotHistories { get; init; } = Array.Empty(); /// /// 操作历史记录。 /// public IReadOnlyList OperationHistories { get; init; } = Array.Empty(); /// /// 证据链信息。 /// public EvidenceChain? EvidenceChain { get; init; } /// /// 缺陷追溯信息。 /// public DefectTraceback? DefectTraceback { get; init; } /// /// 性能指标。 /// public SessionPerformanceMetrics PerformanceMetrics { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层处理历史记录。 /// public sealed class LayerProcessingHistory { /// /// 层ID。 /// public Guid LayerId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 层序号。 /// public int LayerSequence { get; init; } /// /// 层名称。 /// public string LayerName { get; init; } = string.Empty; /// /// 层类型。 /// public string LayerType { get; init; } = string.Empty; /// /// 层状态。 /// public LayerStatus LayerStatus { get; init; } /// /// 层开始时间。 /// public DateTime LayerStartTimeUtc { get; init; } /// /// 层结束时间。 /// public DateTime? LayerEndTimeUtc { get; init; } /// /// 层处理持续时间(秒)。 /// public double LayerProcessingDurationSeconds => LayerEndTimeUtc.HasValue ? (LayerEndTimeUtc.Value - LayerStartTimeUtc).TotalSeconds : (DateTime.UtcNow - LayerStartTimeUtc).TotalSeconds; /// /// 检测到的部件数量。 /// public int DetectedPartCount { get; init; } /// /// 合格部件数量。 /// public int QualifiedPartCount { get; init; } /// /// 缺陷部件数量。 /// public int DefectivePartCount { get; init; } /// /// 层合格率。 /// public double LayerPassRate => DetectedPartCount > 0 ? (double)QualifiedPartCount / DetectedPartCount * 100 : 0.0; /// /// 层判定结果。 /// public LayerJudgmentResult LayerJudgmentResult { get; init; } /// /// 缺陷列表。 /// public IReadOnlyList Defects { get; init; } = Array.Empty(); /// /// 截图数量。 /// public int ScreenshotCount { get; init; } /// /// 报警数量。 /// public int AlarmCount { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层状态枚举。 /// public enum LayerStatus { /// /// 等待中。 /// Waiting = 0, /// /// 处理中。 /// Processing = 1, /// /// 已完成。 /// Completed = 2, /// /// 失败。 /// Failed = 3, /// /// 跳过。 /// Skipped = 4, /// /// 重试中。 /// Retrying = 5 } /// /// 层判定结果枚举。 /// public enum LayerJudgmentResult { /// /// 通过。 /// Pass = 0, /// /// 不通过。 /// Fail = 1, /// /// 重试。 /// Retry = 2, /// /// 人工判定。 /// ManualJudgment = 3 } /// /// 层缺陷信息。 /// public sealed class LayerDefect { /// /// 缺陷ID。 /// public Guid DefectId { get; init; } /// /// 缺陷类型。 /// public DefectType DefectType { get; init; } /// /// 缺陷严重程度。 /// public DefectSeverity DefectSeverity { get; init; } /// /// 缺陷描述。 /// public string DefectDescription { get; init; } = string.Empty; /// /// 部件名称。 /// public string? PartName { get; init; } /// /// 缺陷位置X坐标。 /// public double DefectPositionX { get; init; } /// /// 缺陷位置Y坐标。 /// public double DefectPositionY { get; init; } /// /// 缺陷置信度。 /// public double DefectConfidence { get; init; } /// /// 检测时间。 /// public DateTime DetectionTimeUtc { get; init; } /// /// 关联截图ID。 /// public Guid? AssociatedScreenshotId { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层处理详细信息。 /// public sealed class LayerProcessingDetail { /// /// 层处理历史信息。 /// public LayerProcessingHistory LayerHistory { get; init; } = new(); /// /// 截图历史记录。 /// public IReadOnlyList ScreenshotHistories { get; init; } = Array.Empty(); /// /// 操作历史记录。 /// public IReadOnlyList OperationHistories { get; init; } = Array.Empty(); /// /// 部件检测结果。 /// public IReadOnlyList PartDetectionResults { get; init; } = Array.Empty(); /// /// 规则执行结果。 /// public IReadOnlyList RuleExecutionResults { get; init; } = Array.Empty(); /// /// 性能指标。 /// public LayerPerformanceMetrics PerformanceMetrics { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 部件检测结果。 /// public sealed class PartDetectionResult { /// /// 检测ID。 /// public Guid DetectionId { get; init; } /// /// 部件名称。 /// public string PartName { get; init; } = string.Empty; /// /// 部件类型。 /// public string PartType { get; init; } = string.Empty; /// /// 检测状态。 /// public PartDetectionStatus DetectionStatus { get; init; } /// /// 置信度。 /// public double Confidence { get; init; } /// /// 边界框。 /// public BoundingBox BoundingBox { get; init; } = new(); /// /// 检测时间。 /// public DateTime DetectionTimeUtc { get; init; } /// /// 关联截图ID。 /// public Guid? AssociatedScreenshotId { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 部件检测状态枚举。 /// public enum PartDetectionStatus { /// /// 检测到。 /// Detected = 0, /// /// 未检测到。 /// NotDetected = 1, /// /// 误检。 /// FalsePositive = 2, /// /// 漏检。 /// FalseNegative = 3, /// /// 位置错误。 /// PositionError = 4, /// /// 方向错误。 /// OrientationError = 5 } /// /// 边界框。 /// public sealed class BoundingBox { /// /// X坐标。 /// public double X { get; init; } /// /// Y坐标。 /// public double Y { get; init; } /// /// 宽度。 /// public double Width { get; init; } /// /// 高度。 /// public double Height { get; init; } /// /// 中心点X坐标。 /// public double CenterX => X + Width / 2; /// /// 中心点Y坐标。 /// public double CenterY => Y + Height / 2; /// /// 面积。 /// public double Area => Width * Height; } /// /// 规则执行结果。 /// public sealed class RuleExecutionResult { /// /// 执行ID。 /// public Guid ExecutionId { get; init; } /// /// 规则名称。 /// public string RuleName { get; init; } = string.Empty; /// /// 规则类型。 /// public string RuleType { get; init; } = string.Empty; /// /// 执行状态。 /// public RuleExecutionStatus ExecutionStatus { get; init; } /// /// 执行结果。 /// public bool ExecutionResult { get; init; } /// /// 执行时间(毫秒)。 /// public long ExecutionTimeMs { get; init; } /// /// 执行时间。 /// public DateTime ExecutionTimeUtc { get; init; } /// /// 错误信息。 /// public string? ErrorMessage { get; init; } /// /// 执行详情。 /// public string ExecutionDetails { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 规则执行状态枚举。 /// public enum RuleExecutionStatus { /// /// 成功。 /// Success = 0, /// /// 失败。 /// Failed = 1, /// /// 跳过。 /// Skipped = 2, /// /// 超时。 /// Timeout = 3, /// /// 错误。 /// Error = 4 } /// /// 截图历史记录。 /// public sealed class ScreenshotHistory { /// /// 截图ID。 /// public Guid ScreenshotId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 层ID(可选)。 /// public Guid? LayerId { get; init; } /// /// 截图类型。 /// public ScreenshotType ScreenshotType { get; init; } /// /// 截图时间。 /// public DateTime ScreenshotTimeUtc { get; init; } /// /// 文件路径。 /// public string FilePath { get; init; } = string.Empty; /// /// 文件大小(字节)。 /// public long FileSizeBytes { get; init; } /// /// 文件格式。 /// public string FileFormat { get; init; } = string.Empty; /// /// 图像宽度。 /// public int ImageWidth { get; init; } /// /// 图像高度。 /// public int ImageHeight { get; init; } /// /// 图像描述。 /// public string ImageDescription { get; init; } = string.Empty; /// /// 关联的检测数量。 /// public int AssociatedDetectionCount { get; init; } /// /// 关联的缺陷数量。 /// public int AssociatedDefectCount { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 截图类型枚举。 /// public enum ScreenshotType { /// /// 原始图像。 /// Original = 0, /// /// 处理后图像。 /// Processed = 1, /// /// 检测结果图像。 /// DetectionResult = 2, /// /// 缺陷标记图像。 /// DefectMarked = 3, /// /// 热力图。 /// Heatmap = 4, /// /// 对比图像。 /// Comparison = 5, /// /// 调试图像。 /// Debug = 6, /// /// 自定义图像。 /// Custom = 7 } /// /// 截图详细信息。 /// public sealed class ScreenshotDetail { /// /// 截图历史信息。 /// public ScreenshotHistory ScreenshotHistory { get; init; } = new(); /// /// 图像元数据。 /// public ImageMetadata ImageMetadata { get; init; } = new(); /// /// 关联的检测结果。 /// public IReadOnlyList AssociatedDetections { get; init; } = Array.Empty(); /// /// 关联的缺陷信息。 /// public IReadOnlyList AssociatedDefects { get; init; } = Array.Empty(); /// /// 图像标注。 /// public IReadOnlyList Annotations { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 图像元数据。 /// public sealed class ImageMetadata { /// /// 拍摄时间。 /// public DateTime CaptureTimeUtc { get; init; } /// /// 相机ID。 /// public string? CameraId { get; init; } /// /// 相机名称。 /// public string? CameraName { get; init; } /// /// 曝光时间。 /// public double? ExposureTimeMs { get; init; } /// /// ISO感光度。 /// public int? ISO { get; init; } /// /// 光圈值。 /// public double? Aperture { get; init; } /// /// 焦距。 /// public double? FocalLength { get; init; } /// /// 闪光灯状态。 /// public bool? FlashUsed { get; init; } /// /// 图像质量评分。 /// public double? ImageQualityScore { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 图像标注。 /// public sealed class ImageAnnotation { /// /// 标注ID。 /// public Guid AnnotationId { get; init; } /// /// 标注类型。 /// public AnnotationType AnnotationType { get; init; } /// /// 标注内容。 /// public string AnnotationContent { get; init; } = string.Empty; /// /// 标注位置。 /// public BoundingBox AnnotationPosition { get; init; } = new(); /// /// 标注颜色。 /// public string AnnotationColor { get; init; } = string.Empty; /// /// 标注时间。 /// public DateTime AnnotationTimeUtc { get; init; } /// /// 标注者。 /// public string? Annotator { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 标注类型枚举。 /// public enum AnnotationType { /// /// 矩形。 /// Rectangle = 0, /// /// 圆形。 /// Circle = 1, /// /// 多边形。 /// Polygon = 2, /// /// 点。 /// Point = 3, /// /// 线条。 /// Line = 4, /// /// 文本。 /// Text = 5, /// /// 箭头。 /// Arrow = 6, /// /// 自定义。 /// Custom = 7 } /// /// 证据链信息。 /// public sealed class EvidenceChain { /// /// 证据链ID。 /// public Guid EvidenceChainId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 证据链创建时间。 /// public DateTime CreatedAtUtc { get; init; } /// /// 证据链完整性评分。 /// public double CompletenessScore { get; init; } /// /// 证据链可信度评分。 /// public double CredibilityScore { get; init; } /// /// 证据节点列表。 /// public IReadOnlyList EvidenceNodes { get; init; } = Array.Empty(); /// /// 证据链摘要。 /// public EvidenceChainSummary Summary { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 证据节点。 /// public sealed class EvidenceNode { /// /// 节点ID。 /// public Guid NodeId { get; init; } /// /// 节点类型。 /// public EvidenceNodeType NodeType { get; init; } /// /// 节点权重。 /// public double NodeWeight { get; init; } /// /// 节点时间。 /// public DateTime NodeTimeUtc { get; init; } /// /// 节点描述。 /// public string NodeDescription { get; init; } = string.Empty; /// /// 关联数据ID。 /// public Guid? AssociatedDataId { get; init; } /// /// 关联数据类型。 /// public string? AssociatedDataType { get; init; } /// /// 子节点列表。 /// public IReadOnlyList ChildNodes { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 证据节点类型枚举。 /// public enum EvidenceNodeType { /// /// 会话开始。 /// SessionStart = 0, /// /// 层处理。 /// LayerProcessing = 1, /// /// 部件检测。 /// PartDetection = 2, /// /// 规则执行。 /// RuleExecution = 3, /// /// 截图采集。 /// ScreenshotCapture = 4, /// /// 缺陷发现。 /// DefectDetection = 5, /// /// 报警触发。 /// AlarmTrigger = 6, /// /// 人工操作。 /// ManualOperation = 7, /// /// 最终判定。 /// FinalJudgment = 8, /// /// 会话结束。 /// SessionEnd = 9 } /// /// 证据链摘要。 /// public sealed class EvidenceChainSummary { /// /// 总节点数量。 /// public int TotalNodeCount { get; init; } /// /// 关键节点数量。 /// public int CriticalNodeCount { get; init; } /// /// 截图节点数量。 /// public int ScreenshotNodeCount { get; init; } /// /// 缺陷节点数量。 /// public int DefectNodeCount { get; init; } /// /// 报警节点数量。 /// public int AlarmNodeCount { get; init; } /// /// 时间跨度(分钟)。 /// public double TimeSpanMinutes { get; init; } /// /// 证据链质量评级。 /// public EvidenceChainQuality QualityRating { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 证据链质量评级枚举。 /// public enum EvidenceChainQuality { /// /// 优秀。 /// Excellent = 0, /// /// 良好。 /// Good = 1, /// /// 一般。 /// Fair = 2, /// /// 较差。 /// Poor = 3, /// /// 不完整。 /// Incomplete = 4 } /// /// 层级证据回溯。 /// public sealed class LayerEvidenceTraceback { /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 回溯时间。 /// public DateTime TracebackTimeUtc { get; init; } /// /// 层级证据链路。 /// public IReadOnlyList LayerEvidenceLinks { get; init; } = Array.Empty(); /// /// 回溯摘要。 /// public LayerTracebackSummary Summary { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层级证据链路。 /// public sealed class LayerEvidenceLink { /// /// 链路ID。 /// public Guid LinkId { get; init; } /// /// 层序号。 /// public int LayerSequence { get; init; } /// /// 层名称。 /// public string LayerName { get; init; } = string.Empty; /// /// 层处理时间。 /// public DateTime LayerProcessingTimeUtc { get; init; } /// /// 关键截图列表。 /// public IReadOnlyList KeyScreenshots { get; init; } = Array.Empty(); /// /// 关键缺陷列表。 /// public IReadOnlyList KeyDefects { get; init; } = Array.Empty(); /// /// 关键操作列表。 /// public IReadOnlyList KeyOperations { get; init; } = Array.Empty(); /// /// 链路完整性。 /// public double LinkCompleteness { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层级回溯摘要。 /// public sealed class LayerTracebackSummary { /// /// 总层数。 /// public int TotalLayerCount { get; init; } /// /// 完整链路数量。 /// public int CompleteLinkCount { get; init; } /// /// 部分链路数量。 /// public int PartialLinkCount { get; init; } /// /// 缺失链路数量。 /// public int MissingLinkCount { get; init; } /// /// 总截图数量。 /// public int TotalScreenshotCount { get; init; } /// /// 总缺陷数量。 /// public int TotalDefectCount { get; init; } /// /// 回溯完整性评分。 /// public double TracebackCompletenessScore { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷追溯信息。 /// public sealed class DefectTraceback { /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 追溯时间。 /// public DateTime TracebackTimeUtc { get; init; } /// /// 缺陷追溯链路。 /// public IReadOnlyList DefectTracebackLinks { get; init; } = Array.Empty(); /// /// 缺陷统计分析。 /// public DefectStatisticsAnalysis DefectStatistics { get; init; } = new(); /// /// 缺陷模式分析。 /// public DefectPatternAnalysis PatternAnalysis { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷追溯链路。 /// public sealed class DefectTracebackLink { /// /// 链路ID。 /// public Guid LinkId { get; init; } /// /// 缺陷ID。 /// public Guid DefectId { get; init; } /// /// 缺陷类型。 /// public DefectType DefectType { get; init; } /// /// 缺陷严重程度。 /// public DefectSeverity DefectSeverity { get; init; } /// /// 发现时间。 /// public DateTime DiscoveryTimeUtc { get; init; } /// /// 所在层序号。 /// public int LayerSequence { get; init; } /// /// 所在层名称。 /// public string LayerName { get; init; } = string.Empty; /// /// 根本原因分析。 /// public string RootCauseAnalysis { get; init; } = string.Empty; /// /// 关联截图。 /// public ScreenshotHistory? AssociatedScreenshot { get; init; } /// /// 关联操作。 /// public IReadOnlyList AssociatedOperations { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷统计分析。 /// public sealed class DefectStatisticsAnalysis { /// /// 总缺陷数量。 /// public int TotalDefectCount { get; init; } /// /// 按类型分组的缺陷统计。 /// public Dictionary DefectsByType { get; init; } = new(); /// /// 按严重程度分组的缺陷统计。 /// public Dictionary DefectsBySeverity { get; init; } = new(); /// /// 按层分组的缺陷统计。 /// public Dictionary DefectsByLayer { get; init; } = new(); /// /// 缺陷密度。 /// public double DefectDensity { get; init; } /// /// 缺陷率。 /// public double DefectRate { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷模式分析。 /// public sealed class DefectPatternAnalysis { /// /// 重复缺陷模式。 /// public IReadOnlyList RecurringPatterns { get; init; } = Array.Empty(); /// /// 异常缺陷模式。 /// public IReadOnlyList AnomalousPatterns { get; init; } = Array.Empty(); /// /// 趋势分析。 /// public DefectTrendAnalysis TrendAnalysis { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷模式。 /// public sealed class DefectPattern { /// /// 模式ID。 /// public Guid PatternId { get; init; } /// /// 模式名称。 /// public string PatternName { get; init; } = string.Empty; /// /// 模式描述。 /// public string PatternDescription { get; init; } = string.Empty; /// /// 出现频率。 /// public double OccurrenceFrequency { get; init; } /// /// 模式置信度。 /// public double PatternConfidence { get; init; } /// /// 相关缺陷列表。 /// public IReadOnlyList RelatedDefectIds { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷趋势分析。 /// public sealed class DefectTrendAnalysis { /// /// 趋势方向。 /// public TrendDirection TrendDirection { get; init; } /// /// 变化率。 /// public double ChangeRate { get; init; } /// /// 趋势描述。 /// public string TrendDescription { get; init; } = string.Empty; /// /// 预测下期缺陷数量。 /// public int PredictedNextDefectCount { get; init; } /// /// 置信度。 /// public double Confidence { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 操作历史记录。 /// public sealed class OperationHistory { /// /// 操作ID。 /// public Guid OperationId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 层ID(可选)。 /// public Guid? LayerId { get; init; } /// /// 操作类型。 /// public OperationType OperationType { get; init; } /// /// 操作时间。 /// public DateTime OperationTimeUtc { get; init; } /// /// 操作员ID。 /// public string OperatorId { get; init; } = string.Empty; /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 操作描述。 /// public string OperationDescription { get; init; } = string.Empty; /// /// 操作结果。 /// public OperationResult OperationResult { get; init; } /// /// 操作参数。 /// public Dictionary OperationParameters { get; init; } = new(); /// /// 操作耗时(毫秒)。 /// public long OperationDurationMs { get; init; } /// /// 关联截图ID。 /// public Guid? AssociatedScreenshotId { get; init; } /// /// 错误信息。 /// public string? ErrorMessage { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 操作类型枚举。 /// public enum OperationType { /// /// 会话开始。 /// SessionStart = 0, /// /// 会话结束。 /// SessionEnd = 1, /// /// 层开始。 /// LayerStart = 2, /// /// 层结束。 /// LayerEnd = 3, /// /// 截图采集。 /// ScreenshotCapture = 4, /// /// 部件检测。 /// PartDetection = 5, /// /// 规则执行。 /// RuleExecution = 6, /// /// 报警确认。 /// AlarmConfirm = 7, /// /// 报警清除。 /// AlarmClear = 8, /// /// 人工判定。 /// ManualJudgment = 9, /// /// 参数调整。 /// ParameterAdjustment = 10, /// /// 系统配置。 /// SystemConfiguration = 11, /// /// 数据导出。 /// DataExport = 12, /// /// 其他操作。 /// Other = 13 } /// /// 操作结果枚举。 /// public enum OperationResult { /// /// 成功。 /// Success = 0, /// /// 失败。 /// Failed = 1, /// /// 部分成功。 /// PartialSuccess = 2, /// /// 跳过。 /// Skipped = 3, /// /// 超时。 /// Timeout = 4, /// /// 错误。 /// Error = 5 } /// /// 综合追溯报告。 /// public sealed class ComprehensiveTracebackReport { /// /// 报告ID。 /// public Guid ReportId { get; init; } /// /// 报告类型。 /// public TracebackReportType ReportType { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 报告生成时间。 /// public DateTime GeneratedAtUtc { get; init; } /// /// 报告标题。 /// public string ReportTitle { get; init; } = string.Empty; /// /// 执行摘要。 /// public ReportExecutiveSummary ExecutiveSummary { get; init; } = new(); /// /// 会话概览。 /// public ProductSessionDetail SessionOverview { get; init; } = new(); /// /// 层级分析。 /// public IReadOnlyList LayerAnalyses { get; init; } = Array.Empty(); /// /// 缺陷分析。 /// public DefectAnalysisReport DefectAnalysis { get; init; } = new(); /// /// 性能分析。 /// public PerformanceAnalysisReport PerformanceAnalysis { get; init; } = new(); /// /// 证据链分析。 /// public EvidenceChainAnalysis EvidenceChainAnalysis { get; init; } = new(); /// /// 改进建议。 /// public IReadOnlyList ImprovementSuggestions { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 追溯报告类型枚举。 /// public enum TracebackReportType { /// /// 标准报告。 /// Standard = 0, /// /// 详细报告。 /// Detailed = 1, /// /// 摘要报告。 /// Summary = 2, /// /// 缺陷报告。 /// DefectFocused = 3, /// /// 性能报告。 /// PerformanceFocused = 4, /// /// 合规报告。 /// ComplianceFocused = 5, /// /// 自定义报告。 /// Custom = 6 } /// /// 报告执行摘要。 /// public sealed class ReportExecutiveSummary { /// /// 总体评分。 /// public double OverallScore { get; init; } /// /// 关键发现。 /// public IReadOnlyList KeyFindings { get; init; } = Array.Empty(); /// /// 主要问题。 /// public IReadOnlyList MajorIssues { get; init; } = Array.Empty(); /// /// 改进机会。 /// public IReadOnlyList ImprovementOpportunities { get; init; } = Array.Empty(); /// /// 摘要描述。 /// public string SummaryDescription { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层级分析报告。 /// public sealed class LayerAnalysisReport { /// /// 层序号。 /// public int LayerSequence { get; init; } /// /// 层名称。 /// public string LayerName { get; init; } = string.Empty; /// /// 层性能评分。 /// public double LayerPerformanceScore { get; init; } /// /// 层质量评分。 /// public double LayerQualityScore { get; init; } /// /// 层效率评分。 /// public double LayerEfficiencyScore { get; init; } /// /// 关键指标。 /// public Dictionary KeyMetrics { get; init; } = new(); /// /// 问题识别。 /// public IReadOnlyList IdentifiedIssues { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 缺陷分析报告。 /// public sealed class DefectAnalysisReport { /// /// 总缺陷数量。 /// public int TotalDefectCount { get; init; } /// /// 缺陷率。 /// public double DefectRate { get; init; } /// /// 缺陷分布。 /// public Dictionary DefectDistribution { get; init; } = new(); /// /// 严重程度分布。 /// public Dictionary SeverityDistribution { get; init; } = new(); /// /// 高频缺陷。 /// public IReadOnlyList HighFrequencyDefects { get; init; } = Array.Empty(); /// /// 缺陷趋势。 /// public DefectTrendAnalysis DefectTrend { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 性能分析报告。 /// public sealed class PerformanceAnalysisReport { /// /// 总处理时间。 /// public double TotalProcessingTimeMinutes { get; init; } /// /// 平均层处理时间。 /// public double AverageLayerProcessingTimeSeconds { get; init; } /// /// 系统可用性。 /// public double SystemAvailability { get; init; } /// /// 处理效率。 /// public double ProcessingEfficiency { get; init; } /// /// 资源利用率。 /// public double ResourceUtilization { get; init; } /// /// 性能瓶颈。 /// public IReadOnlyList PerformanceBottlenecks { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 证据链分析。 /// public sealed class EvidenceChainAnalysis { /// /// 证据链完整性。 /// public double EvidenceChainCompleteness { get; init; } /// /// 证据链可信度。 /// public double EvidenceChainCredibility { get; init; } /// /// 关键证据节点。 /// public IReadOnlyList CriticalEvidenceNodes { get; init; } = Array.Empty(); /// /// 证据缺口。 /// public IReadOnlyList EvidenceGaps { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 证据缺口。 /// public sealed class EvidenceGap { /// /// 缺口ID。 /// public Guid GapId { get; init; } /// /// 缺口类型。 /// public EvidenceGapType GapType { get; init; } /// /// 缺口描述。 /// public string GapDescription { get; init; } = string.Empty; /// /// 缺口严重程度。 /// public GapSeverity GapSeverity { get; init; } /// /// 建议措施。 /// public string RecommendedAction { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 证据缺口类型枚举。 /// public enum EvidenceGapType { /// /// 缺失截图。 /// MissingScreenshot = 0, /// /// 缺失操作记录。 /// MissingOperationRecord = 1, /// /// 缺失检测数据。 /// MissingDetectionData = 2, /// /// 缺失规则执行。 /// MissingRuleExecution = 3, /// /// 数据不一致。 /// DataInconsistency = 4, /// /// 时间戳异常。 /// TimestampAnomaly = 5, /// /// 其他缺口。 /// Other = 6 } /// /// 缺口严重程度枚举。 /// public enum GapSeverity { /// /// 低。 /// Low = 0, /// /// 中。 /// Medium = 1, /// /// 高。 /// High = 2, /// /// 严重。 /// Critical = 3 } /// /// 追溯改进建议。 /// public sealed class TracebackImprovementSuggestion { /// /// 建议ID。 /// public Guid SuggestionId { get; init; } /// /// 建议类别。 /// public SuggestionCategory SuggestionCategory { get; init; } /// /// 建议标题。 /// public string SuggestionTitle { get; init; } = string.Empty; /// /// 建议描述。 /// public string SuggestionDescription { get; init; } = string.Empty; /// /// 优先级。 /// public int Priority { get; init; } /// /// 预期效果。 /// public string ExpectedImpact { get; init; } = string.Empty; /// /// 实施难度。 /// public ImplementationDifficulty ImplementationDifficulty { get; init; } /// /// 相关证据。 /// public IReadOnlyList RelatedEvidenceIds { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 追溯统计数据。 /// public sealed class TracebackStatistics { /// /// 统计时间范围。 /// public TimeRange TimeRange { get; init; } = new(); /// /// 产品类型编码。 /// public string ProductTypeCode { get; init; } = string.Empty; /// /// 总会话数量。 /// public int TotalSessionCount { get; init; } /// /// 完成会话数量。 /// public int CompletedSessionCount { get; init; } /// /// 会话完成率。 /// public double SessionCompletionRate => TotalSessionCount > 0 ? (double)CompletedSessionCount / TotalSessionCount * 100 : 0.0; /// /// 总层数量。 /// public int TotalLayerCount { get; init; } /// /// 总截图数量。 /// public int TotalScreenshotCount { get; init; } /// /// 总缺陷数量。 /// public int TotalDefectCount { get; init; } /// /// 总操作数量。 /// public int TotalOperationCount { get; init; } /// /// 平均会话持续时间(分钟)。 /// public double AverageSessionDurationMinutes { get; init; } /// /// 平均层处理时间(秒)。 /// public double AverageLayerProcessingTimeSeconds { get; init; } /// /// 按日期分组的统计。 /// public Dictionary ByDate { get; init; } = new(); /// /// 按产品类型分组的统计。 /// public Dictionary ByProductType { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 按日期分组的追溯统计。 /// public sealed class DailyTracebackStatistics { /// /// 日期。 /// public DateTime Date { get; init; } /// /// 会话数量。 /// public int SessionCount { get; init; } /// /// 完成会话数量。 /// public int CompletedSessionCount { get; init; } /// /// 层数量。 /// public int LayerCount { get; init; } /// /// 截图数量。 /// public int ScreenshotCount { get; init; } /// /// 缺陷数量。 /// public int DefectCount { get; init; } } /// /// 按产品类型分组的追溯统计。 /// public sealed class ProductTypeTracebackStatistics { /// /// 产品类型编码。 /// public string ProductTypeCode { get; init; } = string.Empty; /// /// 会话数量。 /// public int SessionCount { get; init; } /// /// 完成会话数量。 /// public int CompletedSessionCount { get; init; } /// /// 层数量。 /// public int LayerCount { get; init; } /// /// 截图数量。 /// public int ScreenshotCount { get; init; } /// /// 缺陷数量。 /// public int DefectCount { get; init; } } /// /// 历史搜索请求。 /// public sealed class HistorySearchRequest { /// /// 搜索ID。 /// public Guid SearchId { get; init; } /// /// 搜索关键词。 /// public string SearchKeyword { get; init; } = string.Empty; /// /// 搜索类型。 /// public HistorySearchType SearchType { get; init; } /// /// 时间范围。 /// public TimeRange? TimeRange { get; init; } /// /// 产品类型编码。 /// public string? ProductTypeCode { get; init; } /// /// 会话状态。 /// public SessionStatus? SessionStatus { get; init; } /// /// 缺陷类型。 /// public DefectType? DefectType { get; init; } /// /// 操作员ID。 /// public string? OperatorId { get; init; } /// /// 最大结果数量。 /// public int MaxResultCount { get; init; } = 100; /// /// 搜索参数。 /// public Dictionary SearchParameters { get; init; } = new(); /// /// 搜索时间。 /// public DateTime SearchTimeUtc { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 历史搜索类型枚举。 /// public enum HistorySearchType { /// /// 会话搜索。 /// Session = 0, /// /// 层搜索。 /// Layer = 1, /// /// 截图搜索。 /// Screenshot = 2, /// /// 缺陷搜索。 /// Defect = 3, /// /// 操作搜索。 /// Operation = 4, /// /// 全文搜索。 /// FullText = 5, /// /// 综合搜索。 /// Comprehensive = 6 } /// /// 历史搜索结果。 /// public sealed class HistorySearchResult { /// /// 搜索ID。 /// public Guid SearchId { get; init; } /// /// 搜索时间。 /// public DateTime SearchTimeUtc { get; init; } /// /// 总结果数量。 /// public int TotalResultCount { get; init; } /// /// 返回结果数量。 /// public int ReturnedResultCount { get; init; } /// /// 搜索耗时(毫秒)。 /// public long SearchElapsedMs { get; init; } /// /// 会话结果。 /// public IReadOnlyList SessionResults { get; init; } = Array.Empty(); /// /// 层结果。 /// public IReadOnlyList LayerResults { get; init; } = Array.Empty(); /// /// 截图结果。 /// public IReadOnlyList ScreenshotResults { get; init; } = Array.Empty(); /// /// 缺陷结果。 /// public IReadOnlyList DefectResults { get; init; } = Array.Empty(); /// /// 操作结果。 /// public IReadOnlyList OperationResults { get; init; } = Array.Empty(); /// /// 搜索建议。 /// public IReadOnlyList SearchSuggestions { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 追溯数据导出请求。 /// public sealed class TracebackExportRequest { /// /// 导出ID。 /// public Guid ExportId { get; init; } /// /// 导出类型。 /// public TracebackExportType ExportType { get; init; } /// /// 导出格式。 /// public ExportFormat ExportFormat { get; init; } /// /// 时间范围。 /// public TimeRange TimeRange { get; init; } = new(); /// /// 产品类型编码。 /// public string? ProductTypeCode { get; init; } /// /// 会话ID列表。 /// public IReadOnlyList SessionIds { get; init; } = Array.Empty(); /// /// 包含截图。 /// public bool IncludeScreenshots { get; init; } = true; /// /// 包含缺陷详情。 /// public bool IncludeDefectDetails { get; init; } = true; /// /// 包含操作记录。 /// public bool IncludeOperationRecords { get; init; } = true; /// /// 包含证据链。 /// public bool IncludeEvidenceChain { get; init; } = true; /// /// 导出参数。 /// public Dictionary ExportParameters { get; init; } = new(); /// /// 请求用户。 /// public string RequestUser { get; init; } = string.Empty; /// /// 请求时间。 /// public DateTime RequestTimeUtc { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 追溯导出类型枚举。 /// public enum TracebackExportType { /// /// 会话导出。 /// Session = 0, /// /// 层导出。 /// Layer = 1, /// /// 截图导出。 /// Screenshot = 2, /// /// 缺陷导出。 /// Defect = 3, /// /// 操作导出。 /// Operation = 4, /// /// 证据链导出。 /// EvidenceChain = 5, /// /// 综合报告导出。 /// ComprehensiveReport = 6, /// /// 自定义导出。 /// Custom = 7 } /// /// 追溯导出结果。 /// public sealed class TracebackExportResult { /// /// 导出ID。 /// public Guid ExportId { get; init; } /// /// 是否成功导出。 /// public bool IsSuccess { get; init; } /// /// 导出文件路径。 /// public string? FilePath { get; init; } /// /// 导出文件大小(字节)。 /// public long FileSizeBytes { get; init; } /// /// 导出记录数量。 /// public int RecordCount { get; init; } /// /// 导出耗时(毫秒)。 /// public long ExportElapsedMs { get; init; } /// /// 导出时间。 /// public DateTime ExportTimeUtc { get; init; } /// /// 结果描述。 /// public string? ResultDescription { get; init; } /// /// 导出统计。 /// public ExportStatistics ExportStatistics { get; init; } = new(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 导出统计。 /// public sealed class ExportStatistics { /// /// 会话数量。 /// public int SessionCount { get; init; } /// /// 层数量。 /// public int LayerCount { get; init; } /// /// 截图数量。 /// public int ScreenshotCount { get; init; } /// /// 缺陷数量。 /// public int DefectCount { get; init; } /// /// 操作数量。 /// public int OperationCount { get; init; } /// /// 证据链数量。 /// public int EvidenceChainCount { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 会话性能指标。 /// public sealed class SessionPerformanceMetrics { /// /// 总处理时间(分钟)。 /// public double TotalProcessingTimeMinutes { get; init; } /// /// 平均层处理时间(秒)。 /// public double AverageLayerProcessingTimeSeconds { get; init; } /// /// 系统可用性。 /// public double SystemAvailability { get; init; } /// /// 处理效率。 /// public double ProcessingEfficiency { get; init; } /// /// 资源利用率。 /// public double ResourceUtilization { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 层性能指标。 /// public sealed class LayerPerformanceMetrics { /// /// 层处理时间(秒)。 /// public double LayerProcessingTimeSeconds { get; init; } /// /// 检测处理时间(毫秒)。 /// public long DetectionProcessingTimeMs { get; init; } /// /// 规则执行时间(毫秒)。 /// public long RuleExecutionTimeMs { get; init; } /// /// 截图处理时间(毫秒)。 /// public long ScreenshotProcessingTimeMs { get; init; } /// /// 内存使用量(MB)。 /// public double MemoryUsageMb { get; init; } /// /// CPU使用率。 /// public double CpuUsagePercentage { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); }