refs #6897 remove code redirection #2531

Merged
carlossa merged 14 commits from 6897-entryMigration into dev 2024-06-18 06:14:17 +00:00
13 changed files with 68 additions and 52 deletions
Showing only changes of commit deb0f8e828 - Show all commits

View File

@ -767,7 +767,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
(35, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Somewhere in Philippines', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL), (35, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Somewhere in Philippines', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
(36, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Ant-Man Adventure', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL), (36, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Ant-Man Adventure', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
(37, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1110, 'Deadpool swords', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL); (37, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1110, 'Deadpool swords', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL);
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES VALUES
(1, 11, 1, 'ready'), (1, 11, 1, 'ready'),
@ -3848,7 +3848,7 @@ INSERT INTO `vn`.`ledgerConfig` SET
INSERT INTO vn.sectorCollection INSERT INTO vn.sectorCollection
SET id = 2, SET id = 2,
userFk = 18, userFk = 18,
sectorFk = 1; sectorFk = 1;
INSERT INTO vn.sectorCollectionSaleGroup INSERT INTO vn.sectorCollectionSaleGroup
SET id = 8, SET id = 8,
@ -3862,9 +3862,23 @@ INSERT INTO vn.saleGroup (userFk, parkingFk, sectorFk, ticketFk)
INSERT INTO vn.sectorCollection INSERT INTO vn.sectorCollection
SET id = 3, SET id = 3,
userFk = 18, userFk = 18,
sectorFk = 1; sectorFk = 1;
INSERT INTO vn.sectorCollectionSaleGroup INSERT INTO vn.sectorCollectionSaleGroup
SET id = 9, SET id = 9,
sectorCollectionFk = 3, sectorCollectionFk = 3,
saleGroupFk = 6; saleGroupFk = 6;
INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHolidaysNameFk, workCenterFk)
VALUES
(1, '2001-05-08', 1, 1),
(1, '2001-05-09', 1, 1),
(1, '2001-05-10', 1, 1),
(1, '2001-05-11', 1, 1),
(1, '2001-05-14', 1, 5),
(1, '2001-05-15', 1, 5),
(1, '2001-05-16', 1, 5),
(1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5);

View File

@ -1,5 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`debugAdd`(vVariable VARCHAR(255), vValue VARCHAR(255)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`debugAdd`(
vVariable VARCHAR(255),
vValue TEXT
)
MODIFIES SQL DATA MODIFIES SQL DATA
BEGIN BEGIN
/** /**

View File

@ -28,6 +28,8 @@ BEGIN
DECLARE vLockName VARCHAR(215); DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 30; DECLARE vLockTime INT DEFAULT 30;
DECLARE vFreeWagonFk INT; DECLARE vFreeWagonFk INT;
DECLARE vErrorNumber INT;
DECLARE vErrorMsg TEXT;
DECLARE c1 CURSOR FOR DECLARE c1 CURSOR FOR
SELECT ticketFk, `lines`, m3 SELECT ticketFk, `lines`, m3
@ -47,12 +49,18 @@ BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
GET DIAGNOSTICS CONDITION 1
vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT;
IF vLockName IS NOT NULL THEN IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName); DO RELEASE_LOCK(vLockName);
CALL util.debugAdd(JSON_OBJECT( CALL util.debugAdd('collection_new', JSON_OBJECT(
'type', 'releaseLock', 'errorNumber', vErrorNumber,
'userFk', vUserFk 'errorMsg', vErrorMsg,
), vLockName); -- Tmp 'lockName', vLockName,
'userFk', vUserFk
)); -- Tmp
END IF; END IF;
RESIGNAL; RESIGNAL;

View File

@ -1,7 +1,14 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(
vShelvingFk VARCHAR(8),
vBarcode VARCHAR(22),
vQuantity INT,
vPackagingFk VARCHAR(10),
vGrouping INT,
vPacking INT,
vWarehouseFk INT
)
BEGIN BEGIN
/** /**
* Añade registro o lo actualiza si ya existe. * Añade registro o lo actualiza si ya existe.
* *
@ -23,12 +30,7 @@ BEGIN
SELECT barcodeToItem(vBarcode) INTO vItemFk; SELECT barcodeToItem(vBarcode) INTO vItemFk;
IF vBuyFk IS NULL THEN IF vBuyFk IS NULL THEN
CALL cache.last_buy_refresh(FALSE); CALL util.throw('The buy is required');
SELECT buy_id INTO vBuyFk
FROM cache.last_buy
WHERE item_id = vItemFk
AND warehouse_id = vWarehouseFk;
END IF; END IF;
IF vPacking IS NULL IF vPacking IS NULL

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getAtp`(vDated DATE) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getAtp`(vDated DATE)
BEGIN BEGIN
/** /**
* Calcula el valor mínimo acumulado para cada artículo ordenado por fecha y * Calcula el valor mínimo acumulado para cada artículo ordenado por fecha y
@ -44,5 +44,5 @@ BEGIN
GROUP BY itemFk, wareHouseFk; GROUP BY itemFk, wareHouseFk;
DROP TEMPORARY TABLE tItemOrdered; DROP TEMPORARY TABLE tItemOrdered;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -30,6 +30,7 @@ BEGIN
FROM sale s FROM sale s
JOIN ticket t ON t.id = s.ticketFk JOIN ticket t ON t.id = s.ticketFk
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
AND t.warehouseFk
AND s.quantity != 0 AND s.quantity != 0
AND (vItemFk IS NULL OR s.itemFk = vItemFk) AND (vItemFk IS NULL OR s.itemFk = vItemFk)
AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk)
@ -40,7 +41,7 @@ BEGIN
t.warehouseInFk t.warehouseInFk
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
LEFT JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDatedFrom AND vDatedTo WHERE t.landed BETWEEN vDatedFrom AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
AND !e.isExcludedFromAvailable AND !e.isExcludedFromAvailable
@ -53,7 +54,7 @@ BEGIN
t.warehouseOutFk t.warehouseOutFk
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
LEFT JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk)
AND !e.isExcludedFromAvailable AND !e.isExcludedFromAvailable

View File

@ -21,9 +21,6 @@ BEGIN
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-- Añadido temporalmente para que no se cuelgue la db
SET vShowType = TRUE;
WITH itemTags AS ( WITH itemTags AS (
SELECT i.id, SELECT i.id,
typeFk, typeFk,
@ -38,7 +35,7 @@ BEGIN
t.name, t.name,
it.value it.value
FROM vn.item i FROM vn.item i
LEFT JOIN vn.itemTag it ON it.itemFk = i.id LEFT JOIN vn.itemTag it FORCE INDEX(itemTagItemPriority) ON it.itemFk = i.id
AND it.priority = vPriority AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk LEFT JOIN vn.tag t ON t.id = it.tagFk
WHERE i.id = vSelf WHERE i.id = vSelf
@ -68,7 +65,7 @@ BEGIN
iss.visible located, iss.visible located,
b.price2 b.price2
FROM vn.item i FROM vn.item i
JOIN cache.available a ON a.item_id = i.id JOIN cache.available a FORCE INDEX (calc_id_4) ON a.item_id = i.id
AND a.calc_id = vCalcFk AND a.calc_id = vCalcFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf AND ip.itemFk = vSelf

View File

@ -1,13 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionConfig_afterUpdate`
AFTER UPDATE ON `deviceProductionConfig`
FOR EACH ROW
BEGIN
IF NEW.isAllUsersAllowed = 1 OR NEW.isAllUsersAllowed = -1 THEN
SET @username := (SELECT account.myUser_getName());
INSERT INTO vn.mail (receiver, subject, body)
VALUES ('cau@verdnatura.es', 'Se ha activado la autenticación sin restricciones en la app',
CONCAT('El usuario ', @username,' ha habilitado la opción para que todos los usuarios puedan acceder a la app sin restricciones'));
END IF;
END$$
DELIMITER ;

View File

@ -229,8 +229,8 @@
"InvoiceIn is already booked": "InvoiceIn is already booked", "InvoiceIn is already booked": "InvoiceIn is already booked",
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency", "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
"You can only have one PDA": "You can only have one PDA", "You can only have one PDA": "You can only have one PDA",
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member", "Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member",
"It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated", "It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated",
"It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated" "It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated",
"Cannot add holidays on this day": "Cannot add holidays on this day"
} }

View File

@ -41,14 +41,16 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
ids = ids.split(','); const downloadAddZip = async id => {
for (const id of ids) {
ctx.args = ctx.args || {}; ctx.args = ctx.args || {};
ctx.args.id = Number(id); ctx.args.id = Number(id);
const [data] = await models.Route.cmr(ctx, myOptions); const [data] = await models.Route.cmr(ctx, myOptions);
zip.file(`${id}.pdf`, data, {binary: true}); zip.file(`${id}.pdf`, data, {binary: true});
} };
ids = ids.split(',');
const promises = ids.map(id => downloadAddZip(id));
await Promise.all(promises);
const zipStream = zip.generateNodeStream({streamFiles: true}); const zipStream = zip.generateNodeStream({streamFiles: true});
return [zipStream, 'application/zip', `filename="cmrs.zip"`]; return [zipStream, 'application/zip', `filename="cmrs.zip"`];
}; };

View File

@ -48,6 +48,9 @@
"priority": { "priority": {
"type": "number" "type": "number"
}, },
"roadmapStopFk": {
"type": "number"
},
"m3boxes": { "m3boxes": {
"type": "number" "type": "number"
}, },

View File

@ -35,7 +35,7 @@
label="Country" label="Country"
ng-model="filter.countryFk" ng-model="filter.countryFk"
url="countries" url="countries"
show-field="country" show-field="name"
value-field="id"> value-field="id">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>

View File

@ -110,8 +110,7 @@ module.exports = Self => {
workCenterFk: workCenter.workCenterFk workCenterFk: workCenter.workCenterFk
} }
}); });
if ((holiday && isFestive) && (workCenter.workcenterFk === holiday.workCenterFk))
if (holiday && isFestive)
throw new UserError(`Cannot add holidays on this day`); throw new UserError(`Cannot add holidays on this day`);
const absence = await models.Calendar.create({ const absence = await models.Calendar.create({