Merge branch 'dev' into 7654-entry_splitByShelvingCreateColumn
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
e897cdc35b
|
@ -47,9 +47,9 @@ BEGIN
|
|||
INTO vHasTooMuchCollections,
|
||||
vLockName
|
||||
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
|
||||
CALL util.throw('Hay colecciones pendientes');
|
||||
|
|
|
@ -7,27 +7,32 @@ BEGIN
|
|||
* @param vWorkerFk id del worker.
|
||||
* @table Devuelve tabla temporal con las colecciones pendientes
|
||||
*/
|
||||
DROP TEMPORARY TABLE IF EXISTS tCollection;
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
CREATE TEMPORARY TABLE tCollection
|
||||
SELECT c.id collectionFk,
|
||||
date(c.created) created,
|
||||
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
||||
FROM collection c
|
||||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
|
||||
JOIN state s2 ON s2.id = ts.stateFk
|
||||
JOIN productionConfig pc
|
||||
JOIN vn.state ss on ss.code = 'PREPARED'
|
||||
LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id
|
||||
WHERE c.workerFk = vWorkerFk
|
||||
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
|
||||
AND s.quantity != 0
|
||||
AND s2.order < pc.pendingCollectionsOrder
|
||||
GROUP BY c.id
|
||||
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.collection
|
||||
ENGINE = MEMORY
|
||||
SELECT c.id collectionFk,
|
||||
DATE(c.created) created,
|
||||
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
||||
FROM collection c
|
||||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
|
||||
JOIN state s2 ON s2.id = ts.stateFk
|
||||
JOIN productionConfig pc
|
||||
JOIN vn.state ss ON ss.code = 'PREPARED'
|
||||
LEFT JOIN vn.saleTracking st ON st.saleFk = s.id
|
||||
AND st.stateFk = ss.id
|
||||
WHERE c.workerFk = vWorkerFk
|
||||
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
|
||||
AND s.quantity
|
||||
AND s2.order < pc.pendingCollectionsOrder
|
||||
GROUP BY c.id
|
||||
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
||||
|
||||
SELECT * FROM tCollection;
|
||||
SELECT * FROM tmp.collection;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -15,6 +15,11 @@ proc: BEGIN
|
|||
DECLARE vEndingDate DATETIME;
|
||||
DECLARE vIsTodayRelative BOOLEAN;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
|
||||
INTO vEndingDate
|
||||
FROM productionConfig;
|
||||
|
@ -31,7 +36,8 @@ proc: BEGIN
|
|||
CALL prepareClientList();
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
||||
(INDEX (ticketFk)) ENGINE = MEMORY
|
||||
(INDEX (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
|
||||
FROM tmp.productionTicket tt
|
||||
JOIN ticket t ON t.id = tt.ticketFk;
|
||||
|
|
|
@ -278,12 +278,11 @@ BEGIN
|
|||
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
|
||||
CALL buyUltimate(vWarehouseFk, vDate);
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
||||
SELECT ticketFk, problem, saleFk
|
||||
SELECT ticketFk, problem ,saleFk
|
||||
FROM (
|
||||
SELECT tl.ticketFk,
|
||||
s.id saleFk ,
|
||||
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem,
|
||||
MOD(s.quantity, b.`grouping`) hasRounding
|
||||
s.id saleFk,
|
||||
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN ticket t ON t.id = tl.ticketFk
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
|
@ -291,9 +290,9 @@ BEGIN
|
|||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||
JOIN buy b ON b.id = bu.buyFk
|
||||
WHERE MOD(s.quantity, b.`grouping`)
|
||||
GROUP BY tl.ticketFk
|
||||
HAVING hasRounding
|
||||
) sub
|
||||
)sub
|
||||
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
||||
END LOOP;
|
||||
CLOSE vCursor;
|
||||
|
|
|
@ -9,6 +9,11 @@ BEGIN
|
|||
*/
|
||||
DECLARE vStateFk INT;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
INSERT INTO ticket (
|
||||
clientFk,
|
||||
shipped,
|
||||
|
|
Loading…
Reference in New Issue