Base_Task.cs 5.93 KB
using RCS.Model.Comm;
using RCS.Model.Entity.PrimaryKey;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Net;

namespace RCS.Model.Entity
{
    [Table("t_base_task")]

    public class Base_Task : IdEntity
    {
        private string taskNo;
        private DateTime acceptTime;
        private bool commandSending;
        private string taskAgvNo;
        private DateTime? beginTime;
        private DateTime? endTime;
        private string taskErrMsg;
        private EnumMsg.Direction direction;
        private EnumMsg.TaskState taskState;
        private string predictAgvNo;
        private bool isSubmit;
        private Base_Point startPoint;
        private Base_Point endPoint;
        /// <summary>
        /// 任务号
        /// </summary>
        public string TaskNo
        {
            get => taskNo;
            set
            {
                taskNo = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 任务类型 例如 SMT-001
        /// </summary>
        public string TaskType { get; set; }
        
        /// <summary>
        /// 任务群组 例如 PCBA\FA
        /// </summary>
        public string? TaskGroup { get; set; }

        /// <summary>
        /// 任务开始分解序号
        /// </summary>
        [NotMapped]
        public int TaskSplitStep { get; set; }

        /// <summary>
        /// 主任务的任务等级
        /// </summary>
        public int TaskLevel { get; set; }

        /// <summary>
        /// 任务条码
        /// </summary>
        public string TaskPallet { get; set; }

        /// <summary>
        /// 起始点
        /// </summary>
        public string? Initial { get; set; }

        /// <summary>
        /// 目标点
        /// </summary>
        public string? Target { get; set; }

        #region 接收数据库起点终点数据

        public string StartBarcode { get; set; }
        public string? EndBarcode { get; set; }

        #endregion 接收数据库起点终点数据

        /// <summary>
        /// 主任务的起点信息
        /// </summary>
        [NotMapped]
        public Base_Point StartPoint
        {
            get { return startPoint; }
            set
            {
                startPoint = value;
                StartBarcode = startPoint?.Barcode??"";
            }
        }

        /// <summary>
        /// 主任务的终点信息
        /// </summary>
        [NotMapped]
        public Base_Point EndPoint
        {
            get { return endPoint; }
            set
            {
                endPoint = value;
                EndBarcode = endPoint?.Barcode??"";
            }
        }

        /// <summary>
        /// 任务的接收时间
        /// </summary>
        public DateTime AcceptTime
        {
            get => acceptTime;
            set
            {
                acceptTime = value; NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 指令发送中
        /// </summary>
        [NotMapped]
        public bool CommandSending
        {
            get => commandSending;
            set
            {
                commandSending = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 任务是否提交
        /// </summary>
        public bool IsSubmit
        {
            get => isSubmit;
            set
            {
                isSubmit = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 任务小车信息
        /// </summary>
        public string? TaskAgvNo
        {
            get => taskAgvNo;
            set
            {
                taskAgvNo = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 子任务集合
        /// </summary>
        [NotMapped]
        public ObservableCollection<Base_SubTask> SubTaskList { get; set; } = new();

        /// <summary>
        /// 任务的开始时间
        /// </summary>
        public DateTime? BeginTime
        {
            get => beginTime;
            set
            {
                beginTime = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 任务的结束时间
        /// </summary>
        public DateTime? EndTime
        {
            get => endTime;
            set
            {
                endTime = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 任务异常信息
        /// </summary>
        public string TaskErrMsg
        {
            get => taskErrMsg;
            set
            {
                taskErrMsg = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 方向
        /// </summary>
        public EnumMsg.Direction Direction
        {
            get => direction;
            set
            {
                direction = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 主任务状态
        /// </summary>
        public EnumMsg.TaskState TaskState
        {
            get => taskState;
            set
            {
                taskState = value;
                NotifyPropertyChanged();
            }
        }


        /// <summary>
        /// 顶升高度或角度
        /// </summary>
        [NotMapped]
        public short HeightOrAngle { get; set; }


        /// <summary>
        /// 预测用的小车
        /// </summary>
        [NotMapped]
        public string PredictAgvNo
        {
            get => predictAgvNo;
            set
            {
                predictAgvNo = value;
                NotifyPropertyChanged();
            }
        }

        /// <summary>
        /// 预加载路径点
        public List<(int No, string Barcode)> PreLoadPath = [];
    }
}