24 lines
858 B
SQL
24 lines
858 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT)
|
|
proc: BEGIN
|
|
/**
|
|
* Aparca una matrícula en un parking
|
|
*
|
|
* @param vShelvingCode code de la matrícula
|
|
* @param vParkingFk id del parking
|
|
*/
|
|
INSERT INTO vn.shelvingLog (originFk, userFk, action , description,changedModel,changedModelId)
|
|
SELECT s.id, account.myUser_getId(), 'update', CONCAT("Cambio parking ",vShelvingCode," de ", p.code," a ", pNew.code),'Shelving',s.id
|
|
FROM parking p
|
|
JOIN shelving s ON s.parkingFk = p.id
|
|
JOIN parking pNew ON pNew.id = vParkingFk
|
|
WHERE s.code = vShelvingCode COLLATE utf8_unicode_ci;
|
|
|
|
UPDATE vn.shelving
|
|
SET parkingFk = vParkingFk,
|
|
parked = util.VN_NOW(),
|
|
isPrinted = TRUE
|
|
WHERE code = vShelvingCode COLLATE utf8_unicode_ci;
|
|
END$$
|
|
DELIMITER ;
|