Files
OrpaonVision/OrpaonVision.Core/Production/Contracts/ProductionStatisticsDto.cs
2026-04-06 22:04:05 +08:00

298 lines
6.5 KiB
C#
Raw Permalink Blame History

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