using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.DAL.DbModels;
using WCS.Model.ApiModel.AGV;

namespace WCS.BLL.DbModels
{
    /// <summary>
    /// 当前库存存量表
    /// </summary>
    [SugarTable("wcs_agv_task")]
    public class AgvTask
    {
        /// <summary>
        /// 主键 自增Id
        /// </summary>
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
        public int Id { get; set; }

        #region 任务属性

        [SugarColumn(ColumnName = "request_code", Length = 64, IsNullable = false, ColumnDescription = "请求任务时的请求号 需要保证唯一性")]
        public string RequestCode { get; set; }

        [SugarColumn(ColumnName = "task_code", Length = 64, IsNullable = false, ColumnDescription = "请求任务时的任务号 需要保证唯一性")]
        public string TaskCode { get; set; }

        /// <summary>
        /// 任务类型
        /// </summary>       
        [SugarColumn(ColumnName = "task_type", Length = 64, IsNullable = false, ColumnDescription = "任务类型")]
        public string TaskType { get; set; } = string.Empty;

        /// <summary>
        /// 起点位置ID
        /// </summary>
        [SugarColumn(ColumnName = "start_location_id", IsNullable = true, ColumnDescription = "起点位置ID")]
        public int StratLocationId { get; set; } = 0;
        /// <summary>
        /// 起点位置编码
        /// </summary>       
        [SugarColumn(ColumnName = "start_location_code", Length = 64, IsNullable = true, ColumnDescription = "起点位置编码")]
        public string StartLocationCode { get; set; } = string.Empty;

        /// <summary>
        /// 终点位置ID
        /// </summary>
        [SugarColumn(ColumnName = "end_location_id", IsNullable = true, ColumnDescription = "终点位置ID")]
        public int EndLocationId { get; set; } = 0;
        /// <summary>
        /// 终点位置编码
        /// </summary>
        [SugarColumn(ColumnName = "end_location_code", Length = 64, IsNullable = true, ColumnDescription = "终点位置编码")]
        public string EndLocationCode { get; set; } = string.Empty;


        /// <summary>
        /// 货架码
        /// </summary>
        [SugarColumn(ColumnName = "shelf_Code", Length = 64, IsNullable = true, ColumnDescription = "AGV编号")]
        public string ShelfCode { get; set; } = string.Empty;

        /// <summary>
        /// AGV编号
        /// </summary>
        [SugarColumn(ColumnName = "agv_code", Length = 64, IsNullable = true, ColumnDescription = "AGV编号")]
        public string AgvCode { get; set; } = string.Empty;

        /// <summary>
        /// AGV编号
        /// </summary>
        [SugarColumn(ColumnName = "agv_status", Length = 80, IsNullable = true, ColumnDescription = "AGV状态")]
        public string AgvStatus { get; set; } = string.Empty;

        /// <summary>
        /// 任务发起人
        /// </summary>           
        [SugarColumn(ColumnName = "create_user", IsNullable = true, Length = 64, ColumnDescription = "任务发起人")]
        public string? CreateUser { get; set; }

        /// <summary>
        /// 任务创建时间
        /// </summary>           
        [SugarColumn(ColumnName = "create_time", IsNullable = true, ColumnDescription = "任务创建时间")]
        public DateTime? CreateTime { get; set; } = DateTime.Now;


        /// <summary>
        /// 最后更新时间
        /// </summary>           
        [SugarColumn(ColumnName = "modify_time", IsNullable = true, ColumnDescription = "最后更新时间")]
        public DateTime? ModifyTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 任务状态
        /// </summary>           
        [SugarColumn(ColumnName = "task_status", IsNullable = true, ColumnDescription = "任务状态")]
        public TaskStatusEnum TaskStatus { get; set; } = TaskStatusEnum.已创建;
        #endregion

        /// <summary>
        /// 序号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string TaskStatusStr
        {
            get
            {
                return TaskStatus.ToString();
            }
        }

        /// <summary>
        /// 序号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int RowNumber { get; set; }

        /// <summary>
        /// 是否已经选择
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsSelected { get; set; }
    }
}
