inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.36k stars 790 forks source link

DigiKey barcode integration: Barcode matches existing item #7637

Open dieselburner opened 4 months ago

dieselburner commented 4 months ago

Please verify that this bug has NOT been raised before.

Describe the bug*

Linking barcodes via purchase order from DigiKey (Receive line item button) leads to following error:

Barcode matches existing item

While checking already linked barcode identifiers via admin panel I have found out server responds with:

{
    "stockitem": {
        "pk": 54,
        "api_url": "/api/stock/54/",
        "web_url": "/stock/item/54/"
    },
    "plugin": "InvenTreeBarcode",
    "barcode_data": "[)>\u001e06\u001dP182\u001d1PS3B-PH-K-S\u001d30P455-1720-ND\u001dK\u001d1K87684816\u001d10K105867004\u001d9D2022-05\u001d1TS30784-17\u001d11K1\u001d4LMY\u001dQ2\u001d11ZPICK\u001d12Z926627\u001d13Z999999\u001d20Z00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\u001e\u0004",
    "barcode_hash": "41426d2aeca6432f71b14960f7a9fee5",
    "success": "Match found for barcode data"
}

41426d2aeca6432f71b14960f7a9fee5 belongs to existing stock component.

But... I can receive item without linking barcode, and then I can link the same barcode to the same component which I just received via Stock tab, and it shows barcode identifier as 328370653459f52c520d85e49d3737b7.

Surprisingly, seems like I cannot reproduce this bug on demo site, but there's a chance I haven't followed that exact sequence? Or maybe DigiKey plugin is configured?

Steps to Reproduce

Following plugin is enabled: Supplier Integration - DigiKey Plugin has configured Supplier which points to DigiKey.

Just try to link barcodes to two different components (from the same order?) received from DigiKey.

Expected behaviour

InvenTree treats DigiKey barcodes as unique and successfully links to different stock components.

Deployment Method

Version Information

Version Information:

InvenTree-Version: 0.15.5 Django Version: 4.2.14 Commit Hash: cc45357 Commit Date: 2024-07-12

Database: sqlite3 Debug-Mode: False Deployed using Docker: True Platform: Linux-3.10.108-x86_64-with Installer: DOC

Please verify if you can reproduce this bug on the demo site.

Relevant log output

Component 1:

Hash: `41426d2aeca6432f71b14960f7a9fee5`

Data:

{
  "BarcodeFormat": 134217728,
  "BarcodeFormatString": "DATAMATRIX",
  "BarcodeFormat_2": 0,
  "BarcodeFormatString_2": "No Barcode Format in group 2",
  "BarcodeText": "[)>\u001e06\u001dP182\u001d1PS3B-PH-K-S\u001d30P455-1720-ND\u001dK\u001d1K87684816\u001d10K105867004\u001d9D2022-05\u001d1TS30784-17\u001d11K1\u001d4LMY\u001dQ2\u001d11ZPICK\u001d12Z926627\u001d13Z999999\u001d20Z00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\u001e\u0004",
  "BarcodeBytes": "5b 29 3e 1e 30 36 1d 50 31 38 32 1d 31 50 53 33 42 2d 50 48 2d 4b 2d 53 1d 33 30 50 34 35 35 2d 31 37 32 30 2d 4e 44 1d 4b 1d 31 4b 38 37 36 38 34 38 31 36 1d 31 30 4b 31 30 35 38 36 37 30 30 34 1d 39 44 32 30 32 32 2d 30 35 1d 31 54 53 33 30 37 38 34 2d 31 37 1d 31 31 4b 31 1d 34 4c 4d 59 1d 51 32 1d 31 31 5a 50 49 43 4b 1d 31 32 5a 39 32 36 36 32 37 1d 31 33 5a 39 39 39 39 39 39 1d 32 30 5a 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 1e 04",
  "LocalizationResult": {
    "TerminatePhase": 32,
    "BarcodeFormat": 134217728,
    "BarcodeFormatString": "DATAMATRIX",
    "BarcodeFormat_2": 0,
    "BarcodeFormatString_2": "No Barcode Format in group 2",
    "Angle": 0,
    "ResultPoints": [
      "520, 297",
      "647, 298",
      "646, 424",
      "519, 423"
    ],
    "ModuleSize": 3,
    "PageNumber": 0,
    "RegionName": "",
    "DocumentName": null,
    "ResultCoordinateType": 1,
    "AccompanyingTextBytes": null,
    "Confidence": 89,
    "TransformationMatrix": [
      1,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      1
    ]
  },
  "Exception": null,
  "IsDPM": 0,
  "IsMirrored": 0
}

