salix/db/routines/srt/procedures/expedition_weighing.sql

24 lines
638 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`expedition_weighing`(vWeight DECIMAL(10,2), vExpeditionFk INT, OUT vExpeditionOutFk INT )
BEGIN
/**
* Actualiza el peso de una expedición
*
* @param vWeight Peso en kilos
* @param vExpeditionFk Identificador de srt.expedition
*
* @return vExpeditionOutFk Identificador de srt.expedition
*/
SET vExpeditionOutFk = srt.expedition_check(vExpeditionFk);
UPDATE srt.expedition e
JOIN srt.expeditionState es on es.description = 'WEIGHED'
SET weight = vWeight,
stateFk = es.id
WHERE e.id = vExpeditionOutFk;
END$$
DELIMITER ;