质量模块和库存扫码
This commit is contained in:
20
stock_barcode/static/img/barcode.svg
Normal file
20
stock_barcode/static/img/barcode.svg
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="400" height="300" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<metadata id="metadata27">image/svg+xml</metadata>
|
||||
<g class="layer">
|
||||
<title>Barcode Icon</title>
|
||||
<g id="g20">
|
||||
<g id="g12" fill="#8f8f8f">
|
||||
<rect height="186" id="rect2" width="44" x="61" y="57"/>
|
||||
<rect height="186" id="rect4" width="44" x="236.5" y="57"/>
|
||||
<rect height="186" id="rect6" width="44" x="295" y="57"/>
|
||||
<rect height="186" id="rect8" width="24" x="129.5" y="57"/>
|
||||
<rect height="186" id="rect10" width="14" x="193" y="57"/>
|
||||
</g>
|
||||
<g id="g18" fill="#8f8f8f">
|
||||
<polygon id="polygon14" points="59.5,269.5 25.5,269.5 25.5,30.5 59.5,30.5 59.5,19.5 14.5,19.5 14.5,280.5 59.5,280.5"/>
|
||||
<polygon id="polygon16" points="339.4999694824219,19.5 339.4999694824219,30.5 374.4999694824219,30.5 374.4999694824219,269.5 339.4999694824219,269.5 339.4999694824219,280.5 385.4999694824219,280.5 385.4999694824219,19.5"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
BIN
stock_barcode/static/img/barcode_white.png
Normal file
BIN
stock_barcode/static/img/barcode_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
stock_barcode/static/img/barcodes_actions.pdf
Normal file
BIN
stock_barcode/static/img/barcodes_actions.pdf
Normal file
Binary file not shown.
BIN
stock_barcode/static/img/barcodes_demo.pdf
Normal file
BIN
stock_barcode/static/img/barcodes_demo.pdf
Normal file
Binary file not shown.
117
stock_barcode/static/img/make_barcodes.py
Normal file
117
stock_barcode/static/img/make_barcodes.py
Normal file
@@ -0,0 +1,117 @@
|
||||
# Note to run this script (specifically for datamatrix generation) you will need the following installed:
|
||||
# - dmtx-utils (available through apt-get)
|
||||
# - pylibdmtx (available on pip3)
|
||||
# - reportlab version 3.5.52 or higher (available on pip3)
|
||||
|
||||
|
||||
from io import BytesIO
|
||||
from PyPDF2 import PdfFileReader, PdfFileMerger
|
||||
|
||||
from reportlab.graphics import renderPDF
|
||||
from reportlab.graphics.barcode import dmtx
|
||||
from reportlab.graphics.shapes import Drawing
|
||||
from reportlab.pdfgen import canvas
|
||||
from reportlab.lib.pagesizes import A4
|
||||
|
||||
|
||||
OTHER_DEMO_FILENAME = "barcodes_demo.pdf"
|
||||
FONT = "Helvetica"
|
||||
HEADER_FONT_SIZE = 16
|
||||
LABEL_FONT_SIZE = 14
|
||||
TITLE_FONT_SIZE = 11
|
||||
CODE_FONT_SIZE = 8
|
||||
FOOTER_FONT_SIZE = 8
|
||||
PAGE_SIZE = A4
|
||||
|
||||
|
||||
def create_page(barcodes, font_size_and_texts):
|
||||
packet = BytesIO()
|
||||
can = canvas.Canvas(packet, pagesize=PAGE_SIZE)
|
||||
for barcode in barcodes:
|
||||
d = Drawing(PAGE_SIZE[0], PAGE_SIZE[1])
|
||||
d.add(dmtx.DataMatrixWidget(barcode[2]))
|
||||
renderPDF.draw(d, can, barcode[0], barcode[1])
|
||||
|
||||
# add text
|
||||
for font_size, texts in font_size_and_texts:
|
||||
can.setFont(FONT, font_size)
|
||||
for text in texts:
|
||||
can.drawString(text[0], text[1], text[2])
|
||||
can.save()
|
||||
packet.seek(0)
|
||||
return PdfFileReader(packet)
|
||||
|
||||
|
||||
# same on all GS1 pages
|
||||
footer = [(45, 45, "Don't have any barcode scanner? Right click on your screen > Inspect > Console and type the following command:"),
|
||||
(45, 35, ' odoo.__DEBUG__.services["web.core"].bus.trigger("barcode_scanned", "setyourbarcodehere", $(".o_web_client")[0])'),
|
||||
(45, 25, 'and replace "setyourbarcodehere" by the barcode you would like to scan OR use our mobile app.'),
|
||||
(45, 15, 'For GS1 barcodes, remove all "("s and ")"s')]
|
||||
|
||||
# page 1
|
||||
# format is (x, y, "barcode")
|
||||
# barcodes to generate
|
||||
barcodes = [(65, 635, "WH-RECEIPTS"), (250, 623, "0106016478556677300000000510Lot0001"), (435, 623, "0106016478556677300000000510Lot0002"),
|
||||
(65, 490, "0106016478556677300000000510Lot0003"), (250, 500, "O-BTN.validate"),
|
||||
(65, 345, "WH-RECEIPTS"), (250, 345, "01060164785599993650000010"), (435, 345, "01060164785599823160000002"),
|
||||
(65, 215, "O-BTN.validate")]
|
||||
|
||||
header = [(45, 785, "GS1 Barcodes (set Barcode Nomenclature to Default GS1 Nomenclature)")]
|
||||
# text to describe barcode flow
|
||||
flow_labels = [(45, 752, "Receive products tracked by lot (activate Lots & Serial Numbers) "),
|
||||
(45, 460, "Receive products with different unit of measures (activate Units of Measure)")]
|
||||
|
||||
# text to describe (above) each barcode
|
||||
barcode_titles = [(55, 733, "YourCompany Receipts"), (215, 733, "Cable Management Box x5 Lot0001"), (400, 733, "Cable Management Box x5 Lot0002"),
|
||||
(45, 600, "Cable Management Box x5 Lot0003"), (280, 600, "Validate"),
|
||||
(55, 444, "YourCompany Receipts"), (230, 444, "Customized Cabinet (USA) 10 ft³"), (415, 444, "Customized Cabinet (Metric) 2 m³"),
|
||||
(93, 315, "Validate")]
|
||||
|
||||
# text of barcode code (below), but made to look pretty (not literal barcode)
|
||||
barcode_code = [(85, 631, "WH-RECEIPTS"), (220, 619, "(01)06016478556677(30)00000005(10)Lot0001"), (405, 619, "(01)06016478556677(30)00000005(10)Lot0002"),
|
||||
(45, 485, "(01)06016478556677(30)00000005(10)Lot0003"), (275, 495, "O-BTN.validate"),
|
||||
(85, 340, "WH-RECEIPTS"), (238, 340, "(01)06016478559999(3650)000010"), (425, 340, "(01)06016478559982(3160)000002"),
|
||||
(85, 212, "O-BTN.validate")]
|
||||
|
||||
|
||||
font_size_and_texts = [(HEADER_FONT_SIZE, header),
|
||||
(LABEL_FONT_SIZE, flow_labels),
|
||||
(TITLE_FONT_SIZE, barcode_titles),
|
||||
(CODE_FONT_SIZE, barcode_code),
|
||||
(FOOTER_FONT_SIZE, footer)]
|
||||
|
||||
page1 = create_page(barcodes, font_size_and_texts)
|
||||
|
||||
# page 2
|
||||
# format is (x, y, "barcode")
|
||||
# barcodes to generate
|
||||
barcodes = [(65, 635, "WH-RECEIPTS"), (250, 635, "0106016478556332305"), (435, 635, "0006016471234567890591PAL"),
|
||||
(65, 500, "O-BTN.validate")]
|
||||
|
||||
header = []
|
||||
# text to describe barcode flow
|
||||
flow_labels = [(45, 752, "Put in Pack (activate Packages)")]
|
||||
|
||||
# text to describe (above) each barcode
|
||||
barcode_titles = [(55, 733, "YourCompany Receipts"), (233, 733, "Individual Workplace x10"), (410, 733, "Put in Pack: Pallet with SSCC"),
|
||||
(93, 600, "Validate")]
|
||||
|
||||
# text of barcode code (below), but made to look pretty (not literal barcode)
|
||||
barcode_code = [(85, 631, "WH-RECEIPTS"), (245, 631, "(01)06016478556332(30)10"), (425, 631, "(00)060164712345678905(91)PAL"),
|
||||
(85, 495, "O-BTN.validate")]
|
||||
|
||||
font_size_and_texts = [(HEADER_FONT_SIZE, header),
|
||||
(LABEL_FONT_SIZE, flow_labels),
|
||||
(TITLE_FONT_SIZE, barcode_titles),
|
||||
(CODE_FONT_SIZE, barcode_code),
|
||||
(FOOTER_FONT_SIZE, footer)]
|
||||
|
||||
page2 = create_page(barcodes, font_size_and_texts)
|
||||
|
||||
|
||||
# merge with other demo barcodes
|
||||
merger = PdfFileMerger()
|
||||
merger.append(PdfFileReader(open(OTHER_DEMO_FILENAME, "rb")))
|
||||
merger.append(page1)
|
||||
merger.append(page2)
|
||||
merger.write(OTHER_DEMO_FILENAME)
|
||||
192
stock_barcode/static/img/make_barcodes.sh
Normal file
192
stock_barcode/static/img/make_barcodes.sh
Normal file
@@ -0,0 +1,192 @@
|
||||
#!/bin/sh
|
||||
|
||||
barcode -t 2x7+40+40 -m 50x30 -p "210x297mm" -e code128b -n > barcodes_actions_barcode.ps << BARCODES
|
||||
O-CMD.MAIN-MENU
|
||||
O-CMD.DISCARD
|
||||
O-BTN.validate
|
||||
O-CMD.cancel
|
||||
O-BTN.print-op
|
||||
O-BTN.print-slip
|
||||
O-BTN.pack
|
||||
O-BTN.scrap
|
||||
O-BTN.record-components
|
||||
O-CMD.PREV
|
||||
O-CMD.NEXT
|
||||
O-CMD.PAGER-FIRST
|
||||
O-CMD.PAGER-LAST
|
||||
BARCODES
|
||||
|
||||
cat > barcodes_actions_header.ps << HEADER
|
||||
/showTitle { /Helvetica findfont 12 scalefont setfont moveto show } def
|
||||
(MAIN MENU) 89 768 showTitle
|
||||
(DISCARD) 348 768 showTitle
|
||||
(VALIDATE) 89 660 showTitle
|
||||
(CANCEL) 348 660 showTitle
|
||||
(PRINT PICKING OPERATION) 89 551 showTitle
|
||||
(PRINT DELIVERY SLIP) 348 551 showTitle
|
||||
(PUT IN PACK) 89 444 showTitle
|
||||
(SCRAP) 348 444 showTitle
|
||||
(RECORD COMPONENTS) 89 337 showTitle
|
||||
(PREVIOUS PAGE) 348 337 showTitle
|
||||
(NEXT PAGE) 89 230 showTitle
|
||||
(FIRST PAGE) 348 230 showTitle
|
||||
(LAST PAGE) 89 123 showTitle
|
||||
|
||||
HEADER
|
||||
|
||||
cat barcodes_actions_header.ps barcodes_actions_barcode.ps | ps2pdf - - > barcodes_actions.pdf
|
||||
rm barcodes_actions_header.ps barcodes_actions_barcode.ps
|
||||
|
||||
# pg 1 of demo barcodes due to ps headers being restricted to 1 page. Some blanks may exist due to flows having a rows with less than 3 barcodes.
|
||||
barcode -t 3x7+20+35 -m 25x30 -p "210x297mm" -e code128b -n > barcodes_demo_barcode_pg_1.ps << BARCODES
|
||||
WH-RECEIPTS
|
||||
601647855638
|
||||
O-BTN.validate
|
||||
WH/OUT/00005
|
||||
601647855644
|
||||
O-BTN.validate
|
||||
WH-RECEIPTS
|
||||
601647855640
|
||||
601647855631
|
||||
LOT-000002
|
||||
LOT-000003
|
||||
O-BTN.validate
|
||||
WH-STOCK
|
||||
601647855649
|
||||
2601892
|
||||
O-BTN.validate
|
||||
|
||||
|
||||
WH-RECEIPTS
|
||||
601647855650
|
||||
O-BTN.pack
|
||||
BARCODES
|
||||
|
||||
# blank lines included for easier visual matching to barcode spacing
|
||||
cat > barcodes_demo_header_pg_1.ps << HEADER
|
||||
/showLabel { /Helvetica findfont 14 scalefont setfont moveto show } def
|
||||
/showTitle { /Helvetica findfont 11 scalefont setfont moveto show } def
|
||||
/showCode { /Helvetica findfont 8 scalefont setfont moveto show } def
|
||||
/showFooter { /Helvetica findfont 8 scalefont setfont moveto show } def
|
||||
(Receive products in stock) 45 797 showLabel
|
||||
(YourCompany Receipts) 45 777 showTitle
|
||||
(WH-RECEIPTS) 85 718 showCode
|
||||
(Desk Stand with Screen) 230 777 showTitle
|
||||
(601647855638) 271 718 showCode
|
||||
(Validate) 415 777 showTitle
|
||||
(O-BTN.validate) 456 718 showCode
|
||||
(Deliver products to your customers) 45 687 showLabel
|
||||
(WH/OUT/00005) 45 667 showTitle
|
||||
(WH/OUT/00005) 85 608 showCode
|
||||
(Desk Combination) 230 667 showTitle
|
||||
(601647855644) 271 608 showCode
|
||||
(Validate) 415 667 showTitle
|
||||
(O-BTN.validate) 456 608 showCode
|
||||
(Receive products tracked by lot number (activate Lots & Serial Numbers)) 45 577 showLabel
|
||||
(YourCompany Receipts) 45 557 showTitle
|
||||
(WH-RECEIPTS) 85 498 showCode
|
||||
(Corner Desk Black) 230 557 showTitle
|
||||
(601647855640) 271 498 showCode
|
||||
(Cable Management Box) 415 557 showTitle
|
||||
(601647855631) 456 498 showCode
|
||||
(LOT-000002) 45 447 showTitle
|
||||
(LOT-000002) 85 388 showCode
|
||||
(LOT-000003) 230 447 showTitle
|
||||
(LOT-000003) 271 388 showCode
|
||||
(Validate) 415 447 showTitle
|
||||
(O-BTN.validate) 456 388 showCode
|
||||
(Internal transfer (activate Storage Locations)) 45 357 showLabel
|
||||
(WH/Stock) 45 337 showTitle
|
||||
(WH-STOCK) 85 278 showCode
|
||||
(Pedal Bin) 230 337 showTitle
|
||||
(601647855649) 271 278 showCode
|
||||
(WH/Stock/Shelf1) 415 337 showTitle
|
||||
(2601892) 456 278 showCode
|
||||
(Validate) 45 227 showTitle
|
||||
(O-BTN.validate) 85 168 showCode
|
||||
|
||||
|
||||
(Put in Pack (activate Packages)) 45 137 showLabel
|
||||
(YourCompany Receipts) 45 117 showTitle
|
||||
(WH-RECEIPTS) 85 58 showCode
|
||||
(Large Cabinet) 230 117 showTitle
|
||||
(601647855650) 271 58 showCode
|
||||
(Put in Pack) 415 117 showTitle
|
||||
(O-BTN.pack) 456 58 showCode
|
||||
|
||||
(Don't have any barcode scanner? Right click on your screen > Inspect > Console and type the following command:) 45 35 showFooter
|
||||
( odoo.__DEBUG__.services["web.core"].bus.trigger("barcode_scanned", "setyourbarcodehere", \$(".o_web_client")[0])) 45 25 showFooter
|
||||
(and replace "setyourbarcodehere" by the barcode you would like to scan OR use our mobile app.) 45 15 showFooter
|
||||
HEADER
|
||||
|
||||
# pg 2 of demo barcodes. Some blanks may exist due to flows having a rows with less than 3 barcodes.
|
||||
barcode -t 3x7+20+35 -m 25x30 -p "210x297mm" -e code128b -n > barcodes_demo_barcode_pg_2.ps << BARCODES
|
||||
O-BTN.validate
|
||||
|
||||
|
||||
BATCH/00002
|
||||
601647855637
|
||||
601647855651
|
||||
601647855635
|
||||
O-BTN.validate
|
||||
|
||||
BATCH/00001
|
||||
601647855652
|
||||
CLUSTER-PACK-1
|
||||
601647855653
|
||||
CLUSTER-PACK-1
|
||||
601647855651
|
||||
CLUSTER-PACK-2
|
||||
O-BTN.validate
|
||||
|
||||
BARCODES
|
||||
|
||||
cat > barcodes_demo_header_pg_2.ps << HEADER
|
||||
/showLabel { /Helvetica findfont 14 scalefont setfont moveto show } def
|
||||
/showTitle { /Helvetica findfont 11 scalefont setfont moveto show } def
|
||||
/showCode { /Helvetica findfont 8 scalefont setfont moveto show } def
|
||||
/showFooter { /Helvetica findfont 8 scalefont setfont moveto show } def
|
||||
(Validate) 45 777 showTitle
|
||||
(O-BTN.validate) 85 718 showCode
|
||||
|
||||
|
||||
(Batch picking (activate Batch Pickings)) 45 687 showLabel
|
||||
(BATCH/00002) 45 667 showTitle
|
||||
(BATCH/00002) 85 608 showCode
|
||||
(Large Meeting Table) 230 667 showTitle
|
||||
(601647855637) 271 608 showCode
|
||||
(Four Person Desk) 415 667 showTitle
|
||||
(601647855651) 456 608 showCode
|
||||
(Three-Seat Sofa) 45 557 showTitle
|
||||
(601647855635) 85 498 showCode
|
||||
(Validate) 230 557 showTitle
|
||||
(O-BTN.validate) 271 498 showCode
|
||||
|
||||
(Batch picking with cluster pickings (activate Batch Pickings and Packages)) 45 467 showLabel
|
||||
(BATCH/00001) 45 447 showTitle
|
||||
(BATCH/00001) 85 388 showCode
|
||||
(Cabinet with Doors) 230 447 showTitle
|
||||
(601647855652) 271 388 showCode
|
||||
(CLUSTER-PACK-1) 415 447 showTitle
|
||||
(CLUSTER-PACK-1) 456 388 showCode
|
||||
(Acoustic Bloc Screens) 45 337 showTitle
|
||||
(601647855653) 85 278 showCode
|
||||
(CLUSTER-PACK-1) 230 337 showTitle
|
||||
(CLUSTER-PACK-1) 271 278 showCode
|
||||
(Four Person Desk) 415 337 showTitle
|
||||
(601647855651) 456 278 showCode
|
||||
(CLUSTER-PACK-2) 45 227 showTitle
|
||||
(CLUSTER-PACK-2) 85 168 showCode
|
||||
(Validate) 230 227 showTitle
|
||||
(O-BTN.validate) 271 168 showCode
|
||||
|
||||
(Don't have any barcode scanner? Right click on your screen > Inspect > Console and type the following command:) 45 35 showFooter
|
||||
( odoo.__DEBUG__.services["web.core"].bus.trigger("barcode_scanned", "setyourbarcodehere", \$(".o_web_client")[0])) 45 25 showFooter
|
||||
(and replace "setyourbarcodehere" by the barcode you would like to scan OR use our mobile app.) 45 15 showFooter
|
||||
HEADER
|
||||
|
||||
cat barcodes_demo_header_pg_1.ps barcodes_demo_barcode_pg_1.ps barcodes_demo_header_pg_2.ps barcodes_demo_barcode_pg_2.ps | ps2pdf - - > barcodes_demo.pdf
|
||||
rm barcodes_demo_header_pg_1.ps barcodes_demo_barcode_pg_1.ps
|
||||
rm barcodes_demo_header_pg_2.ps barcodes_demo_barcode_pg_2.ps
|
||||
|
||||
python3 make_barcodes.py
|
||||
Reference in New Issue
Block a user