Merge branch 'dev' into 5926_pda_worker_docuware
This commit is contained in:
commit
fedb46044b
|
@ -103,7 +103,7 @@ pipeline {
|
||||||
NODE_ENV = ''
|
NODE_ENV = ''
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'node back/tests.js --ci --junit --network jenkins'
|
sh 'node back/tests.js --junit'
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
@ -121,7 +121,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = packageJson.version
|
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
sh 'docker-compose build back'
|
sh 'docker-compose build back'
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = packageJson.version
|
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
sh 'gulp build'
|
sh 'gulp build'
|
||||||
sh 'docker-compose build front'
|
sh 'docker-compose build front'
|
||||||
|
@ -179,7 +179,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = packageJson.version
|
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
||||||
sh 'docker-compose push'
|
sh 'docker-compose push'
|
||||||
|
@ -210,7 +210,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = packageJson.version
|
env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}"
|
||||||
}
|
}
|
||||||
withKubeConfig([
|
withKubeConfig([
|
||||||
serverUrl: "$KUBERNETES_API",
|
serverUrl: "$KUBERNETES_API",
|
||||||
|
|
|
@ -57,14 +57,14 @@ module.exports = Self => {
|
||||||
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||||
LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType,
|
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType,
|
||||||
IF(mw.weekdays, 'S', 'N') weekDays,
|
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||||
oa.description deliveryObservation
|
oa.description deliveryObservation
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN ticket t ON e.ticketFk = t.id
|
JOIN ticket t ON e.ticketFk = t.id
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
JOIN mrwService ms ON ms.agencyModeCodeFk = am.code
|
JOIN mrwService ms ON ms.agencyModeCodeFk = am.code
|
||||||
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a')
|
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays | 1 << WEEKDAY(t.landed)
|
||||||
JOIN client c ON t.clientFk = c.id
|
JOIN client c ON t.clientFk = c.id
|
||||||
JOIN address a ON t.addressFk = a.id
|
JOIN address a ON t.addressFk = a.id
|
||||||
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||||
|
|
|
@ -129,7 +129,7 @@ INSERT INTO vn.itemShelving (id,itemFk,visible,shelvingFk,`grouping`,packing,pac
|
||||||
INSERT INTO vn.beach (code,warehouseFk) VALUES
|
INSERT INTO vn.beach (code,warehouseFk) VALUES
|
||||||
('TEST',1);
|
('TEST',1);
|
||||||
|
|
||||||
INSERT INTO vn.routesMonitor (routeFk,name,beachFk,m3,expeditionTruckFk) VALUES
|
INSERT INTO vn.routesMonitor (routeFk,name,beachFk,m3,roadmapStopFk) VALUES
|
||||||
(1,'TEST','TEST',1.0,1);
|
(1,'TEST','TEST',1.0,1);
|
||||||
/* #5483
|
/* #5483
|
||||||
INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight)
|
INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight)
|
||||||
|
|
|
@ -46,7 +46,7 @@ BEGIN
|
||||||
JOIN vn.address a ON a.id = t.addressFk
|
JOIN vn.address a ON a.id = t.addressFk
|
||||||
JOIN vn.province p ON p.id = a.provinceFk
|
JOIN vn.province p ON p.id = a.provinceFk
|
||||||
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
||||||
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
LEFT JOIN vn.beach b ON b.code = rm.beachFk
|
LEFT JOIN vn.beach b ON b.code = rm.beachFk
|
||||||
LEFT JOIN vn.`zone`z ON z.id = t.zoneFk
|
LEFT JOIN vn.`zone`z ON z.id = t.zoneFk
|
||||||
JOIN vn.agencyMode am ON t.agencyModeFk = am.id
|
JOIN vn.agencyMode am ON t.agencyModeFk = am.id
|
||||||
|
|
|
@ -22,7 +22,7 @@ BEGIN
|
||||||
LEFT JOIN vn.route r ON r.id = t.routeFk
|
LEFT JOIN vn.route r ON r.id = t.routeFk
|
||||||
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN vn.routesMonitor rm ON t.routeFk = rm.routeFk
|
LEFT JOIN vn.routesMonitor rm ON t.routeFk = rm.routeFk
|
||||||
LEFT JOIN vn.roadmapStop rs ON rm.expeditionTruckFk = rs.id
|
LEFT JOIN vn.roadmapStop rs ON rm.roadmapStopFk = rs.id
|
||||||
WHERE e.id = vExpeditionFk;
|
WHERE e.id = vExpeditionFk;
|
||||||
|
|
||||||
RETURN vDayMinute;
|
RETURN vDayMinute;
|
||||||
|
|
|
@ -34,7 +34,7 @@ FROM (
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`roadmapStopFk` = `rs`.`id`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
|
LEFT JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -45,7 +45,7 @@ FROM (
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`roadmapStopFk` = `rs`.`id`)
|
||||||
)
|
)
|
||||||
JOIN `srt`.`config` `c`
|
JOIN `srt`.`config` `c`
|
||||||
)
|
)
|
||||||
|
|
|
@ -32,7 +32,7 @@ FROM (
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`t`.`routeFk` = `rm`.`routeFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`expeditionTruckFk` = `rs`.`id`)
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rm`.`roadmapStopFk` = `rs`.`id`)
|
||||||
)
|
)
|
||||||
JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`)
|
JOIN `dipole`.`expedition_PrintOut` `epo` ON(`epo`.`expeditionFk` = `e`.`id`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(isTx BOOL)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(vIsTx BOOL)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Confirma los cambios asociados a una transacción.
|
* Confirma los cambios asociados a una transacción.
|
||||||
*
|
*
|
||||||
* @param isTx es true si existe transacción asociada
|
* @param vIsTx es true si existe transacción asociada
|
||||||
*/
|
*/
|
||||||
IF isTx THEN
|
IF vIsTx THEN
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(isTx BOOL)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(vIsTx BOOL)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Deshace los cambios asociados a una transacción.
|
* Deshace los cambios asociados a una transacción.
|
||||||
*
|
*
|
||||||
* @param isTx es true si existe transacción asociada
|
* @param vIsTx es true si existe transacción asociada
|
||||||
*/
|
*/
|
||||||
IF isTx THEN
|
IF vIsTx THEN
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(isTx BOOL)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(vIsTx BOOL)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Inicia una transacción.
|
* Inicia una transacción.
|
||||||
*
|
*
|
||||||
* @param isTx es true si existe transacción asociada
|
* @param vIsTx es true si existe transacción asociada
|
||||||
*/
|
*/
|
||||||
IF isTx THEN
|
IF vIsTx THEN
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -34,7 +34,7 @@ BEGIN
|
||||||
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk
|
||||||
LEFT JOIN vn.agency a ON a.id = am.agencyFk
|
LEFT JOIN vn.agency a ON a.id = am.agencyFk
|
||||||
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
||||||
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
JOIN vn.packagingConfig pc
|
JOIN vn.packagingConfig pc
|
||||||
WHERE t.warehouseFk IN (60,1,44)
|
WHERE t.warehouseFk IN (60,1,44)
|
||||||
AND e.created BETWEEN vStarted AND vEnded
|
AND e.created BETWEEN vStarted AND vEnded
|
||||||
|
|
|
@ -44,7 +44,7 @@ BEGIN
|
||||||
JOIN dua d ON d.id = de.duaFk
|
JOIN dua d ON d.id = de.duaFk
|
||||||
WHERE d.id = vDuaFk
|
WHERE d.id = vDuaFk
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
CALL ledger_next(vFiscalYear, FALSE, vBookEntry);
|
CALL ledger_nextTx(vFiscalYear, vBookEntry);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
OPEN vInvoicesIn;
|
OPEN vInvoicesIn;
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN
|
||||||
WHERE id = vDuaFk;
|
WHERE id = vDuaFk;
|
||||||
|
|
||||||
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
||||||
CALL ledger_next(YEAR(vBookDated), FALSE, vBookNumber);
|
CALL ledger_nextTx(YEAR(vBookDated), vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Apunte de la aduana
|
-- Apunte de la aduana
|
||||||
|
|
|
@ -23,7 +23,8 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
JOIN vn.warehouse w ON w.id = t.warehouseInFk
|
||||||
WHERE t.shipped >= util.VN_CURDATE()
|
WHERE t.shipped >= util.VN_CURDATE()
|
||||||
AND e.currencyFk = vCurrency;
|
AND e.currencyFk = vCurrency
|
||||||
|
AND NOT e.isBooked;
|
||||||
|
|
||||||
SET vComission = currency_getCommission(vCurrency);
|
SET vComission = currency_getCommission(vCurrency);
|
||||||
|
|
||||||
|
|
|
@ -56,13 +56,13 @@ BEGIN
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
IF vPalletFk IS NULL THEN
|
IF vPalletFk IS NULL THEN
|
||||||
SELECT expeditionTruckFk
|
SELECT roadmapStopFk
|
||||||
INTO vTruckFk
|
INTO vTruckFk
|
||||||
FROM (
|
FROM (
|
||||||
SELECT rm.expeditionTruckFk, count(*) n
|
SELECT rm.roadmapStopFk, count(*) n
|
||||||
FROM vn.routesMonitor rm
|
FROM vn.routesMonitor rm
|
||||||
JOIN tExpedition e ON e.routeFk = rm.routeFk
|
JOIN tExpedition e ON e.routeFk = rm.routeFk
|
||||||
GROUP BY expeditionTruckFk
|
GROUP BY roadmapStopFk
|
||||||
ORDER BY n DESC
|
ORDER BY n DESC
|
||||||
LIMIT 1) sub;
|
LIMIT 1) sub;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ BEGIN
|
||||||
LEFT JOIN vn.route r ON r.id = t.routeFk
|
LEFT JOIN vn.route r ON r.id = t.routeFk
|
||||||
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
||||||
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
WHERE e.id = vExpeditionFk;
|
WHERE e.id = vExpeditionFk;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -50,7 +50,7 @@ BEGIN
|
||||||
LEFT JOIN vn.route r ON r.id = t.routeFk
|
LEFT JOIN vn.route r ON r.id = t.routeFk
|
||||||
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
||||||
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
WHERE e.id = vExpeditionFk;
|
WHERE e.id = vExpeditionFk;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -70,7 +70,7 @@ BEGIN
|
||||||
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
||||||
|
|
||||||
IF vBookNumber IS NULL THEN
|
IF vBookNumber IS NULL THEN
|
||||||
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
CALL ledger_nextTx(vFiscalYear, vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Apunte del proveedor
|
-- Apunte del proveedor
|
||||||
|
|
|
@ -61,7 +61,7 @@ BEGIN
|
||||||
WHERE io.id = vInvoice;
|
WHERE io.id = vInvoice;
|
||||||
|
|
||||||
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
||||||
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
CALL ledger_nextTx(vFiscalYear, vBookNumber);
|
||||||
-- Linea del cliente
|
-- Linea del cliente
|
||||||
INSERT INTO XDiario(
|
INSERT INTO XDiario(
|
||||||
ASIEN,
|
ASIEN,
|
||||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
DECLARE vIsOriginalAClient BOOL;
|
DECLARE vIsOriginalAClient BOOL;
|
||||||
DECLARE vPayMethodCompensation INT;
|
DECLARE vPayMethodCompensation INT;
|
||||||
|
|
||||||
CALL ledger_next(YEAR(vDated), FALSE, vNewBookEntry);
|
CALL ledger_nextTx(YEAR(vDated), vNewBookEntry);
|
||||||
|
|
||||||
SELECT COUNT(id) INTO vIsOriginalAClient
|
SELECT COUNT(id) INTO vIsOriginalAClient
|
||||||
FROM client
|
FROM client
|
||||||
|
|
|
@ -1,38 +1,21 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
||||||
IN vFiscalYear INT,
|
IN vFiscalYear INT,
|
||||||
IN vIsManageTransaction BOOLEAN,
|
|
||||||
OUT vLastBookEntry INT
|
OUT vLastBookEntry INT
|
||||||
)
|
)
|
||||||
|
/**
|
||||||
|
* Devuelve un número de asiento válido, según el contador de asientos
|
||||||
|
* tabla vn.ledgerConfig, si no existe lo inicializa a 1
|
||||||
|
* No inicia transacción, para transaccionar usar vn.ledger_nextTx
|
||||||
|
*
|
||||||
|
* @param vFiscalYear Id del año contable
|
||||||
|
* @return vLastBookEntry Id del asiento
|
||||||
|
*/
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vHasStartTransaction BOOLEAN;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
IF vHasStartTransaction THEN
|
|
||||||
ROLLBACK TO sp;
|
|
||||||
RESIGNAL;
|
|
||||||
ELSE
|
|
||||||
ROLLBACK;
|
|
||||||
CALL util.throw ('It has not been possible to generate a new ledger');
|
|
||||||
END IF;
|
|
||||||
END;
|
|
||||||
|
|
||||||
IF vFiscalYear IS NULL THEN
|
IF vFiscalYear IS NULL THEN
|
||||||
CALL util.throw('Fiscal year is required');
|
CALL util.throw('Fiscal year is required');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NOT vIsManageTransaction THEN
|
|
||||||
SELECT @@in_transaction INTO vHasStartTransaction;
|
|
||||||
|
|
||||||
IF NOT vHasStartTransaction THEN
|
|
||||||
START TRANSACTION;
|
|
||||||
ELSE
|
|
||||||
SAVEPOINT sp;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT bookEntry + 1 INTO vLastBookEntry
|
SELECT bookEntry + 1 INTO vLastBookEntry
|
||||||
FROM ledgerCompany
|
FROM ledgerCompany
|
||||||
WHERE fiscalYear = vFiscalYear
|
WHERE fiscalYear = vFiscalYear
|
||||||
|
@ -48,13 +31,5 @@ BEGIN
|
||||||
UPDATE ledgerCompany
|
UPDATE ledgerCompany
|
||||||
SET bookEntry = vLastBookEntry
|
SET bookEntry = vLastBookEntry
|
||||||
WHERE fiscalYear = vFiscalYear;
|
WHERE fiscalYear = vFiscalYear;
|
||||||
|
|
||||||
IF NOT vIsManageTransaction THEN
|
|
||||||
IF vHasStartTransaction THEN
|
|
||||||
RELEASE SAVEPOINT sp;
|
|
||||||
ELSE
|
|
||||||
COMMIT;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -0,0 +1,30 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_nextTx`(
|
||||||
|
IN vFiscalYear INT,
|
||||||
|
OUT vLastBookEntry INT
|
||||||
|
)
|
||||||
|
/**
|
||||||
|
* Devuelve un número de asiento válido, según el contador de asientos
|
||||||
|
* tabla vn.ledgerConfig, si no existe lo inicializa a 1
|
||||||
|
* Lo hace transaccionando el proceso
|
||||||
|
*
|
||||||
|
* @param vFiscalYear Id del año contable
|
||||||
|
* @return vLastBookEntry Id del asiento
|
||||||
|
*/
|
||||||
|
BEGIN
|
||||||
|
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
CALL util.tx_rollback(vIsRequiredTx);
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
IF vFiscalYear IS NULL THEN
|
||||||
|
CALL util.throw('Fiscal year is required');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CALL util.tx_start(vIsRequiredTx);
|
||||||
|
CALL ledger_next(vFiscalYear, vLastBookEntry);
|
||||||
|
CALL util.tx_commit(vIsRequiredTx);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -47,7 +47,7 @@ BEGIN
|
||||||
LEFT JOIN ticketTrolley tt ON tt.ticket = t.id
|
LEFT JOIN ticketTrolley tt ON tt.ticket = t.id
|
||||||
LEFT JOIN zone zo ON t.zoneFk = zo.id
|
LEFT JOIN zone zo ON t.zoneFk = zo.id
|
||||||
LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
|
LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
|
||||||
LEFT JOIN roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
LEFT JOIN roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam)
|
WHERE IF(vIsCollection, tc.collectionFk = vParam, tc.ticketFk = vParam)
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
ORDER BY cc.code;
|
ORDER BY cc.code;
|
||||||
|
|
|
@ -106,7 +106,7 @@ BEGIN
|
||||||
SET rm.m3boxes = sub.m3boxes;
|
SET rm.m3boxes = sub.m3boxes;
|
||||||
|
|
||||||
UPDATE routesMonitor rm
|
UPDATE routesMonitor rm
|
||||||
JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
JOIN vn.roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
SET rm.etd = rs.eta;
|
SET rm.etd = rs.eta;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.routesMonitor;
|
DROP TEMPORARY TABLE tmp.routesMonitor;
|
||||||
|
|
|
@ -24,8 +24,8 @@ BEGIN
|
||||||
DECLARE vEvaNotes VARCHAR(255);
|
DECLARE vEvaNotes VARCHAR(255);
|
||||||
DECLARE vDone BOOL;
|
DECLARE vDone BOOL;
|
||||||
DECLARE vAuxEntryFk INT;
|
DECLARE vAuxEntryFk INT;
|
||||||
DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
|
DECLARE vIsRequiredTx BOOLEAN DEFAULT NOT @@in_transaction;
|
||||||
DECLARE vRsEntry CURSOR FOR
|
DECLARE vRsEntry CURSOR FOR
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM entry e
|
FROM entry e
|
||||||
JOIN travel t ON t.id = e.travelFk
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
@ -35,11 +35,11 @@ BEGIN
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL util.tx_rollback(vTx);
|
CALL util.tx_rollback(vIsRequiredTx);
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
CALL util.tx_start(vTx);
|
CALL util.tx_start(vIsRequiredTx);
|
||||||
|
|
||||||
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
|
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
|
||||||
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
|
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
|
||||||
|
@ -76,6 +76,6 @@ BEGIN
|
||||||
SET @isModeInventory = FALSE;
|
SET @isModeInventory = FALSE;
|
||||||
CLOSE vRsEntry;
|
CLOSE vRsEntry;
|
||||||
|
|
||||||
CALL util.tx_commit(vTx);
|
CALL util.tx_commit(vIsRequiredTx);
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -39,7 +39,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`(
|
||||||
*/
|
*/
|
||||||
BEGIN
|
BEGIN
|
||||||
IF vBookNumber IS NULL THEN
|
IF vBookNumber IS NULL THEN
|
||||||
CALL ledger_next(YEAR(vDated), FALSE, vBookNumber);
|
CALL ledger_nextTx(YEAR(vDated), vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
INSERT INTO XDiario
|
INSERT INTO XDiario
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterInsert`
|
||||||
|
AFTER INSERT ON `claimRatio`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO clientRate(clientFk, `value`)
|
||||||
|
VALUES(NEW.clientFk, NEW.priceIncreasing)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`value` = VALUES(`value`);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -23,7 +23,7 @@ BEGIN
|
||||||
FROM supplier
|
FROM supplier
|
||||||
WHERE id = NEW.supplierFk;
|
WHERE id = NEW.supplierFk;
|
||||||
|
|
||||||
CALL ledger_next(YEAR(NEW.received), TRUE, vNewBookEntry);
|
CALL ledger_next(YEAR(NEW.received), vNewBookEntry);
|
||||||
|
|
||||||
INSERT INTO XDiario (
|
INSERT INTO XDiario (
|
||||||
ASIEN,
|
ASIEN,
|
||||||
|
|
|
@ -8,7 +8,9 @@ BEGIN
|
||||||
SET hasNewRoute = TRUE
|
SET hasNewRoute = TRUE
|
||||||
WHERE ticketFk = NEW.id;
|
WHERE ticketFk = NEW.id;
|
||||||
|
|
||||||
CALL ticket_doCmr(NEW.id);
|
IF NEW.cmrFk THEN
|
||||||
|
CALL ticket_doCmr(NEW.id);
|
||||||
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -8,7 +8,7 @@ AS SELECT `rs`.`id` AS `truckFk`,
|
||||||
`t`.`routeFk` AS `routeFk`,
|
`t`.`routeFk` AS `routeFk`,
|
||||||
`es`.`id` AS `scanFk`,
|
`es`.`id` AS `scanFk`,
|
||||||
`e`.`id` AS `expeditionFk`,
|
`e`.`id` AS `expeditionFk`,
|
||||||
`r`.`expeditionTruckFk` AS `expeditionTruckFk`,
|
`r`.`roadmapStopFk` AS `roadmapStopFk`,
|
||||||
`t`.`warehouseFk` AS `warehouseFk`,
|
`t`.`warehouseFk` AS `warehouseFk`,
|
||||||
`e`.`created` AS `lastPacked`,
|
`e`.`created` AS `lastPacked`,
|
||||||
`t`.`id` AS `ticketFk`
|
`t`.`id` AS `ticketFk`
|
||||||
|
@ -18,7 +18,7 @@ FROM (
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
`vn`.`roadmapStop` `rs`
|
`vn`.`roadmapStop` `rs`
|
||||||
LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`expeditionTruckFk`)
|
LEFT JOIN `vn`.`routesMonitor` `r` ON(`rs`.`id` = `r`.`roadmapStopFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`)
|
LEFT JOIN `vn`.`ticket` `t` ON(`r`.`routeFk` = `t`.`routeFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ AS SELECT `rs2`.`description` AS `truck`,
|
||||||
`r`.`description` AS `zone`,
|
`r`.`description` AS `zone`,
|
||||||
COUNT(`es`.`id`) AS `eti`,
|
COUNT(`es`.`id`) AS `eti`,
|
||||||
`ep`.`id` AS `palletFk`,
|
`ep`.`id` AS `palletFk`,
|
||||||
`rs`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,
|
`rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`,
|
||||||
`t`.`warehouseFk` AS `warehouseFk`,
|
`t`.`warehouseFk` AS `warehouseFk`,
|
||||||
IF(
|
IF(
|
||||||
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
|
`r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY,
|
||||||
|
@ -33,7 +33,7 @@ FROM (
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`)
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `r`.`id`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs2` ON(`rs2`.`id` = `rm`.`expeditionTruckFk`)
|
LEFT JOIN `vn`.`roadmapStop` `rs2` ON(`rs2`.`id` = `rm`.`roadmapStopFk`)
|
||||||
)
|
)
|
||||||
GROUP BY `ep`.`id`,
|
GROUP BY `ep`.`id`,
|
||||||
`t`.`routeFk`
|
`t`.`routeFk`
|
||||||
|
|
|
@ -15,7 +15,7 @@ FROM (
|
||||||
`vn`.`route` `r`
|
`vn`.`route` `r`
|
||||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`r`.`id` = `rm`.`routeFk`)
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`r`.`id` = `rm`.`routeFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`roadmapStopFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`ticket` `t` ON(`t`.`routeFk` = `r`.`id`)
|
JOIN `vn`.`ticket` `t` ON(`t`.`routeFk` = `r`.`id`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -45,7 +45,7 @@ FROM (
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
|
LEFT JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`roadmapStopFk`)
|
||||||
)
|
)
|
||||||
LEFT JOIN `vn`.`beach` `b` ON(`b`.`code` = `rm`.`beachFk`)
|
LEFT JOIN `vn`.`beach` `b` ON(`b`.`code` = `rm`.`beachFk`)
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,7 +13,7 @@ FROM (
|
||||||
)
|
)
|
||||||
JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
|
JOIN `vn`.`routesMonitor` `rm` ON(`rm`.`routeFk` = `t`.`routeFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`expeditionTruckFk`)
|
JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `rm`.`roadmapStopFk`)
|
||||||
)
|
)
|
||||||
WHERE `e`.`id` IS NULL
|
WHERE `e`.`id` IS NULL
|
||||||
AND `rs`.`eta` > `util`.`VN_CURDATE`()
|
AND `rs`.`eta` > `util`.`VN_CURDATE`()
|
||||||
|
|
|
@ -11,9 +11,9 @@ AS SELECT `e`.`truckFk` AS `id`,
|
||||||
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
||||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||||
COUNT(DISTINCT `e`.`expeditionFk`) AS `expeditions`,
|
COUNT(DISTINCT `e`.`expeditionFk`) AS `expeditions`,
|
||||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
||||||
max(`e`.`lastPacked`) AS `lastPacked`
|
max(`e`.`lastPacked`) AS `lastPacked`
|
||||||
FROM `vn`.`expeditionCommon` `e`
|
FROM `vn`.`expeditionCommon` `e`
|
||||||
GROUP BY `e`.`truckFk`
|
GROUP BY `e`.`truckFk`
|
||||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
||||||
`e`.`eta`
|
`e`.`eta`
|
||||||
|
|
|
@ -7,12 +7,12 @@ AS SELECT `e`.`truckFk` AS `id`,
|
||||||
`e`.`palletFk` AS `pallet`,
|
`e`.`palletFk` AS `pallet`,
|
||||||
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
COUNT(DISTINCT `e`.`routeFk`) AS `routes`,
|
||||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||||
COUNT(DISTINCT `e`.`expeditionTruckFk`) AS `destinos`,
|
COUNT(DISTINCT `e`.`roadmapStopFk`) AS `destinos`,
|
||||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
||||||
max(`e`.`lastPacked`) AS `lastPacked`
|
max(`e`.`lastPacked`) AS `lastPacked`
|
||||||
FROM `vn`.`expeditionCommon` `e`
|
FROM `vn`.`expeditionCommon` `e`
|
||||||
GROUP BY `e`.`truckFk`,
|
GROUP BY `e`.`truckFk`,
|
||||||
`e`.`palletFk`
|
`e`.`palletFk`
|
||||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
ORDER BY sum(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
||||||
`e`.`eta`,
|
`e`.`eta`,
|
||||||
`e`.`truckFk`
|
`e`.`truckFk`
|
||||||
|
|
|
@ -8,15 +8,15 @@ AS SELECT `e`.`truckFk` AS `id`,
|
||||||
`e`.`routeFk` AS `route`,
|
`e`.`routeFk` AS `route`,
|
||||||
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
COUNT(DISTINCT `e`.`scanFk`) AS `scans`,
|
||||||
`rs`.`description` AS `destinos`,
|
`rs`.`description` AS `destinos`,
|
||||||
sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) AS `fallos`,
|
SUM(`e`.`truckFk` <> `e`.`roadmapStopFk`) AS `fallos`,
|
||||||
`e`.`expeditionTruckFk` AS `expeditionTruckFk`,
|
`e`.`roadmapStopFk` AS `roadmapStopFk`,
|
||||||
max(`e`.`lastPacked`) AS `lastPacked`
|
MAX(`e`.`lastPacked`) AS `lastPacked`
|
||||||
FROM (
|
FROM (
|
||||||
`vn`.`expeditionCommon` `e`
|
`vn`.`expeditionCommon` `e`
|
||||||
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`expeditionTruckFk`)
|
LEFT JOIN `vn`.`roadmapStop` `rs` ON(`rs`.`id` = `e`.`roadmapStopFk`)
|
||||||
)
|
)
|
||||||
GROUP BY `e`.`truckFk`,
|
GROUP BY `e`.`truckFk`,
|
||||||
`e`.`palletFk`,
|
`e`.`palletFk`,
|
||||||
`e`.`routeFk`
|
`e`.`routeFk`
|
||||||
ORDER BY sum(`e`.`truckFk` <> `e`.`expeditionTruckFk`) DESC,
|
ORDER BY SUM(`e`.`truckFk` <> `e`.`roadmapStopFk`) DESC,
|
||||||
`e`.`palletFk`
|
`e`.`palletFk`
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE vn.routesMonitor CHANGE expeditionTruckFk roadmapStopFk int(11) DEFAULT NULL NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.routesMonitor ADD COLUMN expeditionTruckFk int(11) AS (roadmapStopFk) VIRTUAL;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.country DROP COLUMN country;
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Ticket','refund','WRITE','ALLOW','ROLE','logistic');
|
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE `vn`.`clientRate` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`clientFk` int(11) NOT NULL,
|
||||||
|
`dated` date NOT NULL DEFAULT current_timestamp(),
|
||||||
|
`value` decimal(10,2) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `clientRate_unique` (`clientFk`,`dated`),
|
||||||
|
CONSTRAINT `clientRate_client_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
@ -71,7 +71,10 @@ module.exports = Self => {
|
||||||
// Check for existing purchase requests
|
// Check for existing purchase requests
|
||||||
const hasPurchaseRequests = await models.TicketRequest.count({
|
const hasPurchaseRequests = await models.TicketRequest.count({
|
||||||
ticketFk: id,
|
ticketFk: id,
|
||||||
isOk: true
|
or: [
|
||||||
|
{isOk: true},
|
||||||
|
{isOk: null}
|
||||||
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (hasPurchaseRequests)
|
if (hasPurchaseRequests)
|
||||||
|
|
|
@ -49,7 +49,7 @@ describe('ticket setDeleted()', () => {
|
||||||
ctx.req.__ = value => {
|
ctx.req.__ = value => {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
const ticketId = 23;
|
const ticketId = 24;
|
||||||
const [sectorCollectionBefore] = await models.Ticket.rawSql(
|
const [sectorCollectionBefore] = await models.Ticket.rawSql(
|
||||||
`SELECT COUNT(*) numberRows
|
`SELECT COUNT(*) numberRows
|
||||||
FROM vn.sectorCollection`, [], options);
|
FROM vn.sectorCollection`, [], options);
|
||||||
|
@ -87,7 +87,7 @@ describe('ticket setDeleted()', () => {
|
||||||
const [ticketCollectionOld] = await models.Ticket.rawSql(
|
const [ticketCollectionOld] = await models.Ticket.rawSql(
|
||||||
`SELECT COUNT(*) numberRows
|
`SELECT COUNT(*) numberRows
|
||||||
FROM vn.ticketCollection`, [], options);
|
FROM vn.ticketCollection`, [], options);
|
||||||
const ticketId = 23;
|
const ticketId = 34;
|
||||||
|
|
||||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import ModuleCard from 'salix/components/module-card';
|
import ModuleCard from 'salix/components/module-card';
|
||||||
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
class Controller extends ModuleCard {
|
class Controller extends ModuleCard {
|
||||||
reload() {
|
reload() {
|
||||||
|
@ -59,6 +60,10 @@ class Controller extends ModuleCard {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!this.$params.id) {
|
||||||
|
this.$state.go('ticket.index');
|
||||||
|
throw new UserError(`You must select a ticket`);
|
||||||
|
}
|
||||||
return this.$http.get(`Tickets/${this.$params.id}`, {filter})
|
return this.$http.get(`Tickets/${this.$params.id}`, {filter})
|
||||||
.then(res => this.onData(res.data));
|
.then(res => this.onData(res.data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item class="dropdown"
|
<vn-item class="dropdown"
|
||||||
vn-click-stop="refundMenu.show($event, 'left')"
|
vn-click-stop="refundMenu.show($event, 'left')"
|
||||||
vn-acl="invoicing, claimManager, salesAssistant"
|
vn-acl="invoicing, claimManager, salesAssistant, logistic"
|
||||||
vn-acl-action="remove"
|
vn-acl-action="remove"
|
||||||
vn-tooltip="Create a single ticket with all the content of the current ticket"
|
vn-tooltip="Create a single ticket with all the content of the current ticket"
|
||||||
translate>
|
translate>
|
||||||
|
|
|
@ -64,6 +64,7 @@ You are going to delete this ticket: Vas a eliminar este ticket
|
||||||
Ticket deleted. You can undo this action within the first hour: Ticket eliminado. Puedes deshacer esta acción durante la primera hora
|
Ticket deleted. You can undo this action within the first hour: Ticket eliminado. Puedes deshacer esta acción durante la primera hora
|
||||||
Search ticket by id or alias: Buscar tickets por identificador o alias
|
Search ticket by id or alias: Buscar tickets por identificador o alias
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
|
You must select a ticket: Debes seleccionar un ticket
|
||||||
|
|
||||||
#sections
|
#sections
|
||||||
List: Listado
|
List: Listado
|
||||||
|
|
|
@ -26,18 +26,17 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.cloneWithEntries = async(ctx, id, options) => {
|
Self.cloneWithEntries = async(ctx, id, options) => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
|
let tx;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
let tx = options?.transaction;
|
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
if (!myOptions.transaction) {
|
|
||||||
tx = await Self.beginTransaction({});
|
|
||||||
myOptions.transaction = tx;
|
|
||||||
}
|
|
||||||
|
|
||||||
const travel = await Self.findById(id, {
|
const travel = await Self.findById(id, {
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
|
@ -89,6 +88,8 @@ module.exports = Self => {
|
||||||
'ref'
|
'ref'
|
||||||
]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
return newTravel.id;
|
return newTravel.id;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
|
|
@ -7,19 +7,22 @@ describe('Travel cloneWithEntries()', () => {
|
||||||
const ctx = {req: {accessToken: {userId: currentUserId}}};
|
const ctx = {req: {accessToken: {userId: currentUserId}}};
|
||||||
let newTravelId;
|
let newTravelId;
|
||||||
it(`should clone the travel and the containing entries`, async() => {
|
it(`should clone the travel and the containing entries`, async() => {
|
||||||
const tx = await models.Travel.beginTransaction({
|
const tx = await models.Travel.beginTransaction({});
|
||||||
});
|
|
||||||
const warehouseThree = 3;
|
const warehouseThree = 3;
|
||||||
const agencyModeOne = 1;
|
const agencyModeOne = 1;
|
||||||
|
let travelRemoved;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
newTravelId = await models.Travel.cloneWithEntries(ctx, travelId, options);
|
newTravelId = await models.Travel.cloneWithEntries(ctx, travelId, options);
|
||||||
const travelEntries = await models.Entry.find({
|
const travelEntries = await models.Entry.find({
|
||||||
where: {
|
where: {
|
||||||
travelFk: newTravelId
|
travelFk: newTravelId
|
||||||
}
|
}
|
||||||
}, options);
|
}, options);
|
||||||
const newTravel = await models.Travel.findById(travelId);
|
const newTravel = await models.Travel.findById(travelId, null, options);
|
||||||
|
travelRemoved = await models.Travel.findById(newTravelId);
|
||||||
|
|
||||||
expect(newTravelId).not.toEqual(travelId);
|
expect(newTravelId).not.toEqual(travelId);
|
||||||
expect(newTravel.ref).toEqual('fifth travel');
|
expect(newTravel.ref).toEqual('fifth travel');
|
||||||
|
@ -27,14 +30,9 @@ describe('Travel cloneWithEntries()', () => {
|
||||||
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
|
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
|
||||||
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
|
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
|
||||||
expect(travelEntries.length).toBeGreaterThan(0);
|
expect(travelEntries.length).toBeGreaterThan(0);
|
||||||
await models.Entry.destroyAll({
|
|
||||||
travelFk: newTravelId
|
|
||||||
}, options);
|
|
||||||
await models.Travel.destroyById(newTravelId, options);
|
|
||||||
await tx.rollback();
|
|
||||||
const travelRemoved = await models.Travel.findById(newTravelId, options);
|
|
||||||
|
|
||||||
expect(travelRemoved).toBeNull();
|
expect(travelRemoved).toBeNull();
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -17,15 +17,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
const {backupPrinterNotificationDelay} = await models.ProductionConfig.findOne();
|
const {backupPrinterNotificationDelay} = await models.ProductionConfig.findOne();
|
||||||
if (backupPrinterNotificationDelay) {
|
if (backupPrinterNotificationDelay) {
|
||||||
console.log('operator delay:',
|
|
||||||
backupPrinterNotificationDelay,
|
|
||||||
Date.vnNow(),
|
|
||||||
new Date(Date.vnNow() - (backupPrinterNotificationDelay * 1000))
|
|
||||||
);
|
|
||||||
const notifications = await models.NotificationQueue.find(
|
const notifications = await models.NotificationQueue.find(
|
||||||
{where: {created: {gte: new Date(Date.vnNow() - (backupPrinterNotificationDelay * 1000))},
|
{where: {created: {gte: new Date(Date.vnNow() - (backupPrinterNotificationDelay * 1000))},
|
||||||
notificationFk: notificationName,
|
notificationFk: notificationName,
|
||||||
status: 'sent'
|
status: {neq: 'error'}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "24.24.2",
|
"version": "24.26.0",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
|
@ -35,7 +35,7 @@ SELECT c.itemPackingTypeFk code,
|
||||||
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
|
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
|
||||||
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
|
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
|
||||||
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
||||||
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
|
LEFT JOIN vn.roadmapStop rs ON rs.id = rm.roadmapStopFk
|
||||||
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
|
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
|
||||||
JOIN vn.productionConfig pc
|
JOIN vn.productionConfig pc
|
||||||
WHERE t.id IN (?)
|
WHERE t.id IN (?)
|
||||||
|
|
|
@ -5,7 +5,7 @@ SELECT ep.id palletFk,
|
||||||
COUNT(es.id) labels,
|
COUNT(es.id) labels,
|
||||||
t.warehouseFk warehouseFk,
|
t.warehouseFk warehouseFk,
|
||||||
dayname(r.created) `dayName`,
|
dayname(r.created) `dayName`,
|
||||||
rs.id <=> rm.expeditionTruckFk isMatch
|
rs.id <=> rm.roadmapStopFk isMatch
|
||||||
FROM vn.roadmapStop rs
|
FROM vn.roadmapStop rs
|
||||||
JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id
|
JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id
|
||||||
JOIN vn.expeditionScan es ON es.palletFk = ep.id
|
JOIN vn.expeditionScan es ON es.palletFk = ep.id
|
||||||
|
@ -13,7 +13,7 @@ SELECT ep.id palletFk,
|
||||||
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 vn.routesMonitor rm ON rm.routeFk = r.id
|
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
|
||||||
LEFT JOIN vn.roadmapStop rs2 ON rs2.id = rm.expeditionTruckFk
|
LEFT JOIN vn.roadmapStop rs2 ON rs2.id = rm.roadmapStopFk
|
||||||
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