Removed procedures
This commit is contained in:
parent
c3e8c0cc58
commit
e6804f6ee3
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue