using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.HardWare;

namespace WCS.DAL.DbModels
{
    [SugarTable("wcs_shelf_info")]
    public class ShelfInfo
    {
        /// <summary>
        /// 主键 自增Id
        /// </summary>
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 货架类型Id
        /// </summary>
        [SugarColumn(ColumnName = "shelf_type_id", IsNullable = true, ColumnDescription = "货架类型Id")]
        public int ShelfTypeId { get; set; }

        /// <summary>
        /// 货架类型
        /// </summary>
        [SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
        public string ShelfTypeName { get; set; }

        /// <summary>
        /// 货架编码 对应二维码
        /// </summary>       
        [SugarColumn(ColumnName = "shelf_code", Length = 64, IsNullable = false, ColumnDescription = "货架编码")]
        public string ShelfCode { get; set; }

        /// <summary>
        /// 货架状态 货架当前的状态空货架/非空货架
        /// </summary>
        [SugarColumn(ColumnName = "shelf_status", IsNullable = true, ColumnDescription = "货架状态")]
        public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.空货架;

        ///// <summary>
        ///// 货架区域
        ///// </summary>
        //[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
        //public string ShelfArea { get; set; }

        /// <summary>
        /// 货架尺寸
        /// </summary>
        [SugarColumn(ColumnName = "shelf_size", Length = 256, IsNullable = true, ColumnDescription = "货架尺寸")]
        public string ShelfSize { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(ColumnName = "remark", Length = 128, IsNullable = true, ColumnDescription = "备注")]
        public string Remark { get; set; }

        #region 当前位置信息
        /// <summary>
        /// 当前位置ID
        /// </summary>
        [SugarColumn(ColumnName = "current_location_id", IsNullable = false, ColumnDescription = "当前位置ID")]
        public int CurrentLocationId { get; set; } = 0;

        /// <summary>
        /// 当前位置编码
        /// </summary>
        [SugarColumn(ColumnName = "current_location_code", Length = 64, IsNullable = false, ColumnDescription = "当前位置编码")]
        public string CurrentLocaiotnCode { get; set; } = string.Empty;

        /// <summary>
        /// 目的地位置Id
        /// </summary>
        [SugarColumn(ColumnName = "destination_location_id", IsNullable = false, ColumnDescription = "当前位置ID")]
        public int DestinationLocationId { get; set; } = 0;

        /// <summary>
        /// 目的地位置物料编码
        /// </summary>
        [SugarColumn(ColumnName = "destination_location_code", Length = 64, IsNullable = false, ColumnDescription = "当前位置编码")]
        public string DestinationLocaiotnCode { get; set; } = string.Empty;


        [SugarColumn(ColumnName = "current_task_code", Length = 100, IsNullable = true, ColumnDescription = "当前执行的任务码")]
        public string CurrentTaskCode { get; set; } = string.Empty;

        /// <summary>
        /// 货架运输状态
        /// </summary>
        [SugarColumn(ColumnName = "trans_status", IsNullable = false, ColumnDescription = "货架运输状态")]
        public TransStatusEnum TransStatus { get; set; } = TransStatusEnum.静止;
        #endregion

        /// <summary>
        /// 更新人
        /// </summary>           
        [SugarColumn(ColumnName = "modify_user", Length = 128, IsNullable = true, ColumnDescription = "更新人")]
        public string ModifyUser { get; set; }

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

        /// <summary>
        /// 是否启用
        /// </summary>
        [SugarColumn(ColumnName = "is_enable", IsNullable = false, ColumnDescription = "是否启用")]
        public bool IsEnable { get; set; } = true;

        [SugarColumn(IsIgnore = true)]
        public string IsEnableStr
        {
            get
            {
                if (IsEnable)
                    return "启用";
                else
                    return "禁用";
            }
        }

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

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

    /// <summary>
    /// 货架绑定物料的状态
    /// </summary>
    public enum ShelfStatusEnum
    {
        空货架 = 0,
        非空货架 = 1,
    }

    /// <summary>
    /// 货架运输状态
    /// </summary>
    public enum TransStatusEnum
    {
        静止 = 0,
        运输中 = 1
    }
}
