TBF : (1) SensusOracle.Database implements IStartInfoReader, (2) MainSeq invokes ReadStartInfoOp of result writers that implement IStartInfoReader.
This commit is contained in:
@@ -416,27 +416,6 @@ namespace TBF.BenchControl.Sequences
|
||||
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)
|
||||
{
|
||||
for (int i = StateMachine.Procedure.Tests.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (StateMachine.Procedure.Tests[i].Name.ToLower().Contains("write") ||
|
||||
StateMachine.Procedure.Tests[i].Name.ToLower().Contains("reset"))
|
||||
{
|
||||
StateMachine.Procedure.Tests.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure);
|
||||
|
||||
for (int i = StateMachine.Procedure.Tests.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (StateMachine.Procedure.Tests[i].Name.ToLower().Contains("adj"))
|
||||
{
|
||||
StateMachine.Procedure.Tests.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure);
|
||||
@@ -451,7 +430,7 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
/// Display 'Cycle Begin Form' in case of a normal batch (not a restored batch)
|
||||
///
|
||||
if (selection != Selection.RestoreBatch && selection != Selection.Custom)
|
||||
if (selection != Selection.RestoreBatch)
|
||||
{
|
||||
if (OpenCycleBeginForm()) goto stop;
|
||||
}
|
||||
@@ -547,34 +526,47 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
modelessDlg = null;
|
||||
}
|
||||
|
||||
if (selection == Selection.Custom)
|
||||
///
|
||||
/// Read start info from the DB @ cycle start
|
||||
///
|
||||
State readingStartInfo = State.Create("MainSeq : Reading start info from DB");
|
||||
///
|
||||
string[] resultWriters = StateMachine.Procedure.ResultsWriter.Split(new char[] { '~' });
|
||||
foreach (var writerName in resultWriters)
|
||||
{
|
||||
IStartInfoReader infoReader = TbfComponents.FindComponent(writerName) as IStartInfoReader;
|
||||
if (infoReader != null)
|
||||
{
|
||||
/// Load existing data from databases
|
||||
Results.DBase.Databases.Clear();
|
||||
try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.197; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR10")); }
|
||||
catch (Exception exc) { log.ErrorFormat("Cannot open WR10 result database: {0}", exc.Message); }
|
||||
try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.98; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR11")); }
|
||||
catch (Exception exc) { log.ErrorFormat("Cannot open WR11 result database: {0}", exc.Message); }
|
||||
try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.152; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR13")); }
|
||||
catch (Exception exc) { log.ErrorFormat("Cannot open WR13 result database: {0}", exc.Message); }
|
||||
try { Results.DBase.Databases.Add(new Results.DBase("SERVER=10.42.128.63; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", "WR15")); }
|
||||
catch (Exception exc) { log.ErrorFormat("Cannot open WR15 result database: {0}", exc.Message); }
|
||||
|
||||
for (int i = 0; i < BatchRslts.WaterMeters.Length; i++)
|
||||
try
|
||||
{
|
||||
WaterMeter newWM = BatchRslts.WaterMeters[i];
|
||||
for (int j = 0; j < Results.DBase.Count; j++)
|
||||
{
|
||||
NHibernate.ISession sesn = Results.DBase.Databases[j].OpenSession();
|
||||
|
||||
IList<WaterMeter> watermeters = sesn.QueryOver<WaterMeter>().Where(x => (x.SerialNr == newWM.SerialNr)).List();
|
||||
if (watermeters.Count > 0)
|
||||
{
|
||||
BatchRslts.WaterMeters[i].CopyContentFrom(watermeters[watermeters.Count - 1]); /// Copy results from the last occurance of the watermeter
|
||||
}
|
||||
}
|
||||
IOperation op = infoReader.ReadStartInfoOp(ProcessData.BatchRslts.Batch);
|
||||
if (op != null) readingStartInfo.AddOperation(op);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Bridge.OnError(this, string.Format(Strings.Component_0_crashed_Results_not_saved, writerName));
|
||||
log.FatalFormat("StartInfoReader {0} crashed: {1}", writerName, exc.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
if (readingStartInfo.Operations.Count > 0)
|
||||
{
|
||||
readingStartInfo.AddOperation(checkUiOp).EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
|
||||
if (e.Contains(Event.InfoNotRead))
|
||||
{
|
||||
log.ErrorFormat("StartInfoReader failed to read data from the database");
|
||||
/// TODO: Message for an operator? Error?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +576,7 @@ namespace TBF.BenchControl.Sequences
|
||||
benchFilled = true;
|
||||
Bridge.Bench2UI(ButtonsEtc.ShowBenchFilled);
|
||||
|
||||
if (selection != Selection.PurgeBegin && selection != Selection.RestoreBatch && selection != Selection.Custom)
|
||||
if (selection != Selection.PurgeBegin && selection != Selection.RestoreBatch)
|
||||
{
|
||||
goto cycle_or_test_selected;
|
||||
}
|
||||
@@ -1252,7 +1244,6 @@ namespace TBF.BenchControl.Sequences
|
||||
SaveResults,
|
||||
RestoreBatch,
|
||||
Shutdown,
|
||||
Custom,
|
||||
}
|
||||
|
||||
|
||||
@@ -1342,7 +1333,6 @@ namespace TBF.BenchControl.Sequences
|
||||
if (e.Contains(Event.UiCmdStartQ3)) return Selection.Q3;
|
||||
if (e.Contains(Event.UiCmdAcceptResults)) return Selection.SaveResults;
|
||||
if (e.Contains(Event.UiCmdReloadBatch)) return Selection.RestoreBatch;
|
||||
if (e.Contains(Event.UiCmdCustom)) return Selection.Custom;
|
||||
}
|
||||
while (true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user