7736-Añadir-parámetro-itemFk-a-buyUltimate #2805
|
@ -15,8 +15,7 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
CALL cache.last_buy_refresh(FALSE);
|
CALL cache.last_buy_refresh(FALSE);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate;
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buyUltimate
|
||||||
CREATE TEMPORARY TABLE tmp.buyUltimate
|
|
||||||
(PRIMARY KEY (itemFk, warehouseFk),
|
(PRIMARY KEY (itemFk, warehouseFk),
|
||||||
INDEX(itemFk))
|
INDEX(itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
|
|
|
@ -21,7 +21,7 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vEnded < vStarted THEN
|
IF vEnded < vStarted THEN
|
||||||
SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded);
|
SET vStarted = vEnded - INTERVAL 1 MONTH;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Item
|
-- Item
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
DELIMITER $$
|
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
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Actualiza el grouping de las últimas compras de un artículo
|
* Actualiza el grouping de las últimas compras de un artículo
|
||||||
|
@ -8,9 +12,9 @@ BEGIN
|
||||||
* @param vItemFk Id del Artículo
|
* @param vItemFk Id del Artículo
|
||||||
* @param vGrouping Cantidad de grouping
|
* @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
|
JOIN tmp.buyUltimate bu ON b.id = bu.buyFk
|
||||||
SET b.`grouping` = vGrouping
|
SET b.`grouping` = vGrouping
|
||||||
WHERE bu.warehouseFk = vWarehouseFk
|
WHERE bu.warehouseFk = vWarehouseFk
|
||||||
|
|
|
@ -74,7 +74,7 @@ BEGIN
|
||||||
|
|
||||||
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
||||||
CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, 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)
|
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
|
||||||
SELECT vWarehouseFk,
|
SELECT vWarehouseFk,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
DELIMITER $$
|
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
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Devuelve información relativa al item correspondiente del vBarcode pasado
|
* Devuelve información relativa al item correspondiente del vBarcode pasado
|
||||||
|
@ -11,13 +14,13 @@ BEGIN
|
||||||
DECLARE vCacheAvailableFk INT;
|
DECLARE vCacheAvailableFk INT;
|
||||||
DECLARE vVisibleItemShelving INT;
|
DECLARE vVisibleItemShelving INT;
|
||||||
DECLARE vItemFk 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.visible_refresh(vCacheVisibleFk, FALSE, vWarehouseFk);
|
||||||
CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
|
CALL cache.available_refresh(vCacheAvailableFk, FALSE, vWarehouseFk, vDated);
|
||||||
|
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
|
||||||
SELECT barcodeToItem(vBarcode) INTO vItemFk;
|
|
||||||
|
|
||||||
CALL buy_getUltimate(vItemFk, vWarehouseFk, util.VN_CURDATE());
|
|
||||||
|
|
||||||
SELECT SUM(visible) INTO vVisibleItemShelving
|
SELECT SUM(visible) INTO vVisibleItemShelving
|
||||||
FROM itemShelvingStock
|
FROM itemShelvingStock
|
||||||
|
|
|
@ -52,7 +52,7 @@ module.exports = Self => {
|
||||||
else {
|
else {
|
||||||
const userConfig = await models.UserConfig.findById(userId, {fields: ['warehouseFk']}, myOptions);
|
const userConfig = await models.UserConfig.findById(userId, {fields: ['warehouseFk']}, myOptions);
|
||||||
await Self.rawSql(
|
await Self.rawSql(
|
||||||
'CALL vn.buy_getUltimate(?,?,?)',
|
'CALL buy_getUltimate(?, ?, ?)',
|
||||||
[args.item, userConfig.warehouseFk, null],
|
[args.item, userConfig.warehouseFk, null],
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue