feat: refs #174903 item_getSimilar #2326

Merged
robert merged 5 commits from 174903-item_getSimilar into master 2024-04-22 08:53:59 +00:00
2 changed files with 35 additions and 4 deletions
Showing only changes of commit f269d41596 - Show all commits

View File

@ -13,11 +13,16 @@ proc:BEGIN
* @param vCollectionFk Id de colección
*/
DECLARE vHasTooMuchCollections BOOL;
DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vWarehouseFk INT;
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 15;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
DO RELEASE_LOCK('collection_assign');
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
END IF;
RESIGNAL;
END;
@ -28,7 +33,7 @@ proc:BEGIN
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
INTO vHasTooMuchCollections
FROM tCollection
JOIN productionConfig pc ;
JOIN productionConfig pc;
DROP TEMPORARY TABLE tCollection;
@ -37,7 +42,18 @@ proc:BEGIN
LEAVE proc;
END IF;
IF NOT GET_LOCK('collection_assign',vLockTime) THEN
SELECT warehouseFk, itemPackingTypeFk
INTO vWarehouseFk, vItemPackingTypeFk
FROM operator
WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
'collection_assign',
vWarehouseFk,
vItemPackingTypeFk
);
IF NOT GET_LOCK(vLockName, vLockTime) THEN
LEAVE proc;
END IF;
@ -90,6 +106,6 @@ proc:BEGIN
SET workerFk = vUserFk
WHERE id = vCollectionFk;
DO RELEASE_LOCK('collection_assign');
DO RELEASE_LOCK(vLockName);
END$$
DELIMITER ;

View File

@ -45,6 +45,15 @@ proc:BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
END IF;
RESIGNAL;
END;
SELECT pc.ticketTrolleyMax * o.numberOfWagons,
pc.hasUniqueCollectionTime,
w.code,
@ -70,6 +79,12 @@ proc:BEGIN
JOIN state st ON st.`code` = 'ON_PREPARATION'
JOIN operator o ON o.workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
'collection_new',
vWarehouseFk,
vItemPackingTypeFk
);
IF NOT GET_LOCK(vLockName, vLockTime) THEN
LEAVE proc;
END IF;