Component 2:

Hash: 328370653459f52c520d85e49d3737b7

Data:

{
  "BarcodeFormat": 134217728,
  "BarcodeFormatString": "DATAMATRIX",
  "BarcodeFormat_2": 0,
  "BarcodeFormatString_2": "No Barcode Format in group 2",
  "BarcodeText": "[)>\u001e06\u001dP138\u001d1PFCR684208T\u001d30P4654-FCR684208T-ND\u001dK\u001d1K87684816\u001d10K105867004\u001d9D2340\u001d1TC093580\u001d11K1\u001d4LGB\u001dQ1\u001d11ZPICK\u001d12Z19110233\u001d13Z999999\u001d20Z0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\u001e\u0004",
  "BarcodeBytes": "5b 29 3e 1e 30 36 1d 50 31 33 38 1d 31 50 46 43 52 36 38 34 32 30 38 54 1d 33 30 50 34 36 35 34 2d 46 43 52 36 38 34 32 30 38 54 2d 4e 44 1d 4b 1d 31 4b 38 37 36 38 34 38 31 36 1d 31 30 4b 31 30 35 38 36 37 30 30 34 1d 39 44 32 33 34 30 1d 31 54 43 30 39 33 35 38 30 1d 31 31 4b 31 1d 34 4c 47 42 1d 51 31 1d 31 31 5a 50 49 43 4b 1d 31 32 5a 31 39 31 31 30 32 33 33 1d 31 33 5a 39 39 39 39 39 39 1d 32 30 5a 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 1e 04",
  "LocalizationResult": {
    "TerminatePhase": 32,
    "BarcodeFormat": 134217728,
    "BarcodeFormatString": "DATAMATRIX",
    "BarcodeFormat_2": 0,
    "BarcodeFormatString_2": "No Barcode Format in group 2",
    "Angle": 0,
    "ResultPoints": [
      "486, 279",
      "646, 276",
      "645, 443",
      "486, 441"
    ],
    "ModuleSize": 3,
    "PageNumber": 0,
    "RegionName": "",
    "DocumentName": null,
    "ResultCoordinateType": 1,
    "AccompanyingTextBytes": null,
    "Confidence": 93,
    "TransformationMatrix": [
      1,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      1
    ]
  },
  "Exception": null,
  "IsDPM": 0,
  "IsMirrored": 0
}
30350n commented 4 months ago

Looks like you are scanning two different barcodes:

  1. DigiKey Part Number: 455-1720-ND
  2. DigiKey Part Number: 4654-FCR684208T-ND

(This is from the barcode data).

dieselburner commented 4 months ago

Well, I tried my best to explain the issue, but seems like I failed.

To keep it simple:

Some more info:

I went with printing my own labels, but still think there's something blocking to assign DigiKey barcodes to stock items.

30350n commented 4 months ago

Ah okay, yeah sorry I might have skimmed over some parts. I don't have my own instance nor my InvenTree app updated to a somewhat recent version and this is kind of hard to debug without just trying it.

dieselburner commented 4 months ago

If required, I might be able to find these barcodes and attached them as images, along with supplier part info. Feel free to request.

SchrodingersGat commented 4 months ago

@dieselburner please provide that info if you can, not sure how to reproduce the issue elsewise!

matmair commented 4 months ago

This seems to be largely identical with #7690 and also refers to the same area of code - @dieselburner do you think we can streamline discussions on either one and which would you prefer?

dieselburner commented 3 months ago

@matmair Yes, both this issue and that discussion (which @SchrodingersGat used to create issue you mentioned: https://github.com/inventree/InvenTree/issues/7690) was started by me. While I have used this issue to provide technical information and described the problem that clearly exists, the discussion was originally about how turn off supplier barcode check. But then discussion went into direction which addresses this issue, which is not what I was expecting really. In any case - I will find a bit of time sometime later to provide some more details, including barcode images along with supplier item data, which should be enough to reproduce the issue on your side.

SchrodingersGat commented 1 week ago

@dieselburner I have since added a functionality that the server records scanned barcodes - to make debugging of scanning via the app much easier. Perhaps if you can update, enable barcode logging, and see what the scanned barcodes are reading as?