从扫描GS1型棒code提取信息 [英] Extracting information from a scanned GS1-type barcode

查看:389
本文介绍了从扫描GS1型棒code提取信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发在Android Studio中的一个应用程序在扫描棒code来获得项目的到期日。

I am developing an app on Android Studio to get the expiry date of items upon scanning the barcode.

我不希望用户安装ZXing吧code单独的应用程序,所以我嵌入式斑马线code到我的项目。这样做我已经能够获得的产品标识。

I don't want the user to install ZXing barcode app separately so I embedded the ZXing code into my project. Doing this I have been able to obtain the product identifier.

我也想用扫描棒code数据获取产品信息,如描述,制造商和到期日。我该怎么做?

I also want to get product information such as the description, manufacturer and expiry date using the scanned barcode data. How can I do that?

推荐答案

有参与获得由GS1型棒code,在GS1应用标识符标准格式存储数据psented重新$ P $信息两个进程

There are two processes involved in obtaining the information represented by a GS1-type barcode that stores data in GS1 Application Identifier Standard Format.


  1. 提取包含通过扫描符号所获得的GS1结构化数据中的数据字段(被称为应用程序标识符)的。这始终包含该项目的唯一标识符称为GTIN-14和的可以的补充包括信息,如到期日期,批号等。
    这个过程可以通过一个独立的应用程序来执行。

  2. 查找在一个数据库中提取的GTIN,无论是本地应用程序或通过一些公开的API,提供产地,生产厂家的国家的文字重新presentation和可能的项目描述。
    要执行此过程融为一体prehensively应用程序需要访问外部资源。

  1. Extraction of the data fields (referred to as Application Identifiers) contained within the GS1-structured data obtained by scanning the symbol. This always includes a unique identifier for the item called a GTIN-14 and may include supplementary information such as an expiry date, LOT number, etc. This process can be performed by a standalone application.
  2. Lookup of the extracted GTIN in a database, either local to your application or via some public API, to provide a textual representation of the country of origin, manufacturer and possibly the item description. To perform this process comprehensively an application requires access to external resources.

提取

的GTIN任何补充信息的提取可以通过应用程序直接执行。 GS1格式的数据由应用标识符(AIS)和值的连续清单,用AI(01),它重新presents的GTIN。开始

Extraction of the GTIN and any supplementary information can be performed directly by your application. GS1-formatted data consists of a concatenated list of Application Identifiers (AIs) and values, beginning with AI (01) which represents the GTIN.

例如,数据(01)95012345678903(10)000123(17)150801重新presents以下信息:

For example, the data "(01) 95012345678903 (10) 000123 (17) 150801" represents the following information:

GTIN:             95012345678903
BATCH/LOT:        000123
USE BY OR EXPIRY: 1st August 2015

第3部分: GS1应用标识符说明的的的 GS1一般规格提供每个应用程序标识符的意义和重要的还规定了AI值是否被定义的可变长度固定长度的在这种情况下,被提供的强制长度

Section 3: GS1 Application Identifier Definitions of the GS1 General Specifications provides the meaning of each of the Application Identifiers and importantly also states whether the AI values are by definition variable-length or fixed-length in which case the mandatory length is provided.

GS1酒吧codeS使用一个特殊的非数据字符(FNC1)都以指示该数据符合GS1应用标识符的标准格式,并划定从下一个AI的可变长度数据字段的结束。例如,上面的数据可以连接在code 128符号codeD为 {} FNC1 {019501234567890310000123 FNC1} 17150801 来产生以下GS1-128符号 [*]

GS1 barcodes use a special non-data character (FNC1) both to indicate that the data conforms to GS1 Application Identifier standard format and to delimit the end of a variable-length data field from the next AI. For example, the above data could be encoded in a Code 128 symbol as {FNC1}019501234567890310000123{FNC1}17150801 to produce the following GS1-128 symbol[*]:

GS1-128:(01)95012345678903(10)000123(17)150801

当这个符号是由一间酒吧code扫描仪读取它去codeD如下: [†]

When this symbol is read by a barcode scanner it is decoded as follows[†]:

