feat: refactor buyUltimate refs #7736
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-07-19 12:44:45 +02:00
parent 4ee0bd687f
commit b2a8326170
3 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buyUltimateFromInte
) )
BEGIN BEGIN
/** /**
* DEPRECATED usar buy_getUltimateFromInterval * @deprecated Usar buy_getUltimateFromInterval
* Calcula las últimas compras realizadas * Calcula las últimas compras realizadas
* desde un rango de fechas. * desde un rango de fechas.
* *

View File

@ -13,7 +13,7 @@ BEGIN
* @param vDated Compras hasta fecha * @param vDated Compras hasta fecha
* @return tmp.buyUltimate * @return tmp.buyUltimate
*/ */
CALL cache.last_buy_refresh (FALSE); CALL cache.last_buy_refresh(FALSE);
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate;
CREATE TEMPORARY TABLE tmp.buyUltimate CREATE TEMPORARY TABLE tmp.buyUltimate

View File

@ -25,8 +25,8 @@ BEGIN
END IF; END IF;
-- Item -- Item
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval;
CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval CREATE OR REPLACE TEMPORARY TABLE tmp.buyUltimateFromInterval
(PRIMARY KEY (itemFk, warehouseFk), (PRIMARY KEY (itemFk, warehouseFk),
INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk)) INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk))
ENGINE = MEMORY ENGINE = MEMORY
@ -97,7 +97,8 @@ BEGIN
LIMIT 10000000000000000000) sub LIMIT 10000000000000000000) sub
GROUP BY itemFk, warehouseFk; GROUP BY itemFk, warehouseFk;
-- ItemOriginal -- ItemOriginal
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored) INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
SELECT itemFk, SELECT itemFk,
warehouseFk, warehouseFk,