From 7b42497f88ed5da1cf392895718b0e9404356cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 7 Sep 2020 11:44:44 +0200 Subject: [PATCH] Removed procedures --- .../ticket_closeByAgency.sql | 32 -------------- .../ticket_closeByAllWarehouses.sql | 42 ------------------- .../ticket_closeByRoute.sql | 29 ------------- .../ticket_closeByTicket.sql | 28 ------------- .../ticket_closeByWarehouse.sql | 29 ------------- 5 files changed, 160 deletions(-) delete mode 100644 db/changes/10200-DeEscalation/ticket_closeByAgency.sql delete mode 100644 db/changes/10200-DeEscalation/ticket_closeByAllWarehouses.sql delete mode 100644 db/changes/10200-DeEscalation/ticket_closeByRoute.sql delete mode 100644 db/changes/10200-DeEscalation/ticket_closeByTicket.sql delete mode 100644 db/changes/10200-DeEscalation/ticket_closeByWarehouse.sql diff --git a/db/changes/10200-DeEscalation/ticket_closeByAgency.sql b/db/changes/10200-DeEscalation/ticket_closeByAgency.sql deleted file mode 100644 index 155305afe..000000000 --- a/db/changes/10200-DeEscalation/ticket_closeByAgency.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_closeByAgencyList`(vWarehouseFk INT, vDateTo DATE) -BEGIN -/** - * Inserta los tickets de todos los almacenes en la tabla temporal - * para ser cerrados. - * - * @param vWarehouseFk Id del almacén - * @param vDate Fecha del cierre - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN tmp.ticketClosureAgencyList al ON al.agencyModeFk = t.agencyModeFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel - WHERE al.code = 'PACKED' - AND t.warehouseFk = vWarehouseFk - AND DATE(t.shipped) BETWEEN DATE_ADD(vDateTo, INTERVAL -2 DAY) AND vDateTo - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - - CALL ticket_close(); - - DROP TEMPORARY TABLE tmp.ticketClosureAgencyList; - DROP TEMPORARY TABLE tmp.ticketClosure; -END \ No newline at end of file diff --git a/db/changes/10200-DeEscalation/ticket_closeByAllWarehouses.sql b/db/changes/10200-DeEscalation/ticket_closeByAllWarehouses.sql deleted file mode 100644 index 4a3ae76c8..000000000 --- a/db/changes/10200-DeEscalation/ticket_closeByAllWarehouses.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_closeByAllWarehouses`(vDateTo DATE) -BEGIN -/** - * Inserta los tickets de todos los almacenes en la tabla temporal - * para ser cerrados. - * - * @param vDate Fecha del cierre - */ - DECLARE vDateToEndDay DATETIME DEFAULT util.dayEnd(vDateTo); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN warehouse w ON w.id = t.warehouseFk AND hasComission - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel - WHERE al.code = 'PACKED' - AND DATE(t.shipped) BETWEEN DATE_ADD(vDateTo, INTERVAL -2 DAY) AND vDateTo - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticket_close(); - - -- cau 15033 - UPDATE ticket t - JOIN ticketState ts ON t.id = ts.ticketFk - JOIN alertLevel al ON al.alertLevel = ts.alertLevel - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - JOIN zone z ON z.id = t.zoneFk - SET t.routeFk = NULL - WHERE shipped BETWEEN vDateTo AND vDateToEndDay - AND al.code NOT IN('DELIVERED','PACKED') - AND t.routeFk - AND z.`name` LIKE '%MADRID%'; - - DROP TEMPORARY TABLE tmp.ticketClosure; -END \ No newline at end of file diff --git a/db/changes/10200-DeEscalation/ticket_closeByRoute.sql b/db/changes/10200-DeEscalation/ticket_closeByRoute.sql deleted file mode 100644 index 3c1500bd6..000000000 --- a/db/changes/10200-DeEscalation/ticket_closeByRoute.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_closeByRoute`( vRouteFk INT) -BEGIN -/** - * Inserta los tickets de la ruta en la tabla temporal - * para ser cerrados. - * - * @param vWarehouseFk Almacén a cerrar - * @param vRouteFk Ruta a cerrar - * @param vDate Fecha del cierre - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel - WHERE al.code = 'PACKED' - AND t.routeFk = vRouteFk - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticket_close(); - - DROP TEMPORARY TABLE tmp.ticketClosure; -END \ No newline at end of file diff --git a/db/changes/10200-DeEscalation/ticket_closeByTicket.sql b/db/changes/10200-DeEscalation/ticket_closeByTicket.sql deleted file mode 100644 index 1ffb5a265..000000000 --- a/db/changes/10200-DeEscalation/ticket_closeByTicket.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_closeByTicket`(vTicketFk INT) -BEGIN - -/** - * Inserta el ticket en la tabla temporal - * para ser cerrado. - * - * @param vTicketFk Id del ticket - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel - WHERE al.code = 'PACKED' - AND t.id = vTicketFk - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticket_close(); - - DROP TEMPORARY TABLE tmp.ticketClosure; -END \ No newline at end of file diff --git a/db/changes/10200-DeEscalation/ticket_closeByWarehouse.sql b/db/changes/10200-DeEscalation/ticket_closeByWarehouse.sql deleted file mode 100644 index e7996edb0..000000000 --- a/db/changes/10200-DeEscalation/ticket_closeByWarehouse.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_closeByWarehouse`(vWarehouseFk INT, vDateTo DATE) -BEGIN -/** - * Inserta los tickets del almacen en la tabla temporal - * para ser cerrados. - * - * @param vWarehouseFk Almacén a cerrar - * @param vDate Fecha del cierre - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE ticketClosure ENGINE = MEMORY( - SELECT - t.id AS ticketFk - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel - WHERE al.code = 'PACKED' - AND t.warehouseFk = vWarehouseFk - AND DATE(t.shipped) BETWEEN DATE_ADD(vDateTo, INTERVAL -2 DAY) AND vDateTo - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticket_close(); - - DROP TEMPORARY TABLE tmp.ticketClosure; -END \ No newline at end of file