From 6661cb4c2ae6b137936360cdf058f98e1272c8dc Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 25 Jul 2024 12:30:18 +0200 Subject: [PATCH 1/2] fix: refs #7654 itemShelving --- db/versions/11169-azureCyca/00-firstScript.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/versions/11169-azureCyca/00-firstScript.sql diff --git a/db/versions/11169-azureCyca/00-firstScript.sql b/db/versions/11169-azureCyca/00-firstScript.sql new file mode 100644 index 000000000..49adcfc05 --- /dev/null +++ b/db/versions/11169-azureCyca/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE IF EXISTS vn.itemShelving +MODIFY COLUMN IF EXISTS isSplit tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Este valor cambia al splitar un carro que se ha quedado en holanda'; From 9e18a208b27bb389ae765b8f5dad71e41db53aa1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 25 Jul 2024 13:26:45 +0200 Subject: [PATCH 2/2] fix: refs #7662 get value for proc with select for updates --- back/methods/collection/assign.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/back/methods/collection/assign.js b/back/methods/collection/assign.js index 718cd48c5..f246043b8 100644 --- a/back/methods/collection/assign.js +++ b/back/methods/collection/assign.js @@ -20,13 +20,14 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const randStr = Math.random().toString(36).substring(3); const result = await Self.rawSql(` CALL vn.collection_assign(?, @vCollectionFk); - SELECT @vCollectionFk collectionFk - `, [userId], myOptions); + SELECT @vCollectionFk ? + `, [userId, randStr], myOptions); - // Por si entra en el SELECT FOR UPDATE y retorna un array más - const collectionFk = result[2]?.[0]?.collectionFk || result[3]?.[0]?.collectionFk; + // Por si entra en SELECT FOR UPDATE una o varias veces + const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr]; if (!collectionFk) throw new UserError('There are not picking tickets'); await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);