salix/db/routines/vn/procedures/buy_updatePacking.sql

23 lines
569 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT)
BEGIN
/**
* Actualiza packing
*
* @param vWarehouseFk warehouse del item
* @param vItemFk id del item
* @param vPacking packing a actualizar
*/
2024-07-16 16:44:24 +00:00
CALL buy_getUltimate(vItemFk, vWarehouseFk, util.VN_CURDATE());
UPDATE buy b
JOIN tmp.buyUltimate bu ON b.id = bu.buyFk
SET b.packing = vPacking
WHERE bu.warehouseFk = vWarehouseFk
AND bu.itemFk = vItemFk;
DROP TEMPORARY TABLE tmp.buyUltimate;
END$$
DELIMITER ;