019501234567890310000123{GS}17150801

请注意,最初的FNC1非数据字符被丢弃,可变长度的AI角色分离使用的FNC1已经重新由GS字符(ASCII值29)psented $ P $。

Note that the initial FNC1 non-data character has been discarded and the FNC1 used in the variable-length AI separator role has been represented by a GS character (ASCII value 29).

要真正从这个德codeD GS1符号需要你的应用程序中包含的数据结构,我们将称之为提取原始应用标识符数据AI-TABLE 映射AI模式为从挂到上面的GS1的普通规格部分提供的数据得出了它们的值的长度:

To actually extract the original Application Identifier data from this decoded GS1 symbol requires that your application contains a data structure that we shall refer to as AI-TABLE mapping AI patterns to the length of their values as derived from the data provided in the section of the GS1 General Specifications linked to above:

AI     | N (value length)
-------------------------
(00)   | 18
(01)   | 14
(10)   | variable
(17)   | 6
(240)  | variable
(310n) | 6
(37)   | variable
...

有了这个可以您可以从扫描棒code数据AI-值提取步骤如下:

With this available you can proceed with AI-value extraction from the scanned barcode data as follows:

while more data:
    AI,N = Entry from AI-TABLE matching a prefix of the data, otherwise FAIL.

    if N is fixed-length:
        VALUE = next N characters
    else N is variable length:
        VALUE = characters until "GS" or end of data

    emit: (AI) VALUE

在实践中,你可以选择在你的 AI-TABLE 来使您的应用程序执行加强了每个验证<$ C $多从一般规格数据C>值的类型和长度。然而,以上足以提取给出的数据,如AI(17)再presenting您正在寻找的截止日期。

In practise you may choose to include more of the data from the General Specifications in your AI-TABLE to permit your application to perform enhanced validation of each VALUE's type and length. However the above is sufficient to extract the given data, such as AI (17) representing the expiry date which you are looking for.

查找

要获得你有兴趣(这是不是直接连接在酒吧code codeD)剩余的数据,如该项目的名称和制造商的详细信息,您需要查找提取GTIN利用外部资源如本地产品数据库或可用

To obtain the remaining data that you are interested in (which is not directly encoded in the barcode) such as the item's name and manufacturer details requires that you look up the extracted GTIN using external resources such as a local product database or one of the public UPC database APIs that are available.

该GTIN本身包含原产国(实际上它重新presents国家GS1成员组织与该制造商注册,产地,所以不太国家),制造商标识 - 一起这些被称为GS1 preFIX,是可变长度的并且由GS1被分配 - 和其余的数字重新present这是由制造商自由分配的产品code

The GTIN itself contains a country of origin (actually it represents the national GS1 Member Organisation with which the manufacturer is registered, so not quite country of origin), manufacturer identifier – together these are referred to as the GS1 Prefix, are variable-length and are assigned by GS1 – and the remainder of the digits represent the product code which is assigned freely by the manufacturer.

给定一个GTIN,UPC一些数据库将只提供有关该GS1 preFIX细节,如GS1成员组织和制造商的文本再presentation。其他人试图维持个人GTIN分配到普通物品的记录,然而,这数据将始终有些不完整和过时,因为是实时的GTIN分配没有强制注册。

Given a GTIN, some UPC databases will provide only details relating to the GS1 Prefix such as a textual representation of the GS1 Member Organisation and the manufacturer. Others attempt to maintain a record of individual GTIN assignments to common items, however this data will always be somewhat incomplete and out of date as there is no mandatory registry of real time GTIN assignments.

答案这个问题提供免费的产品信息平台的一些例子。

The answers to this question provide some examples of free product information platforms.

[*]使用在线栏code生成发电机

[†]事实上,你可能会看到] {C1019501234567890310000123 GS} 17150801 在这种情况下GS1-128领先的符号标识 ] C1 可以丢弃。

[†] In fact you might see ]C1019501234567890310000123{GS}17150801 in which case the leading symbology identifier for GS1-128 ]C1 can be discarded.

这篇关于从扫描GS1型棒code提取信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