feat: refs #7774
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-07-24 13:56:21 +02:00
parent 49888cc3b9
commit d0dfb95718
1 changed files with 0 additions and 33 deletions

View File

@ -18,9 +18,6 @@ BEGIN
DECLARE vSalesPersonFK INT;
DECLARE vItemPicker INT;
DECLARE vTicketfailed INT;
DECLARE vSubjectsTicketfailed VARCHAR(50);
DECLARE vMessagesTicketfailed TEXT;
DECLARE rsTicket CURSOR FOR
SELECT tt.ticketFk,
@ -221,36 +218,6 @@ BEGIN
END LOOP;
CLOSE rsTicket;
WITH tOrigin AS (
SELECT tt.ticketFk,
t.clientFk,
t.warehouseFk,
t.companyFk,
t.addressFk,
tt.agencyModeFk,
ti.dated
FROM ticketWeekly tt
JOIN ticket t ON tt.ticketFk = t.id
JOIN tmp.time ti
WHERE WEEKDAY(ti.dated) = tt.weekDay
),total AS(
SELECT tor.ticketFk, tc.id
FROM tOrigin tor
JOIN sale so ON tor.ticketFk = so.ticketFk
LEFT JOIN ticket tc ON tc.id = tor.ticketFk
AND DATE(tc.shipped) = tor.dated
LEFT JOIN sale sc ON sc.ticketFk = tc.id
WHERE sc.id IS NULL
GROUP BY tor.ticketFk, tc.id
)SELECT COUNT(DISTINCT ticketFk) INTO vTicketfailed
FROM total;
IF vTicketfailed THEN
SET vSubjectsTicketfailed = 'Turnos - Tickets que no se han clonado ';
SET vMessagesTicketfailed = 'No se ha podido clonar tickets revisar que tickets han sido y mirar por que no se han clonado';
CALL mail_insert('nocontestar@verdnatura.es', NULL, vSubjectsTicketfailed, vMessagesTicketfailed);
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
END$$
DELIMITER ;