FeedingEquip_Config.cs
7.5 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
public class FeedingEquip_Config : StoreConfig
{
public FeedingEquip_Config()
: base()
{
}
public FeedingEquip_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath)
{
}
/// <summary>
/// 设备是否处于调试状态(1=调试,0=正常)
/// </summary>
[ConfigProAttribute("IsDebug")]
public int IsDebug { get; set; }
///// <summary>
///// 阻挡气缸控制信号(1-4分别对应夹具检测1-4)
///// </summary>
//[ConfigProAttribute("StopCylinderIOType")]
//public int StopCylinderIOType { get; set; }
/// <summary>
/// PRO 0 移栽上下运动是否使用伺服 UpDownUseAxis 1
/// </summary>
[ConfigProAttribute("UpDownUseAxis")]
public int UpDownUseAxis { get; set; }
/// <summary>
/// PRO 0 批量上料轴在移栽上下降的位置 UpDownPositions 0=180000
/// </summary>
[ConfigProAttribute("UpDownPositions",false) ]
public string UpDownPositions { get; set; }
/// <summary>
/// PRO 0 批量上料轴在料仓门口下降的位置 UpDownBoxPositions 0=116000
/// </summary>
[ConfigProAttribute("UpDownBoxPositions", false)]
public string UpDownBoxPositions { get; set; }
/// <summary>
/// AXIS 0 批量上料轴 UpDown_Axis 2
/// </summary>
[ConfigProAttribute("Batch_Axis", false)]
public ConfigMoveAxis Batch_Axis { get; set; }
/// <summary>
/// PRO 0 批量上料轴待机点 P1 BatchAxisP1 403000
/// </summary>
[ConfigProAttribute("BatchAxisP1", false)]
public int BatchAxisP1 { get; set; }
/// <summary>
/// PRO 0 批量上料轴目标速度 BatchAxis_TargetSpeed 150
/// </summary>
[ConfigProAttribute("BatchAxis_TargetSpeed", false)]
public int BatchAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO 0 批量上料轴加速度 BatchAxis_AddSpeed 400
/// </summary>
[ConfigProAttribute("BatchAxis_AddSpeed", false)]
public short BatchAxis_AddSpeed { get; set; }
/// <summary>
/// PRO 0 批量上料轴减速度 BatchAxis_DelSpeed 400
/// </summary>
[ConfigProAttribute("BatchAxis_DelSpeed", false)]
public short BatchAxis_DelSpeed { get; set; }
/// <summary>
/// PRO 0 批量上料轴原点低速度 BatchAxis_HomeLowSpeed 100
/// </summary>
[ConfigProAttribute("BatchAxis_HomeLowSpeed", false)]
public int BatchAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO 0 批量上料轴原点高速 BatchAxis_HomeHighSpeed 200
/// </summary>
[ConfigProAttribute("BatchAxis_HomeHighSpeed", false)]
public int BatchAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO 0 批量上料轴原点加速度 BatchAxis_HomeAddSpeed 200
/// </summary>
[ConfigProAttribute("BatchAxis_HomeAddSpeed", false)]
public int BatchAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO,0,批量上料轴走到待机点速度,BatchAxis_P1Speed,400,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_P1Speed", false)]
public int BatchAxis_P1Speed { get; set; }
/// <summary>
/// PRO,0,批量上料轴下降速度,BatchAxis_DownSpeed,500,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_DownSpeed", false)]
public int BatchAxis_DownSpeed { get; set; }
private Dictionary<int, int> UpDownPositionMap = null;
public int GetUpdownPosition(int trayHeight)
{
try
{
if (UpDownPositionMap == null)
{
UpDownPositionMap = new Dictionary<int, int>();
string[] arrayList = UpDownPositions.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('=');
if (arrStr.Length == 2)
{
int height = Convert.ToInt32(arrStr[0].Trim());
int length = Convert.ToInt32(arrStr[1].Trim());
UpDownPositionMap.Add(height, length);
}
}
}
}
catch (Exception ex)
{
}
if (UpDownPositionMap.ContainsKey(trayHeight))
{
return UpDownPositionMap[trayHeight];
}else if (UpDownPositionMap.ContainsKey(0))
{
return UpDownPositionMap[0];
}
return -1;
}
public void UpdateUpdownPositon(int size, int sizePosition)
{
string newPositionStr = "";
if (UpDownPositionMap.ContainsKey(size))
{
UpDownPositionMap[size] = sizePosition;
}
else
{
UpDownPositionMap.Add(size, sizePosition);
}
foreach(int key in UpDownPositionMap.Keys)
{
newPositionStr += key + "=" + UpDownPositionMap[key] + ";";
}
newPositionStr = newPositionStr.Substring(0, newPositionStr.Length - 1);
UpDownPositions = newPositionStr;
}
private Dictionary<int, int> UpDownBoxPositionMap = null;
public int GetUpdownBoxPosition(int trayHeight)
{
try
{
if (UpDownBoxPositionMap == null)
{
UpDownBoxPositionMap = new Dictionary<int, int>();
string[] arrayList = UpDownBoxPositions.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('=');
if (arrStr.Length == 2)
{
int height = Convert.ToInt32(arrStr[0].Trim());
int length = Convert.ToInt32(arrStr[1].Trim());
UpDownBoxPositionMap.Add(height, length);
}
}
}
}
catch (Exception ex)
{
}
if (UpDownBoxPositionMap.ContainsKey(trayHeight))
{
return UpDownBoxPositionMap[trayHeight];
}else if (UpDownBoxPositionMap.ContainsKey(0))
{
return UpDownBoxPositionMap[0];
}
return -1;
}
public void UpdateUpdownBoxPositon(int size, int sizePosition)
{
string newPositionStr = "";
if (UpDownBoxPositionMap.ContainsKey(size))
{
UpDownBoxPositionMap[size] = sizePosition;
}
else
{
UpDownBoxPositionMap.Add(size, sizePosition);
}
foreach (int key in UpDownPositionMap.Keys)
{
newPositionStr += key + "=" + UpDownBoxPositionMap[key] + ";";
}
newPositionStr = newPositionStr.Substring(0, newPositionStr.Length - 1);
UpDownBoxPositions = newPositionStr;
}
}
}