using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace MilitaryTrainingManagement.Models.Entities;
///
/// 消耗上报记录
///
public class ConsumptionReport
{
[Key]
public int Id { get; set; }
///
/// 配额分配ID
///
[Required]
public int AllocationDistributionId { get; set; }
///
/// 配额分配
///
[ForeignKey(nameof(AllocationDistributionId))]
public AllocationDistribution AllocationDistribution { get; set; } = null!;
///
/// 配额分配(别名,用于兼容)
///
[NotMapped]
public AllocationDistribution Distribution => AllocationDistribution;
///
/// 本次上报数量
///
[Required]
[Column(TypeName = "decimal(18,2)")]
public decimal ReportedAmount { get; set; }
///
/// 上报后累计数量
///
[Required]
[Column(TypeName = "decimal(18,2)")]
public decimal CumulativeAmount { get; set; }
///
/// 备注
///
[MaxLength(500)]
public string? Remarks { get; set; }
///
/// 上报人ID
///
[Required]
public int ReportedByUserId { get; set; }
///
/// 上报人
///
[ForeignKey(nameof(ReportedByUserId))]
public UserAccount ReportedByUser { get; set; } = null!;
///
/// 上报单位ID
///
[Required]
public int ReportedByUnitId { get; set; }
///
/// 上报单位
///
[ForeignKey(nameof(ReportedByUnitId))]
public OrganizationalUnit ReportedByUnit { get; set; } = null!;
///
/// 上报时间
///
[Required]
public DateTime ReportedAt { get; set; }
}