From be1a94c2838422a2600e9c590a25d853bdadd063 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 15 Jan 2024 09:59:32 +0100 Subject: [PATCH 1/3] feat: refs #6634 Modified collection-label --- .../240401/01-saleGroupDetailDefaultSize.sql | 2 ++ .../reports/collection-label/collection-label.html | 2 +- .../reports/collection-label/collection-label.js | 2 +- .../reports/collection-label/sql/labelsData.sql | 14 +++++++++----- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 db/changes/240401/01-saleGroupDetailDefaultSize.sql diff --git a/db/changes/240401/01-saleGroupDetailDefaultSize.sql b/db/changes/240401/01-saleGroupDetailDefaultSize.sql new file mode 100644 index 0000000000..a1e0537ed6 --- /dev/null +++ b/db/changes/240401/01-saleGroupDetailDefaultSize.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.productionConfig ADD saleGroupDetailDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa'; +UPDATE IGNORE vn.productionConfig SET saleGroupDetailDefaultSize = 40 WHERE id = 1; diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html index a699d4ac5c..a0bfcad0ee 100644 --- a/print/templates/reports/collection-label/collection-label.html +++ b/print/templates/reports/collection-label/collection-label.html @@ -15,7 +15,7 @@ {{labelData.workerCode || '---'}} - {{labelCount || labelData.labelCount || 0}} + {{labelData.labelCount || 0}} {{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}} diff --git a/print/templates/reports/collection-label/collection-label.js b/print/templates/reports/collection-label/collection-label.js index d45ecb2bce..cd6ff719a1 100644 --- a/print/templates/reports/collection-label/collection-label.js +++ b/print/templates/reports/collection-label/collection-label.js @@ -18,9 +18,9 @@ module.exports = { } }, async serverPrefetch() { + await this.rawSql('SET @hasPrevia := 0'); let ticketIds; const res = await this.rawSqlFromDef('tickets', [this.id]); - if (res.length) { ticketIds = []; for (const row of res) diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index fef692272c..fffa1bb537 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -7,14 +7,16 @@ SELECT c.itemPackingTypeFk code, cc.code color, t.clientFk, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, - MAX(i.`size`) `size`, + MAX( + IF(sgd.id, IFNULL(pc.saleGroupDetailDefaultSize, i.`size`), i.`size`) + ) `size`, w.code workerCode, TIME_FORMAT(t.shipped, '%H:%i') shippedHour, TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, tt.labelCount, t.nickName, - COUNT(*) lineCount, + SUM(IF(sgd.id, IF(@hasPrevia, 0, @hasPrevia := 1), 1)) lineCount, rm.routeFk FROM vn.ticket t JOIN vn.ticketCollection tc ON tc.ticketFk = t.id @@ -23,7 +25,7 @@ SELECT c.itemPackingTypeFk code, AND cc.wagon = tc.wagon AND cc.trainFk = c.trainFk JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id + LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id JOIN vn.item i ON i.id = s.itemFk JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk @@ -32,7 +34,9 @@ SELECT c.itemPackingTypeFk code, LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.productionConfig pc WHERE t.id IN (?) GROUP BY t.id - ORDER BY cc.`code`; \ No newline at end of file + ORDER BY cc.`code` \ No newline at end of file From a900e0fff62ce1a9d2c7f49ce201aa1da91b0702 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 15 Jan 2024 10:03:05 +0100 Subject: [PATCH 2/3] feat: refs #6634 Minor change --- db/changes/240401/01-saleGroupDetailDefaultSize.sql | 4 ++-- print/templates/reports/collection-label/sql/labelsData.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/changes/240401/01-saleGroupDetailDefaultSize.sql b/db/changes/240401/01-saleGroupDetailDefaultSize.sql index a1e0537ed6..12f17c5e71 100644 --- a/db/changes/240401/01-saleGroupDetailDefaultSize.sql +++ b/db/changes/240401/01-saleGroupDetailDefaultSize.sql @@ -1,2 +1,2 @@ -ALTER TABLE vn.productionConfig ADD saleGroupDetailDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa'; -UPDATE IGNORE vn.productionConfig SET saleGroupDetailDefaultSize = 40 WHERE id = 1; +ALTER TABLE vn.productionConfig ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa'; +UPDATE IGNORE vn.productionConfig SET itemPreviousDefaultSize = 40 WHERE id = 1; diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index fffa1bb537..7a12a56d33 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -8,7 +8,7 @@ SELECT c.itemPackingTypeFk code, t.clientFk, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, MAX( - IF(sgd.id, IFNULL(pc.saleGroupDetailDefaultSize, i.`size`), i.`size`) + IF(sgd.id, IFNULL(pc.itemPreviousDefaultSize, i.`size`), i.`size`) ) `size`, w.code workerCode, TIME_FORMAT(t.shipped, '%H:%i') shippedHour, From 107e35001a83f86cf08fa95d4258d9d704885f48 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 15 Jan 2024 10:09:43 +0100 Subject: [PATCH 3/3] fix: refs #6582 Solved log error --- modules/route/back/models/routesMonitor.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/route/back/models/routesMonitor.json b/modules/route/back/models/routesMonitor.json index e5a0f60621..1220263364 100644 --- a/modules/route/back/models/routesMonitor.json +++ b/modules/route/back/models/routesMonitor.json @@ -1,6 +1,9 @@ { "name": "RoutesMonitor", - "base": "Loggable", + "base": "VnModel", + "mixins": { + "Loggable": true + }, "options": { "mysql": { "table": "routesMonitor"