master #2343

Merged
robert merged 9 commits from master into test 2024-04-22 09:25:01 +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;
@ -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;