7253-devToTest_2418 #2350

Merged
alexm merged 320 commits from 7253-devToTest_2418 into test 2024-04-23 08:02:46 +00:00
1 changed files with 20 additions and 4 deletions
Showing only changes of commit 8f9adbb37c - Show all commits

View File

@ -13,11 +13,16 @@ proc:BEGIN
* @param vCollectionFk Id de colección * @param vCollectionFk Id de colección
*/ */
DECLARE vHasTooMuchCollections BOOL; DECLARE vHasTooMuchCollections BOOL;
DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vWarehouseFk INT;
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 15; DECLARE vLockTime INT DEFAULT 15;
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
DO RELEASE_LOCK('collection_assign'); IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
END IF;
RESIGNAL; RESIGNAL;
END; END;
@ -37,7 +42,18 @@ proc:BEGIN
LEAVE proc; LEAVE proc;
END IF; 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; LEAVE proc;
END IF; END IF;
@ -90,6 +106,6 @@ proc:BEGIN
SET workerFk = vUserFk SET workerFk = vUserFk
WHERE id = vCollectionFk; WHERE id = vCollectionFk;
DO RELEASE_LOCK('collection_assign'); DO RELEASE_LOCK(vLockName);
END$$ END$$
DELIMITER ; DELIMITER ;