BPS C++ API  2.24.4
BpsBarcode Class Reference

Utility class to process scanned bar codes. More...

#include <bpsbarcode.h>

Public Types

enum  Function {
  SSCC = 0 , GRAI = 1 , LotID = 100 , StockLocation = 200 , ArticleCU = 300 , ArticleTU = 301 , ArticleLU = 302 , NetWeight = 320 , Partner = 400 , ShipToPartner = 401 ,
  BillToPartner = 402 , SellingPartner = 403 , DeliveringPartner = 404 , InvoicingPartner = 405 , OriginCountry = 422 , ProcessCountry = 423 , Slaughterhouse = 7030 , CuttingHall1 = 7031 , CuttingHall2 = 7032 , CuttingHall3 = 7033
}
 Bar code function types. More...
 

Public Member Functions

 BpsBarcode (BpsDatastore *aDatastore)
 
 BpsBarcode (BpsDatastore *aDatastore, char aCode, const QString &aData)
 
 BpsBarcode (BpsDatastore *aDatastore, const QString &aName, const QString &aData)
 
 BpsBarcode (const BpsBarcode &aOther)
 The copy constructor. More...
 
char code () const
 
QString data () const
 
QString data (Function aFunction, bool aForLookup) const
 
bool hasGs1Data () const
 Test if this bar code is using GS1 data format with application identifiers (AI). More...
 
QStringList names () const
 
QStringList names (Function aFunction) const
 
void setCode (char aCode)
 Set code identifier. More...
 
void setData (const QString &aData)
 Set bar code data (without the code type identifier). More...
 
void setName (const QString &aName)
 Set code type name. More...
 

Static Public Member Functions

static QMap< char, QStringListcodeNames ()
 
static bool hasGs1Data (char aCode)
 Test if a given bar code type is using GS1 data format with application identifiers (AI). More...
 
static bool hasGs1Data (const QString &aName)
 Test if a given bar code name is using GS1 data format with application identifiers (AI). More...
 
static QList< BpsBarcode::FunctionpartnerFunctions ()
 

Detailed Description

Utility class to process scanned bar codes.

Barcode settings

The mapping of bar code types and application identifiers is taken from the central system settings. For each function the settings in Central System Settings/Scanning can hold a comma separated list of bar codes.

Example bar code lists in those settings:

  • EAN8,EAN13,RSS14 : Any of EAN 8, 13 or RSS 14
  • GS1128(91),39 : Either content of AI 91 in a GS1-128 (formerly EAN-128) bar code, or a Code 39

See chapter Barcode scanning in the manual for more details.

Lookup preprocessing

The barcode data retrieved can be preprocessed for lookup. In this case only the length of the returned data should be matched against the code in the lookup table.

CI Name Preprocessing
A EAN8 The check digit is truncated and the returned data length is 7.
B EAN13 In case the flag is 21, 22, 28 or 29 a code containing price or weight is assumed. The 5 price/weight digits and the check digit is truncated, and the returned data length is 7. For all other flags only the check digit is truncated and the returned data length is 12.

Member Enumeration Documentation

◆ Function

Bar code function types.

Enumerator
SSCC 

Serial shipping container code.

GRAI 

Global returnable asset identifier.

LotID 

Lot ID.

StockLocation 

Stock location.

ArticleCU 

Article consumer unit.

ArticleTU 

Article trading unit.

ArticleLU 

Article logistic unit.

NetWeight 

Net weight.

Partner 

General partner.

ShipToPartner 

Ship to partner.

BillToPartner 

Bill to partner.

SellingPartner 

Selling partner.

DeliveringPartner 

Delivering partner (distributor).

InvoicingPartner 

Invoicing partner.

OriginCountry 

Country of origin or birth.

ProcessCountry 

Country of initial processing or raise up.

Slaughterhouse 

Country/Approval No. or 999/GLN of slaugherhouse.

CuttingHall1 

Country/Approval No. or 999/GLN of first cutting hall.

CuttingHall2 

Country/Approval No. or 999/GLN of second cutting hall.

CuttingHall3 

Country/Approval No. or 999/GLN of third cutting hall.

Constructor & Destructor Documentation

◆ BpsBarcode() [1/4]

BpsBarcode::BpsBarcode ( BpsDatastore aDatastore)
Parameters
aDatastoreThe current datastore object.

◆ BpsBarcode() [2/4]

BpsBarcode::BpsBarcode ( BpsDatastore aDatastore,
char  aCode,
const QString aData 
)
Parameters
aDatastoreThe current datastore object.
aCodeThe code type identifier.
aDataThe code without prefix, suffix and code type identifier.

◆ BpsBarcode() [3/4]

BpsBarcode::BpsBarcode ( BpsDatastore aDatastore,
const QString aName,
const QString aData 
)
Parameters
aDatastoreThe current datastore object.
aNameThe code type name.
aDataThe data without prefix, suffix and code type identifier.

◆ BpsBarcode() [4/4]

BpsBarcode::BpsBarcode ( const BpsBarcode aOther)

The copy constructor.

Parameters
aOtherThe original object to clone.

Member Function Documentation

◆ code()

char BpsBarcode::code ( ) const
Returns
Bar code type identifier.

◆ codeNames()

static QMap<char,QStringList> BpsBarcode::codeNames ( )
static
Returns
Map of scan code ID's to names. A single code can map to multiple names, thus the names are in a string list.

◆ data() [1/2]

QString BpsBarcode::data ( ) const
Returns
The complete bar code data (without the code type identifier).

◆ data() [2/2]

QString BpsBarcode::data ( Function  aFunction,
bool  aForLookup 
) const
Parameters
aFunctionThe function to find the data for.
aForLookupWhen true, EAN8 and EAN13 data is preprocessed for lookup (see class description). For other barcode types this parameter has no effect.
Returns
The functions data portion, or an empty string when bar code has no such function data.

◆ hasGs1Data() [1/3]

bool BpsBarcode::hasGs1Data ( ) const

Test if this bar code is using GS1 data format with application identifiers (AI).

Returns
True if using GS1 data format, false if other format.

◆ hasGs1Data() [2/3]

static bool BpsBarcode::hasGs1Data ( char  aCode)
static

Test if a given bar code type is using GS1 data format with application identifiers (AI).

Parameters
aCodeThe bar code identifier.
Returns
True using GS1 data format, false if other formatting.

◆ hasGs1Data() [3/3]

static bool BpsBarcode::hasGs1Data ( const QString aName)
static

Test if a given bar code name is using GS1 data format with application identifiers (AI).

Parameters
aNameThe code type name.
Returns
True using GS1 data format, false if other formatting.

◆ names() [1/2]

QStringList BpsBarcode::names ( ) const
Returns
The bar code names matching the current code identifier.

◆ names() [2/2]

QStringList BpsBarcode::names ( Function  aFunction) const
Parameters
aFunctionThe function to find the type names for.
Returns
The allowed bar code type names for a certain function.

◆ partnerFunctions()

static QList<BpsBarcode::Function> BpsBarcode::partnerFunctions ( )
static
Returns
List of all partner functions

◆ setCode()

void BpsBarcode::setCode ( char  aCode)

Set code identifier.

Parameters
aCodeThe new code identifier.

◆ setData()

void BpsBarcode::setData ( const QString aData)

Set bar code data (without the code type identifier).

Parameters
aDataThe new bar code data.

◆ setName()

void BpsBarcode::setName ( const QString aName)

Set code type name.

Parameters
aNameThe new code type name.

The documentation for this class was generated from the following file: