7806_devToTest_2332 #2801
|
@ -1,14 +1,18 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(vRoute INT)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza el volumen de la ruta.
|
||||
*
|
||||
* @param vSelf Id ruta
|
||||
*/
|
||||
DECLARE vVolume DECIMAL(10,1)
|
||||
DEFAULT (SELECT SUM(volume) FROM saleVolume WHERE routeFk = vSelf);
|
||||
|
||||
UPDATE vn.route r
|
||||
LEFT JOIN (
|
||||
SELECT routeFk, SUM(volume) AS m3
|
||||
FROM saleVolume
|
||||
WHERE routeFk = vRoute
|
||||
) v ON v.routeFk = r.id
|
||||
SET r.m3 = IFNULL(v.m3,0)
|
||||
WHERE r.id =vRoute;
|
||||
UPDATE `route`
|
||||
SET m3 = IFNULL(vVolume, 0)
|
||||
WHERE id = vSelf;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue