From 1a2ed9ce68cef8d172148c76adb0d2cfd78efcd7 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 31 Jul 2024 11:33:12 +0200 Subject: [PATCH 1/5] refactor: refs #7644 Optimized barcode --- .../templates/reports/buy-label/buy-label.js | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/print/templates/reports/buy-label/buy-label.js b/print/templates/reports/buy-label/buy-label.js index 48ffe336c..18f71c772 100755 --- a/print/templates/reports/buy-label/buy-label.js +++ b/print/templates/reports/buy-label/buy-label.js @@ -12,20 +12,28 @@ module.exports = { const date = new Date(); this.weekNum = moment(date).isoWeek(); this.dayNum = moment(date).day(); + this.barcodes = []; + await this.generateAllBarcodes(this.buys); }, methods: { - getBarcode(id) { - const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null); - const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + generateAllBarcodes(buys) { + const uniqueBuyIds = new Set(buys.map(buy => buy.id)); + for (let buy of uniqueBuyIds) { + const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null); + const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - jsBarcode(svgNode, id, { - xmlDocument: document, - format: 'code128', - displayValue: false, - width: 3.8, - height: 115, - }); - return new XMLSerializer().serializeToString(svgNode); + jsBarcode(svgNode, buy, { + xmlDocument: document, + format: 'code128', + displayValue: false, + width: 3.8, + height: 115, + }); + this.barcodes.push({id: buy, barcode: new XMLSerializer().serializeToString(svgNode)}); + } + }, + getBarcode(id) { + return this.barcodes.find(item => item.id === id).barcode; } }, props: { -- 2.40.1 From 8edb115c2b0acf6eef8a2cefefa9cc066d498b4f Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 31 Jul 2024 12:25:26 +0200 Subject: [PATCH 2/5] feat: refs #7644 Fix msg print --- print/core/cluster.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/print/core/cluster.js b/print/core/cluster.js index e50c26823..3b9c4dfde 100644 --- a/print/core/cluster.js +++ b/print/core/cluster.js @@ -35,8 +35,10 @@ module.exports = { logger.error(`[Print] => ${err.message}`); }); - cluster.on('queue', () => - process.env.SPEC_IS_RUNNING === 'false' && logger.info('Printing task initialized by pool')); + cluster.on('queue', () => { + if (process.env.SPEC_IS_RUNNING !== 'true') + logger.info('Printing task initialized by pool'); + }); }); } }; -- 2.40.1 From fcca2b65c2716917e5032abaa1acf31954002304 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 31 Jul 2024 14:20:36 +0200 Subject: [PATCH 3/5] feat: refs #7644 Fix traduction --- print/templates/reports/buy-label/locale/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/buy-label/locale/en.yml b/print/templates/reports/buy-label/locale/en.yml index 333282759..0de70c000 100644 --- a/print/templates/reports/buy-label/locale/en.yml +++ b/print/templates/reports/buy-label/locale/en.yml @@ -6,7 +6,7 @@ color: Color origin: Origin packing: Packing grouping: Grouping -unitSale: Un. sale +saleUnit: Un. sale producer: Producer control: Control boxNum: Box no. -- 2.40.1 From b1109af1e8f8d9cd031ccba41e1df8061dafcb21 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 2 Aug 2024 10:13:31 +0200 Subject: [PATCH 4/5] feat: refs #7644 Minor changes --- print/templates/reports/buy-label/assets/css/style.css | 2 +- print/templates/reports/buy-label/buy-label.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/buy-label/assets/css/style.css b/print/templates/reports/buy-label/assets/css/style.css index 3b1f2f91e..dee9fe449 100644 --- a/print/templates/reports/buy-label/assets/css/style.css +++ b/print/templates/reports/buy-label/assets/css/style.css @@ -7,11 +7,11 @@ table { border: 1px solid; width: 100%; font-size: inherit; + page-break-before: always; } td { border: 1px solid; padding: 5px; - width: 100%; } span { font-size: 48px; diff --git a/print/templates/reports/buy-label/buy-label.html b/print/templates/reports/buy-label/buy-label.html index 4a0d7f3fc..4bc073660 100644 --- a/print/templates/reports/buy-label/buy-label.html +++ b/print/templates/reports/buy-label/buy-label.html @@ -1,6 +1,6 @@ - +
-- 2.40.1 From 76d8c6c668d4e5e22c0787924d9a25122e320a51 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 2 Aug 2024 11:08:22 +0200 Subject: [PATCH 5/5] feat: refs #7644 Minor changes --- print/templates/reports/buy-label/buy-label.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/buy-label/buy-label.html b/print/templates/reports/buy-label/buy-label.html index 4bc073660..698504238 100644 --- a/print/templates/reports/buy-label/buy-label.html +++ b/print/templates/reports/buy-label/buy-label.html @@ -1,6 +1,6 @@ - +
-- 2.40.1