refs #4898 Added barcode and changes in structure
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2022-12-22 08:04:03 +01:00
parent 7731ca143e
commit d391946f57
4 changed files with 38 additions and 11 deletions

View File

@ -17,7 +17,6 @@ html {
}
.mainTable {
width: 100%;
height: 100%;
border: 10px solid;
border-radius: 20px;
-moz-border-radius: 20px;
@ -54,8 +53,17 @@ html {
}
#QR {
padding: 25px;
padding-left: 40px;
margin-left: 35px;
float:left;
}
#barcode{
text-align: center;
}
#right {
float: right;
margin-top: 20px;
width: 250;
max-width: 250px;
}
#additionalInfo {
padding-top: 20px;

View File

@ -4,10 +4,11 @@
<table class="mainTable">
<tbody>
<tr>
<td colspan="2" id="truck" class="ellipsize">{{labelData.truck || '---'}}</td>
<td id="truck" class="ellipsize">{{labelData.truck || '---'}}</td>
</tr>
<tr>
<td colspan="2">
<td>
<div v-html="getBarcode(labelData.palletFk)" id="barcode"></div>
<table v-for="labelData in labelsData" class="zoneTable">
<thead>
<tr v-if="!labelData.isMatch" id="black">
@ -25,11 +26,13 @@
</td>
</tr>
<tr>
<td><img :src="QR" id="QR"/></td>
<td class="ellipsize">
<div id="additionalInfo"><b>Pallet: </b>{{id}}</div>
<div id="additionalInfo"><b>User: </b> {{username.name || '---'}}</div>
<div id="additionalInfo"><b>Day: </b>{{labelData.dayName.toUpperCase() || '---'}}</div>
<td>
<img :src="QR" id="QR"/>
<div id="right">
<div id="additionalInfo" class="ellipsize"><b>Pallet: </b>{{id}}</div>
<div id="additionalInfo" class="ellipsize"><b>User: </b> {{username.name || '---'}}</div>
<div id="additionalInfo" class="ellipsize"><b>Day: </b>{{labelData.dayName.toUpperCase() || '---'}}</div>
</div>
</td>
</tr>
</tbody>

View File

@ -1,5 +1,7 @@
const Component = require(`vn-print/core/component`);
const reportBody = new Component('report-body');
const jsBarcode = require('jsbarcode');
const {DOMImplementation, XMLSerializer} = require('xmldom');
const UserError = require('vn-loopback/util/user-error');
const qrcode = require('qrcode');
@ -39,6 +41,20 @@ module.exports = {
const data = String(id);
return qrcode.toDataURL(data, {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: 6,
height: 90,
});
return xmlSerializer.serializeToString(svgNode);
},
},
components: {
'report-body': reportBody.build()

View File

@ -2,8 +2,8 @@
"width": "10cm",
"height": "15cm",
"margin": {
"top": "0.5cm",
"right": "0.2cm",
"top": "0.3cm",
"right": "0.07cm",
"bottom": "0cm",
"left": "0cm"
},