Barcode Scan Transitions: To Implement a Simple Transition Flow

This activity will walk you through the implementation of a simple transition flow, which cannot be used for producing a branching structure of transitions.

Story

Suppose that you have defined the following scan states for the scan mode of a custom form:
  • RefNbrState
  • LocationState
  • InventoryItemState
  • LotSerialState
  • ConfirmState
You need to implement transition rules between these states as follows:
  1. From RefNbrState to LocationState
  2. From LocationState to InventoryItemState
  3. From InventoryItemState to LotSerialState
Tip:
You will not implement the last transition, which is from LotSerialState to ConfirmState, because it is performed automatically once the system detects that there is a confirmation state and that the last input state is trying to move the barcode-driven engine further.

Process Overview

You will use the ScanMode.StateFlow() helper method to implement the simple one-by-one chain of input states.

System Preparation

Before you begin performing the step of this activity, do the following:

  1. Prepare an MYOB Acumatica instance by performing the Test Instance: To Deploy an Instance prerequisite activity.
  2. Create a barcode scan class by performing the Barcode Scan Class: To Create a Barcode Scan Class prerequisite activity.
  3. Create the scan mode and define its required properties by performing the Barcode Scan Mode: To Define the Required Properties prerequisite activity.
  4. Create the set of scan states by performing the Barcode Scan States: To Create the Set of Scan States prerequisite activity.

Step: Defining the Transition Flow

Define the scan transition flow as follows.

public sealed class CountMode : ScanMode
{
    ...
  
    protected override IEnumerable<ScanTransition<INScanCount>> CreateTransitions()
    {
        return StateFlow(flow => flow
            .From<RefNbrState>() 
            .NextTo<LocationState>() 
            .NextTo<InventoryItemState>()
            .NextTo<LotSerialState>());
    }
  
    ...
}