7806_devToTest_2332 #2801
|
@ -51399,9 +51399,9 @@ BEGIN
|
||||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
||||||
INTO vHasTooMuchCollections
|
INTO vHasTooMuchCollections
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
LEFT JOIN tCollection ON TRUE;
|
LEFT JOIN tmp.collection ON TRUE;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('Hay colecciones pendientes');
|
||||||
|
@ -51478,9 +51478,9 @@ BEGIN
|
||||||
* @param vWorkerFk id del worker.
|
* @param vWorkerFk id del worker.
|
||||||
* @table Devuelve tabla temporal con las colecciones pendientes
|
* @table Devuelve tabla temporal con las colecciones pendientes
|
||||||
*/
|
*/
|
||||||
DROP TEMPORARY TABLE IF EXISTS tCollection;
|
DROP TEMPORARY TABLE IF EXISTS tmp.collection;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tCollection
|
CREATE TEMPORARY TABLE tmp.collection
|
||||||
SELECT c.id collectionFk,
|
SELECT c.id collectionFk,
|
||||||
date(c.created) created,
|
date(c.created) created,
|
||||||
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
||||||
|
@ -51499,7 +51499,7 @@ BEGIN
|
||||||
GROUP BY c.id
|
GROUP BY c.id
|
||||||
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
||||||
|
|
||||||
SELECT * FROM tCollection;
|
SELECT * FROM tmp.collection;
|
||||||
END ;;
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
|
|
@ -34,10 +34,10 @@ BEGIN
|
||||||
pc.collection_assign_lockname
|
pc.collection_assign_lockname
|
||||||
INTO vHasTooMuchCollections,
|
INTO vHasTooMuchCollections,
|
||||||
vLockName
|
vLockName
|
||||||
FROM tCollection tc
|
FROM tmp.collection c
|
||||||
JOIN productionConfig pc;
|
JOIN productionConfig pc;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('There are pending collections');
|
CALL util.throw('There are pending collections');
|
||||||
|
|
|
@ -17,34 +17,19 @@ BEGIN
|
||||||
SELECT bb.id buyFk,
|
SELECT bb.id buyFk,
|
||||||
FLOOR(ish.visible / ish.packing) ishStickers,
|
FLOOR(ish.visible / ish.packing) ishStickers,
|
||||||
bb.stickers buyStickers
|
bb.stickers buyStickers
|
||||||
FROM vn.itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN (SELECT b.id, b.itemFk, b.stickers
|
JOIN (SELECT b.id, b.itemFk, b.stickers
|
||||||
FROM vn.buy b
|
FROM buy b
|
||||||
WHERE b.entryFk = vFromEntryFk
|
WHERE b.entryFk = vFromEntryFk
|
||||||
ORDER BY b.stickers DESC
|
ORDER BY b.stickers DESC
|
||||||
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
||||||
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
|
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
|
||||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
||||||
|
AND NOT ish.isSplit
|
||||||
GROUP BY ish.id;
|
GROUP BY ish.id;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
-- Cantidades de la matrícula que exceden la de las entradas
|
|
||||||
SELECT ish.itemFk,
|
|
||||||
i.longName,
|
|
||||||
FLOOR(ish.visible / ish.packing) AS etiEnMatricula,
|
|
||||||
bb.stickers etiEnEntrada
|
|
||||||
FROM vn.itemShelving ish
|
|
||||||
JOIN vn.item i ON i.id = ish.itemFk
|
|
||||||
LEFT JOIN (SELECT b.id, b.itemFk, b.stickers
|
|
||||||
FROM vn.buy b
|
|
||||||
WHERE b.entryFk = vFromEntryFk
|
|
||||||
ORDER BY b.stickers DESC
|
|
||||||
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
|
||||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
|
||||||
AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing)
|
|
||||||
GROUP BY ish.id;
|
|
||||||
|
|
||||||
OPEN cur;
|
OPEN cur;
|
||||||
|
|
||||||
read_loop: LOOP
|
read_loop: LOOP
|
||||||
|
@ -57,16 +42,16 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vIshStickers = vBuyStickers THEN
|
IF vIshStickers = vBuyStickers THEN
|
||||||
UPDATE vn.buy
|
UPDATE buy
|
||||||
SET entryFk = vToEntryFk
|
SET entryFk = vToEntryFk
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
ELSE
|
ELSE
|
||||||
UPDATE vn.buy
|
UPDATE buy
|
||||||
SET stickers = stickers - vIshStickers,
|
SET stickers = stickers - vIshStickers,
|
||||||
quantity = stickers * packing
|
quantity = stickers * packing
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
||||||
INSERT INTO vn.buy(entryFk,
|
INSERT INTO buy(entryFk,
|
||||||
itemFk,
|
itemFk,
|
||||||
quantity,
|
quantity,
|
||||||
buyingValue,
|
buyingValue,
|
||||||
|
@ -117,13 +102,16 @@ BEGIN
|
||||||
weight,
|
weight,
|
||||||
deliveryFk,
|
deliveryFk,
|
||||||
itemOriginalFk
|
itemOriginalFk
|
||||||
FROM vn.buy
|
FROM buy
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
||||||
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
|
UPDATE itemShelving
|
||||||
|
SET isSplit = TRUE
|
||||||
|
WHERE shelvingFk = vShelvingFk;
|
||||||
|
END LOOP;
|
||||||
CLOSE cur;
|
CLOSE cur;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.itemShelving ADD isSplit tinyint(1) NULL COMMENT 'Este valor cambia al splitar un carro que se ha quedado en holanda';
|
Loading…
Reference in New Issue