diff --git a/Changelog.md b/Changelog.md
index 66240b4..3dc9bd0 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,5 +1,12 @@
# Changelog
+## 1.3.0 - 2026-02-19 - Change DataMatrix to real Json
+### New Features
+### Bugfixes
+### Changes
+* Change the Barcode to real json, so a , in a textfield not crashes the scanning.
+* Change the LabelCount Collumn to a Checkbox. When checked it only printed one Label.
+
## 1.2.0 - 2026-02-18 - Fix Quantity on Labels so that you can recieve only partial deliverys
### New Features
* Add a new Collumn to set the recieved Quantity on the Parts
diff --git a/InventreeBarcodeGenerator/Drawing.cs b/InventreeBarcodeGenerator/Drawing.cs
index 16c22c3..a414b36 100644
--- a/InventreeBarcodeGenerator/Drawing.cs
+++ b/InventreeBarcodeGenerator/Drawing.cs
@@ -13,7 +13,7 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
label.DrawString(part.SKU, new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, 33);
label.DrawString("Quantity", new Font("Arial", 6, FontStyle.Regular), Brushes.Black, 100, 48);
- label.DrawString(part.Quantity, new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, 56);
+ label.DrawString(part.Quantity.ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, 56);
label.DrawString("Position", new Font("Arial", 6, FontStyle.Regular), Brushes.Black, 100, 71);
label.DrawString(part.CustomerPOLine, new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, 79);
diff --git a/InventreeBarcodeGenerator/Form1.Designer.cs b/InventreeBarcodeGenerator/Form1.Designer.cs
index eab9352..057bc39 100644
--- a/InventreeBarcodeGenerator/Form1.Designer.cs
+++ b/InventreeBarcodeGenerator/Form1.Designer.cs
@@ -53,12 +53,6 @@
this.buttonNone = new Button();
this.buttonAll = new Button();
this.dataGridView1 = new DataGridView();
- this.Column4 = new DataGridViewTextBoxColumn();
- this.Column1 = new DataGridViewCheckBoxColumn();
- this.Column6 = new DataGridViewTextBoxColumn();
- this.Column2 = new DataGridViewTextBoxColumn();
- this.Column3 = new DataGridViewTextBoxColumn();
- this.Got = new DataGridViewTextBoxColumn();
this._textServerName = new Label();
this.label8 = new Label();
this._textPrinterName = new Label();
@@ -70,6 +64,12 @@
this.Druckereinstellungen = new TabPage();
this._checkBox_Landscape = new CheckBox();
this._buttonSaveSettings2 = new Button();
+ this.Pos = new DataGridViewTextBoxColumn();
+ this.Print = new DataGridViewCheckBoxColumn();
+ this.Bag = new DataGridViewCheckBoxColumn();
+ this.Teil = new DataGridViewTextBoxColumn();
+ this.Sku = new DataGridViewTextBoxColumn();
+ this.Got = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)this.pictureBox1).BeginInit();
this.statusStrip1.SuspendLayout();
this._mainTabBox.SuspendLayout();
@@ -317,7 +317,7 @@
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.Column4, this.Column1, this.Column6, this.Column2, this.Column3, this.Got });
+ this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.Pos, this.Print, this.Bag, this.Teil, this.Sku, this.Got });
this.dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystroke;
this.dataGridView1.Location = new Point(6, 40);
this.dataGridView1.MultiSelect = false;
@@ -331,55 +331,6 @@
this.dataGridView1.CellValueChanged += this.DataGridView1_CellValueChanged;
this.dataGridView1.SelectionChanged += this.DataGridView1_SelectionChanged;
//
- // Column4
- //
- this.Column4.HeaderText = "Pos";
- this.Column4.MinimumWidth = 45;
- this.Column4.Name = "Column4";
- this.Column4.ReadOnly = true;
- this.Column4.Resizable = DataGridViewTriState.False;
- this.Column4.Width = 45;
- //
- // Column1
- //
- this.Column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- this.Column1.HeaderText = "Drucken";
- this.Column1.MinimumWidth = 70;
- this.Column1.Name = "Column1";
- this.Column1.Resizable = DataGridViewTriState.False;
- this.Column1.Width = 70;
- //
- // Column6
- //
- this.Column6.HeaderText = "Labels";
- this.Column6.MinimumWidth = 60;
- this.Column6.Name = "Column6";
- this.Column6.SortMode = DataGridViewColumnSortMode.NotSortable;
- this.Column6.Width = 60;
- //
- // Column2
- //
- this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
- this.Column2.HeaderText = "Teil";
- this.Column2.MinimumWidth = 300;
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- //
- // Column3
- //
- this.Column3.HeaderText = "SKU";
- this.Column3.MinimumWidth = 150;
- this.Column3.Name = "Column3";
- this.Column3.ReadOnly = true;
- this.Column3.Width = 150;
- //
- // Got
- //
- this.Got.HeaderText = "Got";
- this.Got.MinimumWidth = 50;
- this.Got.Name = "Got";
- this.Got.Width = 50;
- //
// _textServerName
//
this._textServerName.AutoSize = true;
@@ -499,6 +450,55 @@
this._buttonSaveSettings2.UseVisualStyleBackColor = true;
this._buttonSaveSettings2.Click += this.ButtonSaveSettings_Click;
//
+ // Pos
+ //
+ this.Pos.HeaderText = "Pos";
+ this.Pos.MinimumWidth = 45;
+ this.Pos.Name = "Pos";
+ this.Pos.ReadOnly = true;
+ this.Pos.Resizable = DataGridViewTriState.False;
+ this.Pos.Width = 45;
+ //
+ // Print
+ //
+ this.Print.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
+ this.Print.HeaderText = "Drucken";
+ this.Print.MinimumWidth = 70;
+ this.Print.Name = "Print";
+ this.Print.Resizable = DataGridViewTriState.False;
+ this.Print.Width = 70;
+ //
+ // Bag
+ //
+ this.Bag.HeaderText = "Bag";
+ this.Bag.MinimumWidth = 60;
+ this.Bag.Name = "Bag";
+ this.Bag.Resizable = DataGridViewTriState.True;
+ this.Bag.Width = 60;
+ //
+ // Teil
+ //
+ this.Teil.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ this.Teil.HeaderText = "Teil";
+ this.Teil.MinimumWidth = 300;
+ this.Teil.Name = "Teil";
+ this.Teil.ReadOnly = true;
+ //
+ // Sku
+ //
+ this.Sku.HeaderText = "SKU";
+ this.Sku.MinimumWidth = 150;
+ this.Sku.Name = "Sku";
+ this.Sku.ReadOnly = true;
+ this.Sku.Width = 150;
+ //
+ // Got
+ //
+ this.Got.HeaderText = "Got";
+ this.Got.MinimumWidth = 50;
+ this.Got.Name = "Got";
+ this.Got.Width = 50;
+ //
// Form1
//
this.AutoScaleDimensions = new SizeF(8F, 20F);
@@ -565,11 +565,11 @@
private Button buttonNone;
private Button buttonAll;
private Label labelCount;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewCheckBoxColumn Column1;
- private DataGridViewTextBoxColumn Column6;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
+ private DataGridViewTextBoxColumn Pos;
+ private DataGridViewCheckBoxColumn Print;
+ private DataGridViewCheckBoxColumn Bag;
+ private DataGridViewTextBoxColumn Teil;
+ private DataGridViewTextBoxColumn Sku;
private DataGridViewTextBoxColumn Got;
}
}
diff --git a/InventreeBarcodeGenerator/Form1.cs b/InventreeBarcodeGenerator/Form1.cs
index 2b621de..760baa7 100644
--- a/InventreeBarcodeGenerator/Form1.cs
+++ b/InventreeBarcodeGenerator/Form1.cs
@@ -257,22 +257,21 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
private void PreparePintList() {
this.printList.Clear();
foreach(DataGridViewRow item in this.dataGridView1.Rows) {
- if(item.Cells[1].Value is Boolean b) {
- if(b && Int32.TryParse(item.Cells[2].Value.ToString(), out Int32 c) && c > 0) {
+ if(item.Cells[1].Value is Boolean print) {
+ if(print && item.Cells[2].Value is Boolean bag) {
if(item.Cells[3].Value is LineItem l) {
- for(Int32 i = 0; i < c; i++) {
- Ecia t = l.EciaFormat;
- if(Int32.TryParse(item.Cells[5].Value.ToString(), out Int32 q)) {
- t.Quantity = q.ToString();
+ if(Double.TryParse(item.Cells[5].Value.ToString(), out Double q)) {
+ for(Int32 i = 0; i < Convert.ToInt32(bag ? 1 : q); i++) {
+ Ecia t = l.EciaFormat;
+ t.Quantity = q;
+ this.printList.Enqueue(t);
}
- this.printList.Enqueue(t);
}
}
}
}
}
}
-
private void ButtonPrint_Click(Object sender, EventArgs e) {
this.PreparePintList();
this.printDocument1.Print();
@@ -359,12 +358,12 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
DataGridViewRow r = new();
r.CreateCells(this.dataGridView1);
- Int32 recieved = Convert.ToInt32(Double.Parse(item["received"].ToString()));
- Int32 quantity = Convert.ToInt32(Double.Parse(item["quantity"].ToString()));
+ Double recieved = Double.Parse(item["received"].ToString());
+ Double quantity = Double.Parse(item["quantity"].ToString());
r.Cells[0].Value = i;
r.Cells[1].Value = quantity > recieved;
- r.Cells[2].Value = quantity >= recieved ? quantity - recieved : 0;
+ r.Cells[2].Value = false;
r.Cells[3].Value = new LineItem {
Name = item["internal_part_name"].ToString(),
SKU = item["sku"].ToString(),
@@ -373,12 +372,12 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
Quantity = quantity,
EciaFormat = new Ecia {
CustomerPO = po.Reference,
- PackageId = po.SupplierReference,
+ SupplierOrderNumber = po.SupplierReference,
ShipDate = DateTime.Now.ToString("yyyyMMdd"),
SKU = item["sku"].ToString(),
MPN = item["mpn"].ToString(),
CustomerPOLine = i++.ToString(),
- Quantity = quantity.ToString(),
+ Quantity = quantity,
DateCode = DateTime.Now.ToString("yy01"),
LotCode = "1",
County = "DE"
@@ -404,9 +403,11 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
private void CalcLabelCount() {
Int32 i = 0;
foreach(DataGridViewRow item in this.dataGridView1.Rows) {
- if(item.Cells[1].Value is Boolean b) {
- if(b && Int32.TryParse(item.Cells[2].Value.ToString(), out Int32 c)) {
- i += c;
+ if(item.Cells[1].Value is Boolean print) {
+ if(print && Double.TryParse(item.Cells[5].Value.ToString(), out Double c)) {
+ if(item.Cells[2].Value is Boolean bag) {
+ i += Convert.ToInt32(bag ? 1 : c);
+ }
}
}
}
@@ -419,8 +420,8 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
if(this.dataGridView1.Rows.Count >= i) {
if(this.dataGridView1.Rows[i].Cells[3].Value is LineItem l) {
this.part = l.EciaFormat;
- if(Int32.TryParse(this.dataGridView1.Rows[i].Cells[5].Value.ToString(), out Int32 c)) {
- this.part.Quantity = c.ToString();
+ if(Double.TryParse(this.dataGridView1.Rows[i].Cells[5].Value.ToString(), out Double c)) {
+ this.part.Quantity = c;
}
this.DrawPreview();
}
diff --git a/InventreeBarcodeGenerator/Form1.resx b/InventreeBarcodeGenerator/Form1.resx
index e5d20cb..04308c1 100644
--- a/InventreeBarcodeGenerator/Form1.resx
+++ b/InventreeBarcodeGenerator/Form1.resx
@@ -150,19 +150,19 @@
561, 17
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
diff --git a/InventreeBarcodeGenerator/InventreeBarcodeGenerator.csproj b/InventreeBarcodeGenerator/InventreeBarcodeGenerator.csproj
index 78fa0ab..4d4725e 100644
--- a/InventreeBarcodeGenerator/InventreeBarcodeGenerator.csproj
+++ b/InventreeBarcodeGenerator/InventreeBarcodeGenerator.csproj
@@ -9,7 +9,7 @@
- 1.2.0
+ 1.3.0
$(AssemblyVersion)
$(AssemblyVersion)
BlubbFish
@@ -24,6 +24,7 @@
https://git.blubbfish.net/vs_projects/InventreeBarcodeGenerator.git
git
+ 1.3.0 - 2026-02-19 - Change DataMatrix to real Json
1.2.0 - 2026-02-18 - Fix Quantity on Labels so that you can recieve only partial deliverys
1.1.0 - 2026-02-14 - Rewrote to DataGridView
1.0.0 - 2025-11-23 - Init
diff --git a/InventreeBarcodeGenerator/Models/Ecia.cs b/InventreeBarcodeGenerator/Models/Ecia.cs
index 984f288..9877ba6 100644
--- a/InventreeBarcodeGenerator/Models/Ecia.cs
+++ b/InventreeBarcodeGenerator/Models/Ecia.cs
@@ -1,9 +1,11 @@
-namespace BlubbFish.Applications.Barcodes.Inventree.Models {
+using LitJson;
+
+namespace BlubbFish.Applications.Barcodes.Inventree.Models {
internal class Ecia {
public String CustomerPO {
get; set;
}
- public String PackageId {
+ public String SupplierOrderNumber {
get; set;
}
public String ShipDate {
@@ -18,7 +20,7 @@
public String CustomerPOLine {
get; set;
}
- public String Quantity {
+ public Double Quantity {
get; set;
}
public String DateCode {
@@ -31,17 +33,18 @@
get; set;
}
public override String ToString() => this.Quantity + "x " + this.SKU + " from " + this.CustomerPO;
- public String ToEciaString() => "{" +
- "K" + ":" + this.CustomerPO + "," +
- "4S" + ":" + this.PackageId + "," +
- "6D" + ":" + this.ShipDate + "," +
- "P" + ":" + this.SKU + "," +
- "1P" + ":" + this.MPN + "," +
- "4K" + ":" + this.CustomerPOLine + "," +
- "Q" + ":" + this.Quantity + "," +
- "10D" + ":" + this.DateCode + "," +
- "1T" + ":" + this.LotCode + "," +
- "4L" + ":" + this.County +
- "}";
+ public String ToEciaString() => JsonMapper.ToJson(new Dictionary() {
+ { "K", this.CustomerPO },
+ { "1K", this.SupplierOrderNumber},
+ { "6D", this.ShipDate},
+ { "P", this.SKU},
+ { "1P", this.MPN},
+ { "4K", this.CustomerPOLine},
+ { "Q", this.Quantity},
+ { "10D", this.DateCode},
+ { "1T", this.LotCode},
+ { "4L", this.County},
+
+ });
}
-}
+}
\ No newline at end of file
diff --git a/InventreeBarcodeGenerator/Res/store.py b/InventreeBarcodeGenerator/Res/store.py
new file mode 100644
index 0000000..c3a84dd
--- /dev/null
+++ b/InventreeBarcodeGenerator/Res/store.py
@@ -0,0 +1,71 @@
+"""The BarcodePlugin is meant to integrate the Barcodes into InvenTree.
+
+This plugin can currently only match barcodes to supplier parts.
+"""
+
+import re
+import json
+
+from django.utils.translation import gettext_lazy as _
+
+from plugin import InvenTreePlugin
+from plugin.mixins import SettingsMixin, SupplierBarcodeMixin
+
+
+class ReicheltPlugin(SupplierBarcodeMixin, SettingsMixin, InvenTreePlugin):
+ """Plugin to integrate the Barcodes into InvenTree."""
+
+ NAME = 'ReicheltBarcodePlugin'
+ SLUG = 'Reicheltplugin'
+ TITLE = _('Supplier Integration - Reichelt')
+ DESCRIPTION = _('Provides support for scanning Reichelt barcodes')
+ VERSION = '1.0.0'
+ AUTHOR = _('BlubbFish')
+
+ DEFAULT_SUPPLIER_NAME = 'Reichelt'
+ SETTINGS = {
+ 'SUPPLIER_ID': {
+ 'name': _('Supplier'),
+ 'description': _("The Supplier which acts as 'Reichelt'"),
+ 'model': 'company.company',
+ 'model_filters': {'is_supplier': True},
+ }
+ }
+
+ # Custom field mapping for LCSC barcodes
+ BARCODE_FIELDS = {
+ 'K': SupplierBarcodeMixin.CUSTOMER_ORDER_NUMBER,
+ '1K': SupplierBarcodeMixin.SUPPLIER_ORDER_NUMBER,
+ '11K': SupplierBarcodeMixin.PACKING_LIST_NUMBER,
+ '6D': SupplierBarcodeMixin.SHIP_DATE,
+ '9D': SupplierBarcodeMixin.DATE_CODE,
+ '10D': SupplierBarcodeMixin.DATE_CODE,
+ '4K': SupplierBarcodeMixin.PURCHASE_ORDER_LINE,
+ '14K': SupplierBarcodeMixin.PURCHASE_ORDER_LINE,
+ 'P': SupplierBarcodeMixin.SUPPLIER_PART_NUMBER,
+ '1P': SupplierBarcodeMixin.MANUFACTURER_PART_NUMBER,
+ '30P': SupplierBarcodeMixin.SUPPLIER_PART_NUMBER,
+ '1T': SupplierBarcodeMixin.LOT_CODE,
+ '4L': SupplierBarcodeMixin.COUNTRY_OF_ORIGIN,
+ '1V': SupplierBarcodeMixin.MANUFACTURER,
+ 'Q': SupplierBarcodeMixin.QUANTITY,
+ }
+
+ def extract_barcode_fields(self, barcode_data: str) -> dict[str, str]:
+ """Get supplier_part and barcode_fields from LCSC QR-Code.
+
+ Example QR-Code: {"K":"KA-0077","1K":"028-3720301-6481114","6D":"20260219","P":"B0977HLT4P","1P":"SDCZ48-064G-G46T","4K":"1","Q":0.0,"10D":"2601","1T":"1","4L":"DE"}
+ """
+ try:
+ jsonData = json.loads(barcode_data)
+ except ValueError as err:
+ return {}
+
+ barcode_fields = {}
+
+ # Map from LCSC field names to standard field names
+ for key, field in self.BARCODE_FIELDS.items():
+ if key in jsonData.keys():
+ barcode_fields[field] = jsonData[key]
+
+ return barcode_fields
\ No newline at end of file