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

namespace WCS.BLL.DbModels
{
    /// <summary>
    /// 库存明细表
    /// </summary>
    [SugarTable("wcs_inventory_detail")]
    public class InventoryDetail
    {
        /// <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>
        /// 物料编码（SN）
        /// </summary>
        [SugarColumn(ColumnName = "mat_sn", Length = 200, IsNullable = false, ColumnDescription = "物料SN")]
        public string MatSN { 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 = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
        public int MatQty { get; set; }

        /// <summary>
        /// 物料供应商
        /// </summary>           
        [SugarColumn(ColumnName = "mat_supplier", Length = 150, IsNullable = true, ColumnDescription = "物料供应商")]
        public string? MatSupplier { get; set; }

        /// <summary>
        /// 物料客户
        /// </summary>           
        [SugarColumn(ColumnName = "mat_customer", Length = 150, IsNullable = true, ColumnDescription = "物料客户")]
        public string? MatCustomer { get; set; }
        #endregion

        /// <summary>
        /// 入库时间
        /// </summary>           
        [SugarColumn(ColumnName = "instore_time", IsNullable = false, ColumnDescription = "入库时间")]
        public DateTime InstoreTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 入库操作人
        /// </summary>           
        [SugarColumn(ColumnName = "instore_user", Length = 100, IsNullable = true, ColumnDescription = "操作员")]
        public string InstoreUser { get; set; }

        /// <summary>
        /// 物料是否已被锁定
        /// </summary>
        [SugarColumn(ColumnName = "is_locked", IsNullable = false, ColumnDescription = "物料是否已被锁定")]
        public bool IsLocked { get; set; } = false;
        /// <summary>
        /// 串联绑定后的大货架编码
        /// </summary>
        [SugarColumn(ColumnName = "big_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
        public string? BigShelfCode { get; set; } = string.Empty;
        /// <summary>
        /// Row 行
        /// </summary>
        [SugarColumn(ColumnName = "R", Length = 10, IsNullable = true, ColumnDescription = "库位 行")]
        public string R { get; set; }
        /// <summary>
        /// Column 列
        /// </summary>
        [SugarColumn(ColumnName = "C", Length = 10, IsNullable = true, ColumnDescription = "库位 列")]
        public string C { get; set; }
        /// <summary>
        /// Column 位
        /// </summary>
        [SugarColumn(ColumnName = "Wei", Length = 10, IsNullable = true, ColumnDescription = "库位 位 第几个库位灯")]
        public string Wei { get; set; }

        /// <summary>
        /// WarehouseCode 仓库代码
        /// </summary>
        [SugarColumn(ColumnName = "WarehouseCode", Length = 10, IsNullable = true, ColumnDescription = "仓库代码")]
        public string WarehouseCode { get; set; }

        /// <summary>
        /// 货架的组别、区域（区分单个软件管哪些货架的，前端的配置文件配置一个组别，查询时只显示当前组别的货架）
        /// </summary>
        [SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域（区分单个软件管哪些货架的，前端的配置文件配置一个组别，查询时只显示当前组别的货架）")]
        public string GroupName { get; set; }
        /// <summary>
        /// 序号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int RowNumber { get; set; }
        /// <summary>
        /// 是否已经选择
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsSelected { get; set; }
    }
}
