// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;

namespace PVDEMCS.Services.Models;

/// <summary>
/// 设备状态记录明显
/// </summary>
public partial class EquipmentRecord
{
    public string Id { get; set; }

    /// <summary>
    /// 设备ID
    /// </summary>
    public string EquipmentId { get; set; }

    /// <summary>
    /// 设备编码
    /// </summary>
    public string EquipmentCode { get; set; }

    /// <summary>
    /// 设备名称
    /// </summary>
    public string EquipmentName { get; set; }

    /// <summary>
    /// 设备类型：Ionbond，Balzers，Cemecon
    /// </summary>
    public string EquipmentType { get; set; }

    /// <summary>
    /// 设备状态,运行:Run，待机:Stop，报警:Alarm
    /// </summary>
    public string State { get; set; }

    /// <summary>
    /// 设备编码
    /// </summary>
    public DateTime StartTime { get; set; }

    /// <summary>
    /// 设备名称
    /// </summary>
    public DateTime EndTime { get; set; }

    /// <summary>
    /// 累计时长（分钟）
    /// </summary>
    public decimal TimeTotal 
    {
        get 
        {
            var val = (EndTime - StartTime).TotalMinutes;
            if (val > 0) 
            {
                return Math.Round(Convert.ToDecimal(val),2);
            }

            return 0;
        }
    }


}