Skip to content

Barcode Scanning API #713

Closed
Closed

Description

@SchrodingersGat

Following on from the discussion in #677

Provide an API endpoint for sending scanned data for validation.

Workflow

  1. Client application (web / app / third-party) scans barcode and extracts json data object
  2. JSON data is sent to server
  3. Data are parsed by the server, and "sanitized" into a standard barcode-metadata object
  4. Sanitized (and error-checked) data object passed back to the client for further actions

Barcode Formats

InvenTree
Barcodes can be provided in different "formats". The default format is the QR code generated by InvenTree itself for a StockItem or StockLocation. This barcode data contains some very simple ID information about an element - other data is provided via API lookup.

Manufacturer
Manufacturer / supplier barcode support can be added via a simple translation layer. These barcodes are actually much more useful than the InvenTree ones, as they can be used for:

  • Unique lookup of StockItem by scanning original manufacturer tag
  • Scanning of incoming goods - backend compares metadata to match against a purchaseorder

Plugins

Each "manufacturer" barcode style will be supported via a "Plugin" which is loaded by the server. The plugin must provide a certain set of functions and be able to validate a certain style of barcode.

Activity

  1. added
    enhancement
    on Apr 13, 2020
  2. maholli commented on Apr 13, 2020

    @maholli

    Hooray! Awesome work @SchrodingersGat

    RE: Plugins

    Rather than having each manufacturer as a separate plugin, I took a different approach with my getparts() plugin (new name). We could break it up as you suggest, but then we'll need some preliminary script that determines the appropriate supplier from the barcode information. Getparts() does supplier determination and part query in one step.

    RE: workflow

    1. Data are parsed by the server, and "sanitized" into a standard barcode-metadata object

    Do we know exactly what we want in the standard barcode-metadata object? If you can list them for me I'll modify getparts() to output only those fields.

    Currently:

    >> api = getparts.API(app_credentials)
    >> result = api.search(barcode) # result is JSON
    >> print(result)
    >> {
    >>    "Capacitance": "10nF",
    >>    "Description": "10nF ±10% 50V X7R 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT RoHS",
    >>    "Datasheet": "Walsin Tech Corp 0603B103K500CT",
    >>    "Manufacturer": "Walsin Tech Corp",
    >>    "Package": "0603",
    >>    "Voltage - Rated": "50V"
    >> }

    So we need to decide on...

    1. What the standard metadata should be,
    2. THEN decide if getparts() should massage part-specific keys like "Capacitance" into something more general like "Value".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions