feat: previas con sitema de reservas refs #6861 #2176

Merged
carlosap merged 64 commits from 6861-Pasar-modo-trabajo-de-previa-a-reservas into dev 2024-06-25 11:21:03 +00:00
7 changed files with 16 additions and 18 deletions
Showing only changes of commit b9d1c3228b - Show all commits

View File

@ -75,7 +75,7 @@ BEGIN
END IF;
IF vHasThrow THEN
CALL util.throw("No hay disponibilidad para el artículo seleccionado");
CALL util.throw("There is no available for the selected item");
carlosap marked this conversation as resolved Outdated

castella no.

castella no.
END IF;
jgallego marked this conversation as resolved Outdated

no pots posar ací el throw?

no pots posar ací el throw?

No hi ha un error especific per a caada error, s'aprofita la variable vHasThrow en varios puestos

No hi ha un error especific per a caada error, s'aprofita la variable vHasThrow en varios puestos
IF vSaleGroupFk THEN

View File

@ -40,7 +40,7 @@ BEGIN
DROP TEMPORARY TABLE tCollection;
jgallego marked this conversation as resolved
Review

si hi ha un throw el leave es innecesari

si hi ha un throw el leave es innecesari
IF vHasTooMuchCollections THEN
CALL util.throw('Hay colecciones pendientes');
CALL util.throw('There are pending collections');
jgallego marked this conversation as resolved Outdated

castella no

castella no
END IF;
SELECT warehouseFk, itemPackingTypeFk

View File

@ -7,7 +7,7 @@ BEGIN
* @return Retorna ticketFk, level, agencyName, warehouseFk, salesPersonFk, observation
*/
DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vDated DATE;
DECLARE vYesterday DATE;
-- Si los sacadores son los de pruebas, pinta los colores
SELECT itemPackingTypeFk
@ -15,7 +15,7 @@ BEGIN
FROM collection
WHERE id = vParamFk;
SET vDated = util.yesterday();
SET vYesterday = util.yesterday();
jgallego marked this conversation as resolved Outdated

vYesterday

vYesterday
WITH observation AS (
SELECT tob.ticketFk, tob.description
@ -45,7 +45,7 @@ BEGIN
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
LEFT JOIN observation ob ON ob.ticketFk = t.id
WHERE t.id = vParamFk
AND t.shipped >= vDated
AND t.shipped >= vYesterday
UNION ALL
SELECT t.id ticketFk,
IF(NOT(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
@ -84,6 +84,6 @@ BEGIN
LEFT JOIN observation ob ON ob.ticketFk = t.id
LEFT JOIN vn.client c ON c.id = t.clientFk
WHERE sc.id = vParamFk
AND t.shipped >= vDated;
AND t.shipped >= vYesterday;
END$$
DELIMITER ;

View File

@ -29,7 +29,7 @@ BEGIN
END;
IF (SELECT isPicked FROM itemShelvingSale WHERE id = vItemShelvingSaleFk) THEN
CALL util.throw('Reserva completada');
CALL util.throw('Reservation completed');
jgallego marked this conversation as resolved Outdated

en castella no

en castella no
END IF;
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0))
@ -43,7 +43,7 @@ BEGIN
OR (vQuantity < vReservedQuantity AND
(NOT vIsItemShelvingSaleEmpty OR vIsItemShelvingSaleEmpty IS NULL))
OR (vIsItemShelvingSaleEmpty IS NOT NULL AND vQuantity = vReservedQuantity) THEN
CALL util.throw('La cantidad no puede distinta a la reserva');
CALL util.throw('The quantity cannot be different from the reserved');
END IF;
START TRANSACTION;
@ -89,7 +89,7 @@ BEGIN
COMMIT;

itemShelvingSaleReserve

itemShelvingSaleReserve
IF vIsItemShelvingSaleEmpty AND vQuantity <> vReservedQuantity THEN
CALL itemShelvingSale_moveReserv(vItemShelvingFk, vQuantity);
CALL itemShelving_moveReserv(vItemShelvingFk, vQuantity);
END IF;
END$$
DELIMITER ;

View File

@ -1,11 +1,11 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_moveReserv`(
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_moveReserv`(
vItemShelvingFk INT(10),
vItemFk INT(10)
)
BEGIN
/**
* Elimina reservas de un itemShelvingSale e intenta reservar en otra ubicación
* Elimina reservas de un itemShelving e intenta reservar en otra ubicación
*
* @param vItemShelvingFk Id itemShelving
*/
@ -20,7 +20,6 @@ BEGIN
SELECT id INTO vItemShelvingFk
FROM itemShelving
WHERE id = vItemShelvingFk
AND FALSE
FOR UPDATE;
UPDATE itemShelving

View File

@ -12,8 +12,7 @@ BEGIN
LEFT JOIN vn.sale sl ON sl.id = sgd.saleFk
LEFT JOIN itemShelvingSale iss ON iss.saleFk = sl.id
WHERE sc.userFk = account.myUser_getId()
AND (ISNULL(scsg.sectorCollectionFk)
OR (NOT iss.isPicked))
AND (scsg.sectorCollectionFk IS NULL OR NOT iss.isPicked)
jgallego marked this conversation as resolved Outdated

Por temas de optimización en WHERE, utilizaremos la comparación a null usando IS NULL ISNULL(parentFk)

Por temas de optimización en WHERE, utilizaremos la comparación a null usando IS NULL ~~ISNULL(parentFk)~~
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
END$$
DELIMITER ;

View File

@ -6,7 +6,7 @@ BEGIN
UPDATE sale s
JOIN operator o ON o.workerFk = account.myUser_getId()
SET isPicked = IF(o.isOnReservationMode, isPicked, TRUE)
SET s.isPicked = IF(o.isOnReservationMode, isPicked, TRUE)
carlosap marked this conversation as resolved Outdated

isPicked de quina taula?

isPicked de quina taula?
WHERE id = NEW.saleFk;
END$$
DELIMITER ;