Compare commits
4 Commits
8e2770aa56
...
c3e3d72182
Author | SHA1 | Date |
---|---|---|
Robert Ferrús | c3e3d72182 | |
Alex Moreno | be863c1269 | |
Alex Moreno | b532ce3f77 | |
Juan Ferrer | 9aa46c3a90 |
|
@ -20,6 +20,7 @@ BEGIN
|
|||
|
||||
CALL vn.addressTaxArea();
|
||||
SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.addressCompany,
|
||||
tmp.addressTaxArea;
|
||||
|
|
|
@ -28,6 +28,7 @@ proc:BEGIN
|
|||
DECLARE vLockName VARCHAR(215);
|
||||
DECLARE vLockTime INT DEFAULT 15;
|
||||
DECLARE vFreeWagonFk INT;
|
||||
|
||||
DECLARE c1 CURSOR FOR
|
||||
SELECT ticketFk, `lines`, m3
|
||||
FROM tmp.productionBuffer
|
||||
|
@ -44,13 +45,21 @@ 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,
|
||||
o.warehouseFk,
|
||||
o.itemPackingTypeFk,
|
||||
st.code,
|
||||
CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk),
|
||||
o.numberOfWagons,
|
||||
o.trainFk,
|
||||
o.linesLimit,
|
||||
|
@ -61,7 +70,6 @@ proc:BEGIN
|
|||
vWarehouseFk,
|
||||
vItemPackingTypeFk,
|
||||
vStateFk,
|
||||
vLockName,
|
||||
vWagons,
|
||||
vTrainFk,
|
||||
vLinesLimit,
|
||||
|
@ -71,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;
|
||||
|
|
Loading…
Reference in New Issue