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, QStringList > | codeNames () |
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::Function > | partnerFunctions () |
Utility class to process scanned bar codes.
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:
See chapter Barcode scanning in the manual for more details.
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. |
enum BpsBarcode::Function |
Bar code function types.
BpsBarcode::BpsBarcode | ( | BpsDatastore * | aDatastore | ) |
aDatastore | The current datastore object. |
BpsBarcode::BpsBarcode | ( | BpsDatastore * | aDatastore, |
char | aCode, | ||
const QString & | aData | ||
) |
aDatastore | The current datastore object. |
aCode | The code type identifier. |
aData | The code without prefix, suffix and code type identifier. |
BpsBarcode::BpsBarcode | ( | BpsDatastore * | aDatastore, |
const QString & | aName, | ||
const QString & | aData | ||
) |
aDatastore | The current datastore object. |
aName | The code type name. |
aData | The data without prefix, suffix and code type identifier. |
BpsBarcode::BpsBarcode | ( | const BpsBarcode & | aOther | ) |
The copy constructor.
aOther | The original object to clone. |
char BpsBarcode::code | ( | ) | const |
|
static |
QString BpsBarcode::data | ( | ) | const |
aFunction | The function to find the data for. |
aForLookup | When true, EAN8 and EAN13 data is preprocessed for lookup (see class description). For other barcode types this parameter has no effect. |
bool BpsBarcode::hasGs1Data | ( | ) | const |
Test if this bar code is using GS1 data format with application identifiers (AI).
|
static |
Test if a given bar code type is using GS1 data format with application identifiers (AI).
aCode | The bar code identifier. |
|
static |
Test if a given bar code name is using GS1 data format with application identifiers (AI).
aName | The code type name. |
QStringList BpsBarcode::names | ( | ) | const |
QStringList BpsBarcode::names | ( | Function | aFunction | ) | const |
aFunction | The function to find the type names for. |
|
static |
void BpsBarcode::setCode | ( | char | aCode | ) |
Set code identifier.
aCode | The new code identifier. |
void BpsBarcode::setData | ( | const QString & | aData | ) |
Set bar code data (without the code type identifier).
aData | The new bar code data. |
void BpsBarcode::setName | ( | const QString & | aName | ) |
Set code type name.
aName | The new code type name. |