DataEntry dlg at the beginning closes at the end of the 1st test (at the latest)

This commit is contained in:
Milan Hanajik 2015-01-15 03:51:33 +01:00
parent a697b7a4dc
commit 49a004d7fe
2 changed files with 80 additions and 45 deletions

View File

@ -1,4 +1,3 @@
- zdruzeny: vysledky na process obrazovke sa opakuju 3x
- s/n sa nedostalo do vysledkov - s/n sa nedostalo do vysledkov
- oprava process obrazovky - oprava process obrazovky

View File

@ -29,7 +29,9 @@ namespace TBF.BenchControl.Sequences
/// <returns></returns> /// <returns></returns>
public IList<Event> Execute(Entities.Test dummyArg) public IList<Event> Execute(Entities.Test dummyArg)
{ {
/// Operations running in more then one state bool beginningDlgClosed = true;
/// Operations running in more then one state
checkUiOp = new CheckUIOp(true); checkUiOp = new CheckUIOp(true);
IList<Event> e; IList<Event> e;
@ -209,19 +211,8 @@ namespace TBF.BenchControl.Sequences
case Event.UiCmdStop: goto stop; case Event.UiCmdStop: goto stop;
} }
//-------------------------------- if (OpenDataEntryBeginning()) goto stop;
GenericDevices.IDataEntry dataEntryCmpnt = beginningDlgClosed = false;
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt is IHasCycleBeginForm)
{
Bridge.OnActivity(this, "Enter the water meter data");
State.Create("MainSeq : Enter begin data")
.AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters))
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
}
assume_bench_filled: assume_bench_filled:
@ -283,6 +274,12 @@ namespace TBF.BenchControl.Sequences
//-------------------------------------------------------------- //--------------------------------------------------------------
e = testMethodSequence.Execute(test); e = testMethodSequence.Execute(test);
if (!beginningDlgClosed)
{
beginningDlgClosed = true;
if (OpenDataEntryBeginning()) goto stop;
}
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
if (e.Contains(Event.OpArgumentError)) goto config_error; if (e.Contains(Event.OpArgumentError)) goto config_error;
if (e.Contains(Event.UiCmdStop)) goto stop; if (e.Contains(Event.UiCmdStop)) goto stop;
@ -316,9 +313,15 @@ namespace TBF.BenchControl.Sequences
//-------------------------------------------------------------- //--------------------------------------------------------------
e = testMethodSequence.Execute(test); e = testMethodSequence.Execute(test);
if (e.Contains(Event.Error)) goto error; if (!beginningDlgClosed)
if (e.Contains(Event.OpArgumentError)) goto config_error; {
if (e.Contains(Event.UiCmdStop)) goto stop; beginningDlgClosed = true;
if (OpenDataEntryBeginning()) goto stop;
}
if (e.Contains(Event.Error)) goto error;
if (e.Contains(Event.OpArgumentError)) goto config_error;
if (e.Contains(Event.UiCmdStop)) goto stop;
} }
} }
@ -340,37 +343,11 @@ namespace TBF.BenchControl.Sequences
//-------------------------------- //--------------------------------
string protocolTitle = string.Empty; string protocolTitle = string.Empty;
dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry; GenericDevices.IDataEntry dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt != null) if (dataEntryCmpnt != null)
{ {
Bridge.OnActivity(this, "Enter the protocol data"); Bridge.OnActivity(this, "Enter the protocol data");
if (dataEntryCmpnt is IHasCycleBeginForm)
{
if (!State.LastEvents.Contains(Event.ModelessFormClosed))
{
/// Wait until modeless dialg is closed
State.Create("MainSeq : Check whether the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
}
while (!e.Contains(Event.ModelessFormClosed));
}
/// A state without any dataEntryCmpnt operation so that Stop() when entering
/// this state and Start() when entering the following state are executed.
State.Create("MainSeq : Nothing")
.AddOperation(checkUiOp)
.RemovePermanentOperation(dataEntryCmpnt as IOperation)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) goto stop;
}
if (dataEntryCmpnt is IHasCycleEndForm) if (dataEntryCmpnt is IHasCycleEndForm)
{ {
/// Open the modeless form for the end of the cycle /// Open the modeless form for the end of the cycle
@ -715,6 +692,65 @@ namespace TBF.BenchControl.Sequences
while (true) StateMachine.WaitRunDevsRunOps(); while (true) StateMachine.WaitRunDevsRunOps();
} }
/// <summary>
/// Opens a modeless dialog for entering data at the beginning of a procedure (serial numbers)
/// </summary>
/// <returns>false = OK, true = stop pressed</returns>
bool OpenDataEntryBeginning()
{
IList<Event> e;
GenericDevices.IDataEntry dataEntryCmpnt =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt is IHasCycleBeginForm)
{
Bridge.OnActivity(this, "Enter the water meter data");
State.Create("MainSeq : Enter begin data")
.AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters))
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) return true;
}
return false;
}
/// <summary>
/// Waits until a modeless dialog for entering data at the beginnig of a procedure is closed.
/// This function is typically called at the end of the first test of the procedure.
/// </summary>
/// <returns>false = OK, true = stop pressed</returns>
bool CloseDataEntryBeginning()
{
IList<Event> e;
GenericDevices.IDataEntry dataEntryCmpnt =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt as IHasCycleBeginForm != null)
{
if (!State.LastEvents.Contains(Event.ModelessFormClosed))
{
/// Wait until modeless dialg is closed
State.Create("MainSeq : Check whether the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) return true;
}
while (!e.Contains(Event.ModelessFormClosed));
}
/// A state without any dataEntryCmpnt operation so that Stop() when entering
/// this state and Start() when entering the following state are executed.
State.Create("MainSeq : Nothing")
.AddOperation(checkUiOp)
.RemovePermanentOperation(dataEntryCmpnt as IOperation)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) return true;
}
return false;
}
/// <summary> /// <summary>
/// Perform a camera test /// Perform a camera test