feat(collection-label): refs #6602 add qr to the report
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2024-04-12 08:48:29 +02:00
parent 7ddc0b087e
commit aaef10b8d8
4 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.productionConfig MODIFY COLUMN id INT(10) UNSIGNED FIRST;
ALTER TABLE vn.productionConfig ADD scannableCodeType enum('qr','barcode') DEFAULT 'barcode' NOT NULL;

View File

@ -10,7 +10,11 @@
</td>
<td colspan="2" id="shipped">{{labelData.shipped || '---'}}</td>
</tr>
<tr>
<tr v-if="labelData.scannableCodeType === 'qr'">
<td rowspan="3"><div v-html="getQr(labelData.ticketFk)" id="barcode"></div></td>
<td id="outline" class="ellipsize">{{labelData.workerCode || '---'}}</td>
</tr>
<tr v-else>
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td>
<td id="outline" class="ellipsize">{{labelData.workerCode || '---'}}</td>
</tr>

View File

@ -1,4 +1,6 @@
const jsBarcode = require('jsbarcode');
import qrcode from 'qrcode';
import jsBarcode from 'jsbarcode';
const {DOMImplementation, XMLSerializer} = require('xmldom');
const vnReport = require('../../../core/mixins/vn-report.js');
@ -31,6 +33,16 @@ module.exports = {
this.checkMainEntity(this.labelsData);
},
methods: {
getQR(id) {
let QRdata = JSON.stringify({
company: 'vnl',
user: this.userFk,
created: Date.vnNew(),
table: 'ticket',
id
});
return qrcode.toDataURL(QRdata, {margin: 0});
},
getBarcode(id) {
const xmlSerializer = new XMLSerializer();
const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);

View File

@ -17,7 +17,8 @@ SELECT c.itemPackingTypeFk code,
tt.labelCount,
t.nickName,
SUM(IF(sgd.id IS NULL, 1, 0)) + IF(sgd.id , 1, 0) lineCount,
rm.routeFk
rm.routeFk,
pc.scannableCodeType
FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
JOIN vn.collection c ON c.id = tc.collectionFk