From 88eecd932964921dd4a7c6e9e94e7997fe85588e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 27 Oct 2015 19:02:03 +0100 Subject: [PATCH] Ahora se pueden guardar configuraciones predeterminadas para las estanterias --- debian/changelog | 2 +- web/forms/admin/shelves/shelves.js | 69 ++++++++++++++++---------- web/forms/admin/shelves/ui.xml | 21 +++++++- web/js/hedera/report.js | 4 +- web/locale/ca/js/vn.js | 3 ++ web/locale/es/forms/admin/shelves.json | 7 ++- web/locale/es/js/vn.js | 3 ++ web/reports/shelves/style.css | 8 +++ 8 files changed, 85 insertions(+), 32 deletions(-) diff --git a/debian/changelog b/debian/changelog index 741953c7..29d77c2c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.236-deb8) stable; urgency=low +hedera-web (1.237-deb8) stable; urgency=low * Initial Release. diff --git a/web/forms/admin/shelves/shelves.js b/web/forms/admin/shelves/shelves.js index 72e14d4d..54c578c2 100755 --- a/web/forms/admin/shelves/shelves.js +++ b/web/forms/admin/shelves/shelves.js @@ -2,23 +2,20 @@ Vn.Shelves = new Class ({ Extends: Vn.Module - - ,activate: function () - { - this.$('warehouse').value = 44; - this.$('date').value = new Date (); - this.$('shelf').value = 4; - this.$('reign').value = 1; - this.$('family').value = 2; - this.$('filter').value = 'Ant '; - this.$('max-amount').value = 50; - this.$('show-packing').value = true; - this.$('stack').value = true; - } - ,onFamilyChange: function () + ,onConfigChange: function () { - this.$('report-title').value = this.$('family').get ('Tipo'); + var c = this.$('config'); + this.$('warehouse').value = c.get ('warehouse_id'); + this.$('date').value = new Date (); + this.$('shelf').value = c.get ('shelf_id'); + this.$('reign').value = c.get ('reino_id'); + this.$('family').value = c.get ('family_id'); + this.$('filter').value = c.get ('name_prefix'); + this.$('max-amount').value = c.get ('max_amount'); + this.$('show-packing').value = c.get ('show_packing'); + this.$('stack').value = c.get ('stack'); + this.$('report-title').value = c.get ('name'); } ,onPreviewClick: function () @@ -28,7 +25,7 @@ Vn.Shelves = new Class batch.addParam ('wh', this.$('warehouse')); batch.addParam ('date', this.$('date')); batch.addParam ('family', this.$('family')); - batch.addValue ('filter', this.$('filter').value); + batch.addParam ('filter', this.$('filter')); var report = new Vn.ShelvesReport ({conn: this.conn}); report.setParams ( @@ -47,7 +44,7 @@ Vn.ShelvesReport = new Class Extends: Vn.Report ,nItem: -1 - ,nColors: 4 + ,nColors: 6 ,setParams: function (title, maxAmount, showPacking, stack, batch) { @@ -61,9 +58,9 @@ Vn.ShelvesReport = new Class ,open: function () { var query = - 'SELECT id, name, width, height, max_height, tray_height, '+ + 'SELECT id, name, width, height, depth, max_height, tray_height, '+ 'first_tray_elevation, tray_density, vspacing, hspacing '+ - 'FROM vn2008.shelf WHERE id = #shelf; '+ + 'FROM shelf WHERE id = #shelf; '+ 'CALL item_organizer (#wh, #date, #family, #filter)'; this.conn.execQuery (query, this.onQueryExec.bind (this), this.batch); @@ -76,12 +73,19 @@ Vn.ShelvesReport = new Class var res = resultSet.fetchResult (); res.next (); - var scale = 0.065; + var maxWidth = 170; + var maxHeight = 230; + + var scale = maxWidth / res.get ('width'); + + if (res.get ('max_height') * scale > maxHeight) + scale = maxHeight / res.get ('max_height'); var shelf = this.shelf = { width: res.get ('width') * scale ,height: res.get ('height') * scale + ,depth: res.get ('depth') * scale ,maxHeight: res.get ('max_height') * scale ,trayHeight: res.get ('tray_height') * scale ,firstTrayElevation: res.get ('first_tray_elevation') * scale @@ -94,6 +98,12 @@ Vn.ShelvesReport = new Class var remainings = []; var res = resultSet.fetchResult (); + if (res.data.length == 0) + { + Htk.Toast.showError (_('No items found, check that all fields are correct')); + return; + } + while (res.next ()) if (!this.maxAmount || res.get ('etiquetas') <= this.maxAmount) { @@ -102,6 +112,7 @@ Vn.ShelvesReport = new Class ,packing: res.get ('packing') ,boxHeight: res.get ('z') * 10 * scale ,boxWidth: res.get ('x') * 10 * scale + ,boxDepth: res.get ('y') * 10 * scale ,amount: res.get ('etiquetas') }); } @@ -125,14 +136,16 @@ Vn.ShelvesReport = new Class (shelf.height - shelf.firstTrayElevation) / (shelf.trayHeight + shelf.trayDensity) ); - alloc.trayWidth = shelf.width - shelf.hspacing * 2; + alloc.width = shelf.width - shelf.hspacing * 2; + alloc.depth = shelf.depth; alloc.trayHeight = shelf.trayHeight - shelf.vspacing; alloc.topTrayHeight = shelf.maxHeight - shelf.vspacing - shelf.firstTrayElevation - (alloc.nTrays - 1) * shelf.trayHeight; // Opens the report - this.createWindow ('shelves'); + if (!this.createWindow ('shelves')) + return; // Remaining amount @@ -223,7 +236,7 @@ Vn.ShelvesReport = new Class lastTrayY += shelf.trayHeight + shelf.trayDensity; } } - +/* ,drawEdge: function (shelfDiv) { var edge = this.doc.createElement ('div'); @@ -233,7 +246,7 @@ Vn.ShelvesReport = new Class this.shelfDiv.appendChild (edge); return edge; } - +*/ ,drawBox: function (allocator, item, amount) { if (item.boxWidth == 0 || item.boxHeight == 0) @@ -306,7 +319,7 @@ Vn.Allocator = new Class ,addColumn: function (width) { - if (this.trayX + this.columnWidth + width > this.trayWidth + if (this.trayX + this.columnWidth + width > this.width || this.currentTray == -1) this.addTray (); else @@ -352,8 +365,12 @@ Vn.Allocator = new Class for (var i = 0; i < this.items.length; i++) { var item = this.items[i]; + var boxIncrement = Math.floor (this.depth / item.boxDepth); + + if (boxIncrement < 1) + boxIncrement = 1; - for (var amount = 0; amount < item.amount; amount++) + for (var amount = 0; amount < item.amount; amount += boxIncrement) { this.addBox (item, amount); this.firstShelfBox = false; diff --git a/web/forms/admin/shelves/ui.xml b/web/forms/admin/shelves/ui.xml index 64418240..25a93c88 100755 --- a/web/forms/admin/shelves/ui.xml +++ b/web/forms/admin/shelves/ui.xml @@ -1,10 +1,27 @@ + + + SELECT c.id, c.name, c.name_prefix, c.warehouse_id, c.family_id, + c.shelf_id, c.max_amount, c.show_packing, c.stack, t.reino_id + FROM shelf_config c + JOIN vn2008.Tipos t ON t.tipo_id = c.family_id + +

Shelves

+
+ + +
@@ -16,7 +33,7 @@
- + SELECT tipo_id, Tipo FROM vn2008.Tipos WHERE reino_id = #reign ORDER BY Tipo @@ -49,7 +66,7 @@
- +
diff --git a/web/js/hedera/report.js b/web/js/hedera/report.js index 7a331a28..5bc09125 100755 --- a/web/js/hedera/report.js +++ b/web/js/hedera/report.js @@ -34,8 +34,8 @@ Vn.Report = new Class if (!reportWindow) { Htk.Toast.showError ( - _('Can\'t open the report, please unlock popup block and try again')); - return; + _('Please unlock popups and try again')); + return null; } this.window = reportWindow; diff --git a/web/locale/ca/js/vn.js b/web/locale/ca/js/vn.js index ff522e6f..e9a69e0c 100755 --- a/web/locale/ca/js/vn.js +++ b/web/locale/ca/js/vn.js @@ -56,7 +56,10 @@ Vn.Locale.add ,"CookiesNotification": "En utilitzar aquest lloc web acceptes l'ús de cookies per a la personalització de continguts i anàlisi." ,"ReturnToOldWebsite": "Web antiga" ,"TestTheNewWebsite": "Prova la nova web!" + ,"Print": "Imprimir" + ,"Please unlock popups and try again": + "Si us plau, desbloqueja els popups i torna-ho a intentar" ,"Menu": "Menú" diff --git a/web/locale/es/forms/admin/shelves.json b/web/locale/es/forms/admin/shelves.json index 2e827c62..edf194ad 100644 --- a/web/locale/es/forms/admin/shelves.json +++ b/web/locale/es/forms/admin/shelves.json @@ -1,5 +1,7 @@ { - "Reign": "Reino" + "Configuration": "Configuración" + ,"Select config": "Selecciona configuración" + ,"Reign": "Reino" ,"Family": "Familia" ,"Store": "Almacén" ,"Date": "Fecha" @@ -13,4 +15,7 @@ ,"Preview": "Mostrar" ,"Pallets": "Palets" + + ,"No items found, check that all fields are correct": + "No se han encontrado artículos, comprueba que todos los campos son correctos" } diff --git a/web/locale/es/js/vn.js b/web/locale/es/js/vn.js index 717aeff1..c7535334 100755 --- a/web/locale/es/js/vn.js +++ b/web/locale/es/js/vn.js @@ -56,7 +56,10 @@ Vn.Locale.add ,"CookiesNotification": "Al utilizar este sitio web aceptas el uso de cookies para la personalización de contenidos y análisis." ,"ReturnToOldWebsite": "Web antigua" ,"TestTheNewWebsite": "¡Prueba la nueva web!" + ,"Print": "Imprimir" + ,"Please unlock popups and try again": + "Por favor, desploquea los popups y vuelvelo a intentar" ,"Menu": "Menú" diff --git a/web/reports/shelves/style.css b/web/reports/shelves/style.css index 1e6ceac5..626314de 100644 --- a/web/reports/shelves/style.css +++ b/web/reports/shelves/style.css @@ -68,9 +68,17 @@ h1.page-number background-color: #DDF !important; } .color3 +{ + background-color: #DFF !important; +} +.color4 { background-color: #FDF !important; } +.color5 +{ + background-color: #FFD !important; +} /* Remaining amounts*/