From d53a053ccb9aed3e50f916a63daf77c1b9f39419 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 20 Mar 2024 13:07:02 +0100 Subject: [PATCH] refactor: refs #6923 Deteted procs --- .../vn2008/procedures/add_awb_component.sql | 61 ------------------- .../vn2008/procedures/agencyModeImbalance.sql | 50 --------------- 2 files changed, 111 deletions(-) delete mode 100644 db/routines/vn2008/procedures/add_awb_component.sql delete mode 100644 db/routines/vn2008/procedures/agencyModeImbalance.sql diff --git a/db/routines/vn2008/procedures/add_awb_component.sql b/db/routines/vn2008/procedures/add_awb_component.sql deleted file mode 100644 index e75290b4b..000000000 --- a/db/routines/vn2008/procedures/add_awb_component.sql +++ /dev/null @@ -1,61 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`add_awb_component`(IN vAwbFk SMALLINT) -BEGIN - - DECLARE vShipped DATE; - DECLARE vHasStems BOOLEAN; - - SELECT t.shipped, IF(a.stems, TRUE, FALSE) - INTO vShipped, vHasStems - FROM vn.travel t - JOIN vn.awb a ON a.id = t.awbFk - WHERE awbFk = vAwbFk - LIMIT 1; - - INSERT IGNORE INTO awb_component (awb_id,Id_Proveedor,awb_component_type_id,awb_role_id,awb_unit_id,value,Id_Moneda) - SELECT id, Id_Proveedor, awb_component_type_id, awb_role_id,awb_unit_id, LEAST(GREATEST(value1, IFNULL(min_value, value1)), IFNULL(max_value, value1)), Id_Moneda - FROM ( - SELECT a.id, - IFNULL(act.carguera_id, - CASE awb_role_id - WHEN 1 THEN a.carguera_id - WHEN 2 THEN a.transitario_id - WHEN 3 THEN f.airline_id - END - ) Id_Proveedor, - act.awb_component_type_id, - act.awb_role_id, - act.awb_unit_id, - value * - CASE awb_unit_id - WHEN '1000Tj-20' THEN ((CAST(stems AS SIGNED) - 20000)/1000) + (min_value / value) - WHEN '1000Tj-10' THEN ((CAST(stems AS SIGNED) - 10000)/1000) + (min_value / value) - WHEN '100GW' THEN peso/100 - WHEN 'AWB' THEN 1 -- No action - WHEN 'FB' THEN hb/2 - WHEN 'GW' THEN peso - WHEN 'TW' THEN GREATEST(peso,volume_weight) - WHEN 'PN' THEN LEAST(90, value + a.propertyNumber * 10) - END value1, - value, - act.Id_Moneda, - act.min_value, - act.max_value - FROM awb a - JOIN flight f ON f.flight_id = a.flight_id - LEFT JOIN awb_component_template act ON - ((IFNULL(act.carguera_id, a.carguera_id) = a.carguera_id AND awb_role_id = 1) - OR (IFNULL(act.carguera_id, a.transitario_id) = a.transitario_id AND awb_role_id = 2) - OR (IFNULL(act.airline_id, f.airline_id) = f.airline_id AND awb_role_id = 3) - OR (awb_role_id = 4)) - AND IFNULL(act.airport_out, f.airport_out) = f.airport_out - AND IFNULL(act.airport_in, f.airport_in) = f.airport_in - AND IFNULL(act.airline_id, f.airline_id) = f.airline_id - AND INSTR(IFNULL(act.days, WEEKDAY(vShipped) + 1),WEEKDAY(vShipped) + 1) - JOIN awb_component_type acty ON acty.awb_component_type_id = act.awb_component_type_id - WHERE a.id = vAwbFk AND Fecha <= vShipped - AND (vHasStems = TRUE OR acty.hasStems) - ORDER BY Fecha DESC, act.days DESC LIMIT 10000000000000000000 - ) t; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/agencyModeImbalance.sql b/db/routines/vn2008/procedures/agencyModeImbalance.sql deleted file mode 100644 index 89706f0d2..000000000 --- a/db/routines/vn2008/procedures/agencyModeImbalance.sql +++ /dev/null @@ -1,50 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`agencyModeImbalance`(vStarted DATE, vEnded DATE) -BEGIN -/** - * Devuelve el valor de los precios teorico, practico de las agencias - * y si ademas es de mrw lo compara con su fichero previamente procesado - * - * @param vEktFk Identificador de edi.ekt - */ - DECLARE vEndedDayEnd DATETIME; - - SET vEndedDayEnd = util.dayEnd(vEnded); - - SELECT t.id ticketFk,t.addressFk, - CAST(v.amount AS DECIMAL (10,2)) AS VN, - CAST(v.amount - e.shipping_charge AS DECIMAL (10,2)) AS Difer, - CAST(mrwPrice AS DECIMAL (10,2)) mrwPrice, - CAST(e.shipping_charge - mrwPrice AS DECIMAL (10,2)) mrwDifference, - CAST(e.shipping_charge AS DECIMAL (10,2)) AS teorico, - CAST(e.extraCharge AS DECIMAL (10,2)) AS extraCharge, - t.packages, t.clientFk, - t.zoneFk, a.provinceFk, mrwCount - FROM vn.ticket t - LEFT JOIN - (SELECT ticketFk, SUM(amount) amount, fc.shipped - FROM vn.sale_freightComponent fc - JOIN vn.ticket t ON t.id = fc.ticketFk - JOIN tmp.agencyMode am ON am.agencyModeFk = t.agencyModeFk - WHERE fc.shipped BETWEEN vStarted AND vEndedDayEnd - GROUP BY ticketFk) v ON t.id = v.ticketFk - LEFT JOIN (SELECT t.id, - SUM(t.zonePrice) shipping_charge, - SUM(IFNULL(aex.price,0)) extraCharge - FROM vn.ticket t - LEFT JOIN vn.expedition e ON e.ticketFk = t.id - LEFT JOIN vn.packaging p ON p.id = e.packagingFk - JOIN tmp.agencyMode amc ON amc.agencyModeFk = t.agencyModeFk - JOIN vn.agencyMode am ON am.id = amc.agencyModeFk - LEFT JOIN vn.agencyExtraCharge aex ON p.width+p.depth+p.height BETWEEN aex.sizeMin AND aex.sizeMax AND aex.agencyFk = am.agencyFk - WHERE t.shipped BETWEEN vStarted AND vEndedDayEnd - GROUP BY t.id - ) e ON t.id = e.id - LEFT JOIN (SELECT ticketFk, SUM(price) mrwPrice, COUNT(*) mrwCount - FROM vn.mrw - GROUP BY ticketFk) mrw ON mrw.ticketFk = t.id - JOIN vn.address a ON a.id = t.addressFk - JOIN tmp.agencyMode am ON am.agencyModeFk = t.agencyModeFk - WHERE t.shipped BETWEEN vStarted AND vEndedDayEnd; -END$$ -DELIMITER ; -- 2.40.1