2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelving_setParking`(
|
2024-07-29 05:18:23 +00:00
|
|
|
`vShelvingCode` VARCHAR(8),
|
|
|
|
`vParkingFk` INT
|
|
|
|
)
|
2024-07-26 12:05:22 +00:00
|
|
|
BEGIN
|
2024-01-15 11:31:03 +00:00
|
|
|
/**
|
|
|
|
* Aparca una matrícula en un parking
|
|
|
|
*
|
|
|
|
* @param vShelvingCode code de la matrícula
|
|
|
|
* @param vParkingFk id del parking
|
|
|
|
*/
|
2024-07-26 12:05:22 +00:00
|
|
|
INSERT INTO shelvingLog (originFk, userFk, action , description,changedModel,changedModelId)
|
2024-01-15 11:31:03 +00:00
|
|
|
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;
|
|
|
|
|
2024-07-26 12:05:22 +00:00
|
|
|
UPDATE shelving
|
2024-01-15 11:31:03 +00:00
|
|
|
SET parkingFk = vParkingFk,
|
|
|
|
parked = util.VN_NOW(),
|
|
|
|
isPrinted = TRUE
|
|
|
|
WHERE code = vShelvingCode COLLATE utf8_unicode_ci;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|