diff --git a/db/routines/vn/procedures/itemShelvingLog_get.sql b/db/routines/vn/procedures/itemShelvingLog_get.sql index de4211e41..5a943e867 100644 --- a/db/routines/vn/procedures/itemShelvingLog_get.sql +++ b/db/routines/vn/procedures/itemShelvingLog_get.sql @@ -1,12 +1,12 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`( - vShelvingFk VARCHAR(10) + vShelvingCode VARCHAR(10) ) BEGIN /** * Devuelve el log de los item en cada carro * - * @param vShelvingFk MatrĂ­cula del carro + * @param vShelvingCode MatrĂ­cula del carro * */ SELECT isl.itemShelvingFk, @@ -29,8 +29,8 @@ BEGIN JOIN itemShelvingLog isl ON item.id = isl.itemFk JOIN worker ON isl.workerFk = worker.id JOIN shelving sh ON sh.id = isl.shelvingFk - WHERE sh.code = vShelvingFk COLLATE utf8mb3_unicode_ci - OR isl.itemFk = vShelvingFk -- ?? Respeto porque ya estaba + WHERE sh.code = vShelvingCode COLLATE utf8mb3_unicode_ci + OR isl.itemFk = vShelvingCode -- ?? Respeto porque ya estaba ORDER BY isl.created DESC; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/item_devalueA2.sql b/db/routines/vn/procedures/item_devalueA2.sql index 282f6e01e..3264165a6 100644 --- a/db/routines/vn/procedures/item_devalueA2.sql +++ b/db/routines/vn/procedures/item_devalueA2.sql @@ -1,7 +1,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_devalueA2`( vSelf INT, - vShelvingCode VARCHAR(10), + vShelvingCode VARCHAR(10) COLLATE utf8mb3_general_ci, vBuyingValue DECIMAL(10,4), vQuantity INT ) @@ -112,7 +112,7 @@ BEGIN SELECT ish.id, ish.visible INTO vTargetItemShelvingFk, vCurrentVisible FROM itemShelving ish JOIN shelving sh ON sh.id = ish.shelvingFk - WHERE sh.code = vShelvingCode COLLATE utf8mb3_general_ci + WHERE sh.code = vShelvingCode AND ish.itemFk = vSelf LIMIT 1; @@ -399,7 +399,7 @@ BEGIN FROM itemShelving ish JOIN shelving sh ON sh.id = ish.shelvingFk WHERE ish.itemFK = vSelf - AND sh.code = vShelvingCode COLLATE utf8mb3_general_ci + AND sh.code = vShelvingCode ON DUPLICATE KEY UPDATE visible = vQuantity + VALUES(visible); diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index aa4a14acd..f156ff8f8 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -27,7 +27,7 @@ BEGIN DECLARE vQuantity INT; DECLARE vRemainder INT DEFAULT 0; DECLARE vRemainderSaleFk INT; - DECLARE vShelving VARCHAR(10); + DECLARE vShelvingFk VARCHAR(10); DECLARE vTicketFk INT; SELECT s.quantity, @@ -262,7 +262,7 @@ w1: WHILE vQuantity >= vPacking DO CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE); SELECT shelvingFk, p.code - INTO vShelving, vParkingCode + INTO vShelvingFk, vParkingCode FROM itemShelving ish JOIN shelving sh ON sh.id = ish.shelvingFk JOIN parking p ON p.id = sh.parkingFk @@ -273,7 +273,7 @@ w1: WHILE vQuantity >= vPacking DO itemFk = vItemFk, quantity = vPacking, longName = vConcept, - shelvingFk = vShelving, + shelvingFk = vShelvingFk, parkingCode = vParkingCode, phone = RIGHT(phone,vMaxPhoneLength), street = RIGHT(street, vMAxStreetLength) diff --git a/db/routines/vn/procedures/shelvingChange.sql b/db/routines/vn/procedures/shelvingChange.sql index f0756b385..901b1cf95 100644 --- a/db/routines/vn/procedures/shelvingChange.sql +++ b/db/routines/vn/procedures/shelvingChange.sql @@ -1,10 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8)) +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`shelvingChange`( + `vShelvingO` VARCHAR(10), + `vShelvingD` VARCHAR(10) +) BEGIN - UPDATE itemShelving ish - JOIN shelving sh1 ON sh1.code = vShelvingD COLLATE utf8_unicode_ci - JOIN shelving sh2 ON sh2.code = vShelvingO COLLATE utf8_unicode_ci - SET ish.shelvingFk = sh1.id - WHERE ish.shelvingFk = sh2.id; + UPDATE itemShelving ish + JOIN shelving sh1 ON sh1.code = vShelvingD COLLATE utf8_unicode_ci + JOIN shelving sh2 ON sh2.code = vShelvingO COLLATE utf8_unicode_ci + SET ish.shelvingFk = sh1.id + WHERE ish.shelvingFk = sh2.id; END$$ DELIMITER ;