InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

DigiKey barcode integration: Barcode matches existing item

Open dieselburner opened this issue 1 year ago • 7 comments

Please verify that this bug has NOT been raised before.

  • [X] I checked and didn't find a similar issue

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

  • [X] Docker
  • [ ] Package
  • [ ] Bare metal
  • [ ] Other - added info in Steps to Reproduce

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.

  • [ ] I 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
}

dieselburner avatar Jul 12 '24 15:07 dieselburner

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).

30350n avatar Jul 22 '24 09:07 30350n

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

To keep it simple:

  • I opened the package from DigiKey and tried to assign barcodes printed on bags via Scan Received Items
  • Received the error: Barcode matches existing item
  • Filed the issue with my analysis

Some more info:

  • There were no existing stock of these items
  • Database records of Supplier items shows that barcode* field are not set at all

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

dieselburner avatar Jul 22 '24 09:07 dieselburner

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.

30350n avatar Jul 22 '24 12:07 30350n

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

dieselburner avatar Jul 22 '24 12:07 dieselburner

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

SchrodingersGat avatar Jul 23 '24 01:07 SchrodingersGat

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?

matmair avatar Jul 24 '24 20:07 matmair

@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.

dieselburner avatar Jul 30 '24 07:07 dieselburner

@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?

SchrodingersGat avatar Nov 12 '24 12:11 SchrodingersGat