Merge branch 'dev' into 5546-codigo-registro
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
b4ef49cf24
|
@ -0,0 +1,74 @@
|
||||||
|
DROP TABLE `vn`.`dmsRecover`;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`delivery` DROP FOREIGN KEY delivery_FK;
|
||||||
|
ALTER TABLE `vn`.`delivery` DROP COLUMN addressFk;
|
||||||
|
ALTER TABLE `vn`.`delivery` ADD ticketFk INT NOT NULL;
|
||||||
|
ALTER TABLE `vn`.`delivery` ADD CONSTRAINT delivery_ticketFk_FK FOREIGN KEY (`ticketFk`) REFERENCES `vn`.`ticket`(`id`);
|
||||||
|
|
||||||
|
DELETE FROM `salix`.`ACL` WHERE `property` = 'saveSign';
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||||
|
VALUES
|
||||||
|
('Ticket','saveSign','WRITE','ALLOW','employee');
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS vn.route_getTickets;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_getTickets`(vRouteFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Pasado un RouteFk devuelve la información
|
||||||
|
* de sus tickets.
|
||||||
|
*
|
||||||
|
* @param vRouteFk
|
||||||
|
*
|
||||||
|
* @select Información de los tickets
|
||||||
|
*/
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
t.id Id,
|
||||||
|
t.clientFk Client,
|
||||||
|
a.id Address,
|
||||||
|
t.packages Packages,
|
||||||
|
a.street AddressName,
|
||||||
|
a.postalCode PostalCode,
|
||||||
|
a.city City,
|
||||||
|
sub2.itemPackingTypeFk PackingType,
|
||||||
|
c.phone ClientPhone,
|
||||||
|
c.mobile ClientMobile,
|
||||||
|
a.phone AddressPhone,
|
||||||
|
a.mobile AddressMobile,
|
||||||
|
d.longitude Longitude,
|
||||||
|
d.latitude Latitude,
|
||||||
|
wm.mediaValue SalePersonPhone,
|
||||||
|
tob.Note Note,
|
||||||
|
t.isSigned Signed
|
||||||
|
FROM ticket t
|
||||||
|
JOIN client c ON t.clientFk = c.id
|
||||||
|
JOIN address a ON t.addressFk = a.id
|
||||||
|
LEFT JOIN delivery d ON t.id = d.ticketFk
|
||||||
|
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT tob.description Note, t.id
|
||||||
|
FROM ticketObservation tob
|
||||||
|
JOIN ticket t ON tob.ticketFk = t.id
|
||||||
|
JOIN observationType ot ON ot.id = tob.observationTypeFk
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
AND ot.code = 'delivery'
|
||||||
|
)tob ON tob.id = t.id
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT sub.ticketFk,
|
||||||
|
CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeFk
|
||||||
|
FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items
|
||||||
|
FROM ticket t
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
GROUP BY t.id,i.itemPackingTypeFk)sub
|
||||||
|
GROUP BY sub.ticketFk
|
||||||
|
) sub2 ON sub2.ticketFk = t.id
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
GROUP BY t.id
|
||||||
|
ORDER BY t.priority;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,67 @@
|
||||||
|
DELETE FROM `salix`.`ACL` WHERE `property` = 'saveSign';
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`)
|
||||||
|
VALUES
|
||||||
|
('Ticket','saveSign','WRITE','ALLOW','employee');
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS vn.route_getTickets;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_getTickets`(vRouteFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Pasado un RouteFk devuelve la información
|
||||||
|
* de sus tickets.
|
||||||
|
*
|
||||||
|
* @param vRouteFk
|
||||||
|
*
|
||||||
|
* @select Información de los tickets
|
||||||
|
*/
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
t.id Id,
|
||||||
|
t.clientFk Client,
|
||||||
|
a.id Address,
|
||||||
|
t.packages Packages,
|
||||||
|
a.street AddressName,
|
||||||
|
a.postalCode PostalCode,
|
||||||
|
a.city City,
|
||||||
|
sub2.itemPackingTypeFk PackingType,
|
||||||
|
c.phone ClientPhone,
|
||||||
|
c.mobile ClientMobile,
|
||||||
|
a.phone AddressPhone,
|
||||||
|
a.mobile AddressMobile,
|
||||||
|
d.longitude Longitude,
|
||||||
|
d.latitude Latitude,
|
||||||
|
wm.mediaValue SalePersonPhone,
|
||||||
|
tob.Note Note,
|
||||||
|
t.isSigned Signed
|
||||||
|
FROM ticket t
|
||||||
|
JOIN client c ON t.clientFk = c.id
|
||||||
|
JOIN address a ON t.addressFk = a.id
|
||||||
|
LEFT JOIN delivery d ON t.id = d.ticketFk
|
||||||
|
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT tob.description Note, t.id
|
||||||
|
FROM ticketObservation tob
|
||||||
|
JOIN ticket t ON tob.ticketFk = t.id
|
||||||
|
JOIN observationType ot ON ot.id = tob.observationTypeFk
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
AND ot.code = 'delivery'
|
||||||
|
)tob ON tob.id = t.id
|
||||||
|
LEFT JOIN
|
||||||
|
(SELECT sub.ticketFk,
|
||||||
|
CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeFk
|
||||||
|
FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items
|
||||||
|
FROM ticket t
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
GROUP BY t.id,i.itemPackingTypeFk)sub
|
||||||
|
GROUP BY sub.ticketFk
|
||||||
|
) sub2 ON sub2.ticketFk = t.id
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
GROUP BY t.id
|
||||||
|
ORDER BY t.priority;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,83 @@
|
||||||
|
CREATE TABLE `vn`.`dmsRecover` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`ticketFk` int(11) DEFAULT NULL,
|
||||||
|
`sign` text DEFAULT NULL,
|
||||||
|
`created` timestamp NULL DEFAULT current_timestamp(),
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `ticketFk_idx` (`ticketFk`),
|
||||||
|
CONSTRAINT `ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=31917 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`delivery` ADD addressFk INT;
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS `vn`.`route_getTickets`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_getTickets`(vRouteFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Pasado un RouteFk devuelve la información
|
||||||
|
* de sus tickets.
|
||||||
|
*
|
||||||
|
* @param vRouteFk
|
||||||
|
* @select Información de los tickets
|
||||||
|
*/
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT t.id Id,
|
||||||
|
t.clientFk Client,
|
||||||
|
a.id Address,
|
||||||
|
a.nickname ClientName,
|
||||||
|
t.packages Packages,
|
||||||
|
a.street AddressName,
|
||||||
|
a.postalCode PostalCode,
|
||||||
|
a.city City,
|
||||||
|
sub2.itemPackingTypeFk PackingType,
|
||||||
|
c.phone ClientPhone,
|
||||||
|
c.mobile ClientMobile,
|
||||||
|
a.phone AddressPhone,
|
||||||
|
a.mobile AddressMobile,
|
||||||
|
d.longitude Longitude,
|
||||||
|
d.latitude Latitude,
|
||||||
|
wm.mediaValue SalePersonPhone,
|
||||||
|
tob.description Note,
|
||||||
|
t.isSigned Signed,
|
||||||
|
t.priority
|
||||||
|
FROM ticket t
|
||||||
|
JOIN client c ON t.clientFk = c.id
|
||||||
|
JOIN address a ON t.addressFk = a.id
|
||||||
|
LEFT JOIN delivery d ON d.addressFk = a.id
|
||||||
|
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk
|
||||||
|
LEFT JOIN(
|
||||||
|
SELECT tob.description, t.id
|
||||||
|
FROM ticketObservation tob
|
||||||
|
JOIN ticket t ON tob.ticketFk = t.id
|
||||||
|
JOIN observationType ot ON ot.id = tob.observationTypeFk
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
AND ot.code = 'delivery'
|
||||||
|
)tob ON tob.id = t.id
|
||||||
|
LEFT JOIN(
|
||||||
|
SELECT sub.ticketFk,
|
||||||
|
CONCAT('(',
|
||||||
|
GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk
|
||||||
|
ORDER BY sub.items DESC SEPARATOR ','),
|
||||||
|
') ') itemPackingTypeFk
|
||||||
|
FROM (
|
||||||
|
SELECT s.ticketFk, i.itemPackingTypeFk, COUNT(*) items
|
||||||
|
FROM ticket t
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
GROUP BY t.id, i.itemPackingTypeFk
|
||||||
|
)sub
|
||||||
|
GROUP BY sub.ticketFk
|
||||||
|
)sub2 ON sub2.ticketFk = t.id
|
||||||
|
WHERE t.routeFk = vRouteFk
|
||||||
|
ORDER BY d.id DESC
|
||||||
|
LIMIT 10000000000000000000
|
||||||
|
)sub3
|
||||||
|
GROUP BY sub3.id
|
||||||
|
ORDER BY sub3.priority;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -56,7 +56,7 @@ module.exports = Self => {
|
||||||
reference: invoiceOut.ref,
|
reference: invoiceOut.ref,
|
||||||
recipientId: invoiceOut.clientFk
|
recipientId: invoiceOut.clientFk
|
||||||
});
|
});
|
||||||
const stream = await invoiceReport.toPdfStream();
|
const buffer = await invoiceReport.toPdfStream();
|
||||||
|
|
||||||
const issued = invoiceOut.issued;
|
const issued = invoiceOut.issued;
|
||||||
const year = issued.getFullYear().toString();
|
const year = issued.getFullYear().toString();
|
||||||
|
@ -66,7 +66,7 @@ module.exports = Self => {
|
||||||
const fileName = `${year}${invoiceOut.ref}.pdf`;
|
const fileName = `${year}${invoiceOut.ref}.pdf`;
|
||||||
|
|
||||||
// Store invoice
|
// Store invoice
|
||||||
print.storage.write(stream, {
|
await print.storage.write(buffer, {
|
||||||
type: 'invoice',
|
type: 'invoice',
|
||||||
path: `${year}/${month}/${day}`,
|
path: `${year}/${month}/${day}`,
|
||||||
fileName: fileName
|
fileName: fileName
|
||||||
|
|
|
@ -100,16 +100,23 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$http.post(`InvoiceOuts/invoiceClient`, params)
|
this.$http.post(`InvoiceOuts/invoiceClient`, params)
|
||||||
|
.then(() => this.invoiceNext())
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
this.errors.unshift({
|
const message = res.data?.error?.message || res.message;
|
||||||
address,
|
if (res.status >= 400 && res.status < 500) {
|
||||||
message: res.data.error.message
|
this.errors.unshift({address, message});
|
||||||
});
|
this.invoiceNext();
|
||||||
|
} else {
|
||||||
|
this.invoicing = false;
|
||||||
|
this.status = 'done';
|
||||||
|
throw new UserError(`Critical invoicing error, proccess stopped`);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
}
|
||||||
this.addressIndex++;
|
|
||||||
this.invoiceOut();
|
invoiceNext() {
|
||||||
});
|
this.addressIndex++;
|
||||||
|
this.invoiceOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
get nAddresses() {
|
get nAddresses() {
|
||||||
|
|
|
@ -17,4 +17,5 @@ Ended process: Proceso finalizado
|
||||||
Invoice out: Facturar
|
Invoice out: Facturar
|
||||||
One client: Un solo cliente
|
One client: Un solo cliente
|
||||||
Choose a valid client: Selecciona un cliente válido
|
Choose a valid client: Selecciona un cliente válido
|
||||||
Stop: Parar
|
Stop: Parar
|
||||||
|
Critical invoicing error, proccess stopped: Error crítico al facturar, proceso detenido
|
|
@ -22,7 +22,7 @@
|
||||||
value-field="id"
|
value-field="id"
|
||||||
rule>
|
rule>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
type="number"
|
type="number"
|
||||||
label="Minimum M3"
|
label="Minimum M3"
|
||||||
ng-model="$ctrl.supplierAgencyTerm.minimumM3"
|
ng-model="$ctrl.supplierAgencyTerm.minimumM3"
|
||||||
|
@ -31,19 +31,20 @@
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
type="number"
|
type="number"
|
||||||
label="Package Price"
|
label="Package Price"
|
||||||
ng-model="$ctrl.supplierAgencyTerm.packagePrice"
|
ng-model="$ctrl.supplierAgencyTerm.packagePrice"
|
||||||
rule>
|
rule>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
type="number"
|
type="number"
|
||||||
label="Km Price"
|
label="Km Price"
|
||||||
ng-model="$ctrl.supplierAgencyTerm.kmPrice"
|
ng-model="$ctrl.supplierAgencyTerm.kmPrice"
|
||||||
|
step="0.01"
|
||||||
rule>
|
rule>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
type="number"
|
type="number"
|
||||||
label="M3 Price"
|
label="M3 Price"
|
||||||
ng-model="$ctrl.supplierAgencyTerm.m3Price"
|
ng-model="$ctrl.supplierAgencyTerm.m3Price"
|
||||||
|
@ -52,13 +53,13 @@
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
type="number"
|
type="number"
|
||||||
label="Route Price"
|
label="Route Price"
|
||||||
ng-model="$ctrl.supplierAgencyTerm.routePrice"
|
ng-model="$ctrl.supplierAgencyTerm.routePrice"
|
||||||
rule>
|
rule>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
type="number"
|
type="number"
|
||||||
label="Minimum Km"
|
label="Minimum Km"
|
||||||
ng-model="$ctrl.supplierAgencyTerm.minimumKm"
|
ng-model="$ctrl.supplierAgencyTerm.minimumKm"
|
||||||
|
@ -73,4 +74,4 @@
|
||||||
ui-sref="supplier.card.agencyTerm.index">
|
ui-sref="supplier.card.agencyTerm.index">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -46,7 +46,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) {
|
||||||
const fileName = `${year}${invoiceOut.ref}.pdf`;
|
const fileName = `${year}${invoiceOut.ref}.pdf`;
|
||||||
|
|
||||||
// Store invoice
|
// Store invoice
|
||||||
storage.write(stream, {
|
await storage.write(stream, {
|
||||||
type: 'invoice',
|
type: 'invoice',
|
||||||
path: `${year}/${month}/${day}`,
|
path: `${year}/${month}/${day}`,
|
||||||
fileName: fileName
|
fileName: fileName
|
||||||
|
|
|
@ -4,40 +4,38 @@ const {cpus} = require('os');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init() {
|
init() {
|
||||||
if (!this.pool) {
|
if (this.pool) return;
|
||||||
Cluster.launch({
|
Cluster.launch({
|
||||||
concurrency: Cluster.CONCURRENCY_CONTEXT,
|
concurrency: Cluster.CONCURRENCY_CONTEXT,
|
||||||
maxConcurrency: cpus().length,
|
maxConcurrency: cpus().length,
|
||||||
puppeteerOptions: {
|
puppeteerOptions: {
|
||||||
headless: true,
|
headless: true,
|
||||||
args: [
|
args: [
|
||||||
'--no-sandbox',
|
'--no-sandbox',
|
||||||
'--disable-setuid-sandbox',
|
'--disable-setuid-sandbox',
|
||||||
'--no-zygote'
|
'--no-zygote'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
}).then(cluster => {
|
||||||
.then(cluster => {
|
this.pool = cluster;
|
||||||
this.pool = cluster;
|
|
||||||
|
|
||||||
log4js.configure({
|
log4js.configure({
|
||||||
appenders: {
|
appenders: {
|
||||||
out: {type: 'stdout'}
|
out: {type: 'stdout'}
|
||||||
},
|
},
|
||||||
categories: {default: {appenders: ['out'], level: 'info'}},
|
categories: {default: {appenders: ['out'], level: 'info'}},
|
||||||
});
|
});
|
||||||
|
|
||||||
const logger = log4js.getLogger();
|
const logger = log4js.getLogger();
|
||||||
|
|
||||||
cluster.on('taskerror', (err, data, willRetry) => {
|
cluster.on('taskerror', (err, data, willRetry) => {
|
||||||
if (willRetry)
|
if (willRetry)
|
||||||
logger.warn(`[Print] => ${err.message}\nThis job will be retried`);
|
logger.warn(`[Print] => ${err.message}\nThis job will be retried`);
|
||||||
else
|
else
|
||||||
logger.error(`[Print] => ${err.message}`);
|
logger.error(`[Print] => ${err.message}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
cluster.on('queue', () => logger.info('Printing task initialized by pool'));
|
cluster.on('queue', () => logger.info('Printing task initialized by pool'));
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,28 +32,31 @@ class Report extends Component {
|
||||||
if (fs.existsSync(fullPath))
|
if (fs.existsSync(fullPath))
|
||||||
options = require(optionsPath);
|
options = require(optionsPath);
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
Cluster.pool.queue({}, async({page}) => {
|
Cluster.pool.queue({}, async({page}) => {
|
||||||
await page.emulateMediaType('screen');
|
try {
|
||||||
await page.setContent(template);
|
await page.emulateMediaType('screen');
|
||||||
|
await page.setContent(template);
|
||||||
|
|
||||||
const element = await page.$('#pageFooter');
|
const element = await page.$('#pageFooter');
|
||||||
|
|
||||||
let footer = '\n';
|
let footer = '\n';
|
||||||
if (element) {
|
if (element) {
|
||||||
footer = await page.evaluate(el => {
|
footer = await page.evaluate(el => {
|
||||||
const html = el.innerHTML;
|
const html = el.innerHTML;
|
||||||
el.remove();
|
el.remove();
|
||||||
return html;
|
return html;
|
||||||
}, element);
|
}, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
options.headerTemplate = '\n';
|
||||||
|
options.footerTemplate = footer;
|
||||||
|
|
||||||
|
const buffer = await page.pdf(options);
|
||||||
|
resolve(buffer);
|
||||||
|
} catch (err) {
|
||||||
|
reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
options.headerTemplate = '\n';
|
|
||||||
options.footerTemplate = footer;
|
|
||||||
|
|
||||||
const stream = await page.pdf(options);
|
|
||||||
|
|
||||||
resolve(stream);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,26 +3,14 @@ const path = require('path');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
async write(stream, options) {
|
async write(buffer, options) {
|
||||||
const storage = config.storage[options.type];
|
const storage = config.storage[options.type];
|
||||||
|
|
||||||
if (!storage) return;
|
if (!storage) return;
|
||||||
|
|
||||||
const src = path.join(storage.root, options.path);
|
const src = path.join(storage.root, options.path);
|
||||||
const fileSrc = path.join(src, options.fileName);
|
const fileSrc = path.join(src, options.fileName);
|
||||||
|
|
||||||
await fs.mkdir(src, {recursive: true});
|
await fs.mkdir(src, {recursive: true});
|
||||||
|
await fs.writeFile(fileSrc, buffer);
|
||||||
const writeStream = fs.createWriteStream(fileSrc);
|
|
||||||
writeStream.on('open', () => writeStream.write(stream));
|
|
||||||
writeStream.on('finish', () => writeStream.end());
|
|
||||||
|
|
||||||
return new Promise(resolve => {
|
|
||||||
writeStream.on('close', () => resolve());
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
load(type, data) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,8 @@ SELECT ep.id palletFk,
|
||||||
JOIN vn.expedition e ON e.id = es.expeditionFk
|
JOIN vn.expedition e ON e.id = es.expeditionFk
|
||||||
JOIN vn.ticket t ON t.id = e.ticketFk
|
JOIN vn.ticket t ON t.id = e.ticketFk
|
||||||
JOIN vn.route r ON r.id = t.routeFk
|
JOIN vn.route r ON r.id = t.routeFk
|
||||||
LEFT JOIN vn2008.Rutas_monitor rm ON rm.Id_Ruta = r.id
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
||||||
LEFT JOIN vn.expeditionTruck et2 ON et2.id = rm.expeditionTruckFk
|
LEFT JOIN vn.expeditionTruck et2 ON et2.id = rm.expeditionTruckFk
|
||||||
WHERE ep.id = ?
|
WHERE ep.id = ?
|
||||||
GROUP BY ep.id, t.routeFk
|
GROUP BY ep.id, t.routeFk
|
||||||
ORDER BY t.routeFk
|
ORDER BY t.routeFk
|
||||||
|
|
Loading…
Reference in New Issue