namespace OrpaonVision.Core.Production.Contracts; /// /// 生产统计详情。 /// public sealed class ProductionStatisticsDto { /// /// 统计时间范围开始(UTC)。 /// public DateTime StartTimeUtc { get; init; } /// /// 统计时间范围结束(UTC)。 /// public DateTime EndTimeUtc { get; init; } /// /// 工位ID。 /// public Guid? WorkstationId { get; init; } /// /// 工位名称。 /// public string WorkstationName { get; init; } = string.Empty; /// /// 班次。 /// public string Shift { get; init; } = string.Empty; /// /// 总产品数量。 /// public long TotalProducts { get; init; } /// /// OK产品数量。 /// public long OkProducts { get; init; } /// /// NG产品数量。 /// public long NgProducts { get; init; } /// /// 良率。 /// public decimal YieldRate { get; init; } /// /// 平均节拍(秒)。 /// public decimal AverageCycleTimeSeconds { get; init; } /// /// 最快节拍(秒)。 /// public decimal FastestCycleTimeSeconds { get; init; } /// /// 最慢节拍(秒)。 /// public decimal SlowestCycleTimeSeconds { get; init; } /// /// 按机种分组的统计。 /// public IReadOnlyList ProductTypeStatistics { get; init; } = []; /// /// 按NG类型分组的统计。 /// public IReadOnlyList NgTypeStatistics { get; init; } = []; /// /// 按层级分组的统计。 /// public IReadOnlyList LayerStatistics { get; init; } = []; /// /// 按小时分组的统计。 /// public IReadOnlyList HourlyStatistics { get; init; } = []; /// /// 操作员统计。 /// public IReadOnlyList OperatorStatistics { get; init; } = []; } /// /// 机种统计。 /// public sealed class ProductTypeStatisticsDto { /// /// 机种ID。 /// public Guid ProductTypeId { get; init; } /// /// 机种编码。 /// public string ProductTypeCode { get; init; } = string.Empty; /// /// 机种名称。 /// public string ProductTypeName { get; init; } = string.Empty; /// /// 产品数量。 /// public long Count { get; init; } /// /// OK数量。 /// public long OkCount { get; init; } /// /// NG数量。 /// public long NgCount { get; init; } /// /// 良率。 /// public decimal YieldRate { get; init; } /// /// 平均节拍(秒)。 /// public decimal AverageCycleTimeSeconds { get; init; } } /// /// NG类型统计。 /// public sealed class NgTypeStatisticsDto { /// /// NG类型。 /// public string NgType { get; init; } = string.Empty; /// /// NG类型描述。 /// public string NgTypeDescription { get; init; } = string.Empty; /// /// NG数量。 /// public long Count { get; init; } /// /// 占比。 /// public decimal Percentage { get; init; } /// /// 主要发生的层级。 /// public string MainLayer { get; init; } = string.Empty; } /// /// 层级统计。 /// public sealed class LayerStatisticsDto { /// /// 层级ID。 /// public Guid LayerId { get; init; } /// /// 层级名称。 /// public string LayerName { get; init; } = string.Empty; /// /// 层级序号。 /// public int LayerSequence { get; init; } /// /// 检测次数。 /// public long DetectionCount { get; init; } /// /// NG次数。 /// public long NgCount { get; init; } /// /// NG率。 /// public decimal NgRate { get; init; } /// /// 平均检测时间(毫秒)。 /// public decimal AverageDetectionTimeMs { get; init; } } /// /// 每小时生产统计。 /// public sealed class HourlyProductionDto { /// /// 小时(0-23)。 /// public int Hour { get; init; } /// /// 产品数量。 /// public long ProductCount { get; init; } /// /// OK数量。 /// public long OkCount { get; init; } /// /// NG数量。 /// public long NgCount { get; init; } /// /// 良率。 /// public decimal YieldRate { get; init; } /// /// 平均节拍(秒)。 /// public decimal AverageCycleTimeSeconds { get; init; } } /// /// 操作员统计。 /// public sealed class OperatorStatisticsDto { /// /// 操作员ID。 /// public Guid OperatorId { get; init; } /// /// 操作员姓名。 /// public string OperatorName { get; init; } = string.Empty; /// /// 班次。 /// public string Shift { get; init; } = string.Empty; /// /// 产品数量。 /// public long ProductCount { get; init; } /// /// OK数量。 /// public long OkCount { get; init; } /// /// NG数量。 /// public long NgCount { get; init; } /// /// 良率。 /// public decimal YieldRate { get; init; } /// /// 平均节拍(秒)。 /// public decimal AverageCycleTimeSeconds { get; init; } /// /// 工作时长(小时)。 /// public decimal WorkingHours { get; init; } }