update structure
This commit is contained in:
parent
fb81c473c1
commit
eb159453cf
|
@ -0,0 +1,20 @@
|
|||
USE `vn`;
|
||||
DROP function IF EXISTS `orderTotalVolume`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` FUNCTION `orderTotalVolume`(vOrderId INT) RETURNS decimal(10,3)
|
||||
BEGIN
|
||||
-- Devuelte el volumen total de la orden sumada
|
||||
DECLARE vWarehouseId INTEGER;
|
||||
DECLARE vVolume DECIMAL(10,3);
|
||||
|
||||
SELECT IFNULL(SUM(o.amount * r.cm3)/1000000,0) INTO vVolume
|
||||
FROM hedera.orderRow o
|
||||
JOIN bi.rotacion r on r.Id_Article = o.itemFk AND r.warehouse_id = o.warehouseFk
|
||||
WHERE o.orderFk = vOrderId;
|
||||
|
||||
RETURN vVolume;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
|
@ -0,0 +1,27 @@
|
|||
USE `vn`;
|
||||
DROP function IF EXISTS `orderTotalVolumeBoxes`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` FUNCTION `orderTotalVolumeBoxes`(vOrderId INT) RETURNS decimal(10,3)
|
||||
BEGIN
|
||||
|
||||
/*
|
||||
* Devuelve el volumen estimado del ticket sumado, en cajas
|
||||
*
|
||||
* idT Numero de ticket
|
||||
*
|
||||
*/
|
||||
DECLARE vVolumeBoxM3 DOUBLE;
|
||||
DECLARE vOrderTotalVolumeBoxes DECIMAL(10,1);
|
||||
DECLARE vVnBoxId VARCHAR(10) DEFAULT '94';
|
||||
|
||||
SELECT volume / 1000000 INTO vVolumeBoxM3 FROM packaging WHERE id = vVnBoxId;
|
||||
|
||||
SET vOrderTotalVolumeBoxes = orderTotalVolume(vOrderId) / vVolumeBoxM3;
|
||||
|
||||
RETURN vOrderTotalVolumeBoxes;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue