feat: refs #7646 delete scannableCodeType

This commit is contained in:
Robert Ferrús 2024-07-24 09:14:28 +02:00
parent 23732ab20a
commit 5a9ab84356
4 changed files with 10 additions and 29 deletions

View File

@ -0,0 +1,7 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn.productionConfig
CHANGE COLUMN IF EXISTS scannableCodeType scannableCodeType__ enum('qr','barcode')
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'barcode' NOT NULL,
CHANGE COLUMN IF EXISTS scannablePreviusCodeType scannablePreviusCodeType__ enum('qr','barcode')
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'barcode' NOT NULL;

View File

@ -10,14 +10,10 @@
</td> </td>
<td colspan="2" id="shipped">{{dashIfEmpty(labelData.shipped)}}</td> <td colspan="2" id="shipped">{{dashIfEmpty(labelData.shipped)}}</td>
</tr> </tr>
<tr v-if="labelData?.qrData"> <tr>
<td rowspan="3"><img :src="labelData.qrData" class="qr"/></td> <td rowspan="3"><img :src="labelData.qrData" class="qr"/></td>
<td id="outline" class="ellipsize">{{dashIfEmpty(labelData.workerCode)}}</td> <td id="outline" class="ellipsize">{{dashIfEmpty(labelData.workerCode)}}</td>
</tr> </tr>
<tr v-else>
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" class="basrcode"></div></td>
<td id="outline" class="ellipsize">{{dashIfEmpty(labelData.workerCode)}}</td>
</tr>
<tr> <tr>
<td id="outline" class="ellipsize">{{labelCount || labelData.labelCount || 0}}</td> <td id="outline" class="ellipsize">{{labelCount || labelData.labelCount || 0}}</td>
</tr> </tr>

View File

@ -1,7 +1,5 @@
const {DOMImplementation, XMLSerializer} = require('xmldom');
const vnReport = require('../../../core/mixins/vn-report.js'); const vnReport = require('../../../core/mixins/vn-report.js');
const {toDataURL} = require('qrcode'); const {toDataURL} = require('qrcode');
const jsBarcode = require('jsbarcode');
module.exports = { module.exports = {
name: 'collection-label', name: 'collection-label',
@ -30,11 +28,8 @@ module.exports = {
const labels = await this.rawSqlFromDef('labelsData', [ticketIds]); const labels = await this.rawSqlFromDef('labelsData', [ticketIds]);
const [{scannableCodeType}] = await this.rawSqlFromDef('barcodeType'); for (const labelData of labels)
if (scannableCodeType === 'qr') { labelData.qrData = await this.getQr(labelData?.ticketFk, labelData?.workerFk);
for (const labelData of labels)
labelData.qrData = await this.getQr(labelData?.ticketFk, labelData?.workerFk);
}
this.labelsData = labels; this.labelsData = labels;
this.checkMainEntity(this.labelsData); this.checkMainEntity(this.labelsData);
@ -50,20 +45,6 @@ module.exports = {
}); });
return toDataURL(QRdata, {margin: 0}); return toDataURL(QRdata, {margin: 0});
}, },
getBarcode(id) {
const xmlSerializer = new XMLSerializer();
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 xmlSerializer.serializeToString(svgNode);
},
getVertical(labelData) { getVertical(labelData) {
let value; let value;
if (labelData.collectionFk) { if (labelData.collectionFk) {

View File

@ -1,3 +0,0 @@
SELECT scannableCodeType
FROM productionConfig
LIMIT 1