2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100))
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inserta nuevos registros en la tabla vn.expeditionState
|
|
|
|
*
|
|
|
|
* @param vAdressFk Identificador de vn.ticket
|
|
|
|
* @param vRouteFk Identificador de vn.route
|
|
|
|
* @param vStateCode Corresponde a vn.expeditionStateType.code
|
|
|
|
*/
|
|
|
|
|
|
|
|
INSERT INTO vn.expeditionState(expeditionFk, typeFk)
|
|
|
|
SELECT e.id, est.id
|
|
|
|
FROM vn.expedition e
|
|
|
|
JOIN vn.expeditionStateType est ON est.code = vStateCode
|
|
|
|
JOIN vn.ticket t ON t.id = e.ticketFk
|
|
|
|
WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|