using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels.Task;
using WCS.DAL.DbModels;

namespace WCS.BLL.DbModels
{
    /// <summary>
    /// 已完成已提交的历史任务
    /// </summary>
    [SugarTable("wcs_uploaded_task")]
    public class UploadededTask
    {
        /// <summary>
        /// 主键 自增Id
        /// </summary>
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
        public int Id { get; set; }

        #region 库位属性
        /// <summary>
        /// 入库的库位表ID
        /// </summary>
        [SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
        public int StoreId { get; set; }

        /// <summary>
        /// 入库的库位编码
        /// </summary>
        [SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
        public string StoreCode { get; set; }

        [Navigate(NavigateType.OneToOne, nameof(StoreId))]
        public StoreInfo StoreInfo { get; set; }
        #endregion

        #region 任务属性
        /// <summary>
        /// 任务Id 
        /// </summary>
        [SugarColumn(ColumnName = "task_id", IsNullable = false, ColumnDescription = "任务Id，同一个库位只支持1-7")]
        public int TaskID { get; set; }

        /// <summary>
        /// Guid
        /// </summary>           
        [SugarColumn(ColumnName = "guid", IsNullable = false, ColumnDescription = "Guid 系统那边任务的唯一ID")]
        public Guid Guid { get; set; }

        /// <summary>
        /// 任务模式：入库模式 = 0, 出库模式 = 1, 盘点模式 = 2
        /// </summary>
        [SugarColumn(ColumnName = "task_mode", IsNullable = false, ColumnDescription = "任务模式：入库模式 = 0, 出库模式 = 1, 盘点模式 = 2")]
        public TaskModeEnum TaskMode { get; set; }

        /// <summary>
        /// 出库单据号
        /// </summary>           
        [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
        public string OrderNumber { get; set; }

        /// <summary>
        /// 按钮颜色
        /// </summary>
        [SugarColumn(ColumnName = "button_color", IsNullable = false, ColumnDescription = "按钮颜色 红色 = 1, 绿色 = 2, 黄色 = 3, 蓝色 = 4, 紫色 = 5, 青色 = 6, 白色 = 7,")]
        public ButtonColorEnum ButtonColor { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        [SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
        public string MatCode { get; set; }
        /// <summary>
        /// 物料名称
        /// </summary>           
        [SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
        public string MatName { get; set; }

        /// <summary>
        /// 物料规格
        /// </summary>           
        [SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
        public string MatSpec { get; set; }

        /// <summary>
        /// 物料批次
        /// </summary>           
        [SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
        public string MatBatch { get; set; }

        /// <summary>
        /// 物料数量 
        /// </summary>
        [SugarColumn(ColumnName = "qty", IsNullable = false, ColumnDescription = "目标数量")]
        public int Qty { get; set; }

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

        /// <summary>
        /// 创建人
        /// </summary>           
        [SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
        public string CreateUser { get; set; } = string.Empty;

        /// <summary>
        /// 完成时物料数量 
        /// </summary>
        [SugarColumn(ColumnName = "finish_qty", IsNullable = false, ColumnDescription = "完成数量")]
        public int FinishQty { get; set; } = 0;
        /// <summary>
        /// 完成时间
        /// </summary>           
        [SugarColumn(ColumnName = "finish_time", IsNullable = false, ColumnDescription = "完成时间")]
        public DateTime FinishTime { get; set; } = DateTime.Now;
        #endregion
    }
}
