using MadRunFabric.Common;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace MadRunFabric.Model
{
    /// <summary>
    /// 设备运行工单
    /// </summary>
    [BsonIgnoreExtraElements]
    public class Wo_EquipmentRunning : IBaseModel<string>
    {
        /// <summary>
        /// id
        /// </summary>
        [Key]
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string id { get; set; }
        /// <summary>
        /// 工单编号
        /// </summary>
        public string wocode { get; set; } = "";
        public string wodate { get; set; } = "";
        /// <summary>
        /// 项目名称id
        /// </summary>
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string projectid { get; set; }
        /// <summary>
        /// 检查事项
        /// </summary>
        public string[] matterids { get; set; }
        ///// <summary>
        ///// 系统名称id
        ///// </summary>
        //[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        //public string systemid { get; set; }
        ///// <summary>
        ///// 设备名称id
        ///// </summary>
        //public string[] equipmentid { get; set; }
        /// <summary>
        /// 巡检计划id
        /// </summary>
        [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        public string planid { get; set; }
        /// <summary>
        /// 上次巡检时间
        /// </summary>
        public DateTime lastchecktime { get; set; }
        /// <summary>
        /// 上次巡检结果 1正常，0异常
        /// </summary>
        public int lastcheckresultid { get; set; } = 1;

        /// <summary>
        /// 工单开始时间
        /// </summary>
        public DateTime starttime { get; set; }
        /// <summary>
        /// 工单结束时间
        /// </summary>
        public DateTime endtime { get; set; }
        /// <summary>
        /// 工单名称
        /// </summary>
        public string woname { get; set; }
        /// <summary>
        /// 工单内容
        /// </summary>
        public string wocontent { get; set; }
        /// <summary>
        /// 任务状态:0创建工单，1已转派，3已处理，6挂起 
        /// </summary>
        public int wostate { get; set; } = 0;
        /// <summary>
        /// 提交人 usercode
        /// </summary>
        public string createby { get; set; } = "";
        /// <summary>
        /// 提交时间
        /// </summary>
        public DateTime createtime { get; set; }
        /// <summary>
        /// 是否删除(0正常，-1删除)
        /// </summary>
        public int isdelete { get; set; } = 0;
        /// <summary>
        /// 删除人工号
        /// </summary>
        public string deleteby { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        public DateTime deletetime { get; set; }

        #region 处理信息
        /// <summary>
        /// 巡检人 usercode
        /// </summary>
        public string checkby { get; set; } = "";
        /// <summary>
        /// 设备状态 1正常，0异常
        /// </summary> 
        public int quipmenttype { get; set; } = 1;
        /// <summary>
        /// 异常说明
        /// </summary>
        public string checkcontent { get; set; } = "";
        /// <summary>
        /// 巡检图片
        /// </summary>
        public List<FileBaseModel> checkpic { get; set; } = null;
        /// <summary>
        /// 扩展字段 - 自定义
        /// </summary>
        public List<ExtensionFileModel> extensionlist { get; set; } = null;
        
        /// <summary>
        /// 处理提交时间
        /// </summary>
        public DateTime dealtime { get; set; }
        /// <summary>
        /// 处理人 usercode
        /// </summary>
        public string dealby { get; set; } = "";
        #endregion
        /// <summary>
        /// 工单完成是否返回消息提醒 0不提醒，1提醒
        /// </summary>
        public int isreturnmsg { get; set; } = 0;
        #region
        ///// <summary>
        ///// 系统名称id
        ///// </summary>
        //[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        //public string sysnameid { get; set; }
        ///// <summary>
        ///// 设备名称id
        ///// </summary>
        //[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        //public string equipmentid { get; set; }
        ///// <summary>
        ///// 巡检计划id
        ///// </summary>
        //[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
        //public string planid { get; set; }
        ///// <summary>
        ///// 上次巡检时间
        ///// </summary>
        //public DateTime lastchecktime { get; set; }
        ///// <summary>
        ///// 本次巡检时间
        ///// </summary>
        //public DateTime thischeckime { get; set; }
        ///// <summary>
        ///// 到期时间
        ///// 计算超时需要使用
        ///// </summary>
        //public DateTime expirytime { get; set; }
        ///// <summary>
        ///// 提前展示时长（分钟）
        ///// </summary>
        //public int advancelong { get; set; } = 0;
        ///// <summary>
        ///// 提前展示时间
        ///// </summary>
        //public DateTime advancetime { get; set; }

        ///// <summary>
        ///// 上次巡检结果 1正常，0异常
        ///// </summary>
        //public int lastcheckresultid { get; set; } = 1;
        ///// <summary>
        ///// 异常说明
        ///// </summary>
        //public string abnormalcontent { get; set; } = "";
        ///// <summary>
        ///// 提交人 usercode
        ///// </summary>
        //public string createby { get; set; } = "";
        ///// <summary>
        ///// 提交时间
        ///// </summary>
        //public DateTime createtime { get; set; }
        ///// <summary>
        ///// 是否删除(0正常，-1删除)
        ///// </summary>
        //public int isdelete { get; set; } = 0;
        ///// <summary>
        ///// 删除人工号
        ///// </summary>
        //public string deleteby { get; set; }
        ///// <summary>
        ///// 删除时间
        ///// </summary>
        //public DateTime deletetime { get; set; }

        //#region 处理信息
        ///// <summary>
        ///// 巡检人 usercode
        ///// </summary>
        //public string checkby { get; set; } = "";
        ///// <summary>
        ///// 设备状态 1正常，0异常
        ///// </summary> 
        //public int quipmenttype { get; set; } = 1;
        ///// <summary>
        ///// 异常说明
        ///// </summary>
        //public string checkcontent { get; set; } = "";
        ///// <summary>
        ///// 巡检图片
        ///// </summary>
        //public List<FileBaseModel> checkpic { get; set; } = null;
        /////// <summary>
        /////// 变压器BT1温度℃ A  
        /////// </summary>
        ////public string temperature_a { get; set; }
        /////// <summary>
        /////// 变压器BT1温度℃ B  
        /////// </summary>
        ////public string temperature_b { get; set; }
        /////// <summary>
        /////// 变压器BT1温度℃ C  
        /////// </summary>
        ////public string temperature_c { get; set; }
        /////// <summary>
        /////// 进线柜 电流A  A  
        /////// </summary>
        ////public string electric_a  { get; set; }
        /////// <summary>
        /////// 进线柜 电流A  B 
        /////// </summary>
        ////public string electric_b { get; set; }
        /////// <summary>
        /////// 进线柜 电流A  C  
        /////// </summary>
        ////public string electric_c { get; set; }
        /////// <summary>
        /////// 无功补偿 电流A A  
        /////// </summary>
        ////public string compensationelectric_a { get; set; }
        /////// <summary>
        /////// 无功补偿 电流A  B 
        /////// </summary>
        ////public string compensationelectric_b { get; set; }
        /////// <summary>
        /////// 无功补偿 电流A  C  
        /////// </summary>
        ////public string compensationelectric_c { get; set; }
        /////// <summary>
        /////// 无功补偿 COS  
        /////// </summary>
        ////public string compensationelectriccos_c { get; set; }
        /////// <summary>
        /////// 自定义1
        /////// </summary>
        ////public string customize1 { get; set; }
        /////// <summary>
        /////// 自定义2
        /////// </summary>
        ////public string customize2 { get; set; }
        ///// <summary>
        ///// 扩展字段 - 自定义
        ///// </summary>
        //public List<ExtensionModel> extensionlist { get; set; } = null;
        ///// <summary>
        ///// 任务状态:0创建工单，1已转派，3已处理，6挂起 
        ///// </summary>
        //public int wostate { get; set; } = 0;
        ///// <summary>
        ///// 处理提交时间
        ///// </summary>
        //public DateTime dealtime { get; set; }
        ///// <summary>
        ///// 处理人 usercode
        ///// </summary>
        //public string dealby { get; set; } = "";
        //#endregion
        #endregion
    }


    /// <summary>
    /// 设备运行工单状态 - //0创建工单，1已转派，2抢单，3已处理，6挂起
    /// </summary>
    public enum EnumEquipmentRunningState
    {
        create = 0,
        assign = 1,
        grab = 2,//抢单
        deal = 3,
        hangup = 6
    }
    /// <summary>
    /// 保养工单设备状态：1正常，0异常
    /// </summary>
    public enum EnumWoREquipmentState
    {
        normal = 1,//正常
        abnormal = 0//异常
    }
}
