Merge pull request 'test' (!2217) from test into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2217
This commit is contained in:
commit
2604fb28f8
|
@ -28,6 +28,7 @@ proc:BEGIN
|
||||||
DECLARE vLockName VARCHAR(215);
|
DECLARE vLockName VARCHAR(215);
|
||||||
DECLARE vLockTime INT DEFAULT 15;
|
DECLARE vLockTime INT DEFAULT 15;
|
||||||
DECLARE vFreeWagonFk INT;
|
DECLARE vFreeWagonFk INT;
|
||||||
|
|
||||||
DECLARE c1 CURSOR FOR
|
DECLARE c1 CURSOR FOR
|
||||||
SELECT ticketFk, `lines`, m3
|
SELECT ticketFk, `lines`, m3
|
||||||
FROM tmp.productionBuffer
|
FROM tmp.productionBuffer
|
||||||
|
@ -44,13 +45,21 @@ 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,
|
||||||
o.warehouseFk,
|
o.warehouseFk,
|
||||||
o.itemPackingTypeFk,
|
o.itemPackingTypeFk,
|
||||||
st.code,
|
st.code,
|
||||||
CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk),
|
|
||||||
o.numberOfWagons,
|
o.numberOfWagons,
|
||||||
o.trainFk,
|
o.trainFk,
|
||||||
o.linesLimit,
|
o.linesLimit,
|
||||||
|
@ -61,7 +70,6 @@ proc:BEGIN
|
||||||
vWarehouseFk,
|
vWarehouseFk,
|
||||||
vItemPackingTypeFk,
|
vItemPackingTypeFk,
|
||||||
vStateFk,
|
vStateFk,
|
||||||
vLockName,
|
|
||||||
vWagons,
|
vWagons,
|
||||||
vTrainFk,
|
vTrainFk,
|
||||||
vLinesLimit,
|
vLinesLimit,
|
||||||
|
@ -71,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;
|
||||||
|
@ -250,13 +264,13 @@ proc:BEGIN
|
||||||
UPDATE tTrain
|
UPDATE tTrain
|
||||||
SET ticketFk = vFirstTicketFk
|
SET ticketFk = vFirstTicketFk
|
||||||
WHERE wagon = vFreeWagonFk;
|
WHERE wagon = vFreeWagonFk;
|
||||||
|
|
||||||
-- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo
|
-- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo
|
||||||
DELETE tt.*
|
DELETE tt.*
|
||||||
FROM tTrain tt
|
FROM tTrain tt
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT DISTINCT wagon
|
SELECT DISTINCT wagon
|
||||||
FROM tTrain
|
FROM tTrain
|
||||||
WHERE ticketFk IS NOT NULL
|
WHERE ticketFk IS NOT NULL
|
||||||
) nn ON nn.wagon = tt.wagon
|
) nn ON nn.wagon = tt.wagon
|
||||||
WHERE nn.wagon IS NULL;
|
WHERE nn.wagon IS NULL;
|
||||||
|
@ -271,7 +285,7 @@ proc:BEGIN
|
||||||
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
|
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE read_loop;
|
LEAVE read_loop;
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE c1;
|
CLOSE c1;
|
||||||
|
|
Loading…
Reference in New Issue