From 9585af8e77a2d8566078fb171276be1f047ddd9a Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 23 May 2024 12:39:30 +0200 Subject: [PATCH 01/11] feat: refs #6822 create entryTransfer --- db/routines/vn/procedures/entryTransfer.sql | 113 ++++++++++++++++++++ db/routines/vn/procedures/entry_clone.sql | 9 +- 2 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 db/routines/vn/procedures/entryTransfer.sql diff --git a/db/routines/vn/procedures/entryTransfer.sql b/db/routines/vn/procedures/entryTransfer.sql new file mode 100644 index 000000000..b0d3c98e3 --- /dev/null +++ b/db/routines/vn/procedures/entryTransfer.sql @@ -0,0 +1,113 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entryTransfer`(vOriginalEntry INT) +BEGIN +/** +* If the bic length is Incorrect throw exception +* +* @param vBic bic code +*/ + + DECLARE vNewEntryFk INT; + DECLARE vTravelFk INT; + DECLARE vWarehouseFk INT; + + -- Clonar la entrada + CALL entry_clone(vOriginalEntry); + + SELECT id INTO vNewEntryFk + FROM entry + WHERE clonedFrom = vOriginalEntry + ORDER BY dated DESC + LIMIT 1; + + -- Hay que crear un nuevo travel, con salida hoy y llegada mañana y asignar la entrada nueva al nuevo travel. + INSERT INTO travel( + shipped, + landed, + warehouseInFk, + warehouseOutFk, + `ref`, + isReceived, + agencyModeFk) + SELECT util.VN_CURDATE(), + util.VN_CURDATE() + INTERVAL 1 DAY, + t.warehouseInFk, + t.warehouseOutFk, + t.`ref`, + t.isReceived, + t.agencyModeFk + FROM travel t + JOIN entry e ON e.travelFk = t.id + WHERE e.id = vOriginalEntry; + + SET vTravelFk = LAST_INSERT_ID(); + + UPDATE entry + SET travelFk = vTravelFk + WHERE id = vNewEntryFk; + + -- Poner a 0 las cantidades + UPDATE buy b + SET b.quantity = 0, b.stickers = 0 + WHERE b.entryFk = vNewEntryFk; + + -- Eliminar duplicados + DELETE b.* + FROM buy b + LEFT JOIN (SELECT b.id, b.itemFk + FROM buy b + WHERE b.entryFk = vNewEntryFk + GROUP BY b.itemFk) tBuy ON tBuy.id = b.id + WHERE b.entryFk = vNewEntryFk + AND tBuy.id IS NULL; + + SELECT t.warehouseInFk INTO vWarehouseFk + FROM travel t + JOIN entry e ON e.travelFk = t.id + WHERE e.id = vOriginalEntry; + + -- Actualizar la nueva entrada con lo que no está ubicado HOY, descontando lo vendido HOY de esas ubicaciones + UPDATE buy b + JOIN ( + SELECT tBuy.itemFk, IFNULL(iss.visible,0) visible, tBuy.totalQuantity, IFNULL(sales.sold,0) sold + FROM (SELECT b.itemFk, SUM(b.quantity) totalQuantity + FROM buy b + WHERE b.entryFk = vOriginalEntry + GROUP BY b.itemFk + ) tBuy + LEFT JOIN ( + SELECT ish.itemFk, SUM(visible) visible + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + JOIN sector s ON s.id = p.sectorFk + WHERE s.warehouseFk = vWarehouseFk + AND sh.parked = util.VN_CURDATE() + GROUP BY ish.itemFk) iss ON tBuy.itemFk = iss.itemFk + LEFT JOIN ( + SELECT s.itemFk, SUM(s.quantity) sold + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN itemShelvingSale iss ON iss.saleFk = s.id + JOIN itemShelving is2 ON is2.id = iss.itemShelvingFk + JOIN shelving s2 ON s2.code = is2.shelvingFk + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) + AND s2.parked = util.VN_CURDATE() + GROUP BY s.itemFk) sales ON sales.itemFk = tBuy.itemFk + WHERE visible = tBuy.totalQuantity + OR iss.itemFk IS NULL + ) sub ON sub.itemFk = b.itemFk + SET b.quantity = sub.totalQuantity - sub.visible - sub.sold + WHERE b.entryFk = vNewEntryFk; + + -- Limpia la nueva entrada + DELETE b.* + FROM buy b + WHERE b.entryFk = vNewEntryFk + AND b.quantity = 0; + + CALL cache.visible_refresh(@c,TRUE,7); + CALL cache.available_refresh(@c, TRUE, 7, util.VN_CURDATE()); + +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/entry_clone.sql b/db/routines/vn/procedures/entry_clone.sql index 4f38447c8..b970ac0ff 100644 --- a/db/routines/vn/procedures/entry_clone.sql +++ b/db/routines/vn/procedures/entry_clone.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(vSelf INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(IN vSelf INT, OUT vNewEntryFk INT) BEGIN /** * clones an entry. @@ -8,6 +8,12 @@ BEGIN */ DECLARE vNewEntryFk INT; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + START TRANSACTION; CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL); @@ -15,6 +21,5 @@ BEGIN COMMIT; - SELECT vNewEntryFk; END$$ DELIMITER ; -- 2.40.1 From bac07fe265c0393bbbe329bea42e63b6ae5d270f Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 23 May 2024 12:41:59 +0200 Subject: [PATCH 02/11] feat: refs #6822 --- db/routines/vn/procedures/entryTransfer.sql | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/db/routines/vn/procedures/entryTransfer.sql b/db/routines/vn/procedures/entryTransfer.sql index b0d3c98e3..64c9b7680 100644 --- a/db/routines/vn/procedures/entryTransfer.sql +++ b/db/routines/vn/procedures/entryTransfer.sql @@ -12,13 +12,7 @@ BEGIN DECLARE vWarehouseFk INT; -- Clonar la entrada - CALL entry_clone(vOriginalEntry); - - SELECT id INTO vNewEntryFk - FROM entry - WHERE clonedFrom = vOriginalEntry - ORDER BY dated DESC - LIMIT 1; + CALL entry_clone(vOriginalEntry,vNewEntryFk); -- Hay que crear un nuevo travel, con salida hoy y llegada mañana y asignar la entrada nueva al nuevo travel. INSERT INTO travel( -- 2.40.1 From 04f6059d6f67978947f7f385bded3c2c90640839 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 3 Jul 2024 12:03:28 +0200 Subject: [PATCH 03/11] feat: refs #6822 --- modules/entry/back/methods/entry/transfer.js | 38 ++++++++++++++++++++ modules/entry/back/models/entry.js | 1 + 2 files changed, 39 insertions(+) create mode 100644 modules/entry/back/methods/entry/transfer.js diff --git a/modules/entry/back/methods/entry/transfer.js b/modules/entry/back/methods/entry/transfer.js new file mode 100644 index 000000000..977832694 --- /dev/null +++ b/modules/entry/back/methods/entry/transfer.js @@ -0,0 +1,38 @@ +module.exports = Self => { + Self.remoteMethodCtx('transfer', { + description: 'Trasladar la mercancia de una entrada al dia siguiente', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + http: {source: 'path'} + } + ], + http: { + path: '/:id/transfer', + verb: 'POST' + } + }); + + Self.transfer = async(ctx, id, options) => { + const myOptions = {userId: ctx.req.accessToken.userId}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + await Self.rawSql('CALL vn.entryTransfer(?)', [id], myOptions); + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 6e27e1ece..5f47d718e 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -10,6 +10,7 @@ module.exports = Self => { require('../methods/entry/addFromPackaging')(Self); require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); + require('../methods/entry/transfer')(Self); Self.observe('before save', async function(ctx, options) { if (ctx.isNewInstance) return; -- 2.40.1 From a34376f4d2bf998042920dadc33d3d09711d1452 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 10 Jul 2024 07:31:49 +0200 Subject: [PATCH 04/11] feat: refs #6822 --- .../vn/procedures/{entryTransfer.sql => entry_transfer.sql} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename db/routines/vn/procedures/{entryTransfer.sql => entry_transfer.sql} (98%) diff --git a/db/routines/vn/procedures/entryTransfer.sql b/db/routines/vn/procedures/entry_transfer.sql similarity index 98% rename from db/routines/vn/procedures/entryTransfer.sql rename to db/routines/vn/procedures/entry_transfer.sql index 64c9b7680..c0f111c34 100644 --- a/db/routines/vn/procedures/entryTransfer.sql +++ b/db/routines/vn/procedures/entry_transfer.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entryTransfer`(vOriginalEntry INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT) BEGIN /** * If the bic length is Incorrect throw exception -- 2.40.1 From 5a7d5787f725e15fd86d0e737ab50aed37d1733d Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 11 Jul 2024 07:38:13 +0200 Subject: [PATCH 05/11] feat: refs #6822 clonar travel con warehouseInFk --- db/routines/vn/procedures/entry_transfer.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/entry_transfer.sql b/db/routines/vn/procedures/entry_transfer.sql index c0f111c34..aedfdb7d6 100644 --- a/db/routines/vn/procedures/entry_transfer.sql +++ b/db/routines/vn/procedures/entry_transfer.sql @@ -2,9 +2,9 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT) BEGIN /** -* If the bic length is Incorrect throw exception +* Adelanta a mañana la mercancia de una entrada a partir de lo que hay ubicado en el almacén * -* @param vBic bic code +* @param vOriginalEntry entrada que se quiera adelantar */ DECLARE vNewEntryFk INT; @@ -14,7 +14,7 @@ BEGIN -- Clonar la entrada CALL entry_clone(vOriginalEntry,vNewEntryFk); - -- Hay que crear un nuevo travel, con salida hoy y llegada mañana y asignar la entrada nueva al nuevo travel. + -- Hay que crear un nuevo travel, con salida hoy y llegada mañana y asignar la entrada nueva al nuevo travel. INSERT INTO travel( shipped, landed, @@ -26,7 +26,7 @@ BEGIN SELECT util.VN_CURDATE(), util.VN_CURDATE() + INTERVAL 1 DAY, t.warehouseInFk, - t.warehouseOutFk, + t.warehouseInFk, t.`ref`, t.isReceived, t.agencyModeFk -- 2.40.1 From d60a1a3424a19c0ead18976bf53a74d24bb3109b Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 11 Jul 2024 09:39:06 +0200 Subject: [PATCH 06/11] feat: refs #6822 entry_clone --- db/routines/vn/procedures/entry_clone.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/entry_clone.sql b/db/routines/vn/procedures/entry_clone.sql index b970ac0ff..679af5f47 100644 --- a/db/routines/vn/procedures/entry_clone.sql +++ b/db/routines/vn/procedures/entry_clone.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(IN vSelf INT, OUT vNewEntryFk INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(IN vSelf INT, OUT newEntryFk INT) BEGIN /** * clones an entry. @@ -20,6 +20,7 @@ BEGIN CALL entry_copyBuys(vSelf, vNewEntryFk); COMMIT; + SET newEntryFk = vNewEntryFk; END$$ DELIMITER ; -- 2.40.1 From 109770b0a37059b9a53bf626b5adf230ea29cf42 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 17 Jul 2024 10:28:22 +0200 Subject: [PATCH 07/11] feat: refs #6822 return newEntry --- db/routines/vn/procedures/entry_transfer.sql | 14 +++++++++++++- modules/entry/back/methods/entry/transfer.js | 9 ++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/entry_transfer.sql b/db/routines/vn/procedures/entry_transfer.sql index aedfdb7d6..64cafe043 100644 --- a/db/routines/vn/procedures/entry_transfer.sql +++ b/db/routines/vn/procedures/entry_transfer.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT, OUT vNewEntry INT) BEGIN /** * Adelanta a mañana la mercancia de una entrada a partir de lo que hay ubicado en el almacén @@ -11,6 +11,16 @@ BEGIN DECLARE vTravelFk INT; DECLARE vWarehouseFk INT; + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; -- Clonar la entrada CALL entry_clone(vOriginalEntry,vNewEntryFk); @@ -100,6 +110,8 @@ BEGIN WHERE b.entryFk = vNewEntryFk AND b.quantity = 0; + SET vNewEntry = vNewEntryFk; + COMMIT; CALL cache.visible_refresh(@c,TRUE,7); CALL cache.available_refresh(@c, TRUE, 7, util.VN_CURDATE()); diff --git a/modules/entry/back/methods/entry/transfer.js b/modules/entry/back/methods/entry/transfer.js index 977832694..53ae4b48c 100644 --- a/modules/entry/back/methods/entry/transfer.js +++ b/modules/entry/back/methods/entry/transfer.js @@ -12,6 +12,10 @@ module.exports = Self => { http: { path: '/:id/transfer', verb: 'POST' + }, + returns: { + arg: 'newEntryFk', + type: 'number' } }); @@ -28,8 +32,11 @@ module.exports = Self => { } try { - await Self.rawSql('CALL vn.entryTransfer(?)', [id], myOptions); + await Self.rawSql('CALL vn.entry_transfer(?, @vNewEntry)', [id], myOptions); + const newEntryFk = await Self.rawSql('SELECT @vNewEntry AS newEntryFk', [], myOptions); + if (tx) await tx.commit(); + return newEntryFk; } catch (e) { if (tx) await tx.rollback(); throw e; -- 2.40.1 From 2cb8d07aef43e1021a86e8ebdfbb316ec47116ab Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 17 Jul 2024 10:30:23 +0200 Subject: [PATCH 08/11] feat: refs #6822 --- db/routines/vn/procedures/entry_transfer.sql | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/procedures/entry_transfer.sql b/db/routines/vn/procedures/entry_transfer.sql index 64cafe043..efe630e36 100644 --- a/db/routines/vn/procedures/entry_transfer.sql +++ b/db/routines/vn/procedures/entry_transfer.sql @@ -11,9 +11,6 @@ BEGIN DECLARE vTravelFk INT; DECLARE vWarehouseFk INT; - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; @@ -111,9 +108,9 @@ BEGIN AND b.quantity = 0; SET vNewEntry = vNewEntryFk; - COMMIT; + CALL cache.visible_refresh(@c,TRUE,7); CALL cache.available_refresh(@c, TRUE, 7, util.VN_CURDATE()); - + COMMIT; END$$ DELIMITER ; -- 2.40.1 From 5f63017853f5838ca570ac95dd9f9553d2533f26 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 6 Aug 2024 07:20:30 +0200 Subject: [PATCH 09/11] feat: refs #6822 changes transaction --- .../bs/procedures/ventas_contables_add.sql | 2 +- .../vn/procedures/entry_splitByShelving.sql | 4 +- db/routines/vn/procedures/entry_transfer.sql | 67 ++++++++++--------- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index 72b0c0fee..c82cb96d9 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -15,7 +15,7 @@ BEGIN DELETE FROM bs.ventas_contables WHERE year = vYear - AND month = vMonth; + AND month = vMonth; DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list diff --git a/db/routines/vn/procedures/entry_splitByShelving.sql b/db/routines/vn/procedures/entry_splitByShelving.sql index f46278e5a..a8df482fa 100644 --- a/db/routines/vn/procedures/entry_splitByShelving.sql +++ b/db/routines/vn/procedures/entry_splitByShelving.sql @@ -34,14 +34,14 @@ BEGIN read_loop: LOOP SET vDone = FALSE; - + FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers; IF vDone THEN LEAVE read_loop; END IF; - IF vIshStickers = vBuyStickers THEN + IF vIshStickers = vBuyStickers THEN UPDATE buy SET entryFk = vToEntryFk WHERE id = vBuyFk; diff --git a/db/routines/vn/procedures/entry_transfer.sql b/db/routines/vn/procedures/entry_transfer.sql index efe630e36..6d7da2b37 100644 --- a/db/routines/vn/procedures/entry_transfer.sql +++ b/db/routines/vn/procedures/entry_transfer.sql @@ -17,10 +17,11 @@ BEGIN RESIGNAL; END; - START TRANSACTION; -- Clonar la entrada CALL entry_clone(vOriginalEntry,vNewEntryFk); + START TRANSACTION; + -- Hay que crear un nuevo travel, con salida hoy y llegada mañana y asignar la entrada nueva al nuevo travel. INSERT INTO travel( shipped, @@ -68,36 +69,38 @@ BEGIN WHERE e.id = vOriginalEntry; -- Actualizar la nueva entrada con lo que no está ubicado HOY, descontando lo vendido HOY de esas ubicaciones + CREATE OR REPLACE TEMPORARY TABLE tBuy + ENGINE = MEMORY + SELECT tBuy.itemFk, IFNULL(iss.visible,0) visible, tBuy.totalQuantity, IFNULL(sales.sold,0) sold + FROM (SELECT b.itemFk, SUM(b.quantity) totalQuantity + FROM buy b + WHERE b.entryFk = vOriginalEntry + GROUP BY b.itemFk + ) tBuy + LEFT JOIN ( + SELECT ish.itemFk, SUM(visible) visible + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + JOIN sector s ON s.id = p.sectorFk + WHERE s.warehouseFk = vWarehouseFk + AND sh.parked = util.VN_CURDATE() + GROUP BY ish.itemFk) iss ON tBuy.itemFk = iss.itemFk + LEFT JOIN ( + SELECT s.itemFk, SUM(s.quantity) sold + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN itemShelvingSale iss ON iss.saleFk = s.id + JOIN itemShelving is2 ON is2.id = iss.itemShelvingFk + JOIN shelving s2 ON s2.code = is2.shelvingFk + WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) + AND s2.parked = util.VN_CURDATE() + GROUP BY s.itemFk) sales ON sales.itemFk = tBuy.itemFk + WHERE visible = tBuy.totalQuantity + OR iss.itemFk IS NULL; + UPDATE buy b - JOIN ( - SELECT tBuy.itemFk, IFNULL(iss.visible,0) visible, tBuy.totalQuantity, IFNULL(sales.sold,0) sold - FROM (SELECT b.itemFk, SUM(b.quantity) totalQuantity - FROM buy b - WHERE b.entryFk = vOriginalEntry - GROUP BY b.itemFk - ) tBuy - LEFT JOIN ( - SELECT ish.itemFk, SUM(visible) visible - FROM itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - JOIN sector s ON s.id = p.sectorFk - WHERE s.warehouseFk = vWarehouseFk - AND sh.parked = util.VN_CURDATE() - GROUP BY ish.itemFk) iss ON tBuy.itemFk = iss.itemFk - LEFT JOIN ( - SELECT s.itemFk, SUM(s.quantity) sold - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN itemShelvingSale iss ON iss.saleFk = s.id - JOIN itemShelving is2 ON is2.id = iss.itemShelvingFk - JOIN shelving s2 ON s2.code = is2.shelvingFk - WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - AND s2.parked = util.VN_CURDATE() - GROUP BY s.itemFk) sales ON sales.itemFk = tBuy.itemFk - WHERE visible = tBuy.totalQuantity - OR iss.itemFk IS NULL - ) sub ON sub.itemFk = b.itemFk + JOIN (SELECT * FROM tBuy) sub ON sub.itemFk = b.itemFk SET b.quantity = sub.totalQuantity - sub.visible - sub.sold WHERE b.entryFk = vNewEntryFk; @@ -107,10 +110,12 @@ BEGIN WHERE b.entryFk = vNewEntryFk AND b.quantity = 0; + COMMIT; + SET vNewEntry = vNewEntryFk; CALL cache.visible_refresh(@c,TRUE,7); CALL cache.available_refresh(@c, TRUE, 7, util.VN_CURDATE()); - COMMIT; + END$$ DELIMITER ; -- 2.40.1 From e99920196918815c4b7c32da2a47dea48c5f764b Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 11 Sep 2024 09:59:01 +0200 Subject: [PATCH 10/11] feat: refs #6822 entry_clone --- db/routines/vn/procedures/entry_clone.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/entry_clone.sql b/db/routines/vn/procedures/entry_clone.sql index 1f436e230..122d521cb 100644 --- a/db/routines/vn/procedures/entry_clone.sql +++ b/db/routines/vn/procedures/entry_clone.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_clone`(vSelf INT) +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_clone`(vSelf INT, OUT newEntryFk INT) BEGIN /** * clones an entry. -- 2.40.1 From 9a01ae5ccc5f1e07ab36a31dc2f3bf6377cf9d4a Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 23 Oct 2024 12:32:48 +0200 Subject: [PATCH 11/11] feat: refs #6822 tabulaciones --- db/routines/vn/procedures/entry_transfer.sql | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/db/routines/vn/procedures/entry_transfer.sql b/db/routines/vn/procedures/entry_transfer.sql index 6d7da2b37..9fbf561b2 100644 --- a/db/routines/vn/procedures/entry_transfer.sql +++ b/db/routines/vn/procedures/entry_transfer.sql @@ -2,11 +2,10 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(vOriginalEntry INT, OUT vNewEntry INT) BEGIN /** -* Adelanta a mañana la mercancia de una entrada a partir de lo que hay ubicado en el almacén -* -* @param vOriginalEntry entrada que se quiera adelantar -*/ - + * Adelanta a mañana la mercancia de una entrada a partir de lo que hay ubicado en el almacén + * + * @param vOriginalEntry entrada que se quiera adelantar + */ DECLARE vNewEntryFk INT; DECLARE vTravelFk INT; DECLARE vWarehouseFk INT; @@ -40,7 +39,7 @@ BEGIN t.agencyModeFk FROM travel t JOIN entry e ON e.travelFk = t.id - WHERE e.id = vOriginalEntry; + WHERE e.id = vOriginalEntry; SET vTravelFk = LAST_INSERT_ID(); @@ -116,6 +115,5 @@ BEGIN CALL cache.visible_refresh(@c,TRUE,7); CALL cache.available_refresh(@c, TRUE, 7, util.VN_CURDATE()); - END$$ DELIMITER ; -- 2.40.1