-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathICTKeysight3070Importer.cs
475 lines (410 loc) · 26.4 KB
/
ICTKeysight3070Importer.cs
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Virinco.WATS.Integration.TextConverter;
using Virinco.WATS.Interface;
namespace ICTKeysight3070Converter
{
public class ICTKeysight3070Importer : TextConverterBase
{
public ICTKeysight3070Importer() : base()
{
ConverterParameters.Add("numberFormatMode", "prefix");
}
public void CleanUp()
{
}
private StepStatusType GetStepStatusType(string status)
{
if (status == "0" || status == "00")
{
return StepStatusType.Passed;
}
else
{
return StepStatusType.Failed;
}
}
private UUTStatusType GetUUTStatusType(string status)
{
if (status == "0" || status == "00")
{
return UUTStatusType.Passed;
}
else
{
return UUTStatusType.Failed;
}
}
string group = "";
string compRef = "";
string reportText = "";
UUTStatusType endStatus = UUTStatusType.Passed;
NumericLimitStep multiNumericStep = null;
protected override bool ProcessMatchedLine(SearchFields.SearchMatch match, ref ReportReadState readState)
{
//apiRef.TestMode = TestModeType.Import;
if (match == null)
{
if (!string.IsNullOrEmpty(currentUUT.SerialNumber))
{
if (!string.IsNullOrEmpty(reportText))
{
if (reportText.Length > 5000)
{
reportText = reportText.Substring(0, 5000);
}
currentUUT.Comment = reportText;
}
currentUUT.OperationType = apiRef.GetOperationType(ConverterParameters["operationTypeCode"]);
// override status at the end because we dont use TestModeType.Import
currentUUT.Status = endStatus;
apiRef.Submit(currentUUT);
group = "";
compRef = "";
reportText = "";
}
return true;
}
switch (match.matchField.fieldName)
{
case "BTEST":
{
currentUUT.SerialNumber = (string)match.GetSubField("SerialNumber");
currentUUT.StartDateTime = (DateTime)match.GetSubField("StartDate");
endStatus = GetUUTStatusType((string)match.GetSubField("Status"));
currentUUT.ExecutionTime = (double)match.GetSubField("ExecutionTime");
multiNumericStep = null;
break;
}
case "BLOCK":
{
string BlockDesignator = (string)match.GetSubField("BlockDesignator");
string[] BlockDesignatorParts = BlockDesignator.Split('%');
if (Regex.IsMatch(BlockDesignator, @"^\d+%"))
{
string socketIndex = BlockDesignatorParts[0];
currentUUT.TestSocketIndex = short.Parse(socketIndex);
compRef = string.Join(" ", BlockDesignatorParts.Skip(1));
}
else
{
compRef = string.Join(" ", BlockDesignatorParts);
}
multiNumericStep = null;
reportText = "";
break;
}
case "TestLIM2":
case "TestLIM3":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
}
double multiplier = 1;
string unit = "";
if (ConverterParameters["numberFormatMode"] == "prefix")
{
(multiplier, unit) = UnitMapper.GetMultiplierAndUnitDynamicallyBasedOnNumberSize(group, (double)match.GetSubField("LowLim"));
}
else
{
(multiplier, unit) = UnitMapper.GetMultiplierAndUnitHardcoded(group);
}
NumericLimitStep currentStep = currentSequence.AddNumericLimitStep(compRef);
NumericLimitTest currentTest = currentStep.AddTest((double)match.GetSubField("Meas") * multiplier, CompOperatorType.GELE, (double)match.GetSubField("LowLim") * multiplier, (double)match.GetSubField("HighLim") * multiplier, unit, GetStepStatusType((string)match.GetSubField("Status")));
multiNumericStep = null;
break;
}
case "TestLIM2Multi":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
multiNumericStep = null;
}
if (multiNumericStep == null)
{
multiNumericStep = currentSequence.AddNumericLimitStep(compRef);
}
double multiplier = 1;
string unit = "";
if (ConverterParameters["numberFormatMode"] == "prefix")
{
(multiplier, unit) = UnitMapper.GetMultiplierAndUnitDynamicallyBasedOnNumberSize(group, (double)match.GetSubField("LowLim"));
} else
{
(multiplier, unit) = UnitMapper.GetMultiplierAndUnitHardcoded(group);
}
NumericLimitTest currentTest = multiNumericStep.AddMultipleTest((double)match.GetSubField("Meas") * multiplier, CompOperatorType.GELE, (double)match.GetSubField("LowLim") * multiplier, (double)match.GetSubField("HighLim") * multiplier, unit, (string)match.GetSubField("MeasName"), GetStepStatusType((string)match.GetSubField("Status")));
break;
}
case "BS-CON":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
}
var testNameString = (string)match.GetSubField("testName");
string[] testNameParts = testNameString.Split('%');
string testName;
if (Regex.IsMatch(testNameString, @"^\d+%"))
{
string socketIndex = testNameParts[0];
currentUUT.TestSocketIndex = short.Parse(socketIndex);
testName = string.Join(" ", testNameParts.Skip(1));
}
else
{
testName = string.Join(" ", testNameParts);
}
NumericLimitStep currentStep = currentSequence.AddNumericLimitStep(testName);
currentStep.AddMultipleTest((int)match.GetSubField("shortCount"), "", "Shorts count");
currentStep.AddMultipleTest((int)match.GetSubField("opensCount"), "", "Opens count");
int status;
if (Int32.TryParse((string)match.GetSubField("status"), NumberStyles.Any, CultureInfo.InvariantCulture, out status))
{
currentStep.AddMultipleTest(status, "", "Test status", GetStepStatusType((string)match.GetSubField("status")));
}
multiNumericStep = null;
break;
}
case "Report":
{
if (!string.IsNullOrEmpty((string)match.GetSubField("RepTxt")))
{
if (reportText.Length + ((string)match.GetSubField("RepTxt")).Length > 5000)
{
reportText += ((string)match.GetSubField("RepTxt")).Substring(0, 5000 - reportText.Length);
}
}
multiNumericStep = null;
break;
}
case "D-T":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
}
var testNameString = (string)match.GetSubField("TestName");
string[] testNameParts = testNameString.Split('%');
string testName;
if (Regex.IsMatch(testNameString, @"^\d+%"))
{
string socketIndex = testNameParts[0];
currentUUT.TestSocketIndex = short.Parse(socketIndex);
testName = string.Join(" ", testNameParts.Skip(1));
}
else
{
testName = string.Join(" ", testNameParts);
}
NumericLimitStep currentStep = currentSequence.AddNumericLimitStep(testName);
currentStep.AddMultipleTest((int)match.GetSubField("PinCount"), "", "Pin count");
currentStep.AddMultipleTest((int)match.GetSubField("TestSubstatus"), "", "Test substans");
currentStep.AddMultipleTest((int)match.GetSubField("FailingVectorNumber"), "", "Failing vector number");
int status;
if (Int32.TryParse((string)match.GetSubField("TestStatus"), NumberStyles.Any, CultureInfo.InvariantCulture, out status))
{
currentStep.AddMultipleTest(status, "", "Test status", GetStepStatusType((string)match.GetSubField("TestStatus")));
}
multiNumericStep = null;
break;
}
case "TJET":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
}
var testNameString = (string)match.GetSubField("TestName");
string[] testNameParts = testNameString.Split('%');
string testName;
if (Regex.IsMatch(testNameString, @"^\d+%"))
{
string socketIndex = testNameParts[0];
currentUUT.TestSocketIndex = short.Parse(socketIndex);
testName = string.Join(" ", testNameParts.Skip(1));
}
else
{
testName = string.Join(" ", testNameParts);
}
NumericLimitStep currentStep = currentSequence.AddNumericLimitStep(testName);
currentStep.AddMultipleTest((int)match.GetSubField("PinCount"), "", "Pin count");
int status;
if (Int32.TryParse((string)match.GetSubField("TestStatus"), NumberStyles.Any, CultureInfo.InvariantCulture, out status))
{
currentStep.AddMultipleTest(status, "", "Test status", GetStepStatusType((string)match.GetSubField("TestStatus")));
}
multiNumericStep = null;
break;
}
case "PF":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
}
var testNameString = (string)match.GetSubField("TestName");
string[] testNameParts = testNameString.Split('%');
string testName;
if (Regex.IsMatch(testNameString, @"^\d+%"))
{
string socketIndex = testNameParts[0];
currentUUT.TestSocketIndex = short.Parse(socketIndex);
testName = string.Join(" ", testNameParts.Skip(1));
}
else
{
testName = string.Join(" ", testNameParts);
}
NumericLimitStep currentStep = currentSequence.AddNumericLimitStep(testName);
currentStep.AddMultipleTest((int)match.GetSubField("totalPins"), "", "Total pins");
int status;
if (Int32.TryParse((string)match.GetSubField("TestStatus"), NumberStyles.Any, CultureInfo.InvariantCulture, out status))
{
currentStep.AddMultipleTest(status, "", "Test status", GetStepStatusType((string)match.GetSubField("TestStatus")));
}
multiNumericStep = null;
break;
}
case "TS":
{
if ((string)match.GetSubField("Group") != group)
{
group = (string)match.GetSubField("Group");
currentSequence = currentUUT.GetRootSequenceCall().AddSequenceCall(group);
}
var testNameString = (string)match.GetSubField("TestName");
string[] testNameParts = testNameString.Split('%');
string testName;
if (Regex.IsMatch(testNameString, @"^\d+%"))
{
string socketIndex = testNameParts[0];
currentUUT.TestSocketIndex = short.Parse(socketIndex);
testName = string.Join(" ", testNameParts.Skip(1));
}
else
{
testName = string.Join(" ", testNameParts);
}
NumericLimitStep currentStep = currentSequence.AddNumericLimitStep(testName);
currentStep.AddMultipleTest((int)match.GetSubField("ShortsCount"), "", "Shorts count");
currentStep.AddMultipleTest((int)match.GetSubField("OpensCount"), "", "Opens count");
currentStep.AddMultipleTest((int)match.GetSubField("PhantomsCount"), "", "Phantoms count");
int status;
if (Int32.TryParse((string)match.GetSubField("TestStatus"), NumberStyles.Any, CultureInfo.InvariantCulture, out status))
{
currentStep.AddMultipleTest(status, "", "Test status", GetStepStatusType((string)match.GetSubField("TestStatus")));
}
multiNumericStep = null;
break;
}
default:
break;
}
return true;
}
public ICTKeysight3070Importer(IDictionary<string, string> args) : base(args)
{
// Format: {@BATCH|UUT type (string)|UUT type rev (string)|fixture id (int)|testhead number (int)|testhead type (string)|process step (string)|batch id (string)
// |operator id (string)|controller (string)|testplan id (string)|testplan rev (string)|parent panel type (string)|parent panel type rev (string)}
SearchFields.RegExpSearchField regExpSearchField = searchFields.AddRegExpField(UUTField.UseSubFields, ReportReadState.InHeader, @"^\{@BATCH\|([^|]*)\|([^|]*)\|([^|]*)\|([^|]*)\|([^|]*)\|([^|]*)\|([^|]*)\|([^|]*)\|(?<Station>([^|]*))\|([^|]*)\|(?<Revision>([^|]*))\|([^|]*)\|([^|]*)\|(?<PartNumber>([^|]*))$", null, typeof(string));
regExpSearchField.AddSubField("Station", typeof(string), null, UUTField.StationName);
regExpSearchField.AddSubField("PartNumber", typeof(string), null, UUTField.PartNumber);
regExpSearchField.AddSubField("Revision", typeof(string), null, UUTField.PartRevisionNumber);
// Format: {@BTEST|board id (string)|test status (int)|start datetime (int)|duration (int)|multiple test (bool)|log level (string)|log set (int)
// |learning (bool)|known good (bool)|end datetime (int)|status qualifier (string)|board number (int)|parent panel id (string)}
regExpSearchField = searchFields.AddRegExpField("BTEST", ReportReadState.InHeader, @"^\{@BTEST\|((?<SerialNumber>[^|]*))\|(?<Status>([^|]*))\|(((?<StartDate>[^|]*)))\|((\b0*(?<ExecutionTime>[1-9][0-9]*|0)\b))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))$", null, typeof(string), ReportReadState.InTest);
regExpSearchField.AddSubField("Status", typeof(string), null);
regExpSearchField.AddSubField("SerialNumber", typeof(string), null);
regExpSearchField.AddSubField("StartDate", typeof(DateTime), "yyMMddHHmmss");
regExpSearchField.AddSubField("ExecutionTime", typeof(double), null);
// For some reason some reports have 12 separators (|) and another reports har 13 separators. This may be because a the field 'parent panel type rev' is a field newly added to the format. Anyways we check for both.
regExpSearchField = searchFields.AddRegExpField("BTEST", ReportReadState.InHeader, @"^\{@BTEST\|((?<SerialNumber>[^|]*))\|(?<Status>([^|]*))\|(((?<StartDate>[^|]*)))\|((\b0*(?<ExecutionTime>[1-9][0-9]*|0)\b))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))\|(([^|]*))$", null, typeof(string), ReportReadState.InTest);
regExpSearchField.AddSubField("Status", typeof(string), null);
regExpSearchField.AddSubField("SerialNumber", typeof(string), null);
regExpSearchField.AddSubField("StartDate", typeof(DateTime), "yyMMddHHmmss");
regExpSearchField.AddSubField("ExecutionTime", typeof(double), null);
// Format: {@BLOCK|block designator (string)|block status (int)}
regExpSearchField = searchFields.AddRegExpField("BLOCK", ReportReadState.InTest, @"^{@BLOCK[|](?<BlockDesignator>[^|]*)[|][^|]*$", null, typeof(string));
regExpSearchField.AddSubField("BlockDesignator", typeof(string), null);
// Format: {@group name|test status (int)|measured value (float)|{@LIM2|high limit (float)|low limit (float)}}
// Matches these group names: @A-RES, @A-MEA, @A-NFE, @A-NPN, @A-PFE, @A-PNP, @A-SWI, @A-DIO, @A-JUM
regExpSearchField = searchFields.AddRegExpField("TestLIM2", ReportReadState.InTest, @"{@(?<Group>[^|]+)[|](?<Status>[^|]*)[|]\s*(?<Meas>[0-9+-E.]+)[|]*{@LIM2[|]\s*(?<HighLim>[0-9+-E.]+)[|]\s*(?<LowLim>[0-9+-E.]+)}", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("Status", typeof(string), null);
regExpSearchField.AddSubField("Meas", typeof(double), null);
regExpSearchField.AddSubField("HighLim", typeof(double), null);
regExpSearchField.AddSubField("LowLim", typeof(double), null);
// Format: {@group name|test status (int)|measured value (float)|measurment name (sting){@LIM2|high limit (float)|low limit (float)}}
// Matches these group names: @A-RES, @A-MEA, @A-NFE, @A-NPN, @A-PFE, @A-PNP, @A-SWI, @A-DIO, @A-JUM
regExpSearchField = searchFields.AddRegExpField("TestLIM2Multi", ReportReadState.InTest, @"{@(?<Group>[^|]+)[|](?<Status>[^|]*)[|]\s*(?<Meas>[0-9+-E.]+)[|](?<MeasName>[^}]+)[|]*{@LIM2[|]\s*(?<HighLim>[0-9+-E.]+)[|]\s*(?<LowLim>[0-9+-E.]+)}}", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("Status", typeof(string), null);
regExpSearchField.AddSubField("Meas", typeof(double), null);
regExpSearchField.AddSubField("MeasName", typeof(string), null);
regExpSearchField.AddSubField("HighLim", typeof(double), null);
regExpSearchField.AddSubField("LowLim", typeof(double), null);
// Format: {@group name|test status (int)|measured value (float)|{@LIM3|nominal value (float)|high limit (float)|minus tolerance (float)}}
// Matches these group names: @A-RES, @A-ZEN, @A-CAP, @A-FUS, @A-IND, @A-POT
regExpSearchField = searchFields.AddRegExpField("TestLIM3", ReportReadState.InTest, @"{@(?<Group>[^|]+)[^|]*[|](?<Status>[^|]*)[|](?<Meas>[0-9+-E.]+)[|]*{@LIM3[|](?<Nominal>[0-9+-E.]+)[|](?<HighLim>[0-9+-E.]+)[|](?<LowLim>[0-9+-E.]+)}}", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("Status", typeof(string), null);
regExpSearchField.AddSubField("Meas", typeof(double), null);
regExpSearchField.AddSubField("Nominal", typeof(double), null);
regExpSearchField.AddSubField("HighLim", typeof(double), null);
regExpSearchField.AddSubField("LowLim", typeof(double), null);
// Format: {@BS-CON|test designator (string)|status (int)|shorts count (int)|opens count (int)}
regExpSearchField = searchFields.AddRegExpField("BS-CON", ReportReadState.InTest, @"{@(?<Group>BS-CON)[|](?<testName>.*)[|](?<status>[^|]*)[|](?<shortCount>\d+)[|](?<opensCount>\d+)", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("testName", typeof(string), null);
regExpSearchField.AddSubField("status", typeof(string), null);
regExpSearchField.AddSubField("shortCount", typeof(int), null);
regExpSearchField.AddSubField("opensCount", typeof(int), null);
// Format: {@RPT|message (string)}
regExpSearchField = searchFields.AddRegExpField("Report", ReportReadState.InTest, @"{@RPT[|](?<RepTxt>.*)}", null, typeof(string));
regExpSearchField.AddSubField("RepTxt", typeof(string), null);
// Format: {@D-T|test status (int)|test substatus (int)|failing vector number (int)|pin count (int)|test designator (string)}
regExpSearchField = searchFields.AddRegExpField("D-T", ReportReadState.InTest, @"\{@(?<Group>D-T)\|(?<TestStatus>(0|1|5|7|8))*\|(?<TestSubstatus>([0-9]*))\|(?<FailingVectorNumber>([0-9]*))\|(?<PinCount>([0-9]*))\|(?<TestName>(.*))", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("TestStatus", typeof(string), null);
regExpSearchField.AddSubField("TestSubstatus", typeof(int), null);
regExpSearchField.AddSubField("FailingVectorNumber", typeof(int), null);
regExpSearchField.AddSubField("PinCount", typeof(int), null);
regExpSearchField.AddSubField("TestName", typeof(string), null);
// Format: {@TJET|test status (int)|pin count (int)|test designator (string)}
regExpSearchField = searchFields.AddRegExpField("TJET", ReportReadState.InTest, @"\{@(?<Group>TJET)\|(?<TestStatus>(00|01|07))*\|(?<PinCount>([0-9]*))\|(?<TestName>(.*))", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("TestStatus", typeof(string), null);
regExpSearchField.AddSubField("PinCount", typeof(int), null);
regExpSearchField.AddSubField("TestName", typeof(string), null);
// Format: {@PF|designator (string)|test status (int)|total pins (int)}
regExpSearchField = searchFields.AddRegExpField("PF", ReportReadState.InTest, @"\{@(?<Group>PF)\|(?<TestName>(.*))\|(?<TestStatus>(0|1))\|((?<totalPins>([0-9]*)))", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("totalPins", typeof(int), null);
regExpSearchField.AddSubField("TestStatus", typeof(string), null);
regExpSearchField.AddSubField("TestName", typeof(string), null);
// Format: {@TS|test status (int)|shorts count (int)|opens count (int)|phantoms count (int)|designator (string)}
regExpSearchField = searchFields.AddRegExpField("TS", ReportReadState.InTest, @"\{@(?<Group>TS)\|(?<TestStatus>(0|1|20))*\|(?<ShortsCount>([0-9]*))\|((?<OpensCount>([0-9]*)))\|((?<PhantomsCount>([0-9]*)))\|(?<TestName>(.*))", null, typeof(string));
regExpSearchField.AddSubField("Group", typeof(string), null);
regExpSearchField.AddSubField("TestStatus", typeof(string), null);
regExpSearchField.AddSubField("ShortsCount", typeof(int), null);
regExpSearchField.AddSubField("OpensCount", typeof(int), null);
regExpSearchField.AddSubField("PhantomsCount", typeof(int), null);
regExpSearchField.AddSubField("TestName", typeof(string), null);
}
}
}