Examples
- Last UpdatedOct 29, 2018
- 2 minute read
The following sample code illustrates how to design a form with the SFC control. In this example, three recipe levels have been defined and the control has been configured, initialized and focused on a specific batch. If only two recipe levels are defined, the OperationsVisible property should be disabled and the MiscSet2LevelLabels method must be configured appropriately. The control is responsible for automatically displaying the operations and phases when a unit procedure is selected. This example assumes that the SFC ActiveX control has been properly added to the application.
private void Form_Load(object sender, EventArgs e)
{
// Define required local variable
string CLB = null;
// Set SFC control properties
BatchSFCVar.Host = "BATCHSERVER";
BatchSFCVar.UnitProceduresVisible = 1;
BatchSFCVar.OperationsVisible = 1; //zero for two recipe levels
BatchSFCVar.PhasesVisible = 1;
BatchSFCVar.MiscSet2LevelLabels (false); //true for two recipe levels
BatchSFCVar.EnableBranchSelection (true);
// Initialize communication wiht the batch server
BatchSFCVar.Init();
//Set focus to campaign "C1", lot "L1:, batch B1
CLB = "C1/L1/B1";
BatchSFCVar.SetCLBFocus (CLB);
}
The following example is slightly more complex and uses the Batch ActiveX control to automatically determine the number of recipe levels defined and sets the SFC control accordingly. This example assumes that both the SFC and the Batch ActiveX Controls have been properly added to the application.
For more information on the Batch ActiveX control, see Chapter 4, AVEVA Batch Management ActiveX Control.
private void Form_Load(object sender, EventArgs e)
{
// Define required local variables
string CLB = null;
int TwoRecipeLevels = 0;
// Query number of recipe levels from the Batch ActiveX control
TwoRecipeLevels = BatchOcxVar.MiscGet2Levels();
// Set SFC control properties
BatchSFCVar.Host = "BATCHSERVER";
BatchSFCVar.UnitProceduresVisible = 1;
if (TwoRecipeLevels == 1)
{
// Configure the SFC control for two recipe levels
BatchSFCVar.OperationsVisible = 0;
BatchSFCVar.MiscSet2LevelLabels (true);
}
else
{
// Configure the SFC control for three recipe levels
BatchSFCVar.OperationsVisible = 1;
BatchSFCVar.MiscSet2LevelLabels (false);
}
BatchSFCVar.PhasesVisible = 1;
BatchSFCVar.EnableBranchSelection (true);
// Initialize Communication with Batch Server
BatchSFCVar.Init();
// Set focus to campaign "C1", lot "L1", batch "B1"
CLB = "C1/L1/B1";
BatchSFCVar.SetCLBFocus (CLB);
}