From fda2c5725a6f4fc6e9dcda5760272d0bfc17ceb4 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 16 Dec 2024 12:23:02 +0100 Subject: [PATCH] refactor: refs #8262 Deprecated inventoryFailure --- .../vn/procedures/inventoryFailureAdd.sql | 48 ------------------- .../vn/procedures/item_cleanFloramondo.sql | 4 -- .../11385-yellowOrchid/00-firstScript.sql | 5 ++ 3 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 db/routines/vn/procedures/inventoryFailureAdd.sql create mode 100644 db/versions/11385-yellowOrchid/00-firstScript.sql diff --git a/db/routines/vn/procedures/inventoryFailureAdd.sql b/db/routines/vn/procedures/inventoryFailureAdd.sql deleted file mode 100644 index e2b5fa4a0..000000000 --- a/db/routines/vn/procedures/inventoryFailureAdd.sql +++ /dev/null @@ -1,48 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`inventoryFailureAdd`() -BEGIN - -DECLARE done BOOL DEFAULT FALSE; -DECLARE vTicketFk INT; - -DECLARE rs CURSOR FOR - SELECT id FROM vn.ticket - WHERE shipped = util.yesterday() - AND clientFk = 400 - AND warehouseFk IN (1,44); - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN rs; - -FETCH rs INTO vTicketFk; - -WHILE NOT done DO - - INSERT INTO vn.inventoryFailure(dated, itemFk, quantity, value, warehouseFk, throwerFk) - SELECT t.shipped, - s.itemFk, - s.quantity, - b.buyingValue + b.freightValue + b.packageValue + b.comissionValue, - t.warehouseFk, - w.id - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN cache.last_buy lb ON lb.warehouse_id = t.warehouseFk AND item_id = s.itemFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.worker w ON w.code = LEFT(s.concept, 3) - WHERE t.id = vTicketFk - AND s.quantity > 0; - - FETCH rs INTO vTicketFk; - -END WHILE; - - -CLOSE rs; - - - - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/item_cleanFloramondo.sql b/db/routines/vn/procedures/item_cleanFloramondo.sql index 849cfe93d..21d8ebe3c 100644 --- a/db/routines/vn/procedures/item_cleanFloramondo.sql +++ b/db/routines/vn/procedures/item_cleanFloramondo.sql @@ -164,10 +164,6 @@ BEGIN SET itemFk = vItemNew WHERE itemFk = vItemOld; - UPDATE inventoryFailure - SET itemFk = vItemNew - WHERE itemFk = vItemOld; - UPDATE genericAllocation SET itemFk = vItemNew WHERE itemFk = vItemOld; diff --git a/db/versions/11385-yellowOrchid/00-firstScript.sql b/db/versions/11385-yellowOrchid/00-firstScript.sql new file mode 100644 index 000000000..287e9fcab --- /dev/null +++ b/db/versions/11385-yellowOrchid/00-firstScript.sql @@ -0,0 +1,5 @@ +RENAME TABLE vn.inventoryFailure TO vn.inventoryFailure__; +ALTER TABLE vn.inventoryFailure__ COMMENT='@deprecated 2024-12-16'; + +RENAME TABLE vn.inventoryFailureCause TO vn.inventoryFailureCause__; +ALTER TABLE vn.inventoryFailureCause__ COMMENT='@deprecated 2024-12-16';