1065 lines
27 KiB
C#
1065 lines
27 KiB
C#
using OrpaonVision.Core.LayerRecognition;
|
|
using OrpaonVision.Core.PartRecognition;
|
|
using OrpaonVision.Core.PlacementJudgment;
|
|
using OrpaonVision.Core.QuantityValidation;
|
|
using OrpaonVision.Core.PositionValidation;
|
|
using OrpaonVision.Core.Results;
|
|
|
|
namespace OrpaonVision.Core.LayerCompletion;
|
|
|
|
/// <summary>
|
|
/// 层完成判定服务接口。
|
|
/// </summary>
|
|
public interface ILayerCompletionService
|
|
{
|
|
/// <summary>
|
|
/// 判定层级完成状态。
|
|
/// </summary>
|
|
/// <param name="layerContext">层级上下文。</param>
|
|
/// <param name="completionRules">完成判定规则列表。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>层级完成判定结果。</returns>
|
|
Task<Result<LayerCompletionResult>> JudgeLayerCompletionAsync(LayerContext layerContext, IReadOnlyList<LayerCompletionRule> completionRules, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 判定必装部件完成状态。
|
|
/// </summary>
|
|
/// <param name="parts">部件列表。</param>
|
|
/// <param name="requiredParts">必装部件列表。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>必装部件完成结果。</returns>
|
|
Task<Result<RequiredPartsCompletionResult>> JudgeRequiredPartsAsync(IReadOnlyList<MappedPart> parts, IReadOnlyList<RequiredPart> requiredParts, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 判定关键部件完成状态。
|
|
/// </summary>
|
|
/// <param name="parts">部件列表。</param>
|
|
/// <param name="criticalParts">关键部件列表。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>关键部件完成结果。</returns>
|
|
Task<Result<CriticalPartsCompletionResult>> JudgeCriticalPartsAsync(IReadOnlyList<MappedPart> parts, IReadOnlyList<CriticalPart> criticalParts, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 判定稳定性完成状态。
|
|
/// </summary>
|
|
/// <param name="frameHistory">帧历史记录。</param>
|
|
/// <param name="stabilityRequirements">稳定性要求。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>稳定性完成结果。</returns>
|
|
Task<Result<StabilityCompletionResult>> JudgeStabilityAsync(IReadOnlyList<InferenceResultDto> frameHistory, StabilityRequirements stabilityRequirements, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 判定禁装部件检查状态。
|
|
/// </summary>
|
|
/// <param name="parts">部件列表。</param>
|
|
/// <param name="forbiddenParts">禁装部件列表。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>禁装部件检查结果。</returns>
|
|
Task<Result<ForbiddenPartsCheckResult>> CheckForbiddenPartsAsync(IReadOnlyList<MappedPart> parts, IReadOnlyList<ForbiddenPart> forbiddenParts, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 批量层级完成判定。
|
|
/// </summary>
|
|
/// <param name="layerContexts">层级上下文列表。</param>
|
|
/// <param name="completionRules">完成判定规则列表。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>批量完成判定结果。</returns>
|
|
Task<Result<BatchLayerCompletionResult>> BatchJudgeLayerCompletionAsync(IReadOnlyList<LayerContext> layerContexts, IReadOnlyList<LayerCompletionRule> completionRules, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 获取层级完成统计信息。
|
|
/// </summary>
|
|
/// <param name="startTime">开始时间。</param>
|
|
/// <param name="endTime">结束时间。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>统计信息。</returns>
|
|
Task<Result<LayerCompletionStatistics>> GetCompletionStatisticsAsync(DateTime startTime, DateTime endTime, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 创建层级完成规则。
|
|
/// </summary>
|
|
/// <param name="rule">完成规则。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>创建结果。</returns>
|
|
Task<Result<LayerCompletionRule>> CreateCompletionRuleAsync(LayerCompletionRule rule, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 更新层级完成规则。
|
|
/// </summary>
|
|
/// <param name="rule">完成规则。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>更新结果。</returns>
|
|
Task<Result> UpdateCompletionRuleAsync(LayerCompletionRule rule, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 删除层级完成规则。
|
|
/// </summary>
|
|
/// <param name="ruleId">规则ID。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>删除结果。</returns>
|
|
Task<Result> DeleteCompletionRuleAsync(Guid ruleId, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// 获取层级完成规则列表。
|
|
/// </summary>
|
|
/// <param name="productTypeCode">产品类型编码(可选)。</param>
|
|
/// <param name="layerNumber">层级编号(可选)。</param>
|
|
/// <param name="completionType">完成类型(可选)。</param>
|
|
/// <param name="cancellationToken">取消令牌。</param>
|
|
/// <returns>规则列表。</returns>
|
|
Task<Result<IReadOnlyList<LayerCompletionRule>>> GetCompletionRulesAsync(string? productTypeCode = null, int? layerNumber = null, LayerCompletionType? completionType = null, CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 层级上下文。
|
|
/// </summary>
|
|
public sealed class LayerContext
|
|
{
|
|
/// <summary>
|
|
/// 产品类型编码。
|
|
/// </summary>
|
|
public string ProductTypeCode { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 层级编号。
|
|
/// </summary>
|
|
public int LayerNumber { get; init; }
|
|
|
|
/// <summary>
|
|
/// 层级名称。
|
|
/// </summary>
|
|
public string LayerName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 当前检测到的部件。
|
|
/// </summary>
|
|
public IReadOnlyList<MappedPart> DetectedParts { get; init; } = Array.Empty<MappedPart>();
|
|
|
|
/// <summary>
|
|
/// 帧历史记录。
|
|
/// </summary>
|
|
public IReadOnlyList<InferenceResultDto> FrameHistory { get; init; } = Array.Empty<InferenceResultDto>();
|
|
|
|
/// <summary>
|
|
/// 数量校验结果。
|
|
/// </summary>
|
|
public BatchQuantityValidationResult? QuantityValidationResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 位置校验结果。
|
|
/// </summary>
|
|
public BatchPositionValidationResult? PositionValidationResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 到位判定结果。
|
|
/// </summary>
|
|
public BatchJudgmentResult? PlacementJudgmentResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 层级开始时间。
|
|
/// </summary>
|
|
public DateTime LayerStartTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 层级当前时间。
|
|
/// </summary>
|
|
public DateTime LayerCurrentTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 层级完成判定结果。
|
|
/// </summary>
|
|
public sealed class LayerCompletionResult
|
|
{
|
|
/// <summary>
|
|
/// 是否完成。
|
|
/// </summary>
|
|
public bool IsCompleted { get; init; }
|
|
|
|
/// <summary>
|
|
/// 完成度百分比。
|
|
/// </summary>
|
|
public double CompletionPercentage { get; init; }
|
|
|
|
/// <summary>
|
|
/// 总体置信度。
|
|
/// </summary>
|
|
public double OverallConfidence { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定时间。
|
|
/// </summary>
|
|
public DateTime JudgmentTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 必装部件完成结果。
|
|
/// </summary>
|
|
public RequiredPartsCompletionResult? RequiredPartsResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 关键部件完成结果。
|
|
/// </summary>
|
|
public CriticalPartsCompletionResult? CriticalPartsResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 稳定性完成结果。
|
|
/// </summary>
|
|
public StabilityCompletionResult? StabilityResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 禁装部件检查结果。
|
|
/// </summary>
|
|
public ForbiddenPartsCheckResult? ForbiddenPartsResult { get; init; }
|
|
|
|
/// <summary>
|
|
/// 未满足的硬条件列表。
|
|
/// </summary>
|
|
public IReadOnlyList<HardCondition> UnmetHardConditions { get; init; } = Array.Empty<HardCondition>();
|
|
|
|
/// <summary>
|
|
/// 完成质量。
|
|
/// </summary>
|
|
public CompletionQuality CompletionQuality { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定详情。
|
|
/// </summary>
|
|
public string? Details { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 必装部件完成结果。
|
|
/// </summary>
|
|
public sealed class RequiredPartsCompletionResult
|
|
{
|
|
/// <summary>
|
|
/// 是否满足必装要求。
|
|
/// </summary>
|
|
public bool IsRequiredSatisfied { get; init; }
|
|
|
|
/// <summary>
|
|
/// 必装部件总数。
|
|
/// </summary>
|
|
public int TotalRequiredParts { get; init; }
|
|
|
|
/// <summary>
|
|
/// 已安装必装部件数量。
|
|
/// </summary>
|
|
public int InstalledRequiredParts { get; init; }
|
|
|
|
/// <summary>
|
|
/// 缺失必装部件列表。
|
|
/// </summary>
|
|
public IReadOnlyList<RequiredPart> MissingRequiredParts { get; init; } = Array.Empty<RequiredPart>();
|
|
|
|
/// <summary>
|
|
/// 必装完成率。
|
|
/// </summary>
|
|
public double RequiredCompletionRate => TotalRequiredParts > 0 ? (double)InstalledRequiredParts / TotalRequiredParts * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 判定时间。
|
|
/// </summary>
|
|
public DateTime JudgmentTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定详情。
|
|
/// </summary>
|
|
public string? Details { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关键部件完成结果。
|
|
/// </summary>
|
|
public sealed class CriticalPartsCompletionResult
|
|
{
|
|
/// <summary>
|
|
/// 是否满足关键件要求。
|
|
/// </summary>
|
|
public bool IsCriticalSatisfied { get; init; }
|
|
|
|
/// <summary>
|
|
/// 关键部件总数。
|
|
/// </summary>
|
|
public int TotalCriticalParts { get; init; }
|
|
|
|
/// <summary>
|
|
/// 已安装关键部件数量。
|
|
/// </summary>
|
|
public int InstalledCriticalParts { get; init; }
|
|
|
|
/// <summary>
|
|
/// 缺失关键部件列表。
|
|
/// </summary>
|
|
public IReadOnlyList<CriticalPart> MissingCriticalParts { get; init; } = Array.Empty<CriticalPart>();
|
|
|
|
/// <summary>
|
|
/// 关键件完成率。
|
|
/// </summary>
|
|
public double CriticalCompletionRate => TotalCriticalParts > 0 ? (double)InstalledCriticalParts / TotalCriticalParts * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 判定时间。
|
|
/// </summary>
|
|
public DateTime JudgmentTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定详情。
|
|
/// </summary>
|
|
public string? Details { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 稳定性完成结果。
|
|
/// </summary>
|
|
public sealed class StabilityCompletionResult
|
|
{
|
|
/// <summary>
|
|
/// 是否满足稳定性要求。
|
|
/// </summary>
|
|
public bool IsStabilitySatisfied { get; init; }
|
|
|
|
/// <summary>
|
|
/// 总体稳定性分数。
|
|
/// </summary>
|
|
public double OverallStabilityScore { get; init; }
|
|
|
|
/// <summary>
|
|
/// 稳定性阈值。
|
|
/// </summary>
|
|
public double StabilityThreshold { get; init; }
|
|
|
|
/// <summary>
|
|
/// 稳定帧数量。
|
|
/// </summary>
|
|
public int StableFrameCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 总帧数量。
|
|
/// </summary>
|
|
public int TotalFrameCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 稳定性通过率。
|
|
/// </summary>
|
|
public double StabilityPassRate => TotalFrameCount > 0 ? (double)StableFrameCount / TotalFrameCount * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 判定时间。
|
|
/// </summary>
|
|
public DateTime JudgmentTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定详情。
|
|
/// </summary>
|
|
public string? Details { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 禁装部件检查结果。
|
|
/// </summary>
|
|
public sealed class ForbiddenPartsCheckResult
|
|
{
|
|
/// <summary>
|
|
/// 是否通过禁装检查(无禁装部件)。
|
|
/// </summary>
|
|
public bool IsForbiddenCheckPassed { get; init; }
|
|
|
|
/// <summary>
|
|
/// 检测到的禁装部件列表。
|
|
/// </summary>
|
|
public IReadOnlyList<ForbiddenPartViolation> DetectedForbiddenParts { get; init; } = Array.Empty<ForbiddenPartViolation>();
|
|
|
|
/// <summary>
|
|
/// 禁装部件总数。
|
|
/// </summary>
|
|
public int TotalForbiddenParts { get; init; }
|
|
|
|
/// <summary>
|
|
/// 违规严重程度。
|
|
/// </summary>
|
|
public ViolationSeverity ViolationSeverity { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定时间。
|
|
/// </summary>
|
|
public DateTime JudgmentTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定详情。
|
|
/// </summary>
|
|
public string? Details { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 批量层级完成判定结果。
|
|
/// </summary>
|
|
public sealed class BatchLayerCompletionResult
|
|
{
|
|
/// <summary>
|
|
/// 层级完成判定结果列表。
|
|
/// </summary>
|
|
public IReadOnlyList<LayerCompletionResult> CompletionResults { get; init; } = Array.Empty<LayerCompletionResult>();
|
|
|
|
/// <summary>
|
|
/// 总层级数量。
|
|
/// </summary>
|
|
public int TotalLayers { get; init; }
|
|
|
|
/// <summary>
|
|
/// 完成的层级数量。
|
|
/// </summary>
|
|
public int CompletedLayers { get; init; }
|
|
|
|
/// <summary>
|
|
/// 失败的层级数量。
|
|
/// </summary>
|
|
public int FailedLayers { get; init; }
|
|
|
|
/// <summary>
|
|
/// 总体完成率。
|
|
/// </summary>
|
|
public double OverallCompletionRate => TotalLayers > 0 ? (double)CompletedLayers / TotalLayers * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 批量处理时间。
|
|
/// </summary>
|
|
public DateTime BatchProcessingTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 总耗时(毫秒)。
|
|
/// </summary>
|
|
public long TotalElapsedMs { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定详情。
|
|
/// </summary>
|
|
public string? Details { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 层级完成统计信息。
|
|
/// </summary>
|
|
public sealed class LayerCompletionStatistics
|
|
{
|
|
/// <summary>
|
|
/// 总完成判定次数。
|
|
/// </summary>
|
|
public int TotalCompletions { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功完成次数。
|
|
/// </summary>
|
|
public int SuccessfulCompletions { get; init; }
|
|
|
|
/// <summary>
|
|
/// 失败完成次数。
|
|
/// </summary>
|
|
public int FailedCompletions { get; init; }
|
|
|
|
/// <summary>
|
|
/// 总体完成率。
|
|
/// </summary>
|
|
public double OverallCompletionRate => TotalCompletions > 0 ? (double)SuccessfulCompletions / TotalCompletions * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 按完成类型分组的统计。
|
|
/// </summary>
|
|
public Dictionary<LayerCompletionType, CompletionTypeStatistics> ByCompletionType { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// 按产品类型分组的统计。
|
|
/// </summary>
|
|
public Dictionary<string, ProductTypeCompletionStatistics> ByProductType { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// 按层级分组的统计。
|
|
/// </summary>
|
|
public Dictionary<int, LayerCompletionStatisticsByLayer> ByLayer { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// 统计开始时间。
|
|
/// </summary>
|
|
public DateTime StartTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 统计结束时间。
|
|
/// </summary>
|
|
public DateTime EndTimeUtc { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 完成类型统计。
|
|
/// </summary>
|
|
public sealed class CompletionTypeStatistics
|
|
{
|
|
/// <summary>
|
|
/// 完成类型。
|
|
/// </summary>
|
|
public LayerCompletionType CompletionType { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定次数。
|
|
/// </summary>
|
|
public int JudgmentCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功次数。
|
|
/// </summary>
|
|
public int SuccessCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功率。
|
|
/// </summary>
|
|
public double SuccessRate => JudgmentCount > 0 ? (double)SuccessCount / JudgmentCount * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 平均耗时(毫秒)。
|
|
/// </summary>
|
|
public double AverageElapsedMs { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 产品类型完成统计。
|
|
/// </summary>
|
|
public sealed class ProductTypeCompletionStatistics
|
|
{
|
|
/// <summary>
|
|
/// 产品类型编码。
|
|
/// </summary>
|
|
public string ProductTypeCode { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 判定次数。
|
|
/// </summary>
|
|
public int JudgmentCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功次数。
|
|
/// </summary>
|
|
public int SuccessCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功率。
|
|
/// </summary>
|
|
public double SuccessRate => JudgmentCount > 0 ? (double)SuccessCount / JudgmentCount * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 平均完成度。
|
|
/// </summary>
|
|
public double AverageCompletionPercentage { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按层级分组的完成统计。
|
|
/// </summary>
|
|
public sealed class LayerCompletionStatisticsByLayer
|
|
{
|
|
/// <summary>
|
|
/// 层级编号。
|
|
/// </summary>
|
|
public int LayerNumber { get; init; }
|
|
|
|
/// <summary>
|
|
/// 判定次数。
|
|
/// </summary>
|
|
public int JudgmentCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功次数。
|
|
/// </summary>
|
|
public int SuccessCount { get; init; }
|
|
|
|
/// <summary>
|
|
/// 成功率。
|
|
/// </summary>
|
|
public double SuccessRate => JudgmentCount > 0 ? (double)SuccessCount / JudgmentCount * 100 : 0.0;
|
|
|
|
/// <summary>
|
|
/// 平均完成度。
|
|
/// </summary>
|
|
public double AverageCompletionPercentage { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 层级完成规则。
|
|
/// </summary>
|
|
public sealed class LayerCompletionRule
|
|
{
|
|
/// <summary>
|
|
/// 规则ID。
|
|
/// </summary>
|
|
public Guid RuleId { get; init; }
|
|
|
|
/// <summary>
|
|
/// 规则名称。
|
|
/// </summary>
|
|
public string RuleName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 规则描述。
|
|
/// </summary>
|
|
public string RuleDescription { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 产品类型编码。
|
|
/// </summary>
|
|
public string ProductTypeCode { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 层级编号。
|
|
/// </summary>
|
|
public int LayerNumber { get; init; }
|
|
|
|
/// <summary>
|
|
/// 完成类型。
|
|
/// </summary>
|
|
public LayerCompletionType CompletionType { get; init; }
|
|
|
|
/// <summary>
|
|
/// 硬条件列表。
|
|
/// </summary>
|
|
public IReadOnlyList<HardCondition> HardConditions { get; init; } = Array.Empty<HardCondition>();
|
|
|
|
/// <summary>
|
|
/// 是否启用。
|
|
/// </summary>
|
|
public bool IsEnabled { get; init; } = true;
|
|
|
|
/// <summary>
|
|
/// 优先级。
|
|
/// </summary>
|
|
public int Priority { get; init; } = 1;
|
|
|
|
/// <summary>
|
|
/// 创建时间。
|
|
/// </summary>
|
|
public DateTime CreatedAtUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 更新时间。
|
|
/// </summary>
|
|
public DateTime UpdatedAtUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 版本号。
|
|
/// </summary>
|
|
public string Version { get; init; } = "1.0";
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 硬条件。
|
|
/// </summary>
|
|
public sealed class HardCondition
|
|
{
|
|
/// <summary>
|
|
/// 条件ID。
|
|
/// </summary>
|
|
public Guid ConditionId { get; init; }
|
|
|
|
/// <summary>
|
|
/// 条件名称。
|
|
/// </summary>
|
|
public string ConditionName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 条件类型。
|
|
/// </summary>
|
|
public HardConditionType ConditionType { get; init; }
|
|
|
|
/// <summary>
|
|
/// 是否为必须满足的硬条件。
|
|
/// </summary>
|
|
public bool IsMandatory { get; init; } = true;
|
|
|
|
/// <summary>
|
|
/// 条件权重。
|
|
/// </summary>
|
|
public double Weight { get; init; } = 1.0;
|
|
|
|
/// <summary>
|
|
/// 条件阈值。
|
|
/// </summary>
|
|
public double Threshold { get; init; }
|
|
|
|
/// <summary>
|
|
/// 条件描述。
|
|
/// </summary>
|
|
public string? Description { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 必装部件。
|
|
/// </summary>
|
|
public sealed class RequiredPart
|
|
{
|
|
/// <summary>
|
|
/// 部件ID。
|
|
/// </summary>
|
|
public Guid PartId { get; init; }
|
|
|
|
/// <summary>
|
|
/// 部件编码。
|
|
/// </summary>
|
|
public string PartCode { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 部件类型。
|
|
/// </summary>
|
|
public PartType PartType { get; init; }
|
|
|
|
/// <summary>
|
|
/// 部件名称。
|
|
/// </summary>
|
|
public string PartName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 必装数量。
|
|
/// </summary>
|
|
public int RequiredQuantity { get; init; } = 1;
|
|
|
|
/// <summary>
|
|
/// 部件权重。
|
|
/// </summary>
|
|
public double Weight { get; init; } = 1.0;
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关键部件。
|
|
/// </summary>
|
|
public sealed class CriticalPart
|
|
{
|
|
/// <summary>
|
|
/// 部件ID。
|
|
/// </summary>
|
|
public Guid PartId { get; init; }
|
|
|
|
/// <summary>
|
|
/// 部件编码。
|
|
/// </summary>
|
|
public string PartCode { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 部件类型。
|
|
/// </summary>
|
|
public PartType PartType { get; init; }
|
|
|
|
/// <summary>
|
|
/// 部件名称。
|
|
/// </summary>
|
|
public string PartName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 关键程度。
|
|
/// </summary>
|
|
public CriticalityLevel CriticalityLevel { get; init; }
|
|
|
|
/// <summary>
|
|
/// 必装数量。
|
|
/// </summary>
|
|
public int RequiredQuantity { get; init; } = 1;
|
|
|
|
/// <summary>
|
|
/// 部件权重。
|
|
/// </summary>
|
|
public double Weight { get; init; } = 1.0;
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 禁装部件。
|
|
/// </summary>
|
|
public sealed class ForbiddenPart
|
|
{
|
|
/// <summary>
|
|
/// 部件ID。
|
|
/// </summary>
|
|
public Guid PartId { get; init; }
|
|
|
|
/// <summary>
|
|
/// 部件编码。
|
|
/// </summary>
|
|
public string PartCode { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 部件类型。
|
|
/// </summary>
|
|
public PartType PartType { get; init; }
|
|
|
|
/// <summary>
|
|
/// 部件名称。
|
|
/// </summary>
|
|
public string PartName { get; init; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 违规严重程度。
|
|
/// </summary>
|
|
public ViolationSeverity ViolationSeverity { get; init; }
|
|
|
|
/// <summary>
|
|
/// 禁装原因。
|
|
/// </summary>
|
|
public string? ForbiddenReason { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 禁装部件违规。
|
|
/// </summary>
|
|
public sealed class ForbiddenPartViolation
|
|
{
|
|
/// <summary>
|
|
/// 违规部件信息。
|
|
/// </summary>
|
|
public MappedPart ViolatingPart { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// 禁装部件定义。
|
|
/// </summary>
|
|
public ForbiddenPart ForbiddenPart { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// 违规严重程度。
|
|
/// </summary>
|
|
public ViolationSeverity ViolationSeverity { get; init; }
|
|
|
|
/// <summary>
|
|
/// 违规时间。
|
|
/// </summary>
|
|
public DateTime ViolationTimeUtc { get; init; }
|
|
|
|
/// <summary>
|
|
/// 违规描述。
|
|
/// </summary>
|
|
public string? ViolationDescription { get; init; }
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 稳定性要求。
|
|
/// </summary>
|
|
public sealed class StabilityRequirements
|
|
{
|
|
/// <summary>
|
|
/// 稳定性阈值。
|
|
/// </summary>
|
|
public double StabilityThreshold { get; init; } = 0.8;
|
|
|
|
/// <summary>
|
|
/// 最小稳定帧数。
|
|
/// </summary>
|
|
public int MinimumStableFrames { get; init; } = 10;
|
|
|
|
/// <summary>
|
|
/// 位置变化阈值。
|
|
/// </summary>
|
|
public double PositionChangeThreshold { get; init; } = 5.0;
|
|
|
|
/// <summary>
|
|
/// 面积变化阈值。
|
|
/// </summary>
|
|
public double AreaChangeThreshold { get; init; } = 0.1;
|
|
|
|
/// <summary>
|
|
/// 置信度变化阈值。
|
|
/// </summary>
|
|
public double ConfidenceChangeThreshold { get; init; } = 0.1;
|
|
|
|
/// <summary>
|
|
/// 扩展属性。
|
|
/// </summary>
|
|
public Dictionary<string, object> ExtendedProperties { get; init; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 层级完成类型枚举。
|
|
/// </summary>
|
|
public enum LayerCompletionType
|
|
{
|
|
/// <summary>
|
|
/// 必装部件完成。
|
|
/// </summary>
|
|
RequiredParts = 0,
|
|
|
|
/// <summary>
|
|
/// 关键部件完成。
|
|
/// </summary>
|
|
CriticalParts = 1,
|
|
|
|
/// <summary>
|
|
/// 稳定性完成。
|
|
/// </summary>
|
|
Stability = 2,
|
|
|
|
/// <summary>
|
|
/// 禁装检查。
|
|
/// </summary>
|
|
ForbiddenCheck = 3,
|
|
|
|
/// <summary>
|
|
/// 综合完成。
|
|
/// </summary>
|
|
Comprehensive = 4
|
|
}
|
|
|
|
/// <summary>
|
|
/// 硬条件类型枚举。
|
|
/// </summary>
|
|
public enum HardConditionType
|
|
{
|
|
/// <summary>
|
|
/// 必装部件条件。
|
|
/// </summary>
|
|
RequiredParts = 0,
|
|
|
|
/// <summary>
|
|
/// 关键部件条件。
|
|
/// </summary>
|
|
CriticalParts = 1,
|
|
|
|
/// <summary>
|
|
/// 稳定性条件。
|
|
/// </summary>
|
|
Stability = 2,
|
|
|
|
/// <summary>
|
|
/// 禁装检查条件。
|
|
/// </summary>
|
|
ForbiddenCheck = 3
|
|
}
|
|
|
|
/// <summary>
|
|
/// 完成质量枚举。
|
|
/// </summary>
|
|
public enum CompletionQuality
|
|
{
|
|
/// <summary>
|
|
/// 优秀。
|
|
/// </summary>
|
|
Excellent = 0,
|
|
|
|
/// <summary>
|
|
/// 良好。
|
|
/// </summary>
|
|
Good = 1,
|
|
|
|
/// <summary>
|
|
/// 一般。
|
|
/// </summary>
|
|
Fair = 2,
|
|
|
|
/// <summary>
|
|
/// 较差。
|
|
/// </summary>
|
|
Poor = 3
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关键程度枚举。
|
|
/// </summary>
|
|
public enum CriticalityLevel
|
|
{
|
|
/// <summary>
|
|
/// 一般关键。
|
|
/// </summary>
|
|
Normal = 0,
|
|
|
|
/// <summary>
|
|
/// 重要关键。
|
|
/// </summary>
|
|
Important = 1,
|
|
|
|
/// <summary>
|
|
/// 严重关键。
|
|
/// </summary>
|
|
Critical = 2
|
|
}
|
|
|
|
/// <summary>
|
|
/// 违规严重程度枚举。
|
|
/// </summary>
|
|
public enum ViolationSeverity
|
|
{
|
|
/// <summary>
|
|
/// 轻微违规。
|
|
/// </summary>
|
|
Minor = 0,
|
|
|
|
/// <summary>
|
|
/// 一般违规。
|
|
/// </summary>
|
|
Normal = 1,
|
|
|
|
/// <summary>
|
|
/// 严重违规。
|
|
/// </summary>
|
|
Serious = 2,
|
|
|
|
/// <summary>
|
|
/// 致命违规。
|
|
/// </summary>
|
|
Fatal = 3
|
|
}
|