0
1
Fork 0

Ahora se pueden guardar configuraciones predeterminadas para las estanterias

This commit is contained in:
Juan Ferrer Toribio 2015-10-27 19:02:03 +01:00
parent 2e627dfdba
commit 88eecd9329
8 changed files with 85 additions and 32 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.236-deb8) stable; urgency=low hedera-web (1.237-deb8) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -2,23 +2,20 @@
Vn.Shelves = new Class Vn.Shelves = new Class
({ ({
Extends: Vn.Module 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 () ,onPreviewClick: function ()
@ -28,7 +25,7 @@ Vn.Shelves = new Class
batch.addParam ('wh', this.$('warehouse')); batch.addParam ('wh', this.$('warehouse'));
batch.addParam ('date', this.$('date')); batch.addParam ('date', this.$('date'));
batch.addParam ('family', this.$('family')); batch.addParam ('family', this.$('family'));
batch.addValue ('filter', this.$('filter').value); batch.addParam ('filter', this.$('filter'));
var report = new Vn.ShelvesReport ({conn: this.conn}); var report = new Vn.ShelvesReport ({conn: this.conn});
report.setParams ( report.setParams (
@ -47,7 +44,7 @@ Vn.ShelvesReport = new Class
Extends: Vn.Report Extends: Vn.Report
,nItem: -1 ,nItem: -1
,nColors: 4 ,nColors: 6
,setParams: function (title, maxAmount, showPacking, stack, batch) ,setParams: function (title, maxAmount, showPacking, stack, batch)
{ {
@ -61,9 +58,9 @@ Vn.ShelvesReport = new Class
,open: function () ,open: function ()
{ {
var query = 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 '+ '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)'; 'CALL item_organizer (#wh, #date, #family, #filter)';
this.conn.execQuery (query, this.onQueryExec.bind (this), this.batch); this.conn.execQuery (query, this.onQueryExec.bind (this), this.batch);
@ -76,12 +73,19 @@ Vn.ShelvesReport = new Class
var res = resultSet.fetchResult (); var res = resultSet.fetchResult ();
res.next (); 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 = var shelf = this.shelf =
{ {
width: res.get ('width') * scale width: res.get ('width') * scale
,height: res.get ('height') * scale ,height: res.get ('height') * scale
,depth: res.get ('depth') * scale
,maxHeight: res.get ('max_height') * scale ,maxHeight: res.get ('max_height') * scale
,trayHeight: res.get ('tray_height') * scale ,trayHeight: res.get ('tray_height') * scale
,firstTrayElevation: res.get ('first_tray_elevation') * scale ,firstTrayElevation: res.get ('first_tray_elevation') * scale
@ -94,6 +98,12 @@ Vn.ShelvesReport = new Class
var remainings = []; var remainings = [];
var res = resultSet.fetchResult (); 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 ()) while (res.next ())
if (!this.maxAmount || res.get ('etiquetas') <= this.maxAmount) if (!this.maxAmount || res.get ('etiquetas') <= this.maxAmount)
{ {
@ -102,6 +112,7 @@ Vn.ShelvesReport = new Class
,packing: res.get ('packing') ,packing: res.get ('packing')
,boxHeight: res.get ('z') * 10 * scale ,boxHeight: res.get ('z') * 10 * scale
,boxWidth: res.get ('x') * 10 * scale ,boxWidth: res.get ('x') * 10 * scale
,boxDepth: res.get ('y') * 10 * scale
,amount: res.get ('etiquetas') ,amount: res.get ('etiquetas')
}); });
} }
@ -125,14 +136,16 @@ Vn.ShelvesReport = new Class
(shelf.height - shelf.firstTrayElevation) / (shelf.height - shelf.firstTrayElevation) /
(shelf.trayHeight + shelf.trayDensity) (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.trayHeight = shelf.trayHeight - shelf.vspacing;
alloc.topTrayHeight = shelf.maxHeight - shelf.vspacing alloc.topTrayHeight = shelf.maxHeight - shelf.vspacing
- shelf.firstTrayElevation - (alloc.nTrays - 1) * shelf.trayHeight; - shelf.firstTrayElevation - (alloc.nTrays - 1) * shelf.trayHeight;
// Opens the report // Opens the report
this.createWindow ('shelves'); if (!this.createWindow ('shelves'))
return;
// Remaining amount // Remaining amount
@ -223,7 +236,7 @@ Vn.ShelvesReport = new Class
lastTrayY += shelf.trayHeight + shelf.trayDensity; lastTrayY += shelf.trayHeight + shelf.trayDensity;
} }
} }
/*
,drawEdge: function (shelfDiv) ,drawEdge: function (shelfDiv)
{ {
var edge = this.doc.createElement ('div'); var edge = this.doc.createElement ('div');
@ -233,7 +246,7 @@ Vn.ShelvesReport = new Class
this.shelfDiv.appendChild (edge); this.shelfDiv.appendChild (edge);
return edge; return edge;
} }
*/
,drawBox: function (allocator, item, amount) ,drawBox: function (allocator, item, amount)
{ {
if (item.boxWidth == 0 || item.boxHeight == 0) if (item.boxWidth == 0 || item.boxHeight == 0)
@ -306,7 +319,7 @@ Vn.Allocator = new Class
,addColumn: function (width) ,addColumn: function (width)
{ {
if (this.trayX + this.columnWidth + width > this.trayWidth if (this.trayX + this.columnWidth + width > this.width
|| this.currentTray == -1) || this.currentTray == -1)
this.addTray (); this.addTray ();
else else
@ -352,8 +365,12 @@ Vn.Allocator = new Class
for (var i = 0; i < this.items.length; i++) for (var i = 0; i < this.items.length; i++)
{ {
var item = this.items[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.addBox (item, amount);
this.firstShelfBox = false; this.firstShelfBox = false;

View File

@ -1,10 +1,27 @@
<vn> <vn>
<vn-group>
<db-model property="model" id="configs-model">
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
</db-model>
</vn-group>
<div id="title"> <div id="title">
<h1><t>Shelves</t></h1> <h1><t>Shelves</t></h1>
</div> </div>
<div id="form" class="shelves"> <div id="form" class="shelves">
<div class="box"> <div class="box">
<div class="body"> <div class="body">
<div class="form-group">
<label><t>Configuration</t></label>
<htk-combo
id="config"
placeholder="_Select config"
model="configs-model"
on-changed="onConfigChange"
on-ready="onConfigChange"/>
</div>
<div class="form-group"> <div class="form-group">
<label><t>Reign</t></label> <label><t>Reign</t></label>
<htk-combo id="reign"> <htk-combo id="reign">
@ -16,7 +33,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label><t>Family</t></label> <label><t>Family</t></label>
<htk-combo id="family" on-changed="onFamilyChange" on-ready="onFamilyChange"> <htk-combo id="family">
<db-model property="model"> <db-model property="model">
SELECT tipo_id, Tipo FROM vn2008.Tipos SELECT tipo_id, Tipo FROM vn2008.Tipos
WHERE reino_id = #reign ORDER BY Tipo WHERE reino_id = #reign ORDER BY Tipo
@ -49,7 +66,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label><t>Name prefix</t></label> <label><t>Name prefix</t></label>
<input type="text" id="filter"/> <htk-entry id="filter"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label><t>Limit amount per item</t></label> <label><t>Limit amount per item</t></label>

View File

@ -34,8 +34,8 @@ Vn.Report = new Class
if (!reportWindow) if (!reportWindow)
{ {
Htk.Toast.showError ( Htk.Toast.showError (
_('Can\'t open the report, please unlock popup block and try again')); _('Please unlock popups and try again'));
return; return null;
} }
this.window = reportWindow; this.window = reportWindow;

View File

@ -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." ,"CookiesNotification": "En utilitzar aquest lloc web acceptes l'ús de cookies per a la personalització de continguts i anàlisi."
,"ReturnToOldWebsite": "Web antiga" ,"ReturnToOldWebsite": "Web antiga"
,"TestTheNewWebsite": "Prova la nova web!" ,"TestTheNewWebsite": "Prova la nova web!"
,"Print": "Imprimir" ,"Print": "Imprimir"
,"Please unlock popups and try again":
"Si us plau, desbloqueja els popups i torna-ho a intentar"
,"Menu": "Menú" ,"Menu": "Menú"

View File

@ -1,5 +1,7 @@
{ {
"Reign": "Reino" "Configuration": "Configuración"
,"Select config": "Selecciona configuración"
,"Reign": "Reino"
,"Family": "Familia" ,"Family": "Familia"
,"Store": "Almacén" ,"Store": "Almacén"
,"Date": "Fecha" ,"Date": "Fecha"
@ -13,4 +15,7 @@
,"Preview": "Mostrar" ,"Preview": "Mostrar"
,"Pallets": "Palets" ,"Pallets": "Palets"
,"No items found, check that all fields are correct":
"No se han encontrado artículos, comprueba que todos los campos son correctos"
} }

View File

@ -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." ,"CookiesNotification": "Al utilizar este sitio web aceptas el uso de cookies para la personalización de contenidos y análisis."
,"ReturnToOldWebsite": "Web antigua" ,"ReturnToOldWebsite": "Web antigua"
,"TestTheNewWebsite": "¡Prueba la nueva web!" ,"TestTheNewWebsite": "¡Prueba la nueva web!"
,"Print": "Imprimir" ,"Print": "Imprimir"
,"Please unlock popups and try again":
"Por favor, desploquea los popups y vuelvelo a intentar"
,"Menu": "Menú" ,"Menu": "Menú"

View File

@ -68,9 +68,17 @@ h1.page-number
background-color: #DDF !important; background-color: #DDF !important;
} }
.color3 .color3
{
background-color: #DFF !important;
}
.color4
{ {
background-color: #FDF !important; background-color: #FDF !important;
} }
.color5
{
background-color: #FFD !important;
}
/* Remaining amounts*/ /* Remaining amounts*/