Merge branch '6230-revoke' of https://gitea.verdnatura.es/verdnatura/salix into 6230-revoke
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
162c78e392
|
@ -7,7 +7,7 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vSelf El id del ticket
|
* @param vSelf El id del ticket
|
||||||
*/
|
*/
|
||||||
DECLARE vCmrFk, vPreviousCmrFk, vCurrentCmrFk INT;
|
DECLARE vCmrFk INT;
|
||||||
SELECT cmrFk INTO vCmrFk
|
SELECT cmrFk INTO vCmrFk
|
||||||
FROM ticket
|
FROM ticket
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
@ -44,8 +44,6 @@ BEGIN
|
||||||
AND t.id = vSelf
|
AND t.id = vSelf
|
||||||
GROUP BY t.id;
|
GROUP BY t.id;
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
IF vCmrFk THEN
|
IF vCmrFk THEN
|
||||||
UPDATE cmr c
|
UPDATE cmr c
|
||||||
JOIN tTicket t
|
JOIN tTicket t
|
||||||
|
@ -57,9 +55,7 @@ BEGIN
|
||||||
c.supplierFk = t.supplierFk,
|
c.supplierFk = t.supplierFk,
|
||||||
c.ead = t.landed
|
c.ead = t.landed
|
||||||
WHERE id = vCmrFk;
|
WHERE id = vCmrFk;
|
||||||
ELSE
|
ELSE
|
||||||
SELECT MAX(id) INTO vPreviousCmrFk FROM cmr;
|
|
||||||
|
|
||||||
INSERT INTO cmr (
|
INSERT INTO cmr (
|
||||||
senderInstruccions,
|
senderInstruccions,
|
||||||
truckPlate,
|
truckPlate,
|
||||||
|
@ -70,17 +66,14 @@ BEGIN
|
||||||
ead
|
ead
|
||||||
)
|
)
|
||||||
SELECT * FROM tTicket;
|
SELECT * FROM tTicket;
|
||||||
|
|
||||||
SELECT MAX(id) INTO vCurrentCmrFk FROM cmr;
|
|
||||||
|
|
||||||
IF vPreviousCmrFk <> vCurrentCmrFk THEN
|
IF (SELECT EXISTS(SELECT * FROM tTicket)) THEN
|
||||||
UPDATE ticket
|
UPDATE ticket
|
||||||
SET cmrFk = vCurrentCmrFk
|
SET cmrFk = LAST_INSERT_ID()
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
DROP TEMPORARY TABLE tTicket;
|
DROP TEMPORARY TABLE tTicket;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -7,6 +7,8 @@ BEGIN
|
||||||
UPDATE expedition
|
UPDATE expedition
|
||||||
SET hasNewRoute = TRUE
|
SET hasNewRoute = TRUE
|
||||||
WHERE ticketFk = NEW.id;
|
WHERE ticketFk = NEW.id;
|
||||||
|
|
||||||
|
CALL ticket_doCmr(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue