second commit

This commit is contained in:
Guillermo Bonet 2022-10-04 13:06:59 +02:00
parent 23726b6e60
commit 2c7cce4b36
5 changed files with 25 additions and 88 deletions

View File

@ -4,37 +4,36 @@
<table class="grid">
<tbody>
<tr>
<td rowspan="6"><span class="vertical">{{levelV}}</span></td>
<td id="right">{{ticketFk}}</td>
<td rowspan="6"><span class="vertical">{{tags.levelV}}</span></td>
<td id="right">{{tags.ticketFk}}</td>
<td>/</td>
<td id="left">{{clientFk}}</td>
<td colspan="2">{{shipped}}</td>
<td id="left">{{tags.clientFk}}</td>
<td colspan="2">{{tags.shipped}}</td>
</tr>
<tr>
<td colspan="3" rowspan="3" class="center">{{barcode}}</td>
<td colspan="3" rowspan="3" class="center"><img v-bind:src="barcode"/></td>
<td></td>
<td class="outline">{{workerCode}}</td>
<td class="outline">{{tags.workerCode}}</td>
</tr>
<tr>
<td></td>
<td class="outline">{{labelCount}}</td>
<td class="outline">{{tags.labelCount}}</td>
</tr>
<tr>
<td></td>
<td class="outline">{{packingTypeFk}}</td>
<td class="outline">{{tags.itemPackingTypeFk}}</td>
</tr>
<tr>
<td colspan="3" id="agencyDescripton" class="center">{{agencyDescripton}}</span></td>
<td colspan="3" id="agencyDescripton" class="center">{{tags.agencyDescripton}}</span></td>
<td></td>
<td id="bold">{{lineCount}}</td>
<td id="bold">{{tags.lineCount}}</td>
</tr>
<tr>
<td colspan="3" id="nickname" class="center">{{nickname}}</td>
<td colspan="3" id="nickname" class="center">{{tags.nickname}}</td>
<td></td>
<td id="bold">{{agencyHour}}</td>
<td id="bold">{{tags.agencyHour}}</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -6,45 +6,27 @@ const qrcode = require('qrcode');
module.exports = {
name: 'collection-label',
async serverPrefetch() {
this.collectionTicket = await this.fetchItem(this.collectionTicketId);
this.tags = await this.fetchItemTags(this.collectionTicketId);
this.barcode = await this.getBarcodeBase64(this.collectionTicketId);
this.isCollection = await this.isCollection(this.param);
this.tags = await this.fetchCollectionTicket(this.isCollection, this.param, this.param);
this.barcode = await this.getBarcodeBase64(this.param);
if (!this.collectionTicket)
if (!this.tags)
throw new Error('Something went wrong');
},
computed: {
dated() {
const filters = this.$options.filters;
return filters.date(new Date(), '%W/%d');
},
labelPage() {
const labelNumber = this.labelNumber ? this.labelNumber : 1;
const totalLabels = this.totalLabels ? this.totalLabels : 1;
return `${labelNumber}/${totalLabels}`;
}
},
methods: {
fetchItem(id, warehouseId) {
return this.findOneFromDef('item', [id, warehouseId]);
isCollection(param) {
return this.findOneFromDef('isCollection', [param]);
},
fetchItemTags(itemId) {
return this.rawSqlFromDef('itemTags', [itemId]).then(rows => {
fetchCollectionTicket(isCollection, param, param) {
return this.rawSqlFromDef('collectionTicket', [isCollection, param, param]).then(rows => {
const tags = {};
rows.forEach(row => tags[row.code] = row.value);
return tags;
});
},
getBarcodeBase64(itemId) {
return qrcode.toDataURL(itemId, {margin: 0});
},
packing() {
const stems = this.item.stems ? this.item.stems : 1;
return `${this.item.packing}x${stems}`;
getBarcodeBase64(param) {
return qrcode.toDataURL(param, {margin: 0});
}
},
components: {
@ -52,17 +34,8 @@ module.exports = {
'report-footer': reportFooter.build()
},
props: {
itemId: {
param: {
required: true
},
warehouseId: {
required: true
},
labelNumber: {
type: String
},
totalLabels: {
type: String
}
}
};

View File

@ -1,35 +0,0 @@
SELECT c.itemPackingTypeFk,
CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color,
CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV,
tc.ticketFk,
LEFT(COALESCE(et.description, zo.name, am.name),12) agencyDescription,
am.name,
t.clientFk,
CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), '') m3 ,
CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size,
w.code workerCode,
tt.labelCount,
IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour,
t.shipped,
COUNT(*) lineCount,
t.nickName
FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
JOIN vn.collection c ON c.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
AND cc.wagon = tc.wagon
AND cc.trainFk = c.trainFk
JOIN vn.sale s ON s.ticketFk = t.id
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.worker w ON w.id = c.workerFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam)
GROUP BY t.id
ORDER BY cc.`code`;