using SqlSugar;
using System;

namespace WCS.Entity
{
    /// <summary>
    /// 任务表
    /// </summary>
    [SugarTable(nameof(WCS_TaskOld) + "_{year}{month}{day}", "任务表")]
    [SplitTable(SplitType.Month)]//按年分表 （自带分表支持 年、季、月、周、日）
    public class WCS_TaskOld
    {
        #region 任务基本信息

        /// <summary>
        /// ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "ID")]
        public int Id { get; set; }

        /// <summary>
        /// 生产编码
        /// </summary>
        [SugarColumn(ColumnDescription = "生产编码", Length = 50)]
        public string BarCode { get; set; }

        /// <summary>
        /// 任务类型
        /// </summary>
        [SugarColumn(ColumnDescription = "任务类型")]
        public TaskType Type { get; set; }

        /// <summary>
        /// 任务状态
        /// </summary>
        [SugarColumn(ColumnDescription = "任务状态")]
        public TaskStatus Status { get; set; }

        /// <summary>
        /// 起始地址
        /// </summary>
        [SugarColumn(ColumnDescription = "起始地址", Length = 20)]
        public string AddrFrom { get; set; }

        /// <summary>
        /// 目标地址
        /// </summary>
        [SugarColumn(ColumnDescription = "目标地址", Length = 20)]
        public string AddrTo { get; set; }

        /// <summary>
        /// 下一个地址
        /// </summary>
        [SugarColumn(ColumnDescription = "下一个地址", Length = 20, IsNullable = true)]
        public string AddrNext { get; set; }

        /// <summary>
        /// 巷道
        /// </summary>
        [SugarColumn(ColumnDescription = "巷道", Length = 10, IsNullable = true)]
        public string Tunnel { get; set; }

        /// <summary>
        /// 楼层
        /// </summary>
        [SugarColumn(ColumnDescription = "楼层", IsNullable = true)]
        public int Floor { get; set; }

        /// <summary>
        /// 设备
        /// </summary>
        [SugarColumn(ColumnDescription = "设备", Length = 20, IsNullable = true)]
        public string Device { get; set; }

        /// <summary>
        /// 最后一个交互点
        /// </summary>
        [SugarColumn(ColumnDescription = "最后一个交互点", Length = 20, IsNullable = true)]
        public string LastInteractionPoint { get; set; }

        /// <summary>
        /// 堆垛机放货站台
        /// </summary>
        [SugarColumn(ColumnDescription = "堆垛机放货站台", Length = 20, IsNullable = true)]
        public string SrmStation { get; set; }

        /// <summary>
        ///  客户现场的机台/产线编号
        /// </summary>
        [SugarColumn(ColumnDescription = "客户现场的机台/产线编号", IsNullable = true)]
        public string WorkBench { get; set; }

        /// <summary>
        ///  仓库编号
        /// </summary>
        [SugarColumn(ColumnDescription = "仓库编号", IsNullable = true)]
        public string WarehouseCode { get; set; }

        /// <summary>
        /// WMS任务号
        /// </summary>
        [SugarColumn(ColumnDescription = "WMS任务号")]
        public int WmsTask { get; set; }

        /// <summary>
        /// 任务组ID
        /// </summary>
        [SugarColumn(ColumnDescription = "任务组ID", IsNullable = true)]
        public string TaskGroupKey { get; set; }

        #endregion 任务基本信息

        #region 码垛信息

        /// <summary>
        ///  码垛单号
        /// </summary>
        [SugarColumn(ColumnDescription = "单号", IsNullable = true)]
        public int DocId { get; set; }

        /// <summary>
        ///  生产单号
        /// </summary>
        [SugarColumn(ColumnDescription = "生产单号", IsNullable = true)]
        public string WorkOrder { get; set; }

        /// <summary>
        ///  码垛托盘类型
        /// </summary>
        [SugarColumn(ColumnDescription = "托盘类型", IsNullable = true)]
        public short PalletType { get; set; }

        /// <summary>
        ///  码垛工位
        /// </summary>
        [SugarColumn(ColumnDescription = "码垛工位", IsNullable = true)]
        public short ProdLine { get; set; }

        /// <summary>
        /// 满盘数量
        /// </summary>
        [SugarColumn(ColumnDescription = "满盘数量", IsNullable = true)]
        public short FullQty { get; set; }

        #endregion 码垛信息

        #region 外形信息

        /// <summary>
        /// 高度
        /// </summary>
        [SugarColumn(ColumnDescription = "高度", IsNullable = true)]
        public short Height { get; set; }

        /// <summary>
        ///  重量
        /// </summary>
        [SugarColumn(ColumnDescription = "重量", IsNullable = true)]
        public float Weight { get; set; }

