using OrpaonVision.Core.Results; using OrpaonVision.Core.Common; namespace OrpaonVision.Core.ManualOverride; /// /// 人工复位放行服务接口。 /// public interface IManualOverrideService { /// /// 获取可复位放行的会话列表。 /// /// 开始时间。 /// 结束时间。 /// 产品类型编码(可选)。 /// 复位状态(可选)。 /// 取消令牌。 /// 可复位放行的会话列表。 Task>> GetOverrideableSessionsAsync(DateTime startTime, DateTime endTime, string? productTypeCode = null, OverrideStatus? overrideStatus = null, CancellationToken cancellationToken = default); /// /// 获取会话复位放行权限。 /// /// 会话ID。 /// 操作员ID。 /// 取消令牌。 /// 复位放行权限。 Task> GetOverridePermissionAsync(Guid sessionId, string operatorId, CancellationToken cancellationToken = default); /// /// 验证复位放行条件。 /// /// 会话ID。 /// 复位请求。 /// 取消令牌。 /// 验证结果。 Task> ValidateOverrideConditionsAsync(Guid sessionId, ManualOverrideRequest overrideRequest, CancellationToken cancellationToken = default); /// /// 执行人工复位放行。 /// /// 复位请求。 /// 取消令牌。 /// 复位结果。 Task> ExecuteManualOverrideAsync(ManualOverrideRequest overrideRequest, CancellationToken cancellationToken = default); /// /// 批量执行人工复位放行。 /// /// 批量复位请求。 /// 取消令牌。 /// 批量复位结果。 Task> ExecuteBatchManualOverrideAsync(IReadOnlyList overrideRequests, CancellationToken cancellationToken = default); /// /// 获取复位放行历史记录。 /// /// 开始时间。 /// 结束时间。 /// 操作员ID(可选)。 /// 复位结果(可选)。 /// 取消令牌。 /// 复位放行历史记录。 Task>> GetOverrideHistoryAsync(DateTime startTime, DateTime endTime, string? operatorId = null, OverrideResult? overrideResult = null, CancellationToken cancellationToken = default); /// /// 获取复位放行详细信息。 /// /// 复位ID。 /// 取消令牌。 /// 复位放行详细信息。 Task> GetOverrideDetailAsync(Guid overrideId, CancellationToken cancellationToken = default); /// /// 撤销人工复位放行。 /// /// 复位ID。 /// 撤销原因。 /// 操作员ID。 /// 取消令牌。 /// 撤销结果。 Task> RevokeManualOverrideAsync(Guid overrideId, string revokeReason, string operatorId, CancellationToken cancellationToken = default); /// /// 获取复位放行统计信息。 /// /// 开始时间。 /// 结束时间。 /// 产品类型编码(可选)。 /// 取消令牌。 /// 复位放行统计信息。 Task> GetOverrideStatisticsAsync(DateTime startTime, DateTime endTime, string? productTypeCode = null, CancellationToken cancellationToken = default); /// /// 获取复位放行审计日志。 /// /// 会话ID(可选)。 /// 复位ID(可选)。 /// 开始时间(可选)。 /// 结束时间(可选)。 /// 审计级别(可选)。 /// 取消令牌。 /// 复位放行审计日志。 Task>> GetOverrideAuditLogsAsync(Guid? sessionId = null, Guid? overrideId = null, DateTime? startTime = null, DateTime? endTime = null, AuditLevel? auditLevel = null, CancellationToken cancellationToken = default); /// /// 生成复位放行报告。 /// /// 报告请求。 /// 取消令牌。 /// 复位放行报告。 Task> GenerateOverrideReportAsync(OverrideReportRequest reportRequest, CancellationToken cancellationToken = default); /// /// 检查复位放行合规性。 /// /// 会话ID。 /// 复位请求。 /// 取消令牌。 /// 合规性检查结果。 Task> CheckOverrideComplianceAsync(Guid sessionId, ManualOverrideRequest overrideRequest, CancellationToken cancellationToken = default); /// /// 获取复位放行模板。 /// /// 模板类型。 /// 取消令牌。 /// 复位放行模板。 Task> GetOverrideTemplateAsync(OverrideTemplateType templateType, CancellationToken cancellationToken = default); /// /// 保存复位放行模板。 /// /// 复位放行模板。 /// 取消令牌。 /// 保存结果。 Task> SaveOverrideTemplateAsync(OverrideTemplate template, CancellationToken cancellationToken = default); } /// /// 可复位放行的会话。 /// public sealed class OverrideableSession { /// /// 会话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 FinalJudgmentResult FinalJudgmentResult { get; init; } /// /// 会话开始时间。 /// public DateTime SessionStartTimeUtc { get; init; } /// /// 会话结束时间。 /// public DateTime? SessionEndTimeUtc { get; init; } /// /// 复位状态。 /// public OverrideStatus OverrideStatus { get; init; } /// /// 可复位原因。 /// public IReadOnlyList OverrideReasons { get; init; } = Array.Empty(); /// /// 复位优先级。 /// public OverridePriority OverridePriority { get; init; } /// /// 需要权限级别。 /// public OperatorPermissionLevel RequiredPermissionLevel { 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; } /// /// NG原因列表。 /// public IReadOnlyList NGReasons { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位状态枚举。 /// public enum OverrideStatus { /// /// 未复位。 /// NotOverridden = 0, /// /// 待复位。 /// Pending = 1, /// /// 已复位。 /// Overridden = 2, /// /// 复位被拒绝。 /// Rejected = 3, /// /// 复位已撤销。 /// Revoked = 4, /// /// 复位已过期。 /// Expired = 5 } /// /// 复位原因。 /// public sealed class OverrideReason { /// /// 原因ID。 /// public Guid ReasonId { get; init; } /// /// 原因类型。 /// public OverrideReasonType ReasonType { get; init; } /// /// 原因描述。 /// public string ReasonDescription { get; init; } = string.Empty; /// /// 原因严重程度。 /// public OverrideSeverity ReasonSeverity { get; init; } /// /// 建议措施。 /// public string RecommendedAction { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位原因类型枚举。 /// public enum OverrideReasonType { /// /// 设备故障。 /// EquipmentFailure = 0, /// /// 工艺异常。 /// ProcessAnomaly = 1, /// /// 材料问题。 /// MaterialIssue = 2, /// /// 人员操作。 /// HumanError = 3, /// /// 环境因素。 /// EnvironmentalFactor = 4, /// /// 系统错误。 /// SystemError = 5, /// /// 质量标准。 /// QualityStandard = 6, /// /// 其他原因。 /// Other = 7 } /// /// 复位严重程度枚举。 /// public enum OverrideSeverity { /// /// 低。 /// Low = 0, /// /// 中。 /// Medium = 1, /// /// 高。 /// High = 2, /// /// 严重。 /// Critical = 3 } /// /// 复位优先级枚举。 /// public enum OverridePriority { /// /// 低。 /// Low = 0, /// /// 中。 /// Medium = 1, /// /// 高。 /// High = 2, /// /// 紧急。 /// Urgent = 3 } /// /// 操作员权限级别枚举。 /// public enum OperatorPermissionLevel { /// /// 操作员。 /// Operator = 0, /// /// 技术员。 /// Technician = 1, /// /// 班组长。 /// TeamLeader = 2, /// /// 主管。 /// Supervisor = 3, /// /// 经理。 /// Manager = 4, /// /// 管理员。 /// Administrator = 5 } /// /// 复位权限。 /// public sealed class OverridePermission { /// /// 权限ID。 /// public Guid PermissionId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 操作员ID。 /// public string OperatorId { get; init; } = string.Empty; /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 操作员权限级别。 /// public OperatorPermissionLevel OperatorPermissionLevel { get; init; } /// /// 是否有权限。 /// public bool HasPermission { get; init; } /// /// 权限原因。 /// public string PermissionReason { get; init; } = string.Empty; /// /// 权限限制。 /// public IReadOnlyList PermissionRestrictions { get; init; } = Array.Empty(); /// /// 权限有效期。 /// public DateTime? PermissionExpiryUtc { get; init; } /// /// 需要二次确认。 /// public bool RequireSecondaryConfirmation { get; init; } /// /// 需要审批流程。 /// public bool RequireApprovalProcess { get; init; } /// /// 审批人列表。 /// public IReadOnlyList RequiredApprovers { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 人工复位请求。 /// public sealed class ManualOverrideRequest { /// /// 请求ID。 /// public Guid RequestId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 操作员ID。 /// public string OperatorId { get; init; } = string.Empty; /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 复位类型。 /// public OverrideType OverrideType { get; init; } /// /// 复位原因。 /// public string OverrideReason { get; init; } = string.Empty; /// /// 复位描述。 /// public string OverrideDescription { get; init; } = string.Empty; /// /// 复位优先级。 /// public OverridePriority OverridePriority { get; init; } /// /// 目标状态。 /// public SessionStatus TargetStatus { get; init; } /// /// 复位参数。 /// public Dictionary OverrideParameters { get; init; } = new(); /// /// 附件列表。 /// public IReadOnlyList Attachments { get; init; } = Array.Empty(); /// /// 请求时间。 /// public DateTime RequestTimeUtc { get; init; } /// /// 期望执行时间。 /// public DateTime? DesiredExecutionTimeUtc { get; init; } /// /// 是否紧急。 /// public bool IsUrgent { get; init; } /// /// 是否需要审批。 /// public bool RequireApproval { get; init; } /// /// 审批人列表。 /// public IReadOnlyList Approvers { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位类型枚举。 /// public enum OverrideType { /// /// 复位放行。 /// ResetAndRelease = 0, /// /// 强制通过。 /// ForcePass = 1, /// /// 跳过检测。 /// SkipInspection = 2, /// /// 重新处理。 /// Reprocess = 3, /// /// 人工判定。 /// ManualJudgment = 4, /// /// 临时放行。 /// TemporaryRelease = 5, /// /// 条件放行。 /// ConditionalRelease = 6, /// /// 特殊处理。 /// SpecialHandling = 7 } /// /// 复位附件。 /// public sealed class OverrideAttachment { /// /// 附件ID。 /// public Guid AttachmentId { get; init; } /// /// 附件名称。 /// public string AttachmentName { get; init; } = string.Empty; /// /// 附件类型。 /// public string AttachmentType { get; init; } = string.Empty; /// /// 文件路径。 /// public string FilePath { get; init; } = string.Empty; /// /// 文件大小(字节)。 /// public long FileSizeBytes { get; init; } /// /// 上传时间。 /// public DateTime UploadTimeUtc { get; init; } /// /// 上传者。 /// public string Uploader { get; init; } = string.Empty; /// /// 附件描述。 /// public string AttachmentDescription { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位验证结果。 /// public sealed class OverrideValidationResult { /// /// 验证ID。 /// public Guid ValidationId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 请求ID。 /// public Guid RequestId { get; init; } /// /// 是否通过验证。 /// public bool IsValid { get; init; } /// /// 验证结果。 /// public ValidationResult ValidationResult { get; init; } /// /// 验证消息。 /// public string ValidationMessage { get; init; } = string.Empty; /// /// 验证详情。 /// public IReadOnlyList ValidationDetails { get; init; } = Array.Empty(); /// /// 验证警告。 /// public IReadOnlyList ValidationWarnings { get; init; } = Array.Empty(); /// /// 验证错误。 /// public IReadOnlyList ValidationErrors { get; init; } = Array.Empty(); /// /// 验证时间。 /// public DateTime ValidationTimeUtc { get; init; } /// /// 验证耗时(毫秒)。 /// public long ValidationElapsedMs { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 验证结果枚举。 /// public enum ValidationResult { /// /// 通过。 /// Pass = 0, /// /// 警告。 /// Warning = 1, /// /// 失败。 /// Fail = 2, /// /// 需要审批。 /// RequireApproval = 3, /// /// 需要更多信息。 /// RequireMoreInfo = 4 } /// /// 验证详情。 /// public sealed class ValidationDetail { /// /// 详情ID。 /// public Guid DetailId { get; init; } /// /// 验证项目。 /// public string ValidationItem { get; init; } = string.Empty; /// /// 验证结果。 /// public ValidationResult ValidationResult { get; init; } /// /// 验证消息。 /// public string ValidationMessage { get; init; } = string.Empty; /// /// 验证值。 /// public object? ValidationValue { get; init; } /// /// 期望值。 /// public object? ExpectedValue { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 人工复位结果。 /// public sealed class ManualOverrideResult { /// /// 复位ID。 /// public Guid OverrideId { get; init; } /// /// 请求ID。 /// public Guid RequestId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 复位结果。 /// public OverrideResult OverrideResult { get; init; } /// /// 复位状态。 /// public OverrideStatus OverrideStatus { get; init; } /// /// 复位消息。 /// public string OverrideMessage { get; init; } = string.Empty; /// /// 执行时间。 /// public DateTime ExecutionTimeUtc { get; init; } /// /// 执行耗时(毫秒)。 /// public long ExecutionElapsedMs { get; init; } /// /// 执行者。 /// public string Executor { get; init; } = string.Empty; /// /// 执行详情。 /// public IReadOnlyList ExecutionDetails { get; init; } = Array.Empty(); /// /// 影响的会话状态。 /// public SessionStatus AffectedSessionStatus { get; init; } /// /// 后续操作。 /// public IReadOnlyList FollowUpActions { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位结果枚举。 /// public enum OverrideResult { /// /// 成功。 /// Success = 0, /// /// 失败。 /// Failed = 1, /// /// 部分成功。 /// PartialSuccess = 2, /// /// 被拒绝。 /// Rejected = 3, /// /// 超时。 /// Timeout = 4, /// /// 取消。 /// Cancelled = 5 } /// /// 执行详情。 /// public sealed class ExecutionDetail { /// /// 详情ID。 /// public Guid DetailId { get; init; } /// /// 执行步骤。 /// public string ExecutionStep { get; init; } = string.Empty; /// /// 执行结果。 /// public bool ExecutionResult { get; init; } /// /// 执行消息。 /// public string ExecutionMessage { get; init; } = string.Empty; /// /// 执行时间。 /// public DateTime ExecutionTimeUtc { get; init; } /// /// 执行耗时(毫秒)。 /// public long ExecutionElapsedMs { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 批量人工复位结果。 /// public sealed class BatchManualOverrideResult { /// /// 批量操作ID。 /// public Guid BatchId { get; init; } /// /// 总请求数。 /// public int TotalRequestCount { get; init; } /// /// 成功数量。 /// public int SuccessCount { get; init; } /// /// 失败数量。 /// public int FailureCount { get; init; } /// /// 成功率。 /// public double SuccessRate => TotalRequestCount > 0 ? (double)SuccessCount / TotalRequestCount * 100 : 0.0; /// /// 批量结果。 /// public IReadOnlyList Results { get; init; } = Array.Empty(); /// /// 批量消息。 /// public string BatchMessage { get; init; } = string.Empty; /// /// 批量执行时间。 /// public DateTime BatchExecutionTimeUtc { get; init; } /// /// 批量执行耗时(毫秒)。 /// public long BatchExecutionElapsedMs { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 人工复位历史记录。 /// public sealed class ManualOverrideHistory { /// /// 历史记录ID。 /// public Guid HistoryId { get; init; } /// /// 复位ID。 /// public Guid OverrideId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 请求ID。 /// public Guid RequestId { get; init; } /// /// 复位类型。 /// public OverrideType OverrideType { get; init; } /// /// 复位结果。 /// public OverrideResult OverrideResult { get; init; } /// /// 复位状态。 /// public OverrideStatus OverrideStatus { get; init; } /// /// 操作员ID。 /// public string OperatorId { get; init; } = string.Empty; /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 复位原因。 /// public string OverrideReason { get; init; } = string.Empty; /// /// 复位时间。 /// public DateTime OverrideTimeUtc { get; init; } /// /// 复位耗时(毫秒)。 /// public long OverrideElapsedMs { get; init; } /// /// 复位消息。 /// public string OverrideMessage { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 人工复位详细信息。 /// public sealed class ManualOverrideDetail { /// /// 复位ID。 /// public Guid OverrideId { get; init; } /// /// 复位结果。 /// public ManualOverrideResult OverrideResult { get; init; } = new(); /// /// 复位请求。 /// public ManualOverrideRequest OverrideRequest { get; init; } = new(); /// /// 验证结果。 /// public OverrideValidationResult? ValidationResult { get; init; } /// /// 权限信息。 /// public OverridePermission? Permission { get; init; } /// /// 审批信息。 /// public IReadOnlyList ApprovalInfos { get; init; } = Array.Empty(); /// /// 影响分析。 /// public OverrideImpactAnalysis ImpactAnalysis { get; init; } = new(); /// /// 合规性检查。 /// public OverrideComplianceCheck? ComplianceCheck { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 审批信息。 /// public sealed class ApprovalInfo { /// /// 审批ID。 /// public Guid ApprovalId { get; init; } /// /// 审批人ID。 /// public string ApproverId { get; init; } = string.Empty; /// /// 审批人姓名。 /// public string ApproverName { get; init; } = string.Empty; /// /// 审批结果。 /// public ApprovalResult ApprovalResult { get; init; } /// /// 审批意见。 /// public string ApprovalComment { get; init; } = string.Empty; /// /// 审批时间。 /// public DateTime ApprovalTimeUtc { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 审批结果枚举。 /// public enum ApprovalResult { /// /// 批准。 /// Approved = 0, /// /// 拒绝。 /// Rejected = 1, /// /// 待审批。 /// Pending = 2, /// /// 撤回。 /// Withdrawn = 3 } /// /// 复位影响分析。 /// public sealed class OverrideImpactAnalysis { /// /// 分析ID。 /// public Guid AnalysisId { get; init; } /// /// 影响等级。 /// public ImpactLevel ImpactLevel { get; init; } /// /// 影响描述。 /// public string ImpactDescription { get; init; } = string.Empty; /// /// 影响的会话数量。 /// public int AffectedSessionCount { get; init; } /// /// 影响的层数量。 /// public int AffectedLayerCount { get; init; } /// /// 影响的检测数量。 /// public int AffectedDetectionCount { get; init; } /// /// 风险评估。 /// public RiskAssessment RiskAssessment { get; init; } = new(); /// /// 建议措施。 /// public IReadOnlyList RecommendedActions { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 影响等级枚举。 /// public enum ImpactLevel { /// /// 无影响。 /// None = 0, /// /// 低影响。 /// Low = 1, /// /// 中等影响。 /// Medium = 2, /// /// 高影响。 /// High = 3, /// /// 严重影响。 /// Critical = 4 } /// /// 风险评估。 /// public sealed class RiskAssessment { /// /// 风险等级。 /// public RiskLevel RiskLevel { get; init; } /// /// 风险描述。 /// public string RiskDescription { get; init; } = string.Empty; /// /// 风险概率。 /// public double RiskProbability { get; init; } /// /// 风险影响。 /// public double RiskImpact { get; init; } /// /// 风险值。 /// public double RiskValue => RiskProbability * RiskImpact; /// /// 缓解措施。 /// public IReadOnlyList MitigationMeasures { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 风险等级枚举。 /// public enum RiskLevel { /// /// 无风险。 /// None = 0, /// /// 低风险。 /// Low = 1, /// /// 中等风险。 /// Medium = 2, /// /// 高风险。 /// High = 3, /// /// 极高风险。 /// Critical = 4 } /// /// 复位撤销结果。 /// public sealed class OverrideRevokeResult { /// /// 撤销ID。 /// public Guid RevokeId { get; init; } /// /// 复位ID。 /// public Guid OverrideId { get; init; } /// /// 撤销结果。 /// public RevokeResult RevokeResult { get; init; } /// /// 撤销原因。 /// public string RevokeReason { get; init; } = string.Empty; /// /// 撤销时间。 /// public DateTime RevokeTimeUtc { get; init; } /// /// 撤销者。 /// public string Revoker { get; init; } = string.Empty; /// /// 撤销消息。 /// public string RevokeMessage { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 撤销结果枚举。 /// public enum RevokeResult { /// /// 成功。 /// Success = 0, /// /// 失败。 /// Failed = 1, /// /// 已过期。 /// Expired = 2, /// /// 无权限。 /// NoPermission = 3, /// /// 已撤销。 /// AlreadyRevoked = 4 } /// /// 人工复位统计信息。 /// public sealed class ManualOverrideStatistics { /// /// 统计时间范围。 /// public TimeRange TimeRange { get; init; } = new(); /// /// 产品类型编码。 /// public string ProductTypeCode { get; init; } = string.Empty; /// /// 总复位次数。 /// public int TotalOverrideCount { get; init; } /// /// 成功复位次数。 /// public int SuccessfulOverrideCount { get; init; } /// /// 失败复位次数。 /// public int FailedOverrideCount { get; init; } /// /// 成功率。 /// public double SuccessRate => TotalOverrideCount > 0 ? (double)SuccessfulOverrideCount / TotalOverrideCount * 100 : 0.0; /// /// 按复位类型分组的统计。 /// public Dictionary OverridesByType { get; init; } = new(); /// /// 按操作员分组的统计。 /// public Dictionary OverridesByOperator { get; init; } = new(); /// /// 按日期分组的统计。 /// public Dictionary ByDate { get; init; } = new(); /// /// 平均复位耗时(毫秒)。 /// public double AverageOverrideElapsedMs { get; init; } /// /// 最长复位耗时(毫秒)。 /// public long MaxOverrideElapsedMs { get; init; } /// /// 最短复位耗时(毫秒)。 /// public long MinOverrideElapsedMs { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 操作员复位统计。 /// public sealed class OperatorOverrideStatistics { /// /// 操作员ID。 /// public string OperatorId { get; init; } = string.Empty; /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 复位次数。 /// public int OverrideCount { get; init; } /// /// 成功次数。 /// public int SuccessCount { get; init; } /// /// 失败次数。 /// public int FailureCount { get; init; } /// /// 成功率。 /// public double SuccessRate => OverrideCount > 0 ? (double)SuccessCount / OverrideCount * 100 : 0.0; /// /// 平均耗时(毫秒)。 /// public double AverageElapsedMs { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 每日复位统计。 /// public sealed class DailyOverrideStatistics { /// /// 日期。 /// public DateTime Date { get; init; } /// /// 复位次数。 /// public int OverrideCount { get; init; } /// /// 成功次数。 /// public int SuccessCount { get; init; } /// /// 失败次数。 /// public int FailureCount { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位审计日志。 /// public sealed class OverrideAuditLog { /// /// 日志ID。 /// public Guid LogId { get; init; } /// /// 会话ID。 /// public Guid? SessionId { get; init; } /// /// 复位ID。 /// public Guid? OverrideId { get; init; } /// /// 审计级别。 /// public AuditLevel AuditLevel { get; init; } /// /// 审计类型。 /// public AuditType AuditType { get; init; } /// /// 审计消息。 /// public string AuditMessage { get; init; } = string.Empty; /// /// 审计详情。 /// public string AuditDetails { get; init; } = string.Empty; /// /// 操作员ID。 /// public string OperatorId { get; init; } = string.Empty; /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 审计时间。 /// public DateTime AuditTimeUtc { get; init; } /// /// 客户端IP。 /// public string? ClientIp { get; init; } /// /// 用户代理。 /// public string? UserAgent { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 审计级别枚举。 /// public enum AuditLevel { /// /// 信息。 /// Info = 0, /// /// 警告。 /// Warning = 1, /// /// 错误。 /// Error = 2, /// /// 严重。 /// Critical = 3, /// /// 调试。 /// Debug = 4 } /// /// 审计类型枚举。 /// public enum AuditType { /// /// 请求创建。 /// RequestCreated = 0, /// /// 权限检查。 /// PermissionChecked = 1, /// /// 验证执行。 /// ValidationExecuted = 2, /// /// 复位执行。 /// OverrideExecuted = 3, /// /// 复位撤销。 /// OverrideRevoked = 4, /// /// 审批操作。 /// ApprovalAction = 5, /// /// 状态变更。 /// StatusChanged = 6, /// /// 异常处理。 /// ExceptionHandled = 7, /// /// 系统操作。 /// SystemOperation = 8 } /// /// 复位放行报告。 /// public sealed class ManualOverrideReport { /// /// 报告ID。 /// public Guid ReportId { get; init; } /// /// 报告类型。 /// public OverrideReportType ReportType { get; init; } /// /// 报告标题。 /// public string ReportTitle { get; init; } = string.Empty; /// /// 报告时间范围。 /// public TimeRange TimeRange { get; init; } = new(); /// /// 生成时间。 /// public DateTime GeneratedAtUtc { get; init; } /// /// 执行摘要。 /// public ReportExecutiveSummary ExecutiveSummary { get; init; } = new(); /// /// 统计分析。 /// public ManualOverrideStatistics Statistics { get; init; } = new(); /// /// 趋势分析。 /// public OverrideTrendAnalysis TrendAnalysis { get; init; } = new(); /// /// 合规性分析。 /// public OverrideComplianceAnalysis ComplianceAnalysis { get; init; } = new(); /// /// 风险分析。 /// public OverrideRiskAnalysis RiskAnalysis { get; init; } = new(); /// /// 改进建议。 /// public IReadOnlyList ImprovementSuggestions { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位报告类型枚举。 /// public enum OverrideReportType { /// /// 日报。 /// Daily = 0, /// /// 周报。 /// Weekly = 1, /// /// 月报。 /// Monthly = 2, /// /// 季报。 /// Quarterly = 3, /// /// 年报。 /// Annual = 4, /// /// 自定义。 /// Custom = 5 } /// /// 报告执行摘要。 /// 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 OverrideTrendAnalysis { /// /// 趋势方向。 /// public TrendDirection TrendDirection { get; init; } /// /// 变化率。 /// public double ChangeRate { get; init; } /// /// 趋势描述。 /// public string TrendDescription { get; init; } = string.Empty; /// /// 预测下期复位次数。 /// public int PredictedNextOverrideCount { get; init; } /// /// 置信度。 /// public double Confidence { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位合规性分析。 /// public sealed class OverrideComplianceAnalysis { /// /// 合规性评分。 /// public double ComplianceScore { get; init; } /// /// 合规违规次数。 /// public int ComplianceViolationCount { get; init; } /// /// 合规违规类型。 /// public IReadOnlyList Violations { get; init; } = Array.Empty(); /// /// 合规建议。 /// public IReadOnlyList ComplianceRecommendations { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 合规违规。 /// public sealed class ComplianceViolation { /// /// 违规ID。 /// public Guid ViolationId { get; init; } /// /// 违规类型。 /// public string ViolationType { get; init; } = string.Empty; /// /// 违规描述。 /// public string ViolationDescription { get; init; } = string.Empty; /// /// 违规严重程度。 /// public ViolationSeverity ViolationSeverity { get; init; } /// /// 违规时间。 /// public DateTime ViolationTimeUtc { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 违规严重程度枚举。 /// public enum ViolationSeverity { /// /// 轻微。 /// Minor = 0, /// /// 一般。 /// Moderate = 1, /// /// 严重。 /// Severe = 2, /// /// 极严重。 /// Critical = 3 } /// /// 复位风险分析。 /// public sealed class OverrideRiskAnalysis { /// /// 风险评分。 /// public double RiskScore { get; init; } /// /// 高风险复位次数。 /// public int HighRiskOverrideCount { get; init; } /// /// 风险因素。 /// public IReadOnlyList RiskFactors { get; init; } = Array.Empty(); /// /// 风险缓解建议。 /// public IReadOnlyList RiskMitigationRecommendations { get; init; } = Array.Empty(); /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 风险因素。 /// public sealed class RiskFactor { /// /// 因素ID。 /// public Guid FactorId { get; init; } /// /// 因素名称。 /// public string FactorName { get; init; } = string.Empty; /// /// 因素描述。 /// public string FactorDescription { get; init; } = string.Empty; /// /// 风险等级。 /// public RiskLevel RiskLevel { get; init; } /// /// 影响程度。 /// public double ImpactLevel { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位改进建议。 /// public sealed class OverrideImprovementSuggestion { /// /// 建议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 Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位合规性检查。 /// public sealed class OverrideComplianceCheck { /// /// 检查ID。 /// public Guid CheckId { get; init; } /// /// 会话ID。 /// public Guid SessionId { get; init; } /// /// 检查结果。 /// public ComplianceCheckResult CheckResult { get; init; } /// /// 合规性评分。 /// public double ComplianceScore { get; init; } /// /// 检查项。 /// public IReadOnlyList CheckItems { get; init; } = Array.Empty(); /// /// 违规项。 /// public IReadOnlyList Violations { get; init; } = Array.Empty(); /// /// 检查时间。 /// public DateTime CheckTimeUtc { get; init; } /// /// 检查耗时(毫秒)。 /// public long CheckElapsedMs { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 合规性检查结果枚举。 /// public enum ComplianceCheckResult { /// /// 通过。 /// Pass = 0, /// /// 警告。 /// Warning = 1, /// /// 失败。 /// Fail = 2, /// /// 需要人工审核。 /// RequireManualReview = 3 } /// /// 合规性检查项。 /// public sealed class ComplianceCheckItem { /// /// 检查项ID。 /// public Guid ItemId { get; init; } /// /// 检查项名称。 /// public string ItemName { get; init; } = string.Empty; /// /// 检查项描述。 /// public string ItemDescription { get; init; } = string.Empty; /// /// 检查结果。 /// public ComplianceCheckResult CheckResult { get; init; } /// /// 检查值。 /// public object? CheckValue { get; init; } /// /// 标准值。 /// public object? StandardValue { get; init; } /// /// 检查消息。 /// public string CheckMessage { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位报告请求。 /// public sealed class OverrideReportRequest { /// /// 请求ID。 /// public Guid RequestId { get; init; } /// /// 报告类型。 /// public OverrideReportType ReportType { get; init; } /// /// 时间范围。 /// public TimeRange TimeRange { get; init; } = new(); /// /// 产品类型编码。 /// public string? ProductTypeCode { get; init; } /// /// 操作员ID。 /// public string? OperatorId { get; init; } /// /// 复位类型。 /// public OverrideType? OverrideType { get; init; } /// /// 报告参数。 /// public Dictionary ReportParameters { get; init; } = new(); /// /// 请求用户。 /// public string RequestUser { get; init; } = string.Empty; /// /// 请求时间。 /// public DateTime RequestTimeUtc { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位模板。 /// public sealed class OverrideTemplate { /// /// 模板ID。 /// public Guid TemplateId { get; init; } /// /// 模板类型。 /// public OverrideTemplateType TemplateType { get; init; } /// /// 模板名称。 /// public string TemplateName { get; init; } = string.Empty; /// /// 模板描述。 /// public string TemplateDescription { get; init; } = string.Empty; /// /// 模板内容。 /// public string TemplateContent { get; init; } = string.Empty; /// /// 模板参数。 /// public IReadOnlyList TemplateParameters { get; init; } = Array.Empty(); /// /// 适用条件。 /// public IReadOnlyList ApplicableConditions { get; init; } = Array.Empty(); /// /// 创建时间。 /// public DateTime CreatedAtUtc { get; init; } /// /// 创建者。 /// public string Creator { get; init; } = string.Empty; /// /// 是否启用。 /// public bool IsEnabled { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位模板类型枚举。 /// public enum OverrideTemplateType { /// /// 设备故障。 /// EquipmentFailure = 0, /// /// 工艺异常。 /// ProcessAnomaly = 1, /// /// 质量问题。 /// QualityIssue = 2, /// /// 紧急放行。 /// EmergencyRelease = 3, /// /// 条件放行。 /// ConditionalRelease = 4, /// /// 临时措施。 /// TemporaryMeasure = 5, /// /// 自定义。 /// Custom = 6 } /// /// 模板参数。 /// public sealed class TemplateParameter { /// /// 参数ID。 /// public Guid ParameterId { get; init; } /// /// 参数名称。 /// public string ParameterName { get; init; } = string.Empty; /// /// 参数类型。 /// public string ParameterType { get; init; } = string.Empty; /// /// 参数描述。 /// public string ParameterDescription { get; init; } = string.Empty; /// /// 是否必需。 /// public bool IsRequired { get; init; } /// /// 默认值。 /// public object? DefaultValue { get; init; } /// /// 验证规则。 /// public string? ValidationRule { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 模板条件。 /// public sealed class TemplateCondition { /// /// 条件ID。 /// public Guid ConditionId { get; init; } /// /// 条件名称。 /// public string ConditionName { get; init; } = string.Empty; /// /// 条件表达式。 /// public string ConditionExpression { get; init; } = string.Empty; /// /// 条件描述。 /// public string ConditionDescription { get; init; } = string.Empty; /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); } /// /// 复位模板保存结果。 /// public sealed class OverrideTemplateSaveResult { /// /// 保存结果。 /// public bool IsSuccess { get; init; } /// /// 模板ID。 /// public Guid TemplateId { get; init; } /// /// 保存消息。 /// public string SaveMessage { get; init; } = string.Empty; /// /// 保存时间。 /// public DateTime SaveTimeUtc { get; init; } /// /// 扩展属性。 /// public Dictionary ExtendedProperties { get; init; } = new(); }