Batch results written into the built in Results database.

This commit is contained in:
Milan Hanajik
2016-01-08 13:51:54 +01:00
parent f5642a2676
commit b131ba01a8
3 changed files with 96 additions and 15 deletions
@@ -664,19 +664,21 @@ namespace TBF.BenchControl.Sequences
}
while (e.Contains(Event.Busy));
/// TODO: Reimplement !!!!!!!!!!!
/////
///// Save to database and to 'summary results' logger
/////
//IList<TestResult> sortedResults = Utils.GetSortedTestResults(StateMachine.Procedure, results, 0);
//foreach (var rslt in sortedResults)
//{
// if (rslt != null)
// {
// Config.FluentCommon.SaveToDb(StateMachine.WtSession, rslt);
// summaryResults.Info(TestResult2CsvLine(rslt));
// }
//}
bool resultsSent = !e.Contains(Event.Error);
ProcessData.BatchRslts.Batch.RsltsSent = resultsSent;
///
/// Save results to the built in 'Results' database
///
Results.DB.SaveNewBatch(ProcessData.BatchRslts.Batch);
///
/// Save results to 'summary results' logger
///
foreach (var tr in ProcessData.BatchRslts.Batch.TestRslts)
{
summaryResults.Info(TestResult2CsvLine(tr));
}
Program.LocalSettings.BatchNr++;
@@ -692,6 +692,14 @@ namespace TBF.BenchControl.Sequences
{
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, part);
if (tstRslt == null) return string.Empty;
return TestResult2CsvLine(tstRslt);
}
protected string TestResult2CsvLine(Results.Entities.TestRslt tstRslt)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(tstRslt.StartTime);
@@ -776,7 +784,7 @@ namespace TBF.BenchControl.Sequences
{
if (!ProcessData.BatchRslts.WaterMeters[i].Compound())
{
Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.Single);
if (mtrRslt != null)
{
@@ -810,7 +818,7 @@ namespace TBF.BenchControl.Sequences
{
for (byte b = (byte)CompoundMeterId.CompoundMain; b <= (byte)CompoundMeterId.Compound; b++)
{
Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, (CompoundMeterId)b);
Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, (CompoundMeterId)b);
if (mtrRslt != null)
{