MainSeq change to Restore a previously saved batch results, ver. 2.12.544

This commit is contained in:
Milan Hanajik 2017-04-20 13:45:38 +02:00
parent 45869401ad
commit 9cc9e4b4c9
3 changed files with 46 additions and 9 deletions

View File

@ -286,6 +286,16 @@ namespace Results
batches = session.QueryOver<Batch>()
.Where(x => (x.BatchNr == batchNr))
.List();
foreach (var batch in batches)
{
batch.TestRslts = session.QueryOver<TestRslt>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
batch.WaterMeters = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch.Id == batch.Id))
.List();
}
}
catch (Exception exc)
{

View File

@ -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")]

View File

@ -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
/// <param name="newBatchNr">New unique batch number</param>
/// <param name="procedure">Reloaded procedure</param>
/// <returns></returns>
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