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`.`buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Actualiza el grouping de las últimas compras de un artículo
|
|
|
|
*
|
|
|
|
* @param vWarehouseFk Id del almacén
|
|
|
|
* @param vItemFk Id del Artículo
|
|
|
|
* @param vGrouping Cantidad de grouping
|
|
|
|
*/
|
|
|
|
CALL vn.buyUltimate(vWarehouseFk, util.VN_CURDATE());
|
|
|
|
|
|
|
|
UPDATE vn.buy b
|
|
|
|
JOIN tmp.buyUltimate bu ON b.id = bu.buyFk
|
|
|
|
SET b.`grouping` = vGrouping
|
|
|
|
WHERE bu.warehouseFk = vWarehouseFk
|
|
|
|
AND bu.itemFk = vItemFk;
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|