feat: previas con sitema de reservas refs #6861 #2176
|
@ -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
|
||||
jgallego marked this conversation as resolved
Outdated
|
||||
JOIN productionConfig pc ;
|
||||
|
||||
|
@ -27,8 +41,19 @@ proc:BEGIN
|
|||
LEAVE proc;
|
||||
jgallego marked this conversation as resolved
jgallego
commented
si hi ha un throw el leave es innecesari si hi ha un throw el leave es innecesari
|
||||
END IF;
|
||||
|
||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
castella no castella no
|
||||
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
alias