Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4810-print_template
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
55b90d8a80
|
@ -47,20 +47,22 @@ module.exports = Self => {
|
||||||
for (let dms of dmsToDelete) {
|
for (let dms of dmsToDelete) {
|
||||||
const pathHash = DmsContainer.getHash(dms.id);
|
const pathHash = DmsContainer.getHash(dms.id);
|
||||||
const dmsContainer = await DmsContainer.container(pathHash);
|
const dmsContainer = await DmsContainer.container(pathHash);
|
||||||
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
|
|
||||||
try {
|
try {
|
||||||
|
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
|
||||||
await fs.unlink(dstFile);
|
await fs.unlink(dstFile);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
continue;
|
if (err.code != 'ENOENT')
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await dms.destroy(myOptions);
|
||||||
|
|
||||||
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
||||||
try {
|
try {
|
||||||
await fs.rmdir(dstFolder);
|
await fs.rmdir(dstFolder);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
await dms.destroy(myOptions);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,12 +47,8 @@ module.exports = class Docker {
|
||||||
if (ci) network = `--network="${networkName}"`;
|
if (ci) network = `--network="${networkName}"`;
|
||||||
|
|
||||||
log('Starting container...');
|
log('Starting container...');
|
||||||
const container = await this.execP(`
|
const container = await this.execP(
|
||||||
docker run \
|
`docker run ${network} --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||||
${network} \
|
|
||||||
--env RUN_CHOWN=${runChown} \
|
|
||||||
-d ${dockerArgs} salix-db
|
|
||||||
`);
|
|
||||||
this.id = container.stdout.trim();
|
this.id = container.stdout.trim();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -918,7 +918,7 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||||
(3, 'Perdida', 'LOST');
|
(3, 'Perdida', 'LOST');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
||||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL),
|
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL),
|
||||||
|
|
|
@ -27518,7 +27518,7 @@ CREATE TABLE `expedition` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`agencyModeFk` int(11) NOT NULL,
|
`agencyModeFk` int(11) NOT NULL,
|
||||||
`ticketFk` int(10) NOT NULL,
|
`ticketFk` int(10) NOT NULL,
|
||||||
`isBox` int(11) DEFAULT 1 COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk',
|
`freightItemFk` int(11) DEFAULT 1 COMMENT 'Este campo realmente en un campo itemFk, haciendo referencia al artículo que nos va a facturar el proveedor de transporte.\nSe debería llamar freightItemFk',
|
||||||
`created` timestamp NULL DEFAULT current_timestamp(),
|
`created` timestamp NULL DEFAULT current_timestamp(),
|
||||||
`isRefund__` bit(1) DEFAULT b'0' COMMENT 'Deprecado 01/06/2022',
|
`isRefund__` bit(1) DEFAULT b'0' COMMENT 'Deprecado 01/06/2022',
|
||||||
`isPickUp__` bit(1) DEFAULT b'0' COMMENT 'Deprecado 01/06/2022',
|
`isPickUp__` bit(1) DEFAULT b'0' COMMENT 'Deprecado 01/06/2022',
|
||||||
|
@ -27534,7 +27534,7 @@ CREATE TABLE `expedition` (
|
||||||
`hasNewRoute` bit(1) NOT NULL DEFAULT b'0',
|
`hasNewRoute` bit(1) NOT NULL DEFAULT b'0',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `index1` (`agencyModeFk`),
|
KEY `index1` (`agencyModeFk`),
|
||||||
KEY `index2` (`isBox`),
|
KEY `index2` (`freightItemFk`),
|
||||||
KEY `index3` (`created`),
|
KEY `index3` (`created`),
|
||||||
KEY `index4` (`ticketFk`),
|
KEY `index4` (`ticketFk`),
|
||||||
KEY `expedition_fk3_idx` (`packagingFk`),
|
KEY `expedition_fk3_idx` (`packagingFk`),
|
||||||
|
@ -27567,7 +27567,7 @@ BEGIN
|
||||||
|
|
||||||
DECLARE vShipFk INT;
|
DECLARE vShipFk INT;
|
||||||
|
|
||||||
IF NEW.isBox > 0 THEN
|
IF NEW.freightItemFk > 0 THEN
|
||||||
|
|
||||||
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
|
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
|
||||||
|
|
||||||
|
@ -27638,7 +27638,7 @@ DELIMITER ;;
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE ticket t
|
UPDATE ticket t
|
||||||
SET packages = (SELECT COUNT(counter)-1
|
SET packages = (SELECT COUNT(counter)-1
|
||||||
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.isBox)
|
FROM expedition e WHERE e.ticketFk = OLD.ticketFk and e.freightItemFk)
|
||||||
WHERE t.id = OLD.ticketFk;
|
WHERE t.id = OLD.ticketFk;
|
||||||
|
|
||||||
END */;;
|
END */;;
|
||||||
|
@ -36287,7 +36287,7 @@ CREATE TABLE `sorter` (
|
||||||
`created` datetime NOT NULL,
|
`created` datetime NOT NULL,
|
||||||
`routeFk` int(10) unsigned NOT NULL,
|
`routeFk` int(10) unsigned NOT NULL,
|
||||||
`ticketFk` int(10) NOT NULL,
|
`ticketFk` int(10) NOT NULL,
|
||||||
`isBox` int(11) DEFAULT 1,
|
`freightItemFk` int(11) DEFAULT 1,
|
||||||
`itemFk` int(11) DEFAULT NULL,
|
`itemFk` int(11) DEFAULT NULL,
|
||||||
`width` decimal(10,2) DEFAULT 0.00,
|
`width` decimal(10,2) DEFAULT 0.00,
|
||||||
`depth` decimal(10,2) DEFAULT 0.00,
|
`depth` decimal(10,2) DEFAULT 0.00,
|
||||||
|
@ -44956,7 +44956,7 @@ BEGIN
|
||||||
SELECT SUM((t.zonePrice - t.zoneBonus) * ebv.ratio) INTO deliveryPrice
|
SELECT SUM((t.zonePrice - t.zoneBonus) * ebv.ratio) INTO deliveryPrice
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
LEFT JOIN expedition e ON e.ticketFk = t.id
|
LEFT JOIN expedition e ON e.ticketFk = t.id
|
||||||
JOIN expeditionBoxVol ebv ON ebv.boxFk = e.isBox
|
JOIN expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk
|
||||||
WHERE t.id = vTicketFk;
|
WHERE t.id = vTicketFk;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -46492,7 +46492,7 @@ BEGIN
|
||||||
LEFT JOIN item i ON i.id = b.itemFk
|
LEFT JOIN item i ON i.id = b.itemFk
|
||||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox
|
LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.freightItemFk
|
||||||
JOIN volumeConfig vc ON TRUE
|
JOIN volumeConfig vc ON TRUE
|
||||||
WHERE b.id = vSelf;
|
WHERE b.id = vSelf;
|
||||||
|
|
||||||
|
@ -53229,7 +53229,7 @@ BEGIN
|
||||||
INNER JOIN vn.ticketState ts ON ts.ticketFk = exp.ticketFk
|
INNER JOIN vn.ticketState ts ON ts.ticketFk = exp.ticketFk
|
||||||
LEFT JOIN vn.address a ON t.addressFk = a.id
|
LEFT JOIN vn.address a ON t.addressFk = a.id
|
||||||
LEFT JOIN vn.warehouse w ON t.warehouseFk = w.id
|
LEFT JOIN vn.warehouse w ON t.warehouseFk = w.id
|
||||||
WHERE t.routeFk = vRouteFk AND exp.isBox > 0;
|
WHERE t.routeFk = vRouteFk AND exp.freightItemFk > 0;
|
||||||
END ;;
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
@ -53760,7 +53760,7 @@ BEGIN
|
||||||
GROUP BY sub.ticketFk
|
GROUP BY sub.ticketFk
|
||||||
) sub2 ON sub2.ticketFk = t.id
|
) sub2 ON sub2.ticketFk = t.id
|
||||||
LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk
|
LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk
|
||||||
WHERE t.routeFk = vRouteFk AND e.isBox <> FALSE
|
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
||||||
ORDER BY r.created, t.priority DESC;
|
ORDER BY r.created, t.priority DESC;
|
||||||
END ;;
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
ng-transclude="prepend"
|
ng-transclude="prepend"
|
||||||
class="prepend">
|
class="prepend">
|
||||||
</div>
|
</div>
|
||||||
<div class="infix">
|
<div class="infix" >
|
||||||
<div class="fix prefix"></div>
|
<div class="fix prefix"></div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<section
|
<section
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
</section>
|
</section>
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
accept="{{$ctrl.accept}}"
|
accept="{{$ctrl.accept}}">
|
||||||
style="display: none;">
|
|
||||||
</input>
|
</input>
|
||||||
</div>
|
</div>
|
||||||
<div class="fix suffix"></div>
|
<div class="fix suffix"></div>
|
||||||
|
|
|
@ -4,4 +4,13 @@
|
||||||
.value {
|
.value {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.control {
|
||||||
|
& > input[type=file] {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
& > section {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -239,5 +239,6 @@
|
||||||
"This route does not exists": "Esta ruta no existe",
|
"This route does not exists": "Esta ruta no existe",
|
||||||
"Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*",
|
"Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*",
|
||||||
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
||||||
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario"
|
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
|
||||||
|
"Empty data source": "Origen de datos vacio"
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
url="Packagings"
|
url="Packagings"
|
||||||
show-field="id"
|
show-field="id"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
where="{isBox: true}"
|
where="{freightItemFk: true}"
|
||||||
ng-model="buy.packageFk"
|
ng-model="buy.packageFk"
|
||||||
on-change="$ctrl.saveBuy(buy)">
|
on-change="$ctrl.saveBuy(buy)">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
||||||
`SELECT
|
`SELECT
|
||||||
e.id,
|
e.id,
|
||||||
e.ticketFk,
|
e.ticketFk,
|
||||||
e.isBox,
|
e.freightItemFk,
|
||||||
e.workerFk,
|
e.workerFk,
|
||||||
i1.name packageItemName,
|
i1.name packageItemName,
|
||||||
e.counter,
|
e.counter,
|
||||||
|
@ -51,7 +51,7 @@ module.exports = Self => {
|
||||||
FROM vn.expedition e
|
FROM vn.expedition e
|
||||||
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
|
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
|
||||||
LEFT JOIN vn.item i2 ON i2.id = e.itemFk
|
LEFT JOIN vn.item i2 ON i2.id = e.itemFk
|
||||||
INNER JOIN vn.item i1 ON i1.id = e.isBox
|
INNER JOIN vn.item i1 ON i1.id = e.freightItemFk
|
||||||
LEFT JOIN vn.packaging p ON p.id = e.packagingFk
|
LEFT JOIN vn.packaging p ON p.id = e.packagingFk
|
||||||
LEFT JOIN vn.item i3 ON i3.id = p.itemFk
|
LEFT JOIN vn.item i3 ON i3.id = p.itemFk
|
||||||
LEFT JOIN account.user u ON u.id = e.workerFk
|
LEFT JOIN account.user u ON u.id = e.workerFk
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
const {Report} = require('vn-print');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('collectionLabel', {
|
||||||
|
description: 'Returns the collection label',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The ticket id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/:id/collection-label',
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.collectionLabel = async(ctx, id) => {
|
||||||
|
const args = Object.assign({}, ctx.args);
|
||||||
|
const params = {lang: ctx.req.getLocale()};
|
||||||
|
|
||||||
|
delete args.ctx;
|
||||||
|
for (const param in args)
|
||||||
|
params[param] = args[param];
|
||||||
|
|
||||||
|
const report = new Report('collection-label', params);
|
||||||
|
const stream = await report.toPdfStream();
|
||||||
|
|
||||||
|
return [stream, 'application/pdf', `filename="doc-${id}.pdf"`];
|
||||||
|
};
|
||||||
|
};
|
|
@ -16,7 +16,7 @@
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"isBox": {
|
"freightItemFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"created": {
|
"created": {
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
"freightItem": {
|
"freightItem": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Item",
|
"model": "Item",
|
||||||
"foreignKey": "isBox"
|
"foreignKey": "freightItemFk"
|
||||||
},
|
},
|
||||||
"packaging": {
|
"packaging": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -33,4 +33,5 @@ module.exports = function(Self) {
|
||||||
require('../methods/ticket/closeByTicket')(Self);
|
require('../methods/ticket/closeByTicket')(Self);
|
||||||
require('../methods/ticket/closeByAgency')(Self);
|
require('../methods/ticket/closeByAgency')(Self);
|
||||||
require('../methods/ticket/closeByRoute')(Self);
|
require('../methods/ticket/closeByRoute')(Self);
|
||||||
|
require('../methods/ticket/collectionLabel')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const vnPrintPath = path.resolve('print');
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${vnPrintPath}/common/css/spacing.css`,
|
||||||
|
`${vnPrintPath}/common/css/misc.css`,
|
||||||
|
`${vnPrintPath}/common/css/layout.css`,
|
||||||
|
`${vnPrintPath}/common/css/report.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,37 @@
|
||||||
|
html {
|
||||||
|
font-family: "Roboto";
|
||||||
|
margin-top: -7px;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
#vertical {
|
||||||
|
writing-mode: vertical-rl;
|
||||||
|
height: 226px;
|
||||||
|
margin-left: -13px;
|
||||||
|
}
|
||||||
|
.outline {
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
#nickname {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
#agencyDescripton {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
#bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
#barcode{
|
||||||
|
width: 390px;
|
||||||
|
}
|
||||||
|
#shipped {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
#ticketFk, #vertical {
|
||||||
|
font-size: 34px;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html v-bind:lang="$i18n.locale">
|
||||||
|
<body>
|
||||||
|
<table v-for="labelData in labelsData" style="break-before: page;">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="6"><span id="vertical">{{labelData.levelV}}</span></td>
|
||||||
|
<td id="ticketFk" >{{labelData.ticketFk}} ⬸ {{labelData.clientFk}}</td>
|
||||||
|
<td colspan="2" id="shipped">{{labelData.shipped}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td>
|
||||||
|
<td class="outline">{{labelData.workerCode}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="outline">{{labelData.labelCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="outline">{{labelData.size}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><div id="agencyDescripton">{{labelData.agencyDescription}}</div></td>
|
||||||
|
<td id="bold">{{labelData.lineCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td id="nickname">{{labelData.nickName}}</td>
|
||||||
|
<td id="bold">{{labelData.agencyHour}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,46 @@
|
||||||
|
const jsBarcode = require('jsbarcode');
|
||||||
|
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'collection-label',
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
description: 'The ticket or collection id'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async serverPrefetch() {
|
||||||
|
let ticketIds;
|
||||||
|
const res = await this.rawSqlFromDef('tickets', [this.id]);
|
||||||
|
|
||||||
|
if (res.length) {
|
||||||
|
ticketIds = [];
|
||||||
|
for (const row of res)
|
||||||
|
ticketIds.push(row.ticketFk);
|
||||||
|
} else
|
||||||
|
ticketIds = [this.id];
|
||||||
|
|
||||||
|
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
|
||||||
|
|
||||||
|
if (!this.labelsData.length)
|
||||||
|
throw new UserError('Empty data source');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
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: 110,
|
||||||
|
});
|
||||||
|
return xmlSerializer.serializeToString(svgNode);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
reportName: labelCollection
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"width": "10.4cm",
|
||||||
|
"height": "4.8cm",
|
||||||
|
"margin": {
|
||||||
|
"top": "0cm",
|
||||||
|
"right": "0.5cm",
|
||||||
|
"bottom": "0cm",
|
||||||
|
"left": "0cm"
|
||||||
|
},
|
||||||
|
"printBackground": true
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
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)), 'm³') 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_FORMAT(t.shipped, '%H:%i'), TIME_FORMAT(zo.`hour`, '%H:%i')) agencyHour,
|
||||||
|
DATE_FORMAT(t.shipped, '%d/%m/%y') 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 tc.ticketFk IN (?)
|
||||||
|
GROUP BY t.id
|
||||||
|
ORDER BY cc.`code`;
|
|
@ -0,0 +1,3 @@
|
||||||
|
SELECT ticketFk
|
||||||
|
FROM ticketCollection
|
||||||
|
WHERE collectionFk = ?
|
Loading…
Reference in New Issue