ClientNode.cs
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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;
}
}
}