26 lines
625 B
SQL
26 lines
625 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updateGrouping`(
|
|
vWarehouseFk INT,
|
|
vItemFk INT,
|
|
vGrouping INT
|
|
)
|
|
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 buy_getUltimate(vItemFk, vWarehouseFk, util.VN_CURDATE());
|
|
|
|
UPDATE 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 ;
|