desenvolvimento (bug 6096)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@44139 d1611594-4594-4d17-8e1d-87c2c4800839
master
lucas.taia 2015-05-19 17:49:26 +00:00
parent d4e4d96193
commit 953ad577f6
3 changed files with 159 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
@ -24,19 +25,23 @@ import org.zkoss.zul.Combobox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Longbox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.api.Comboitem;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Estacion;
import com.rjconsultores.ventaboletos.entidad.EstacionImpresora;
import com.rjconsultores.ventaboletos.entidad.EstacionRioCard;
import com.rjconsultores.ventaboletos.entidad.EstacionSitef;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.EstacionService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.render.EstacionRioCardRender;
import com.rjconsultores.ventaboletos.web.utilerias.render.EstacionSitefRender;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEstacionImpresora;
@ -56,8 +61,10 @@ public class EditarEstacionController extends MyGenericForwardComposer {
private MyListbox estacionList;
private MyListbox estacionSitefList;
private MyListbox estacionImpresoraList;
private MyListbox estacionRioCardList;
private Combobox cmbEmpresa;
private Combobox cmbEmpresaImpressora;
private Combobox cmbEmpresaRioCard;
private Button btnApagar;
private Textbox txtDescEstacion;
private Textbox txtDescMac;
@ -68,14 +75,17 @@ public class EditarEstacionController extends MyGenericForwardComposer {
private Intbox txtNumEmpresa;
private Intbox txtNumFilial;
private Intbox txtNumPdv;
private Textbox txtOperadora;
private List<Empresa> lsEmpresa;
private List<EstacionSitef> lsEstacionSitef;
private List<EstacionRioCard> lsEstacionRiocard;
private List<EstacionImpresora> lsEstacionImpresora;
private static Logger log = Logger.getLogger(EditarEstacionController.class);
private Textbox txtNomImpressoara;
private Textbox txtNomeArquivoLayout;
private Radio rdPausarImpressoraNo;
private Radio rdPausarImpressoraSi;
private Tab tabRioCard;
public Estacion getEstacion() {
return estacion;
@ -99,6 +109,11 @@ public class EditarEstacionController extends MyGenericForwardComposer {
estacionList = (MyListbox) Executions.getCurrent().getArg().get("estacionList");
estacionSitefList.setItemRenderer(new EstacionSitefRender());
estacionImpresoraList.setItemRenderer(new RenderEstacionImpresora());
estacionRioCardList.setItemRenderer(new EstacionRioCardRender());
if (ApplicationProperties.getInstance().integracionRioCard()) {
tabRioCard.setVisible(true);
}
if (estacion.getEstacionId() == null) {
btnApagar.setVisible(Boolean.FALSE);
@ -121,6 +136,9 @@ public class EditarEstacionController extends MyGenericForwardComposer {
lsEstacionSitef = estacion.getEstacionSitefList();
estacionSitefList.setData(lsEstacionSitef);
lsEstacionRiocard = estacion.getEstacionRioCardList();
estacionRioCardList.setData(lsEstacionRiocard);
lsEstacionImpresora = estacion.getLsEstacionImpresora();
estacionImpresoraList.setData(lsEstacionImpresora);
@ -145,6 +163,7 @@ public class EditarEstacionController extends MyGenericForwardComposer {
txtNumPdv.getValue();
txtDescEstacion.getValue();
txtNumCaja.getValue();
txtOperadora.getValue();
String descMac = txtDescMac.getText();
@ -161,6 +180,7 @@ public class EditarEstacionController extends MyGenericForwardComposer {
try {
estacion.setEstacionSitefList(estacionSitefList.getListData());
estacion.setEstacionRioCardList(estacionRioCardList.getListData());
estacion.setLsEstacionImpresora(estacionImpresoraList.getListData());
estacionService.suscribirActualizar(estacion);
@ -264,6 +284,62 @@ public class EditarEstacionController extends MyGenericForwardComposer {
estacionSitefList.addItemNovo(es);
}
}
public void onClick$btnAddConfRioCard(Event e) {
Comboitem cbiEmpresa = cmbEmpresaRioCard.getSelectedItem();
String operadora = txtOperadora.getValue();
if (cbiEmpresa != null && StringUtils.isNotBlank(operadora)) {
Empresa empresa = (Empresa) cbiEmpresa.getValue();
final Integer empresaId = empresa.getEmpresaId();
boolean empresaExiste = CollectionUtils.exists(estacionRioCardList.getListData(), new Predicate() {
@Override
public boolean evaluate(Object obj) {
EstacionRioCard e = (EstacionRioCard) obj;
return (e.getActivo() && e.getEmpresa().getEmpresaId().equals(empresaId));
}
});
if (empresaExiste) {
Clients.alert(Labels.getLabel("editarEstacionController.MSG.empresaYaExiste"), Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION);
return;
}
EstacionRioCard estacionRioCard = new EstacionRioCard();
estacionRioCard.setEmpresa(empresa);
estacionRioCard.setEstacion(estacion);
estacionRioCard.setOperadora(operadora);
estacionRioCard.setActivo(Boolean.TRUE);
estacionRioCard.setFecmodif(Calendar.getInstance().getTime());
estacionRioCard.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
estacionRioCardList.addItemNovo(estacionRioCard);
}
}
public void onClick$btnRemConfRioCard(Event ev) {
if (estacionRioCardList.getSelected() == null) {
return;
}
EstacionRioCard rc = (EstacionRioCard) estacionRioCardList.getSelected();
estacionImpresoraList.removeSelectedItem();
if (rc.getEstacionRioCardId() != null) {
rc.setFecmodif(Calendar.getInstance().getTime());
rc.setActivo(Boolean.FALSE);
rc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
estacionRioCardList.addItemNovo(rc);
}
}
public void onClick$btnAddEstacionImpresora(Event ev) {
Comboitem cbiEmpresa = cmbEmpresaImpressora.getSelectedItem();

View File

@ -0,0 +1,34 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.utilerias.render;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.entidad.EstacionRioCard;
/**
*
* @author RJ
*/
public class EstacionRioCardRender implements ListitemRenderer {
public void render(Listitem lstm, Object o) throws Exception {
EstacionRioCard rc = (EstacionRioCard) o;
if (!rc.getActivo()) {
return;
}
Listcell lc = new Listcell(rc.getEmpresa().getNombempresa());
lc.setParent(lstm);
lc = new Listcell(rc.getOperadora().toString());
lc.setParent(lstm);
lstm.setValue(rc);
}
}

View File

@ -29,6 +29,8 @@
label="${c:l('editarEstacionController.window.title')}" />
<tab
label="${c:l('editarEstacionController.tab.label.sitef')}" />
<tab
id="tabRioCard" label="RioCard" visible="false"/>
<tab
label="${c:l('editarEstacionController.tab.label.impresora')}" />
</tabs>
@ -188,6 +190,53 @@
</listhead>
</listbox>
</tabpanel>
<tabpanel>
<!-- RIOCARD -->
<grid fixedLayout="true">
<columns>
<column width="30%" />
<column width="70%" />
</columns>
<rows>
<row>
<label
value="${c:l('editarEstacionController.empresa.label')}" />
<combobox id="cmbEmpresaRioCard" width="90%"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true"
model="@{winEditarEstacion$composer.lsEmpresa}" />
</row>
<row>
<label
value="Operadora" />
<textbox id="txtOperadora"
width="90%" maxlength="40" constraint="no empty" />
</row>
</rows>
</grid>
<toolbar>
<hbox spacing="5px" style="padding:1px"
align="right">
<button id="btnAddConfRioCard" height="20"
image="/gui/img/add.png" width="35px"
tooltiptext="${c:l('editarEstacionController.btnAddSitef.tooltiptext')}" />
<button id="btnRemConfRioCard" height="20"
image="/gui/img/remove.png" width="35px"
tooltiptext="${c:l('editarEstacionController.btnBorrarSitef.tooltiptext')}" />
</hbox>
</toolbar>
<listbox id="estacionRioCardList"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="false" height="100px">
<listhead sizable="true">
<listheader image="/gui/img/create_doc.gif" width="50%"
label="${c:l('editarEstacionController.empresa.label')}" />
<listheader image="/gui/img/create_doc.gif" width="50%"
label="Operadora" />
</listhead>
</listbox>
</tabpanel>
<tabpanel>
<!-- IMPRESSORAS -->