Barcode Scan States: General Information

ScanState<TScanState> is a class for a barcode scan state. This class represents a component that contains the logic for handling a non-fixed input (such as a barcode, quantity, or date) of a barcode-driven MYOB Acumatica form.

Learning Objectives

In this chapter, you will learn how to do the following:

  • Create a set of scan states of a scan mode
  • Implement the input scan state
  • Implement the confirmation scan state

Applicable Scenarios

You create scan states in the following cases:

  • You have created a scan mode on a custom form and need to implement the set of scan states of this mode.
  • You have added a new scan mode on an existing barcode-driven form and need to implement the set of scan states of this mode.
  • You need to define a new scan state for an existing scan mode of a barcode-driven from.

Scan State Classes

You create particular instances of the ScanState<TScanState> class in the ScanMode<TScanBasis>.CreateStates() method. The order of states used in this method doesn't imply the actual order of the input states.

A scan state class can be one of the following types:
  • EntityState<TScanBasis, TEntity>: An input scan state that is used to transform a barcode to a particular entity, validate it, and then apply it to the barcode-driven form
  • ConfirmationState<TScanBasis>: A confirmation scan state that validates and confirms all changes accumulated by other scan states and completes the barcode processing cycle
  • CommandOnlyState<TScanBasis>: A built-in scan state that rejects any non-fixed input and reports to users that they should use only commands

Usually a scan mode has multiple input states and no more than one confirmation state.

The following diagram shows the relationships between these classes. For details about the methods and properties of these classes, see ScanState<TScanBasis> Class, EntityState<TScanBasis,TEntity> Class, ConfirmationState<TScanBasis> Class, and CommandOnlyStateBase<TScanBasis> Class.
Figure 1. Scan state classes