feat: refs #7531 Added address_hasDelivery
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
d95482ea54
commit
c2ca9cfbe5
|
@ -0,0 +1,24 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`address_hasDelivery`(vSelf INT, vLanded DATE)
|
||||||
|
RETURNS BOOL
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Retorna si hay reparto disponible para
|
||||||
|
* la dirección y fecha solicitada.
|
||||||
|
*
|
||||||
|
* @param vSelf Id de dirección de envío
|
||||||
|
* @param vLanded Fecha de entrega
|
||||||
|
* @return true|false
|
||||||
|
*/
|
||||||
|
DECLARE vHasDelivery BOOL;
|
||||||
|
|
||||||
|
CALL zone_getAgency(vSelf, vLanded);
|
||||||
|
|
||||||
|
SELECT EXISTS (SELECT TRUE FROM tmp.zoneGetAgency) INTO vHasDelivery;
|
||||||
|
|
||||||
|
RETURN vHasDelivery;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.zoneGetAgency;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -21,6 +21,7 @@ BEGIN
|
||||||
SELECT clientFk
|
SELECT clientFk
|
||||||
FROM vn.ticket
|
FROM vn.ticket
|
||||||
WHERE shipped BETWEEN vShipped AND util.dayEnd(vShipped)
|
WHERE shipped BETWEEN vShipped AND util.dayEnd(vShipped)
|
||||||
|
AND NOT isDeleted
|
||||||
)
|
)
|
||||||
SELECT c.id,
|
SELECT c.id,
|
||||||
c.name,
|
c.name,
|
||||||
|
@ -50,7 +51,8 @@ BEGIN
|
||||||
AND c.isActive
|
AND c.isActive
|
||||||
AND ct.code = 'normal'
|
AND ct.code = 'normal'
|
||||||
AND bt.code <> 'worker'
|
AND bt.code <> 'worker'
|
||||||
AND (d.id = vDepartmentFk OR NOT vDepartmentFk)
|
AND (d.id = vDepartmentFk OR vDepartmentFk IS NULL)
|
||||||
|
AND vn.address_hasDelivery(c.defaultAddressFk, vShipped)
|
||||||
GROUP BY c.id;
|
GROUP BY c.id;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneNodes;
|
DROP TEMPORARY TABLE tmp.zoneNodes;
|
||||||
|
|
Loading…
Reference in New Issue