7736-Añadir-parámetro-itemFk-a-buyUltimate #2805

Merged
carlosap merged 12 commits from 7736-Añadir-parámetro-itemFk-a-buyUltimate into test 2024-07-30 09:13:10 +00:00
6 changed files with 20 additions and 14 deletions
Showing only changes of commit d7b9a3ffd0 - Show all commits

View File

@ -15,8 +15,7 @@ BEGIN
*/
CALL cache.last_buy_refresh(FALSE);
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate;
CREATE TEMPORARY TABLE tmp.buyUltimate
CREATE OR REPLACE TEMPORARY TABLE tmp.buyUltimate
(PRIMARY KEY (itemFk, warehouseFk),
INDEX(itemFk))
ENGINE = MEMORY

View File

@ -21,7 +21,7 @@ BEGIN
END IF;
IF vEnded < vStarted THEN
SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded);
SET vStarted = vEnded - INTERVAL 1 MONTH;
END IF;
-- Item

View File

@ -1,5 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT)
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
@ -8,9 +12,9 @@ BEGIN
* @param vItemFk Id del Artículo
* @param vGrouping Cantidad de grouping
*/
CALL vn.buy_getUltimate (vItemFk, vWarehouseFk, util.VN_CURDATE());
CALL buy_getUltimate (vItemFk, vWarehouseFk, util.VN_CURDATE());
UPDATE vn.buy b
UPDATE buy b
JOIN tmp.buyUltimate bu ON b.id = bu.buyFk
SET b.`grouping` = vGrouping
WHERE bu.warehouseFk = vWarehouseFk

View File

@ -74,7 +74,7 @@ BEGIN
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped);
CALL vn.buy_getUltimate(NULL, vWarehouseFk, vShipped);
CALL buy_getUltimate(NULL, vWarehouseFk, vShipped);
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
SELECT vWarehouseFk,

View File

@ -1,5 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getInfo`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getInfo`(
`vBarcode` VARCHAR(22),
`vWarehouseFk` INT
)
BEGIN
/**
* Devuelve información relativa al item correspondiente del vBarcode pasado
@ -11,13 +14,13 @@ BEGIN
DECLARE vCacheAvailableFk INT;
DECLARE vVisibleItemShelving INT;
DECLARE vItemFk INT;
DECLARE vDated DATE;
SELECT barcodeToItem(vBarcode), util.VN_CURDATE() INTO vItemFk, vDated;
CALL cache.visible_refresh(vCacheVisibleFk, FALSE, vWarehouseFk);
CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
SELECT barcodeToItem(vBarcode) INTO vItemFk;
CALL buy_getUltimate(vItemFk, vWarehouseFk, util.VN_CURDATE());
CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, vDated);
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
SELECT SUM(visible) INTO vVisibleItemShelving
FROM itemShelvingStock

View File

@ -52,7 +52,7 @@ module.exports = Self => {
else {
const userConfig = await models.UserConfig.findById(userId, {fields: ['warehouseFk']}, myOptions);
await Self.rawSql(
'CALL vn.buy_getUltimate(?,?,?)',
'CALL buy_getUltimate(?, ?, ?)',
[args.item, userConfig.warehouseFk, null],
myOptions
);