        /// <summary>
        ///  长度
        /// </summary>
        [SugarColumn(ColumnDescription = "产品长度", IsNullable = true)]
        public decimal Length { get; set; }

        #endregion 外形信息

        #region 操作时间与用户

        /// <summary>
        /// 创建时间
        /// 新增数据时自动获取服务器时间
        /// </summary>
        [SugarColumn(ColumnDescription = "创建时间", InsertServerTime = true)]
        public DateTime AddTime { get; set; }

        /// <summary>
        /// 创建用户
        /// 仅记录用户ID
        /// </summary>
        [SugarColumn(ColumnDescription = "创建用户", Length = 50)]
        public string AddWho { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        [SugarColumn(ColumnDescription = "开始时间", IsNullable = true)]
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 更新用户
        /// 仅记录用户ID
        /// </summary>
        [SugarColumn(ColumnDescription = "更新用户", Length = 50, IsNullable = true)]
        public string EditWho { get; set; }

        /// <summary>
        /// 更新时间
        /// 更新数据时自动获取服务器时间
        /// </summary>
        [SugarColumn(ColumnDescription = "更新时间", UpdateServerTime = true, IsNullable = true)]
        public DateTime EditTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        [SugarColumn(ColumnDescription = "结束时间", IsNullable = true)]
        public DateTime? EndTime { get; set; }

        #endregion 操作时间与用户

        #region 条码物料相关信息

        /// <summary>
        ///  物料编码
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
        public string MatCode { get; set; }

        /// <summary>
        /// 材料号
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
        public string InvBarCode { get; set; }

        /// <summary>
        ///  是否快投
        /// </summary>
        [SugarColumn(ColumnDataType = "bit", IsNullable = true)]
        public bool IsFast { get; set; }

        /// <summary>
        ///  等级
        /// </summary>
        [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
        public string Grade { get; set; }

        /// <summary>
        ///  是否改手盘
        /// </summary>
        [SugarColumn(ColumnDataType = "bit", IsNullable = true)]
        public bool IsSurplus { get; set; }

        /// <summary>
        ///  是否返空
        /// </summary>
        [SugarColumn(ColumnDataType = "bit", IsNullable = true)]
        public bool IsRework { get; set; }

        #endregion 条码物料相关信息

        /// <summary>
        /// 更新状态
        /// </summary>
        [SugarColumn(ColumnDescription = "更新状态")]
        public TaskStatus Uploaded { get; set; }

        /// <summary>
        /// AGV任务号
        /// </summary>
        [SugarColumn(ColumnDescription = "AGV任务号", IsNullable = true)]
        public int AgvTaskID { get; set; }

        /// <summary>
        ///  Agv任务信息
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(AgvTaskID))]
        public WCS_AgvTaskInfo AgvTask { get; set; }

        /// <summary>
        /// 优先级
        /// </summary>
        [SugarColumn(ColumnDescription = "优先级")]
        public int Priority { get; set; }

        /// <summary>
        /// 手动处理备注
        /// </summary>
        [SugarColumn(ColumnDescription = "手动处理备注", IsNullable = true)]
        public string ManualRemarks { get; set; }

        /// <summary>
        ///  出库任务类型
        /// </summary>
        [SugarColumn(ColumnDescription = "出库任务类型", IsNullable = true)]
        public OutTypeEnum OutType { get; set; }

        /// <summary>
        /// 产品编码
        /// </summary>
        [SugarColumn(ColumnDescription = "产品编码", IsNullable = true)]
        public string MaterialCode { get; set; }

        /// <summary>
        /// 是否可用
        /// </summary>
        [SugarColumn(ColumnDescription = "是否可用")]
        public bool Enabled { get; set; } = true;

        /// <summary>
        /// 业务类型
        /// </summary>
        [SugarColumn(ColumnDescription = "业务类型", IsNullable = true)]
        public string BusType { get; set; }

        /// <summary>
        ///  货位类型
        /// </summary>
        [SugarColumn(ColumnDescription = "货位类型", IsNullable = true)]
        public int GoodsType { get; set; }

        /// <summary>
        ///  行
        /// </summary>
        [SugarColumn(ColumnDescription = "行", IsNullable = true)]
        public int Line { get; set; }

        /// <summary>
        /// 列
        /// </summary>
        [SugarColumn(ColumnDescription = "列", IsNullable = true)]
        public int Col { get; set; }

        /// <summary>
        /// 层
        /// </summary>
        [SugarColumn(ColumnDescription = "层", IsNullable = true)]
        public int Layer { get; set; }

        /// <summary>
        ///  深度
        /// </summary>
        [SugarColumn(ColumnDescription = "深度", IsNullable = true)]
        public int Depth { get; set; }
    }
}
