(1) MainSeq : Q1, Q2, Q3 buttons fixed, (2) outer loop error fix, (3) Components can be managed by Administrators only.
This commit is contained in:
parent
459cb5bb4a
commit
be82f1fe0e
@ -105,6 +105,7 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
IList<Event> e;
|
||||
Selection selection;
|
||||
string selectedTestName;
|
||||
|
||||
StateMachine.LoadProcedure(true); // TODO: Implement as an operation so that the worker thread is not blocked
|
||||
|
||||
@ -301,6 +302,14 @@ namespace TBF.BenchControl.Sequences
|
||||
do
|
||||
{
|
||||
selection = MakeSelection(MKSelContext.ProcedureNotSelected);
|
||||
switch (selection)
|
||||
{
|
||||
case Selection.Q1: selectedTestName = "Q1"; break;
|
||||
case Selection.Q2: selectedTestName = "Q2"; break;
|
||||
case Selection.Q3: selectedTestName = "Q3"; break;
|
||||
default: selectedTestName = Bridge.SelectedTestName; break;
|
||||
}
|
||||
|
||||
UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any)
|
||||
StateMachine.LoadProcedure(false);
|
||||
}
|
||||
@ -510,7 +519,14 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
//----------------------------------------------------------
|
||||
selection = MakeSelection(MKSelContext.InsideProcedure);
|
||||
///
|
||||
switch (selection)
|
||||
{
|
||||
case Selection.Q1: selectedTestName = "Q1"; break;
|
||||
case Selection.Q2: selectedTestName = "Q2"; break;
|
||||
case Selection.Q3: selectedTestName = "Q3"; break;
|
||||
default: selectedTestName = Bridge.SelectedTestName; break;
|
||||
}
|
||||
///
|
||||
UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any)
|
||||
///
|
||||
if (selection == Selection.PurgeBegin) goto fill_the_bench;
|
||||
@ -573,7 +589,7 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
if (selection == Selection.RestOfCycle) /// ... otherwise
|
||||
{
|
||||
Test slctdTest = TBF.BenchControl.StateMachine.GetTest(selection, out repetNr);
|
||||
Test slctdTest = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
|
||||
if (slctdTest == null)
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
|
||||
@ -620,8 +636,9 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
int currentTestIx = selsctedTestIx;
|
||||
int outerLoopStartIx = currentTestIx;
|
||||
bool isOuterLoopMode = false;
|
||||
int outerLoopStartIx = -1; /// This is to identify program errors
|
||||
int outerLoopRepeats = 0;
|
||||
while (currentTestIx < StateMachine.Tests.Count - simultWithEvacuationCount)
|
||||
{
|
||||
Test test = StateMachine.Tests[currentTestIx];
|
||||
@ -652,6 +669,10 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
StateMachine.LoadTestParams(test);
|
||||
ProcessData.RegisterReaders = sensPath.RegisterReaders;
|
||||
if (isOuterLoopMode && outerLoopRepeats != test.Repeats)
|
||||
{
|
||||
goto config_error;
|
||||
}
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
@ -673,7 +694,6 @@ namespace TBF.BenchControl.Sequences
|
||||
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
||||
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
|
||||
/// start, transition, flow detection, flow setting, aborted, test, transition, end
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
if (testMethod.DoTransitions())
|
||||
@ -700,6 +720,7 @@ namespace TBF.BenchControl.Sequences
|
||||
&& !e.Contains(Event.OpArgumentError)
|
||||
&& !e.Contains(Event.UiCmdStop));
|
||||
|
||||
if (e.Contains(Event.OuterLoopStart)) break; /// Do not repeat OuterLoopStart test in this loop
|
||||
if (lastTestFinished && !isOuterLoopMode) repetNr++;
|
||||
}
|
||||
while (lastTestFinished && !isOuterLoopMode && repetNr <= test.Repeats);
|
||||
@ -740,7 +761,13 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
else if (e.Contains(Event.OuterLoopStart))
|
||||
{
|
||||
if (isOuterLoopMode)
|
||||
{
|
||||
goto config_error;
|
||||
}
|
||||
|
||||
isOuterLoopMode = true;
|
||||
outerLoopRepeats = test.Repeats;
|
||||
repetNr = 1;
|
||||
outerLoopStartIx = currentTestIx;
|
||||
}
|
||||
@ -802,10 +829,10 @@ namespace TBF.BenchControl.Sequences
|
||||
deferredData.Clear();
|
||||
}
|
||||
///------------------------------------------------------------------------------------------------------------
|
||||
else /// if (selection == Selection.Test)
|
||||
else /// if (selection == Selection.Test or Q1 or Q2 or Q3)
|
||||
{
|
||||
int repetNr;
|
||||
Test test = TBF.BenchControl.StateMachine.GetTest(selection, out repetNr);
|
||||
Test test = TBF.BenchControl.StateMachine.GetTest(selectedTestName, out repetNr);
|
||||
if (test == null)
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
|
||||
|
||||
@ -424,32 +424,19 @@ namespace TBF.BenchControl
|
||||
/// </summary>
|
||||
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
|
||||
/// <returns>The selected test or null</returns>
|
||||
public static Config.Entities.Test GetTest(Sequences.MainSeq.Selection selection, out int repetNr)
|
||||
public static Config.Entities.Test GetTest(string selectedTestName, out int repetNr)
|
||||
{
|
||||
repetNr = 1;
|
||||
if ((selection == Sequences.MainSeq.Selection.Q1) && (Tests.Count >= 1))
|
||||
foreach (var test in Tests)
|
||||
{
|
||||
return Tests[0];
|
||||
}
|
||||
else if ((selection == Sequences.MainSeq.Selection.Q2) && (Tests.Count >= 2))
|
||||
{
|
||||
return Tests[1];
|
||||
}
|
||||
else if ((selection == Sequences.MainSeq.Selection.Q3) && (Tests.Count >= 3))
|
||||
{
|
||||
return Tests[2];
|
||||
}
|
||||
else if (selection == Sequences.MainSeq.Selection.Test || selection == Sequences.MainSeq.Selection.RestOfCycle)
|
||||
{
|
||||
foreach (var test in Tests)
|
||||
if (test.Name.Equals(selectedTestName)) return test; /// Test name specified, keep repetNr = 1
|
||||
|
||||
for (int i = 1; i <= test.Repeats; i++)
|
||||
{
|
||||
for (int i = 1; i <= test.Repeats; i++)
|
||||
if (Utils.TestTitle(test, i).Equals(selectedTestName))
|
||||
{
|
||||
if (Utils.TestTitle(test, i).Equals(UiBridge.Bridge.SelectedTestName))
|
||||
{
|
||||
repetNr = i;
|
||||
return test;
|
||||
}
|
||||
repetNr = i;
|
||||
return test;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ namespace TBF
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = Users.Grp.GID.Metrologists;
|
||||
sharedButtons.RequiredGroupMembership = Users.Grp.GID.Administrators;
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up |
|
||||
|
||||
Loading…
Reference in New Issue
Block a user