feat: previas con sitema de reservas refs #6861 #2176
|
@ -75,7 +75,7 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vHasThrow THEN
|
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
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
no pots posar ací el throw? no pots posar ací el throw?
carlosap
commented
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
|
IF vSaleGroupFk THEN
|
||||||
|
|
|
@ -40,7 +40,7 @@ BEGIN
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tCollection;
|
||||||
|
|
||||||
jgallego marked this conversation as resolved
jgallego
commented
si hi ha un throw el leave es innecesari si hi ha un throw el leave es innecesari
|
|||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('There are pending collections');
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
castella no castella no
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT warehouseFk, itemPackingTypeFk
|
SELECT warehouseFk, itemPackingTypeFk
|
||||||
|
|
|
@ -7,7 +7,7 @@ BEGIN
|
||||||
* @return Retorna ticketFk, level, agencyName, warehouseFk, salesPersonFk, observation
|
* @return Retorna ticketFk, level, agencyName, warehouseFk, salesPersonFk, observation
|
||||||
*/
|
*/
|
||||||
DECLARE vItemPackingTypeFk VARCHAR(1);
|
DECLARE vItemPackingTypeFk VARCHAR(1);
|
||||||
DECLARE vDated DATE;
|
DECLARE vYesterday DATE;
|
||||||
|
|
||||||
-- Si los sacadores son los de pruebas, pinta los colores
|
-- Si los sacadores son los de pruebas, pinta los colores
|
||||||
SELECT itemPackingTypeFk
|
SELECT itemPackingTypeFk
|
||||||
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
FROM collection
|
FROM collection
|
||||||
WHERE id = vParamFk;
|
WHERE id = vParamFk;
|
||||||
|
|
||||||
SET vDated = util.yesterday();
|
SET vYesterday = util.yesterday();
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
vYesterday vYesterday
|
|||||||
|
|
||||||
WITH observation AS (
|
WITH observation AS (
|
||||||
SELECT tob.ticketFk, tob.description
|
SELECT tob.ticketFk, tob.description
|
||||||
|
@ -45,7 +45,7 @@ BEGIN
|
||||||
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
|
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||||
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
LEFT JOIN observation ob ON ob.ticketFk = t.id
|
||||||
WHERE t.id = vParamFk
|
WHERE t.id = vParamFk
|
||||||
AND t.shipped >= vDated
|
AND t.shipped >= vYesterday
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT t.id ticketFk,
|
SELECT t.id ticketFk,
|
||||||
IF(NOT(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
|
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 observation ob ON ob.ticketFk = t.id
|
||||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
LEFT JOIN vn.client c ON c.id = t.clientFk
|
||||||
WHERE sc.id = vParamFk
|
WHERE sc.id = vParamFk
|
||||||
AND t.shipped >= vDated;
|
AND t.shipped >= vYesterday;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -29,7 +29,7 @@ BEGIN
|
||||||
END;
|
END;
|
||||||
|
|
||||||
IF (SELECT isPicked FROM itemShelvingSale WHERE id = vItemShelvingSaleFk) THEN
|
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
jgallego
commented
en castella no en castella no
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0))
|
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk, SUM(IFNULL(iss.quantity,0))
|
||||||
|
@ -43,7 +43,7 @@ BEGIN
|
||||||
OR (vQuantity < vReservedQuantity AND
|
OR (vQuantity < vReservedQuantity AND
|
||||||
(NOT vIsItemShelvingSaleEmpty OR vIsItemShelvingSaleEmpty IS NULL))
|
(NOT vIsItemShelvingSaleEmpty OR vIsItemShelvingSaleEmpty IS NULL))
|
||||||
OR (vIsItemShelvingSaleEmpty IS NOT NULL AND vQuantity = vReservedQuantity) THEN
|
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;
|
END IF;
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
@ -89,7 +89,7 @@ BEGIN
|
||||||
COMMIT;
|
COMMIT;
|
||||||
jgallego
commented
itemShelvingSaleReserve itemShelvingSaleReserve
|
|||||||
|
|
||||||
IF vIsItemShelvingSaleEmpty AND vQuantity <> vReservedQuantity THEN
|
IF vIsItemShelvingSaleEmpty AND vQuantity <> vReservedQuantity THEN
|
||||||
CALL itemShelvingSale_moveReserv(vItemShelvingFk, vQuantity);
|
CALL itemShelving_moveReserv(vItemShelvingFk, vQuantity);
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -1,11 +1,11 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_moveReserv`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_moveReserv`(
|
||||||
vItemShelvingFk INT(10),
|
vItemShelvingFk INT(10),
|
||||||
vItemFk INT(10)
|
vItemFk INT(10)
|
||||||
)
|
)
|
||||||
BEGIN
|
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
|
* @param vItemShelvingFk Id itemShelving
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,6 @@ BEGIN
|
||||||
SELECT id INTO vItemShelvingFk
|
SELECT id INTO vItemShelvingFk
|
||||||
FROM itemShelving
|
FROM itemShelving
|
||||||
WHERE id = vItemShelvingFk
|
WHERE id = vItemShelvingFk
|
||||||
AND FALSE
|
|
||||||
FOR UPDATE;
|
FOR UPDATE;
|
||||||
|
|
||||||
UPDATE itemShelving
|
UPDATE itemShelving
|
|
@ -12,8 +12,7 @@ BEGIN
|
||||||
LEFT JOIN vn.sale sl ON sl.id = sgd.saleFk
|
LEFT JOIN vn.sale sl ON sl.id = sgd.saleFk
|
||||||
LEFT JOIN itemShelvingSale iss ON iss.saleFk = sl.id
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = sl.id
|
||||||
WHERE sc.userFk = account.myUser_getId()
|
WHERE sc.userFk = account.myUser_getId()
|
||||||
AND (ISNULL(scsg.sectorCollectionFk)
|
AND (scsg.sectorCollectionFk IS NULL OR NOT iss.isPicked)
|
||||||
jgallego marked this conversation as resolved
Outdated
jgallego
commented
Por temas de optimización en WHERE, utilizaremos la comparación a null usando IS NULL Por temas de optimización en WHERE, utilizaremos la comparación a null usando IS NULL ~~ISNULL(parentFk)~~
|
|||||||
OR (NOT iss.isPicked))
|
|
||||||
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
|
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -6,7 +6,7 @@ BEGIN
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
JOIN operator o ON o.workerFk = account.myUser_getId()
|
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
jgallego
commented
isPicked de quina taula? isPicked de quina taula?
|
|||||||
WHERE id = NEW.saleFk;
|
WHERE id = NEW.saleFk;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
Loading…
Reference in New Issue
castella no.