updated format
This commit is contained in:
70
test_barcode_format.py
Normal file
70
test_barcode_format.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify barcode format in generated PDFs
|
||||
"""
|
||||
import sys
|
||||
sys.path.insert(0, '/srv/quality_app-v2')
|
||||
|
||||
from app.modules.labels.pdf_generator import LabelPDFGenerator
|
||||
|
||||
# Test order data
|
||||
test_order = {
|
||||
'comanda_productie': 'TEST-ORD-004',
|
||||
'cod_articol': 'ART004',
|
||||
'descr_com_prod': 'Metal Bracket D - Galvanized Steel',
|
||||
'cantitate': 300,
|
||||
'com_achiz_client': 'CLIENT-PO-2024-004',
|
||||
'nr_linie_com_client': '04',
|
||||
'customer_name': 'MetalCraft Solutions',
|
||||
'customer_article_number': 'MC-BRACK-D004',
|
||||
'data_livrara': '2024-03-22',
|
||||
'dimensiune': 'Small'
|
||||
}
|
||||
|
||||
print("="*70)
|
||||
print("BARCODE FORMAT TEST")
|
||||
print("="*70)
|
||||
|
||||
# Test what sequential number will be generated
|
||||
prod_order = test_order['comanda_productie']
|
||||
piece_number = 1
|
||||
|
||||
# This is how the PDF generator creates the sequential number
|
||||
sequential_number = f"{prod_order}-{piece_number:04d}"
|
||||
|
||||
print(f"\n📦 Production Order: {prod_order}")
|
||||
print(f"🔢 Piece Number: {piece_number}")
|
||||
print(f"📊 Sequential Number (Horizontal Barcode): {sequential_number}")
|
||||
|
||||
# Check vertical barcode format
|
||||
com_achiz_client = test_order['com_achiz_client']
|
||||
nr_linie = test_order['nr_linie_com_client']
|
||||
vertical_code = f"{com_achiz_client}/{nr_linie}"
|
||||
|
||||
print(f"📐 Vertical Barcode: {vertical_code}")
|
||||
|
||||
print("\n" + "="*70)
|
||||
print("EXPECTED vs ACTUAL")
|
||||
print("="*70)
|
||||
print(f"✅ CORRECT Horizontal: {sequential_number}")
|
||||
print(f"❌ WRONG Format: TEST/ORD/004/0001")
|
||||
print(f"")
|
||||
print("If you're seeing TEST/ORD/004/0001, possible causes:")
|
||||
print("1. Data in database has slashes instead of hyphens")
|
||||
print("2. Barcode scanner is configured to translate hyphens to slashes")
|
||||
print("3. Looking at wrong barcode (there are 2 barcodes on each label)")
|
||||
print("="*70)
|
||||
|
||||
# Generate actual PDF to verify
|
||||
print("\n🔧 Generating test PDF...")
|
||||
pdf_gen = LabelPDFGenerator(paper_saving_mode=True)
|
||||
pdf_buffer = pdf_gen.generate_single_label_pdf(test_order, 1, 300, printer_optimized=True)
|
||||
|
||||
# Save test PDF
|
||||
output_file = '/srv/quality_app-v2/test_label_output.pdf'
|
||||
with open(output_file, 'wb') as f:
|
||||
f.write(pdf_buffer.read())
|
||||
|
||||
print(f"✅ Test PDF saved to: {output_file}")
|
||||
print(f"📄 Open this PDF to verify the barcode format visually")
|
||||
print("\nThe barcode should encode: TEST-ORD-004-0001 (with hyphens)")
|
||||
74
test_label.pdf
Normal file
74
test_label.pdf
Normal file
@@ -0,0 +1,74 @@
|
||||
%PDF-1.4
|
||||
%<25><><EFBFBD><EFBFBD> ReportLab Generated PDF document http://www.reportlab.com
|
||||
1 0 obj
|
||||
<<
|
||||
/F1 2 0 R /F2 3 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Contents 8 0 R /MediaBox [ 0 0 226.7717 297.6378 ] /Parent 7 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
>>
|
||||
/Type /Page
|
||||
>>
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/PageMode /UseNone /Pages 7 0 R /Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
6 0 obj
|
||||
<<
|
||||
/Author (anonymous) /CreationDate (D:20260215130816+00'00') /Creator (Recticel Label System) /Keywords () /ModDate (D:20260215130816+00'00') /Producer (Optimized for Epson TM-T20 / Citizen CTS-310)
|
||||
/Subject (Production Label) /Title (Thermal Label - Optimized for Label Printers) /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
7 0 obj
|
||||
<<
|
||||
/Count 1 /Kids [ 4 0 R ] /Type /Pages
|
||||
>>
|
||||
endobj
|
||||
8 0 obj
|
||||
<<
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 1821
|
||||
>>
|
||||
stream
|
||||
Gat=-gMRrh&:N/3n?EFq$&<^g3d)DUc.1AU#kf05/)-&XUe&87LYQ1kCsLUd+N*?ec5[>91M:B%)BZ+HYO@^%ZV[iTA&UnhDA>6RC@PWD?-IDu\9p4klCZbC@O>lS:F[3e_&1-gPE%(AcA&(f=`$3B26607<*+9UE/%42ioWKa`pAt1L.mD#/V%=#C+q.kkPD?Yo_<9A-lD.:[P=#QiUZ[q+1gi[ID/k@DUm:TqYPI/E<#<,[J4f^bJuCm*6<nseXb^<j>bllfG\fj['cKg1]GI=*:%HO`e:]_o",h[ZaCiQ_^^r)AI=JGa,tI<WR7"U#@AkQjnnUt]A!6`&"B&+e(l!;CeQb=KNWUFh/&Gek7aIglVfbB$Q(7-&>sSlErQ$lp>N1/oY@&Ke_C6u;t,k'^&S&ua2RuJVn(3pc*_^JK,?`0l`/9hDS>noD18LSjgKLG_NM?pm"r?8YKpO0a_#S0K`TZ3lcn_`Z:Q,_'"37tP`c8bQ\giurQ\J_2TtF$\uiP?o4+-!G9)]<49>"j\c/kH?iAa8W2jdeX^<tD*Qq=E4^PtXZa*ikG^J`;DRk36R$:,HPPb<#[b7gdf:=sP\9Si<d$YBAc9@cEhcubDs"V8J3]SS3!ept=VF.X+LRq!9+^t,aIYg:-*cBK*B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j5K\3nHpSD-<GpHD;_L/RrQVd(H8"R<_:X^:-No(k+7D>G_#i=s4TVM<Gt\3)O.@XVI^qA*W^6;a=?[\#Ijgg7@Q"eDK:fR]<il306,oF/W[9LN:k)3gLfHjARf*JEJpT$~>endstream
|
||||
endobj
|
||||
xref
|
||||
0 9
|
||||
0000000000 65535 f
|
||||
0000000073 00000 n
|
||||
0000000114 00000 n
|
||||
0000000221 00000 n
|
||||
0000000333 00000 n
|
||||
0000000536 00000 n
|
||||
0000000604 00000 n
|
||||
0000000924 00000 n
|
||||
0000000983 00000 n
|
||||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<ea57d8511a72770d9c6e1dd29826f00c><ea57d8511a72770d9c6e1dd29826f00c>]
|
||||
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||
|
||||
/Info 6 0 R
|
||||
/Root 5 0 R
|
||||
/Size 9
|
||||
>>
|
||||
startxref
|
||||
2895
|
||||
%%EOF
|
||||
Reference in New Issue
Block a user