From 5cf102c7fd006456da224168d99e8f283a9bdebb Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 24 Aug 2022 14:13:26 +0200 Subject: [PATCH 1/6] sustituido density por weightByPiece --- .../back/methods/entry/editLatestBuys.js | 2 +- .../back/methods/entry/latestBuysFilter.js | 2 +- modules/entry/front/latest-buys/index.html | 6 ++-- modules/entry/front/latest-buys/index.js | 4 +-- modules/item/back/methods/item/filter.js | 2 +- modules/item/back/models/item.json | 4 +-- modules/item/front/basic-data/index.html | 5 ++- modules/item/front/index/index.html | 6 ++-- modules/item/front/index/index.js | 2 +- modules/item/front/locale/es.yml | 2 +- modules/item/front/summary/index.html | 4 +-- .../methods/travel/extraCommunityFilter.js | 14 ++++---- .../reports/extra-community/sql/entries.sql | 33 ++++++++++--------- .../reports/extra-community/sql/travels.sql | 4 +-- 14 files changed, 46 insertions(+), 44 deletions(-) diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index 72bee98ae..2642d4f4d 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -52,7 +52,7 @@ module.exports = Self => { switch (field) { case 'size': - case 'density': + case 'weightByPiece': case 'description': case 'packingOut': modelName = 'Item'; diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 9a21d4472..8972b4f5c 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -155,7 +155,7 @@ module.exports = Self => { i.image, i.id AS itemFk, i.size, - i.density, + i.weightByPiece, it.code, i.typeFk, i.family, diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index adeda5e56..16df3e926 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -67,8 +67,8 @@ Origin - - Density + + WeightByPiece Active @@ -181,7 +181,7 @@ {{::buy.intrastat}} {{::buy.origin}} - {{::buy.density}} + {{::buy.weightByPiece}} { i.subName, i.isActive, i.stems, - i.density, + i.weightByPiece, i.stemMultiplier, i.typeFk, i.isFloramondo, diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 01b6ba093..704c97434 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -53,9 +53,9 @@ "type": "number", "description": "Relevancy" }, - "density": { + "weightByPiece": { "type": "number", - "description": "Density" + "description": "WeightByPiece" }, "stemMultiplier": { "type": "number", diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 22fd33a07..2d608f505 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -124,9 +124,8 @@ Buyer - - Density + + WeightByPiece Multiplier @@ -117,7 +117,7 @@ {{::item.userName}} - {{::item.density}} + {{::item.weightByPiece}} {{::item.stemMultiplier}} - + diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js index 7769b7f21..76e25a543 100644 --- a/modules/travel/back/methods/travel/extraCommunityFilter.js +++ b/modules/travel/back/methods/travel/extraCommunityFilter.js @@ -130,8 +130,8 @@ module.exports = Self => { SUM(b.stickers) AS stickers, s.id AS supplierFk, s.nickname AS cargoSupplierNickname, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg + CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg, + CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg FROM travel t LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN entry e ON e.travelFk = t.id @@ -143,7 +143,8 @@ module.exports = Self => { JOIN warehouse wo ON wo.id = t.warehouseOutFk JOIN country c ON c.id = wo.countryFk LEFT JOIN continent cnt ON cnt.id = c.continentFk - JOIN agencyMode am ON am.id = t.agencyModeFk` + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN vn.volumeConfig vc` ); stmt.merge(conn.makeWhere(filter.where)); @@ -164,15 +165,16 @@ module.exports = Self => { SUM(b.stickers) AS stickers, e.evaNotes, e.notes, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg + CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg, + CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg FROM tmp.travel tr JOIN entry e ON e.travelFk = tr.id JOIN buy b ON b.entryFk = e.id JOIN packaging pkg ON pkg.id = b.packageFk JOIN item i ON i.id = b.itemFk JOIN itemType it ON it.id = i.typeFk - JOIN supplier s ON s.id = e.supplierFk` + JOIN supplier s ON s.id = e.supplierFk + JOIN vn.volumeConfig vc` ); stmt.merge(conn.makeGroupBy('e.id')); diff --git a/print/templates/reports/extra-community/sql/entries.sql b/print/templates/reports/extra-community/sql/entries.sql index ad2529a1c..a90bf8b0b 100644 --- a/print/templates/reports/extra-community/sql/entries.sql +++ b/print/templates/reports/extra-community/sql/entries.sql @@ -1,17 +1,18 @@ SELECT - e.id, - e.travelFk, - e.ref, - s.name AS supplierName, - SUM(b.stickers) AS stickers, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg -FROM travel t - JOIN entry e ON e.travelFk = t.id - JOIN buy b ON b.entryFk = e.id - JOIN packaging pkg ON pkg.id = b.packageFk - JOIN item i ON i.id = b.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN supplier s ON s.id = e.supplierFk - WHERE t.id IN(?) -GROUP BY e.id \ No newline at end of file + e.id, + e.travelFk, + e.ref, + s.name AS supplierName, + SUM(b.stickers) AS stickers, + CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg, + CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg + FROM travel t + JOIN entry e ON e.travelFk = t.id + JOIN buy b ON b.entryFk = e.id + JOIN packaging pkg ON pkg.id = b.packageFk + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN supplier s ON s.id = e.supplierFk + JOIN vn.volumeConfig vc + WHERE t.id IN(?) + GROUP BY e.id \ No newline at end of file diff --git a/print/templates/reports/extra-community/sql/travels.sql b/print/templates/reports/extra-community/sql/travels.sql index f8a4e0142..0f2f8d416 100644 --- a/print/templates/reports/extra-community/sql/travels.sql +++ b/print/templates/reports/extra-community/sql/travels.sql @@ -6,8 +6,8 @@ SELECT t.kg, am.id AS agencyModeFk, SUM(b.stickers) AS stickers, - CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg, - CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg + CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg, + CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg FROM travel t LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN entry e ON e.travelFk = t.id From 426ff5f7537d233f1529bc9d166af17eeef79d3c Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 27 Sep 2022 11:26:36 +0200 Subject: [PATCH 2/6] selector con weightByPieceCheckbox --- e2e/helpers/selectors.js | 2 +- e2e/paths/04-item/09_index.spec.js | 4 ++-- print/templates/reports/extra-community/sql/travels.sql | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0ad9ad7f4..cf120043d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -391,7 +391,7 @@ export default { intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Intrastat"]', originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]', buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]', - densityCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Density"]', + weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="WeightByPiece"]', saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button' }, itemFixedPrice: { diff --git a/e2e/paths/04-item/09_index.spec.js b/e2e/paths/04-item/09_index.spec.js index f9262863d..6e0a4bd5c 100644 --- a/e2e/paths/04-item/09_index.spec.js +++ b/e2e/paths/04-item/09_index.spec.js @@ -31,7 +31,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.originCheckbox); await page.waitToClick(selectors.itemsIndex.buyerCheckbox); - await page.waitToClick(selectors.itemsIndex.densityCheckbox); + await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox); await page.waitToClick(selectors.itemsIndex.saveFieldsButton); const message = await page.waitForSnackbar(); @@ -64,7 +64,7 @@ describe('Item index path', () => { await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.originCheckbox); await page.waitToClick(selectors.itemsIndex.buyerCheckbox); - await page.waitToClick(selectors.itemsIndex.densityCheckbox); + await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox); await page.waitToClick(selectors.itemsIndex.saveFieldsButton); const message = await page.waitForSnackbar(); diff --git a/print/templates/reports/extra-community/sql/travels.sql b/print/templates/reports/extra-community/sql/travels.sql index 0f2f8d416..b0987c330 100644 --- a/print/templates/reports/extra-community/sql/travels.sql +++ b/print/templates/reports/extra-community/sql/travels.sql @@ -9,6 +9,7 @@ SELECT CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg, CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg FROM travel t + JOIN volumeConfig vc LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN entry e ON e.travelFk = t.id LEFT JOIN buy b ON b.entryFk = e.id From 417222905189164ec5515eb56300d4a7a8e9248f Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 29 Sep 2022 09:35:57 +0200 Subject: [PATCH 3/6] Closure hotfix --- modules/monitor/front/index/tickets/index.html | 3 +++ print/methods/closure/closeAll.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index a504301a5..138788ed6 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -210,6 +210,9 @@ + + diff --git a/print/methods/closure/closeAll.js b/print/methods/closure/closeAll.js index dad8b4569..513574418 100644 --- a/print/methods/closure/closeAll.js +++ b/print/methods/closure/closeAll.js @@ -11,10 +11,10 @@ module.exports = async function(request, response, next) { if (reqArgs.to) toDate = reqArgs.to; const todayMinDate = new Date(); - minDate.setHours(0, 0, 0, 0); + todayMinDate.setHours(0, 0, 0, 0); const todayMaxDate = new Date(); - maxDate.setHours(23, 59, 59, 59); + todayMinDate.setHours(23, 59, 59, 59); // Prevent closure for current day if (toDate >= todayMinDate && toDate <= todayMaxDate) From d7b563c5ec4e6d6c115fff9cf5d8534eedf71fbd Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 29 Sep 2022 10:09:01 +0200 Subject: [PATCH 4/6] Debug logs --- print/methods/closure/closeAll.js | 2 ++ print/methods/closure/closure.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/print/methods/closure/closeAll.js b/print/methods/closure/closeAll.js index 513574418..36b853052 100644 --- a/print/methods/closure/closeAll.js +++ b/print/methods/closure/closeAll.js @@ -20,6 +20,8 @@ module.exports = async function(request, response, next) { if (toDate >= todayMinDate && toDate <= todayMaxDate) throw new Error('You cannot close tickets for today'); + console.log(`Making closure up to ${toDate}...`); + const tickets = await db.rawSql(` SELECT t.id, diff --git a/print/methods/closure/closure.js b/print/methods/closure/closure.js index 67a2538e8..fe5aba5e7 100644 --- a/print/methods/closure/closure.js +++ b/print/methods/closure/closure.js @@ -7,11 +7,13 @@ const storage = require('vn-print/core/storage'); module.exports = { async start(tickets, reqArgs) { + console.log(tickets); if (tickets.length == 0) return; const failedtickets = []; for (const ticket of tickets) { try { + console.log(`Closing ticket id ${ticket.id}...`); await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]); const invoiceOut = await db.findOne(` From 12f4ef0850e0c0f5c5771316e5ab1de649d3c726 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 30 Sep 2022 13:55:41 +0200 Subject: [PATCH 5/6] fix(print): log sent mails --- print/core/smtp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/core/smtp.js b/print/core/smtp.js index 50a413673..a55ba448d 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -29,7 +29,7 @@ module.exports = { for (let attachment of options.attachments) { const fileName = attachment.filename; const filePath = attachment.path; - if (fileName.includes('.png')) return; + if (fileName.includes('.png')) continue; if (fileName || filePath) attachments.push(filePath ? filePath : fileName); From eb48685484fbe64679372b9464c64b57b8bcac45 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 30 Sep 2022 14:55:31 +0200 Subject: [PATCH 6/6] selectores reparados --- e2e/helpers/selectors.js | 2 +- modules/entry/front/latest-buys/index.html | 2 +- modules/entry/front/latest-buys/index.js | 2 +- modules/item/front/basic-data/index.html | 2 +- modules/item/front/index/index.html | 2 +- modules/item/front/locale/es.yml | 2 +- modules/item/front/summary/index.html | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index cf120043d..237fdad0c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -391,7 +391,7 @@ export default { intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Intrastat"]', originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]', buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]', - weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="WeightByPiece"]', + weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Weight/Piece"]', saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button' }, itemFixedPrice: { diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index c2ac9ee9b..fc44ddfc2 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -69,7 +69,7 @@ Origin - WeightByPiece + Weight/Piece Active diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index 16b2e22a7..d9065193e 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -80,7 +80,7 @@ export default class Controller extends Section { {field: 'weight', displayName: this.$t('Weight')}, {field: 'description', displayName: this.$t('Description')}, {field: 'size', displayName: this.$t('Size')}, - {field: 'weightByPiece', displayName: this.$t('weightByPiece')}, + {field: 'weightByPiece', displayName: this.$t('weight/Piece')}, {field: 'packingOut', displayName: this.$t('PackingOut')}, {field: 'landing', displayName: this.$t('Landing')} ]; diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 2d608f505..8d1afe4e1 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -124,7 +124,7 @@ diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 423d9c61a..6f5cce7c0 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -46,7 +46,7 @@ Buyer - WeightByPiece + Weight/Piece Multiplier diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml index 76ed94d2f..1b75e3802 100644 --- a/modules/item/front/locale/es.yml +++ b/modules/item/front/locale/es.yml @@ -40,7 +40,7 @@ Create: Crear Client card: Ficha del cliente Shipped: F. envío stems: Tallos -WeightByPiece: Peso/tallo +Weight/Piece: Peso/tallo Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras SalesPerson: Comercial Concept: Concepto diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index 3a651ec9e..a4d40c829 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -91,7 +91,7 @@ -