Created
July 27, 2018 07:33
-
-
Save lynxz/5b4e370994ebdd35b2d90bec70e86d5c to your computer and use it in GitHub Desktop.
Fetching the result data for a specific wafer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
using (var store = new DocumentStore { Urls = new[] { "http://swe-raventest:8080" } }.Initialize()) | |
{ | |
string waferId = "5809"; | |
using (var session = store.OpenSession("S9")) | |
{ | |
var timer = Stopwatch.StartNew(); | |
var docs = session.Query<ProcessStepResult>("ProcessStep/Search") | |
.Statistics(out QueryStatistics stats) | |
.Where(d => d.WaferId == waferId && d.Latest) | |
.Select(d => new | |
{ | |
d.DeviceId, | |
d.StepName, | |
d.StepId, | |
d.StopTime, | |
Result = d.Result.ToString(), | |
Status = d.Status.ToString() | |
}).ToList(); | |
var waferResult = new WaferResult() { | |
WaferId = waferId, | |
FirstUpdated = docs.Min(d => d.StopTime), | |
LastUpdated = docs.Max(d=> d.StopTime), | |
DeviceResults = docs.Select(d => new DeviceResult { | |
DeviceId = d.DeviceId, | |
StepId = d.StepId, | |
StepName = d.StepName, | |
Status = d.Status, | |
Result = d.Result | |
}).ToArray() | |
}; | |
timer.Stop(); | |
Console.WriteLine($"Raven Time: {stats.DurationInMs}ms"); | |
Console.WriteLine($"Total Time: {timer.Elapsed.TotalMilliseconds}ms"); | |
} | |
} | |
} | |
// Define other methods and classes here | |
public enum StepStatus | |
{ | |
NotStarted, | |
InProgress, | |
Aborted, | |
ExecutionError, | |
Finished | |
} | |
public enum StepResult | |
{ | |
NA, | |
Undetermined, | |
Pass, | |
Fail | |
} | |
public class ProcessStepResult | |
{ | |
public string DeviceId { get; set; } | |
public string WaferId { get; set; } | |
public string StepName { get; set; } | |
public string StepId { get; set; } | |
public bool Latest { get; set; } | |
public StepResult Result { get; set; } | |
public StepStatus Status { get; set; } | |
public DateTimeOffset StopTime { get; set; } | |
} | |
public class WaferResult | |
{ | |
public string WaferId { get; set; } | |
public DeviceResult[] DeviceResults { get; set; } | |
public DateTimeOffset FirstUpdated { get; set; } | |
public DateTimeOffset LastUpdated { get; set; } | |
} | |
public class DeviceResult | |
{ | |
public string DeviceId { get; set; } | |
public string StepId { get; set; } | |
public string StepName { get; set; } | |
public string Result { get; set; } | |
public string Status { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment