master #2343
|
@ -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;
|
||||||
|
@ -28,7 +33,7 @@ proc:BEGIN
|
||||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
||||||
INTO vHasTooMuchCollections
|
INTO vHasTooMuchCollections
|
||||||
FROM tCollection
|
FROM tCollection
|
||||||
JOIN productionConfig pc ;
|
JOIN productionConfig pc;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tCollection;
|
||||||
|
|
||||||
|
@ -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 ;
|
||||||
|
|
|
@ -45,6 +45,15 @@ proc:BEGIN
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
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,
|
SELECT pc.ticketTrolleyMax * o.numberOfWagons,
|
||||||
pc.hasUniqueCollectionTime,
|
pc.hasUniqueCollectionTime,
|
||||||
w.code,
|
w.code,
|
||||||
|
@ -70,6 +79,12 @@ proc:BEGIN
|
||||||
JOIN state st ON st.`code` = 'ON_PREPARATION'
|
JOIN state st ON st.`code` = 'ON_PREPARATION'
|
||||||
JOIN operator o ON o.workerFk = vUserFk;
|
JOIN operator o ON o.workerFk = vUserFk;
|
||||||
|
|
||||||
|
SET vLockName = CONCAT_WS('/',
|
||||||
|
'collection_new',
|
||||||
|
vWarehouseFk,
|
||||||
|
vItemPackingTypeFk
|
||||||
|
);
|
||||||
|
|
||||||
IF NOT GET_LOCK(vLockName, vLockTime) THEN
|
IF NOT GET_LOCK(vLockName, vLockTime) THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
Loading…
Reference in New Issue