2019-10-29 11:29:38 +00:00
|
|
|
USE `vn`;
|
|
|
|
DROP procedure IF EXISTS `zone_getLanded`;
|
|
|
|
|
|
|
|
DELIMITER $$
|
|
|
|
USE `vn`$$
|
|
|
|
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Devuelve una tabla temporal con el dia de recepcion para vShipped.
|
|
|
|
*
|
|
|
|
* @param vShipped Fecha de preparacion de mercancia
|
|
|
|
* @param vAddressFk Id de consignatario, %NULL para recogida
|
|
|
|
* @param vAgencyModeFk Id agencia
|
|
|
|
* @param vWarehouseFk vWarehouseFk
|
2019-10-31 11:54:16 +00:00
|
|
|
* @table tmp.zoneGetLanded Datos de recepción
|
2019-10-29 11:29:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
CALL zone_getFromGeo(address_getGeo(vAddressFk));
|
2019-10-31 11:54:16 +00:00
|
|
|
CALL zone_getOptionsForLanding(vShipped);
|
2019-10-29 11:29:38 +00:00
|
|
|
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
|
|
CREATE TEMPORARY TABLE tmp.zoneGetLanded
|
|
|
|
ENGINE = MEMORY
|
2019-10-31 11:54:16 +00:00
|
|
|
SELECT vWarehouseFk warehouseFk,
|
|
|
|
TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed,
|
2019-11-07 10:12:05 +00:00
|
|
|
zo.zoneFk
|
2019-10-29 11:29:38 +00:00
|
|
|
FROM tmp.zoneOption zo
|
|
|
|
JOIN zone z ON z.id = zo.zoneFk
|
2019-11-07 10:12:05 +00:00
|
|
|
JOIN zoneWarehouse zw ON zw.zoneFk = z.id
|
|
|
|
WHERE agencyModeFk = vAgencyModeFk
|
|
|
|
AND warehouseFk = vWarehouseFk;
|
2019-10-29 11:29:38 +00:00
|
|
|
|
|
|
|
DROP TEMPORARY TABLE
|
|
|
|
tmp.zone,
|
|
|
|
tmp.zoneOption;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
|
2019-11-07 10:12:05 +00:00
|
|
|
DELIMITER ;
|
|
|
|
|