From c1c01df3c3f05f5402335143e752d93809b1d595 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 20 Jun 2024 09:37:22 +0200 Subject: [PATCH 1/5] feat itemShelving_filterBuyer refs #7023 --- db/routines/vn/procedures/itemShelving_filterBuyer.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql index 7112aa48e..894a14464 100644 --- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql +++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql @@ -15,7 +15,7 @@ proc:BEGIN SELECT * FROM (SELECT sub.itemFk, sub.longName, - CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT('Hoy quedan por sacar ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, sub.upstairs, sub.downstairs, @@ -52,7 +52,7 @@ proc:BEGIN UNION ALL SELECT v.item_id, i.longName, - CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT('Hoy quedan por sacar ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, 0, 0, From 3fa7eb1d2aa03ca39289bb9836f5b997c0de0ca5 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 21 Jun 2024 13:01:19 +0200 Subject: [PATCH 2/5] feat itemShelving_filterBuyer refs #7023 --- db/routines/vn/procedures/itemShelving_filterBuyer.sql | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql index 894a14464..2fdf21ee1 100644 --- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql +++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql @@ -15,13 +15,14 @@ proc:BEGIN SELECT * FROM (SELECT sub.itemFk, sub.longName, - CONCAT('Hoy quedan por sacar ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, sub.upstairs, sub.downstairs, sub.visible, CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho, - sub.name itemColour + sub.name itemColour, + CAST(sub2.pendiente AS DECIMAL(10,0)) pendingAmount FROM (SELECT iss.itemFk, CONCAT(i.longName, ' ', IFNULL(i.size, ''),' ', IFNULL(i.subName, '') ) longName, '' size, @@ -52,13 +53,14 @@ proc:BEGIN UNION ALL SELECT v.item_id, i.longName, - CONCAT('Hoy quedan por sacar ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, 0, 0, v.visible, v.visible nicho, - ik.name itemColour + ik.name itemColour, + CAST(sub5.pendiente AS DECIMAL(10,0) pendingAmount FROM cache.visible v JOIN item i ON i.id = v.item_id LEFT JOIN ink ik ON ik.id = i.inkFk From 41316537006c336064476cadd7add125ed74bbe9 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 21 Jun 2024 13:02:36 +0200 Subject: [PATCH 3/5] feat itemShelving_filterBuyer refs #7023 --- db/routines/vn/procedures/itemShelving_filterBuyer.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql index 2fdf21ee1..d4675ea0e 100644 --- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql +++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql @@ -60,7 +60,7 @@ proc:BEGIN v.visible, v.visible nicho, ik.name itemColour, - CAST(sub5.pendiente AS DECIMAL(10,0) pendingAmount + CAST(sub5.pendiente AS DECIMAL(10,0)) pendingAmount FROM cache.visible v JOIN item i ON i.id = v.item_id LEFT JOIN ink ik ON ik.id = i.inkFk From 24cf23dddc0ef4c42407ef7576689fff1767132f Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 21 Jun 2024 13:16:01 +0200 Subject: [PATCH 4/5] feat: refs #62add travelKgPercentage table and model --- .../11114-goldenDracena/00-firstScript.sql | 18 ++++++++++++++++ .../methods/travel/extraCommunityFilter.js | 14 ++++++++++++- modules/travel/back/model-config.json | 5 ++++- .../back/models/travel-kg-percentage.json | 21 +++++++++++++++++++ 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 db/versions/11114-goldenDracena/00-firstScript.sql create mode 100644 modules/travel/back/models/travel-kg-percentage.json diff --git a/db/versions/11114-goldenDracena/00-firstScript.sql b/db/versions/11114-goldenDracena/00-firstScript.sql new file mode 100644 index 000000000..0b6581faf --- /dev/null +++ b/db/versions/11114-goldenDracena/00-firstScript.sql @@ -0,0 +1,18 @@ +-- Place your SQL code here +CREATE TABLE IF NOT EXISTS travelKgPercentage ( + value INT(3) PRIMARY KEY, + className VARCHAR(50) +); + +INSERT IGNORE INTO travelKgPercentage (value, className) + VALUES + (80, 'primary'), + (100, 'alert'); + +INSERT IGNORE INTO salix.ACL + SET model = 'TravelKgPercentage', + property = '*', + accessType = 'READ', + permission = 'ALLOW', + principalType = 'ROLE', + principalId = 'employee'; \ No newline at end of file diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js index 488297318..dcb704ff5 100644 --- a/modules/travel/back/methods/travel/extraCommunityFilter.js +++ b/modules/travel/back/methods/travel/extraCommunityFilter.js @@ -138,7 +138,19 @@ module.exports = Self => { b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0) - ) as volumeKg + ) as volumeKg, + GREATEST( + CAST(SUM(b.weight * b.stickers) AS INT), + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(pkg.volume, + pkg.volume, + pkg.width * pkg.depth * pkg.height + ) / 1000000 + ) AS INT + ) + / t.kg * 100, 0) percentageKg FROM travel t LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN entry e ON e.travelFk = t.id diff --git a/modules/travel/back/model-config.json b/modules/travel/back/model-config.json index ed5c071b3..952ce0d20 100644 --- a/modules/travel/back/model-config.json +++ b/modules/travel/back/model-config.json @@ -11,6 +11,9 @@ "Thermograph": { "dataSource": "vn" }, + "TravelKgPercentage": { + "dataSource": "vn" + }, "TravelThermograph": { "dataSource": "vn" }, @@ -20,4 +23,4 @@ "Temperature": { "dataSource": "vn" } -} +} \ No newline at end of file diff --git a/modules/travel/back/models/travel-kg-percentage.json b/modules/travel/back/models/travel-kg-percentage.json new file mode 100644 index 000000000..e99a88999 --- /dev/null +++ b/modules/travel/back/models/travel-kg-percentage.json @@ -0,0 +1,21 @@ +{ + "name": "TravelKgPercentage", + "base": "VnModel", + "mixins": { + "Loggable": true + }, + "options": { + "mysql": { + "table": "travelKgPercentage" + } + }, + "properties": { + "value": { + "type": "number", + "id": true + }, + "className": { + "type": "string" + } + } +} \ No newline at end of file From 5ef0dffa3e23d82a10a63ed26b126da05def2230 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 21 Jun 2024 13:38:00 +0200 Subject: [PATCH 5/5] fix: refs #6238 add scheme --- db/versions/11114-goldenDracena/00-firstScript.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/versions/11114-goldenDracena/00-firstScript.sql b/db/versions/11114-goldenDracena/00-firstScript.sql index 0b6581faf..cc283f418 100644 --- a/db/versions/11114-goldenDracena/00-firstScript.sql +++ b/db/versions/11114-goldenDracena/00-firstScript.sql @@ -1,10 +1,10 @@ -- Place your SQL code here -CREATE TABLE IF NOT EXISTS travelKgPercentage ( +CREATE TABLE IF NOT EXISTS vn.travelKgPercentage ( value INT(3) PRIMARY KEY, className VARCHAR(50) ); -INSERT IGNORE INTO travelKgPercentage (value, className) +INSERT IGNORE INTO vn.travelKgPercentage (value, className) VALUES (80, 'primary'), (100, 'alert');