using SqlSugar;
using WCS.Model.ApiModel.OutStore;

namespace WCS.BLL.DbModels
{
    /// <summary>
    /// 出库单据
    /// </summary>
    [SugarTable("wcs_out_order")]
    public class OutOrder
    {
        /// <summary>
        /// 主键 自增Id
        /// </summary>
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
        public int Id { get; set; }

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

        /// <summary>
        /// 单据状态
        /// </summary>           
        [SugarColumn(ColumnName = "order_status", IsNullable = false, ColumnDescription = "单据状态")]
        public OutOrderStatus OrderStatus { get; set; } = OutOrderStatus.未发料;

        /// <summary>
        /// 单据执行状态：	待发料，	开始发料，	暂停发料，	发料完成
        /// </summary>           
        [SugarColumn(ColumnName = "order_exe_status", IsNullable = true, ColumnDescription = "执行状态：\t待发料，\t开始发料，\t暂停发料，\t发料完成")]
        public OutOrderExeStatus OutOrderExeStatus { get; set; } = OutOrderExeStatus.待发料;


        /// <summary>
        /// 单据来源
        /// </summary>           
        [SugarColumn(ColumnName = "order_source", Length = 50, IsNullable = true, ColumnDescription = "单据来源")]
        public string OrderSource { get; set; }

        /// <summary>
        /// 单据类型
        /// </summary>           
        [SugarColumn(ColumnName = "order_type", Length = 50, IsNullable = true, ColumnDescription = "单据类型")]
        public string OrderType { get; set; }

        /// <summary>
        /// 单据同步类型
        /// </summary>           
        [SugarColumn(ColumnName = "sync_type", IsNullable = false, ColumnDescription = "单据同步类型：ByMatCode,ByMatSn")]
        public SyncTypeEnum SyncType { get; set; }

        /// <summary>
        /// 货架类型名称
        /// </summary>
        [SugarColumn(ColumnName = "shelf_type_name", Length = 50, IsNullable = false, ColumnDescription = "货架类型名称")]
        public string ShelfTypeName { get; set; }
        /// <summary>
        /// 货架类型Id
        /// </summary>
        [SugarColumn(ColumnName = "shelf_type_id", IsNullable = false, DefaultValue = "0", ColumnDescription = "货架类型Id")]
        public int ShelfTypeId { get; set; } = 0;

        /// <summary>
        /// 货架的组别、区域（区分单个软件管哪些货架的，前端的配置文件配置一个组别，查询时只显示当前组别的货架）
        /// </summary>
        [SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域（区分单个软件管哪些货架的，前端的配置文件配置一个组别，查询时只显示当前组别的货架）")]
        public string GroupName { get; set; } = string.Empty;

        /// <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; }

        /// <summary>
        /// 是否是盟讯公司盘点生成的出库单
        /// </summary>
        [SugarColumn(ColumnName = "is_MXPD", IsNullable = true, ColumnDescription = "是否是盟讯公司盘点生成的出库单")]
        public bool? IsMXPD { get; set; } = false;

        /// <summary>
        /// 用于绑定DataGrid中是否选择
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsSelected { get; set; }

        /// <summary>
        /// 用于绑定中显示序号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int RowNumber { get; set; }

        /// <summary>
        /// 返回当前是否正在进行出库
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool IsOuting { get; set; } = false;
    }

}
