refs #6861 feat: getLock
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
ea4f70f460
commit
d770cd8d48
|
@ -10,13 +10,27 @@ proc:BEGIN
|
|||
* @param vCollectionFk Id de colección
|
||||
*/
|
||||
DECLARE vHasTooMuchCollections BOOL;
|
||||
DECLARE vLockTime INT DEFAULT 15;
|
||||
DECLARE vItemPackingTypeFk VARCHAR(1);
|
||||
DECLARE vWarehouseFk INT;
|
||||
DECLARE vLockName VARCHAR(215);
|
||||
DECLARE vLockTime INT DEFAULT 30;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
IF vLockName IS NOT NULL THEN
|
||||
DO RELEASE_LOCK(vLockName);
|
||||
END IF;
|
||||
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
-- Si hay colecciones sin terminar, sale del proceso
|
||||
CALL collection_get(vUserFk);
|
||||
|
||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
||||
INTO vHasTooMuchCollections
|
||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
|
||||
collection_assign_lockname
|
||||
INTO vHasTooMuchCollections,
|
||||
vLockName
|
||||
FROM tCollection
|
||||
JOIN productionConfig pc ;
|
||||
|
||||
|
@ -27,8 +41,19 @@ proc:BEGIN
|
|||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
IF NOT GET_LOCK('collection_getAssigned', vLockTime) THEN
|
||||
LEAVE proc;
|
||||
SELECT warehouseFk, itemPackingTypeFk
|
||||
INTO vWarehouseFk, vItemPackingTypeFk
|
||||
FROM operator
|
||||
WHERE workerFk = vUserFk;
|
||||
|
||||
SET vLockName = CONCAT_WS('/',
|
||||
vLockName,
|
||||
vWarehouseFk,
|
||||
vItemPackingTypeFk
|
||||
);
|
||||
|
||||
IF NOT GET_LOCK(vLockName, vLockTime) THEN
|
||||
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
|
||||
END IF;
|
||||
|
||||
-- Se eliminan las colecciones sin asignar que estan obsoletas
|
||||
|
@ -72,6 +97,6 @@ proc:BEGIN
|
|||
|
||||
CALL itemShelvingSale_addByCollection(vCollectionFk);
|
||||
|
||||
DO RELEASE_LOCK('collection_getAssigned');
|
||||
DO RELEASE_LOCK(vLockName);
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue