From 06296e7bd5fff378be03592e7a2048e813cd0c0b Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 2 Oct 2024 13:39:10 +0200 Subject: [PATCH 1/3] feat: refs #8071 travel_weeklyClone --- db/routines/vn/procedures/travel_cloneWithEntries.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql index ee26aea32..0199c452f 100644 --- a/db/routines/vn/procedures/travel_cloneWithEntries.sql +++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql @@ -62,7 +62,7 @@ BEGIN END IF; CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); - CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); + CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); SELECT evaNotes INTO vEvaNotes FROM entry @@ -71,6 +71,8 @@ BEGIN UPDATE entry SET evaNotes = vEvaNotes WHERE id = vNewEntryFk; + + CALL vn.buy_recalcPricesByEntry(vNewEntryFk); END LOOP; SET @isModeInventory = FALSE; From 11e13fdb200838e29e815aa8d88c547cf49815b4 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 25 Oct 2024 06:40:06 +0200 Subject: [PATCH 2/3] feat: refs #7922 refs #792 scanOrder --- db/routines/vn/procedures/expedition_getFromRoute.sql | 4 +++- db/versions/11319-redEucalyptus/00-firstScript.sql | 3 +++ .../back/methods/expedition-state/addExpeditionState.js | 2 ++ modules/ticket/back/models/expedition-state.json | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/versions/11319-redEucalyptus/00-firstScript.sql diff --git a/db/routines/vn/procedures/expedition_getFromRoute.sql b/db/routines/vn/procedures/expedition_getFromRoute.sql index f95936413..8c2ab057d 100644 --- a/db/routines/vn/procedures/expedition_getFromRoute.sql +++ b/db/routines/vn/procedures/expedition_getFromRoute.sql @@ -16,7 +16,8 @@ BEGIN a.nickname, sub2.itemPackingTypeConcat, est.code, - es.isScanned + es2.isScanned, + es2.scanOrder FROM expedition e JOIN ticket t ON t.id = e.ticketFk JOIN ticketState ts ON ts.ticketFk = e.ticketFk @@ -38,6 +39,7 @@ BEGIN SELECT MAX(id) FROM expeditionState es WHERE expeditionFk = e.id) + LEFT JOIN expeditionState es2 ON es2.id = es.id WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE ORDER BY r.created, t.priority DESC; END$$ diff --git a/db/versions/11319-redEucalyptus/00-firstScript.sql b/db/versions/11319-redEucalyptus/00-firstScript.sql new file mode 100644 index 000000000..62bd64f4a --- /dev/null +++ b/db/versions/11319-redEucalyptus/00-firstScript.sql @@ -0,0 +1,3 @@ +USE vn; + +ALTER TABLE vn.expeditionState ADD scanOrder int(11) DEFAULT NULL NULL COMMENT 'Indica la posiciĆ³n al cargar la furgoneta'; diff --git a/modules/ticket/back/methods/expedition-state/addExpeditionState.js b/modules/ticket/back/methods/expedition-state/addExpeditionState.js index 80d74ee92..0ba402ff7 100644 --- a/modules/ticket/back/methods/expedition-state/addExpeditionState.js +++ b/modules/ticket/back/methods/expedition-state/addExpeditionState.js @@ -44,6 +44,7 @@ module.exports = Self => { const typeFk = expeditionStateType.id; expeditionId = expedition.expeditionFk; + expeditionPosition = expedition?.scanOrder ?? null; const isScannedExpedition = expedition.isScanned ?? false; await models.ExpeditionState.create({ @@ -51,6 +52,7 @@ module.exports = Self => { typeFk, userFk: userId, isScanned: isScannedExpedition, + scanOrder: expeditionPosition }, myOptions); } diff --git a/modules/ticket/back/models/expedition-state.json b/modules/ticket/back/models/expedition-state.json index 159a9275e..e96d2544c 100644 --- a/modules/ticket/back/models/expedition-state.json +++ b/modules/ticket/back/models/expedition-state.json @@ -26,6 +26,9 @@ }, "isScanned": { "type": "boolean" + }, + "scanOrder": { + "type": "number" } }, "relations": { From f05b6a46b090c0913eb248083b02ac723f92c8dd Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 28 Oct 2024 14:36:10 +0100 Subject: [PATCH 3/3] feat: refs #8071 quitar esquema --- db/routines/vn/procedures/travel_cloneWithEntries.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql index 0199c452f..5b2958edc 100644 --- a/db/routines/vn/procedures/travel_cloneWithEntries.sql +++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql @@ -72,7 +72,7 @@ BEGIN SET evaNotes = vEvaNotes WHERE id = vNewEntryFk; - CALL vn.buy_recalcPricesByEntry(vNewEntryFk); + CALL buy_recalcPricesByEntry(vNewEntryFk); END LOOP; SET @isModeInventory = FALSE;