ClientNode.cs 1.7 KB
using System;

namespace Clinet
{
    public class ClientNode
    {
        /// <summary>
        /// 节点名称
        /// </summary>
        public string Name { set; get; }
        /// <summary>
        /// 标记,用于包装料仓
        /// </summary>
        public string Mark { set; get; }
        /// <summary>
        /// 当前架子的RFID
        /// </summary>
        public string RFID { set; get; }
        /// <summary>
        /// 动作
        /// </summary>
        public ClientAction Action { set; get; }
        /// <summary>
        /// 优先级
        /// </summary>
        public ClientLevel Level { set; get; }

        public ClientNode()
        {
        }

        public ClientNode(string name, string mark, string rfid, ClientAction action, ClientLevel level)
        {
            Name = name;
            Mark = mark;
            RFID = rfid;
            Action = action;
            Level = level;
        }

        /// <summary>
        /// 所有属性的文本形式
        /// </summary>
        /// <returns></returns>
        public string ToText()
        {
            System.Reflection.PropertyInfo[] info = typeof(ClientNode).GetProperties();
            string[] arr = new string[info.Length];
            for (int i = 0; i < info.Length; i++)
                arr[i] = string.Format("\"{0}\":\"{1}\"", info[i].Name, info[i].GetValue(this));
            return string.Join(",", arr);
        





            //string s = string.Format("Name={0}, Action={1}, Level={2}, Mark={3}, RFID={4}", Name, Action, Level, Mark, RFID);
            //return s;
        }

        public ClientNode ToCopy()
        {
            ClientNode node = new ClientNode(Name, Mark, RFID, Action, Level);
            return node;
        }
    }
}