2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`travelVolume`(vTravelFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT w1.name AS ORI,
|
|
|
|
w2.name AS DES,
|
|
|
|
tr.shipped shipment,
|
|
|
|
tr.landed landing,
|
|
|
|
a.name Agencia,
|
|
|
|
s.name Proveedor,
|
|
|
|
e.id Id_Entrada,
|
|
|
|
e.invoiceNumber Referencia,
|
|
|
|
CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) *
|
|
|
|
vn.item_getVolume(b.itemFk ,b.packagingFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) AS CC,
|
|
|
|
CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) *
|
|
|
|
vn.item_getVolume(b.itemFk ,b.packagingFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) AS espais
|
|
|
|
FROM vn.buy b
|
|
|
|
JOIN vn.entry e ON e.id = b.entryFk
|
|
|
|
JOIN vn.supplier s ON s.id = e.supplierFk
|
|
|
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
|
|
|
JOIN vn.agencyMode a ON a.id = tr.agencyModeFk
|
|
|
|
JOIN vn.warehouse w1 ON w1.id = tr.warehouseInFk
|
|
|
|
JOIN vn.warehouse w2 ON w2.id = tr.warehouseOutFk
|
|
|
|
JOIN vn.volumeConfig vc
|
|
|
|
JOIN vn.item i ON i.id = b.itemFk
|
|
|
|
JOIN vn.itemType it ON it.id = i.typeFk
|
|
|
|
WHERE tr.id = vTravelFk;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|