7152-devToTest_2414 #2228
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getCollisions`()
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneIncluded_checkCollisions`()
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula si para un mismo codigo postal y dia
|
* Calcula si para un mismo codigo postal y dia
|
||||||
|
@ -10,6 +10,7 @@ BEGIN
|
||||||
DECLARE vZoneFk INT;
|
DECLARE vZoneFk INT;
|
||||||
DECLARE vIsDone INT DEFAULT FALSE;
|
DECLARE vIsDone INT DEFAULT FALSE;
|
||||||
DECLARE vTableCollisions TEXT;
|
DECLARE vTableCollisions TEXT;
|
||||||
|
DECLARE json_data JSON;
|
||||||
DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption;
|
DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
||||||
|
@ -77,49 +78,28 @@ BEGIN
|
||||||
GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk
|
GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk
|
||||||
HAVING count(*) > 1;
|
HAVING count(*) > 1;
|
||||||
|
|
||||||
SELECT '<table cellspacing="10">
|
SELECT JSON_ARRAYAGG(
|
||||||
<tr>
|
JSON_OBJECT(
|
||||||
<th>C.Postal</th>
|
'zoneFk', zoneFk,
|
||||||
<th>Número de zona</th>
|
'zn', JSON_OBJECT('name', zn.name),
|
||||||
<th>Precio</th>
|
'z', JSON_OBJECT('name', z.name,'price', z.price),
|
||||||
<th>Zona</th>
|
'w', JSON_OBJECT('name', w.name)
|
||||||
<th>Almacén</th>
|
)
|
||||||
<th>Salix</th>
|
) FROM tmp.zoneNodes zn
|
||||||
</tr>' INTO vTableCollisions;
|
|
||||||
|
|
||||||
INSERT INTO mail (receiver,replyTo,subject,body)
|
|
||||||
SELECT 'pepe@verdnatura.es' receiver,
|
|
||||||
'noreply@verdnatura.es' replyTo,
|
|
||||||
CONCAT('Colisiones en zonas ', util.VN_CURDATE()) subject,
|
|
||||||
CONCAT(vTableCollisions,
|
|
||||||
GROUP_CONCAT(sub.td SEPARATOR ''),
|
|
||||||
'</table>') body
|
|
||||||
FROM(SELECT
|
|
||||||
CONCAT('<tr>
|
|
||||||
<td>', zn.name, '</td>
|
|
||||||
<td>', zoneFk,'</td>
|
|
||||||
<td>', z.price,'</td>
|
|
||||||
<td>', z.name,'</td>
|
|
||||||
<td>', w.name, '</td>
|
|
||||||
<td>', CONCAT('<a href="https://salix.verdnatura.es/#!/zone/',
|
|
||||||
zoneFk,
|
|
||||||
'/location?q=%7B%22search%22:%22',
|
|
||||||
zn.name,
|
|
||||||
'%22%7D">'
|
|
||||||
'https://salix.verdnatura.es/#!/zone/',
|
|
||||||
zoneFk,
|
|
||||||
'/location?q=%7B%22search%22:%22',
|
|
||||||
zn.name,
|
|
||||||
'%22%7D</a>'),'</td>
|
|
||||||
</tr>') td
|
|
||||||
FROM tmp.zoneNodes zn
|
|
||||||
JOIN zone z ON z.id = zn.zoneFk
|
JOIN zone z ON z.id = zn.zoneFk
|
||||||
JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk
|
JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk
|
||||||
JOIN warehouse w ON w.id = gc.warehouseFk) sub;
|
JOIN warehouse w ON w.id = gc.warehouseFk
|
||||||
|
INTO json_data;
|
||||||
|
|
||||||
|
SELECT util.notification_send(
|
||||||
|
'zone-included',
|
||||||
|
JSON_OBJECT('zoneCollisions',json_data),
|
||||||
|
account.myUser_getId()
|
||||||
|
);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
geoCollision,
|
geoCollision,
|
||||||
tmp.zone,
|
tmp.zone,
|
||||||
tmp.zoneNodes;
|
tmp.zoneNodes;
|
||||||
END$$
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue