Compare commits
No commits in common. "main" and "v1.2.0" have entirely different histories.
13
Changelog.md
13
Changelog.md
@ -1,18 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 1.3.1 - 2026-02-32 - Add PackageListNumber
|
||||
### New Features
|
||||
* Add a Filed for Package List Number, so that multiple Shipments can be tracked
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 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
|
||||
|
||||
@ -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.ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 100, 56);
|
||||
label.DrawString(part.Quantity, 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);
|
||||
|
||||
112
InventreeBarcodeGenerator/Form1.Designer.cs
generated
112
InventreeBarcodeGenerator/Form1.Designer.cs
generated
@ -53,11 +53,11 @@
|
||||
this.buttonNone = new Button();
|
||||
this.buttonAll = new Button();
|
||||
this.dataGridView1 = new DataGridView();
|
||||
this.Pos = new DataGridViewTextBoxColumn();
|
||||
this.Print = new DataGridViewCheckBoxColumn();
|
||||
this.Bag = new DataGridViewCheckBoxColumn();
|
||||
this.Teil = new DataGridViewTextBoxColumn();
|
||||
this.Sku = new DataGridViewTextBoxColumn();
|
||||
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();
|
||||
@ -70,8 +70,6 @@
|
||||
this.Druckereinstellungen = new TabPage();
|
||||
this._checkBox_Landscape = new CheckBox();
|
||||
this._buttonSaveSettings2 = new Button();
|
||||
this.label7 = new Label();
|
||||
this.textBox1 = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)this.pictureBox1).BeginInit();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this._mainTabBox.SuspendLayout();
|
||||
@ -218,7 +216,7 @@
|
||||
// _buttonQueryPo
|
||||
//
|
||||
this._buttonQueryPo.Image = Properties.Resources.arrow_reload_24;
|
||||
this._buttonQueryPo.Location = new Point(866, 6);
|
||||
this._buttonQueryPo.Location = new Point(1236, 6);
|
||||
this._buttonQueryPo.Name = "_buttonQueryPo";
|
||||
this._buttonQueryPo.Size = new Size(56, 29);
|
||||
this._buttonQueryPo.TabIndex = 15;
|
||||
@ -230,7 +228,7 @@
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new Point(6, 6);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new Size(854, 28);
|
||||
this.comboBox1.Size = new Size(1224, 28);
|
||||
this.comboBox1.TabIndex = 16;
|
||||
this.comboBox1.SelectedIndexChanged += this.comboBox1_SelectedIndexChanged;
|
||||
//
|
||||
@ -263,8 +261,6 @@
|
||||
//
|
||||
// Label
|
||||
//
|
||||
this.Label.Controls.Add(this.textBox1);
|
||||
this.Label.Controls.Add(this.label7);
|
||||
this.Label.Controls.Add(this.labelCount);
|
||||
this.Label.Controls.Add(this.buttonNone);
|
||||
this.Label.Controls.Add(this.buttonAll);
|
||||
@ -321,7 +317,7 @@
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
this.dataGridView1.AllowUserToResizeRows = false;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.Pos, this.Print, this.Bag, this.Teil, this.Sku, this.Got });
|
||||
this.dataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.Column4, this.Column1, this.Column6, this.Column2, this.Column3, this.Got });
|
||||
this.dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystroke;
|
||||
this.dataGridView1.Location = new Point(6, 40);
|
||||
this.dataGridView1.MultiSelect = false;
|
||||
@ -335,47 +331,47 @@
|
||||
this.dataGridView1.CellValueChanged += this.DataGridView1_CellValueChanged;
|
||||
this.dataGridView1.SelectionChanged += this.DataGridView1_SelectionChanged;
|
||||
//
|
||||
// Pos
|
||||
// Column4
|
||||
//
|
||||
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;
|
||||
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;
|
||||
//
|
||||
// Print
|
||||
// Column1
|
||||
//
|
||||
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;
|
||||
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;
|
||||
//
|
||||
// Bag
|
||||
// Column6
|
||||
//
|
||||
this.Bag.HeaderText = "Bag";
|
||||
this.Bag.MinimumWidth = 60;
|
||||
this.Bag.Name = "Bag";
|
||||
this.Bag.Resizable = DataGridViewTriState.True;
|
||||
this.Bag.Width = 60;
|
||||
this.Column6.HeaderText = "Labels";
|
||||
this.Column6.MinimumWidth = 60;
|
||||
this.Column6.Name = "Column6";
|
||||
this.Column6.SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
this.Column6.Width = 60;
|
||||
//
|
||||
// Teil
|
||||
// Column2
|
||||
//
|
||||
this.Teil.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Teil.HeaderText = "Teil";
|
||||
this.Teil.MinimumWidth = 300;
|
||||
this.Teil.Name = "Teil";
|
||||
this.Teil.ReadOnly = true;
|
||||
this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Column2.HeaderText = "Teil";
|
||||
this.Column2.MinimumWidth = 300;
|
||||
this.Column2.Name = "Column2";
|
||||
this.Column2.ReadOnly = true;
|
||||
//
|
||||
// Sku
|
||||
// Column3
|
||||
//
|
||||
this.Sku.HeaderText = "SKU";
|
||||
this.Sku.MinimumWidth = 150;
|
||||
this.Sku.Name = "Sku";
|
||||
this.Sku.ReadOnly = true;
|
||||
this.Sku.Width = 150;
|
||||
this.Column3.HeaderText = "SKU";
|
||||
this.Column3.MinimumWidth = 150;
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column3.ReadOnly = true;
|
||||
this.Column3.Width = 150;
|
||||
//
|
||||
// Got
|
||||
//
|
||||
@ -503,22 +499,6 @@
|
||||
this._buttonSaveSettings2.UseVisualStyleBackColor = true;
|
||||
this._buttonSaveSettings2.Click += this.ButtonSaveSettings_Click;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new Point(928, 9);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new Size(87, 20);
|
||||
this.label7.TabIndex = 29;
|
||||
this.label7.Text = "Package-ID:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new Point(1021, 6);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new Size(271, 27);
|
||||
this.textBox1.TabIndex = 30;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
@ -585,13 +565,11 @@
|
||||
private Button buttonNone;
|
||||
private Button buttonAll;
|
||||
private Label labelCount;
|
||||
private DataGridViewTextBoxColumn Pos;
|
||||
private DataGridViewCheckBoxColumn Print;
|
||||
private DataGridViewCheckBoxColumn Bag;
|
||||
private DataGridViewTextBoxColumn Teil;
|
||||
private DataGridViewTextBoxColumn Sku;
|
||||
private DataGridViewTextBoxColumn Column4;
|
||||
private DataGridViewCheckBoxColumn Column1;
|
||||
private DataGridViewTextBoxColumn Column6;
|
||||
private DataGridViewTextBoxColumn Column2;
|
||||
private DataGridViewTextBoxColumn Column3;
|
||||
private DataGridViewTextBoxColumn Got;
|
||||
private TextBox textBox1;
|
||||
private Label label7;
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,21 +257,22 @@ 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 print) {
|
||||
if(print && item.Cells[2].Value is Boolean bag) {
|
||||
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[3].Value is LineItem l) {
|
||||
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);
|
||||
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();
|
||||
}
|
||||
this.printList.Enqueue(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonPrint_Click(Object sender, EventArgs e) {
|
||||
this.PreparePintList();
|
||||
this.printDocument1.Print();
|
||||
@ -358,12 +359,12 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
|
||||
DataGridViewRow r = new();
|
||||
r.CreateCells(this.dataGridView1);
|
||||
|
||||
Double recieved = Double.Parse(item["received"].ToString());
|
||||
Double quantity = Double.Parse(item["quantity"].ToString());
|
||||
Int32 recieved = Convert.ToInt32(Double.Parse(item["received"].ToString()));
|
||||
Int32 quantity = Convert.ToInt32(Double.Parse(item["quantity"].ToString()));
|
||||
|
||||
r.Cells[0].Value = i;
|
||||
r.Cells[1].Value = quantity > recieved;
|
||||
r.Cells[2].Value = false;
|
||||
r.Cells[2].Value = quantity >= recieved ? quantity - recieved : 0;
|
||||
r.Cells[3].Value = new LineItem {
|
||||
Name = item["internal_part_name"].ToString(),
|
||||
SKU = item["sku"].ToString(),
|
||||
@ -372,16 +373,15 @@ namespace BlubbFish.Applications.Barcodes.Inventree {
|
||||
Quantity = quantity,
|
||||
EciaFormat = new Ecia {
|
||||
CustomerPO = po.Reference,
|
||||
SupplierOrderNumber = po.SupplierReference,
|
||||
PackageId = po.SupplierReference,
|
||||
ShipDate = DateTime.Now.ToString("yyyyMMdd"),
|
||||
SKU = item["sku"].ToString(),
|
||||
MPN = item["mpn"].ToString(),
|
||||
CustomerPOLine = i++.ToString(),
|
||||
Quantity = quantity,
|
||||
Quantity = quantity.ToString(),
|
||||
DateCode = DateTime.Now.ToString("yy01"),
|
||||
LotCode = "N/T",
|
||||
County = "DE",
|
||||
PackingListNumber = this.textBox1.Text
|
||||
LotCode = "1",
|
||||
County = "DE"
|
||||
}
|
||||
};
|
||||
r.Cells[4].Value = item["sku"].ToString();
|
||||
@ -404,11 +404,9 @@ 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 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);
|
||||
}
|
||||
if(item.Cells[1].Value is Boolean b) {
|
||||
if(b && Int32.TryParse(item.Cells[2].Value.ToString(), out Int32 c)) {
|
||||
i += c;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -421,8 +419,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(Double.TryParse(this.dataGridView1.Rows[i].Cells[5].Value.ToString(), out Double c)) {
|
||||
this.part.Quantity = c;
|
||||
if(Int32.TryParse(this.dataGridView1.Rows[i].Cells[5].Value.ToString(), out Int32 c)) {
|
||||
this.part.Quantity = c.ToString();
|
||||
}
|
||||
this.DrawPreview();
|
||||
}
|
||||
|
||||
@ -150,19 +150,19 @@
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>561, 17</value>
|
||||
</metadata>
|
||||
<metadata name="Pos.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Print.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Bag.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Teil.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Sku.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Got.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>1.3.1</AssemblyVersion>
|
||||
<AssemblyVersion>1.2.0</AssemblyVersion>
|
||||
<FileVersion>$(AssemblyVersion)</FileVersion>
|
||||
<Version>$(AssemblyVersion)</Version>
|
||||
<Authors>BlubbFish</Authors>
|
||||
@ -24,8 +24,6 @@
|
||||
<RepositoryUrl>https://git.blubbfish.net/vs_projects/InventreeBarcodeGenerator.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageReleaseNotes>
|
||||
1.3.1 - 2026-02-32 - Add PackageListNumber
|
||||
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
|
||||
|
||||
@ -1,14 +1,9 @@
|
||||
using LitJson;
|
||||
|
||||
namespace BlubbFish.Applications.Barcodes.Inventree.Models {
|
||||
namespace BlubbFish.Applications.Barcodes.Inventree.Models {
|
||||
internal class Ecia {
|
||||
public String CustomerPO {
|
||||
get; set;
|
||||
}
|
||||
public String SupplierOrderNumber {
|
||||
get; set;
|
||||
}
|
||||
public String PackingListNumber {
|
||||
public String PackageId {
|
||||
get; set;
|
||||
}
|
||||
public String ShipDate {
|
||||
@ -23,7 +18,7 @@ namespace BlubbFish.Applications.Barcodes.Inventree.Models {
|
||||
public String CustomerPOLine {
|
||||
get; set;
|
||||
}
|
||||
public Double Quantity {
|
||||
public String Quantity {
|
||||
get; set;
|
||||
}
|
||||
public String DateCode {
|
||||
@ -36,19 +31,17 @@ namespace BlubbFish.Applications.Barcodes.Inventree.Models {
|
||||
get; set;
|
||||
}
|
||||
public override String ToString() => this.Quantity + "x " + this.SKU + " from " + this.CustomerPO;
|
||||
public String ToEciaString() => JsonMapper.ToJson(new Dictionary<String, Object>() {
|
||||
{ "K", this.CustomerPO },
|
||||
{ "1K", this.SupplierOrderNumber },
|
||||
{ "11K", this.PackingListNumber },
|
||||
{ "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() => "{" +
|
||||
"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 +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
"""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
|
||||
Loading…
Reference in New Issue
Block a user