diff --git a/Results/DB.cs b/Results/DB.cs index 4ba14057f..86631c224 100644 --- a/Results/DB.cs +++ b/Results/DB.cs @@ -286,6 +286,16 @@ namespace Results batches = session.QueryOver() .Where(x => (x.BatchNr == batchNr)) .List(); + + foreach (var batch in batches) + { + batch.TestRslts = session.QueryOver() + .Where(x => (x.Batch.Id == batch.Id)) + .List(); + batch.WaterMeters = session.QueryOver() + .Where(x => (x.Batch.Id == batch.Id)) + .List(); + } } catch (Exception exc) { diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index e9752d822..3d74b3b3b 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.12.486.0")] -[assembly: AssemblyFileVersion("2.12.486.0")] +[assembly: AssemblyVersion("2.12.544.0")] +[assembly: AssemblyFileVersion("2.12.544.0")] diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index a4b64eb87..88c6f548b 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -240,8 +240,8 @@ namespace TBF.BenchControl.Sequences if (selection == Selection.RestoreBatch) { - BatchRslts = RestoreBatchResults(TBF.UiBridge.Bridge.BatchNr, /// Original batch number - newBatchNr); /// New batch number + BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure); + RestoreBatchResults(TBF.UiBridge.Bridge.BatchNr, ref BatchRslts); /// pass the original batch number of the batch to be restored } else if (selection == Selection.Custom) { @@ -1358,15 +1358,42 @@ namespace TBF.BenchControl.Sequences /// New unique batch number /// Reloaded procedure /// - Results.BatchResults RestoreBatchResults(int oriBatchNr, int newBatchNr) + void RestoreBatchResults(int oriBatchNr, ref Results.BatchResults batchResults) { - Batch batch = Results.DB.LoadBatch(oriBatchNr); - batch.BatchNr = newBatchNr; - return Results.BatchResults.FromBatch(batch); + Batch oriBatch = Results.DB.LoadBatch(oriBatchNr); + + batchResults.Batch.StartTime = oriBatch.StartTime; + + foreach (var testRslt in batchResults.Batch.TestRslts) + { + foreach (var oriTstRslt in oriBatch.TestRslts) + { + if (testRslt.Name() == oriTstRslt.Name() && + testRslt.Part == oriTstRslt.Part && + testRslt.RepetitionNr == oriTstRslt.RepetitionNr) + { + testRslt.CopyContentFrom(oriTstRslt); + break; + } + } + } + + for (int i = 0; i < batchResults.WaterMeters.Length; i++) + { + WaterMeter wm = batchResults.WaterMeters[i]; + foreach (var wm2 in oriBatch.WaterMeters) + { + if (wm.WMPosition == wm2.WMPosition) + { + wm.CopyContentFrom(wm2); + break; + } + } + } } - void CollectSimultSteps() + void CollectSimultSteps() { /// /// Collect steps (e.g. iPerl communication) to be done simultaneously with purging