ADM_20121217_1RC90
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@23218 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
1b7c2bc81e
commit
605388d013
|
@ -5,7 +5,10 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.seguridad;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -17,17 +20,21 @@ import org.zkoss.zk.ui.Executions;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Button;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Intbox;
|
||||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||
import com.rjconsultores.ventaboletos.entidad.EstacionSitef;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.EstacionService;
|
||||
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.EstacionSitefRender;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -40,7 +47,11 @@ public class EditarEstacionController extends MyGenericForwardComposer {
|
|||
private static final long serialVersionUID = 1L;
|
||||
@Autowired
|
||||
private EstacionService estacionService;
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
private MyListbox estacionList;
|
||||
private MyListbox estacionSitefList;
|
||||
private Combobox cmbEmpresa;
|
||||
private Button btnApagar;
|
||||
private Textbox txtDescEstacion;
|
||||
private Textbox txtDescMac;
|
||||
|
@ -49,6 +60,8 @@ public class EditarEstacionController extends MyGenericForwardComposer {
|
|||
private Intbox txtNumEmpresa;
|
||||
private Intbox txtNumFilial;
|
||||
private Intbox txtNumPdv;
|
||||
private List<Empresa> lsEmpresa;
|
||||
private List<EstacionSitef> lsEstacionSitef;
|
||||
private static Logger log = Logger.getLogger(EditarEstacionController.class);
|
||||
|
||||
public Estacion getEstacion() {
|
||||
|
@ -63,8 +76,11 @@ public class EditarEstacionController extends MyGenericForwardComposer {
|
|||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
lsEmpresa = empresaService.obtenerTodos();
|
||||
estacionSitefList.setItemRenderer(new EstacionSitefRender());
|
||||
estacion = (Estacion) Executions.getCurrent().getArg().get("estacion");
|
||||
estacionList = (MyListbox) Executions.getCurrent().getArg().get("estacionList");
|
||||
estacionSitefList.setItemRenderer(new EstacionSitefRender());
|
||||
|
||||
if (estacion.getEstacionId() == null) {
|
||||
btnApagar.setVisible(Boolean.FALSE);
|
||||
|
@ -83,17 +99,15 @@ public class EditarEstacionController extends MyGenericForwardComposer {
|
|||
txtDescMac.setText(descMac.toUpperCase());
|
||||
}
|
||||
|
||||
if(estacion.getEstacionSitefId() == null){
|
||||
estacion.setEstacionSitefId(new EstacionSitef());
|
||||
}
|
||||
|
||||
lsEstacionSitef = estacion.getEstacionSitefList();
|
||||
estacionSitefList.setData(lsEstacionSitef);
|
||||
|
||||
}
|
||||
|
||||
txtDescEstacion.focus();
|
||||
}
|
||||
|
||||
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||
Boolean salvar = false;
|
||||
cmbPuntoVenta.getValue(true);
|
||||
txtNumEmpresa.getValue();
|
||||
txtNumFilial.getValue();
|
||||
|
@ -105,42 +119,24 @@ public class EditarEstacionController extends MyGenericForwardComposer {
|
|||
estacion.setFecmodif(Calendar.getInstance().getTime());
|
||||
estacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
estacion.setDescmac(estacionService.getDecimalMAC(descMac).toString());
|
||||
|
||||
|
||||
if((txtNumEmpresa.getValue() == null)&& (txtNumFilial.getValue()== null)&&(txtNumPdv.getValue()== null)){
|
||||
salvar = true;
|
||||
estacion.setEstacionSitefId(null);
|
||||
}else{
|
||||
|
||||
if((!(txtNumEmpresa.getValue()== null))&& (!(txtNumFilial.getValue()== null))&&(!(txtNumPdv.getValue()== null))){
|
||||
salvar = true;
|
||||
estacion.getEstacionSitefId().setActivo(Boolean.TRUE);
|
||||
estacion.getEstacionSitefId().setFecmodif(Calendar.getInstance().getTime());
|
||||
estacion.getEstacionSitefId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
}else{
|
||||
salvar = false;
|
||||
}
|
||||
}
|
||||
if(salvar){
|
||||
|
||||
try {
|
||||
estacionService.suscribirActualizar(estacion);
|
||||
Messagebox.show(Labels.getLabel("editarEstacionController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarEstacionController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
estacionList.updateItem(estacion);
|
||||
|
||||
closeWindow();
|
||||
} catch (BusinessException e) {
|
||||
Messagebox.show(e.getMessage(), Labels.getLabel("editarEstacionController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
}else{
|
||||
Messagebox.show(Labels.getLabel("editarEstacionController.MSG.sitef"),
|
||||
|
||||
|
||||
try {
|
||||
estacion.setEstacionSitefList(estacionSitefList.getListData());
|
||||
estacionService.suscribirActualizar(estacion);
|
||||
Messagebox.show(Labels.getLabel("editarEstacionController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarEstacionController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
estacionList.updateItem(estacion);
|
||||
|
||||
closeWindow();
|
||||
} catch (BusinessException e) {
|
||||
Messagebox.show(e.getMessage(), Labels.getLabel("editarEstacionController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onClick$btnApagar(Event ev) {
|
||||
|
@ -166,4 +162,74 @@ public class EditarEstacionController extends MyGenericForwardComposer {
|
|||
Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick$btnAddConfSitef(Event e) {
|
||||
|
||||
if ( (cmbEmpresa.getSelectedItem() == null) || (txtNumEmpresa.getValue() == null) || (txtNumFilial.getValue() == null) || (txtNumPdv.getValue() == null) ) {
|
||||
Clients.alert(Labels.getLabel("editarEstacionController.MSG.sitef"),Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
final Integer empresaId = ((Empresa) cmbEmpresa.getSelectedItem().getValue()).getEmpresaId();
|
||||
|
||||
boolean empresaExiste = CollectionUtils.exists(estacionSitefList.getListData(), new Predicate() {
|
||||
|
||||
@Override
|
||||
public boolean evaluate(Object obj) {
|
||||
|
||||
EstacionSitef e = (EstacionSitef)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;
|
||||
}
|
||||
|
||||
EstacionSitef es =new EstacionSitef();
|
||||
es.setActivo(Boolean.TRUE);
|
||||
es.setEmpresa((Empresa) cmbEmpresa.getSelectedItem().getValue());
|
||||
es.setFecmodif(Calendar.getInstance().getTime());
|
||||
es.setEstacion(estacion);
|
||||
es.setNumempresa(txtNumEmpresa.getValue());
|
||||
es.setNumfilial(txtNumFilial.getValue());
|
||||
es.setNumpdv(txtNumPdv.getValue());
|
||||
es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
estacionSitefList.addItem(es);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onClick$btnRemConfSitef(Event e) {
|
||||
|
||||
if (estacionSitefList.getSelected() == null){
|
||||
return;
|
||||
}
|
||||
|
||||
EstacionSitef es = (EstacionSitef) estacionSitefList.getSelected();
|
||||
|
||||
estacionSitefList.removeItem(es);
|
||||
|
||||
if (es.getEstacionsitefId() != null){
|
||||
es.setFecmodif(Calendar.getInstance().getTime());
|
||||
es.setActivo(Boolean.FALSE);
|
||||
es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
estacionSitefList.addItemNovo(es);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<Empresa> getLsEmpresa() {
|
||||
return lsEmpresa;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
package com.rjconsultores.ventaboletos.web.utilerias;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.zkoss.zul.ListModelList;
|
||||
import org.zkoss.zul.Listbox;
|
||||
|
||||
|
@ -33,11 +32,21 @@ public class MyListbox extends Listbox {
|
|||
setVflex(Boolean.TRUE);
|
||||
}
|
||||
|
||||
|
||||
public boolean addItemNovo(Object item) {
|
||||
return this.modelList.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona um item na lista caso ele não esteja presente na lista
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
* @return - True se o item foi adicionado
|
||||
* @deprecated - Use o método addItemNovo
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean addItem(Object item) {
|
||||
boolean ok = false;
|
||||
if (!this.modelList.contains(item)) {
|
||||
|
@ -59,8 +68,15 @@ public class MyListbox extends Listbox {
|
|||
}
|
||||
}
|
||||
|
||||
public void removeItem(Object item) {
|
||||
this.modelList.remove(item);
|
||||
public Object removeItem(Object item) {
|
||||
int index = this.getSelectedIndex();
|
||||
|
||||
if (index != -1) {
|
||||
return this.modelList.remove(index);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public Object getSelected() {
|
||||
|
@ -74,11 +90,6 @@ public class MyListbox extends Listbox {
|
|||
}
|
||||
|
||||
public List<Object> getSelectedsItens() {
|
||||
// List<Object> selecteds = new ArrayList<Object>();
|
||||
// Set set = getSelectedItems();
|
||||
// Object[] os = set.toArray();
|
||||
// selecteds.addAll(Arrays.asList(os));
|
||||
|
||||
int index = this.getSelectedIndex();
|
||||
int qtd = this.getSelectedCount();
|
||||
List<Object> selecteds = new ArrayList<Object>();
|
||||
|
@ -98,4 +109,8 @@ public class MyListbox extends Listbox {
|
|||
public Object[] getData() {
|
||||
return this.modelList.toArray();
|
||||
}
|
||||
|
||||
public List getListData() {
|
||||
return this.modelList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.EstacionSitef;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Desenvolvimento
|
||||
*/
|
||||
public class EstacionSitefRender implements ListitemRenderer {
|
||||
|
||||
public void render(Listitem lstm, Object o) throws Exception {
|
||||
EstacionSitef es = (EstacionSitef) o;
|
||||
|
||||
if (!es.getActivo()){
|
||||
return;
|
||||
}
|
||||
|
||||
Listcell lc = new Listcell(es.getEmpresa().getNombempresa());
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(es.getNumempresa().toString());
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(es.getNumfilial().toString());
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(es.getNumpdv().toString());
|
||||
lc.setParent(lstm);
|
||||
|
||||
|
||||
lstm.setValue(es);
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
# <controler>. <id>. <propiedade> = XXX
|
||||
|
||||
#Versao do VentaBoleto:
|
||||
versao = ADM_20121214_1RC89
|
||||
versao = ADM_20121217_1RC90
|
||||
|
||||
# MSG Defaut:
|
||||
MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100
|
||||
|
@ -952,9 +952,7 @@ editarConfiguracionCategoriaController.MSG.necesitaDescuento = Necessita inform
|
|||
editarConfiguracionCategoriaController.MSG.necesitaMarca = Necessita informar uma marca.
|
||||
editarConfiguracionCategoriaController.MSG.necesitaMercado = Necessita informar um trecho.
|
||||
editarConfiguracionCategoriaController.MSG.necesitaClase = Necessita informar um tipo de classe.
|
||||
editarConfiguracionCategoriaController.lblImprimirPassagem.value = Impressão de Passagem
|
||||
editarConfiguracionCategoriaController.lblImprimePassagem.value = Imprimir
|
||||
editarConfiguracionCategoriaController.lblNaoImprimePassagem.value = Não Imprimir
|
||||
|
||||
|
||||
# Detener a pantalla de Pesquisa
|
||||
busquedaCatalogoDeParadaController.window.title = Localidade
|
||||
|
@ -2578,10 +2576,17 @@ editarEstacionController.pinPad = Pinpad com impresora própria
|
|||
editarEstacionController.MSG.suscribirOK = Estação Registrada com Sucesso.
|
||||
editarEstacionController.MSG.borrarPergunta = Eliminar Estação?
|
||||
editarEstacionController.MSG.borrarOK = Estação Excluida com Sucesso.
|
||||
editarEstacionController.btnAddSitef.tooltiptext = Adicionar Conf. Sitef
|
||||
editarEstacionController.btnBorrarSitef.tooltiptext = Remover Conf. Sitef
|
||||
editarEstacionController.empresa.label=Empresa
|
||||
editarEstacionController.numEmpresa.label=Cód. Empresa
|
||||
editarEstacionController.numFilial.label=Cód. Filial
|
||||
editarEstacionController.numPdv.label=Num. PDV
|
||||
|
||||
#Editar Estacion Sitef
|
||||
editarEstacionController.tab.label.sitef = SiTef
|
||||
editarEstacionController.MSG.sitef = Todos os campos da aba SiTef devem ser preenchidos
|
||||
editarEstacionController.MSG.sitef = Todos os campos do SiTef devem ser preenchidos
|
||||
editarEstacionController.MSG.empresaYaExiste= A empresa informada já está cadastrada
|
||||
editarEstacionController.lbNumEmpresa.value = Código da Empresa
|
||||
editarEstacionController.lbNumFilial.value = Código da Filial
|
||||
editarEstacionController.lbNumPdv.value = Númedo PDV
|
||||
|
|
|
@ -168,9 +168,7 @@
|
|||
tooltiptext="${c:l('editarConfiguracionCancelacionController.btnBorrarCorrida.tooltiptext')}" />
|
||||
</hbox>
|
||||
</toolbar>
|
||||
<listbox id="cancelacionCargoList"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||
vflex="true" multiple="false">
|
||||
<listbox id="cancelacionCargoList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox" vflex="true" multiple="false">
|
||||
<listhead sizable="true">
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
width="25%"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winEditarEstacion"?>
|
||||
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||
|
||||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<zk>
|
||||
<window id="winEditarEstacion" border="normal"
|
||||
apply="${editarEstacionController}" width="500px"
|
||||
contentStyle="overflow:auto"
|
||||
|
@ -115,23 +115,55 @@
|
|||
<column width="70%" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${c:l('editarEstacionController.empresa.label')}" />
|
||||
<combobox id="cmbEmpresa" width="90%"
|
||||
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||
mold="rounded" buttonVisible="true" model="@{winEditarEstacion$composer.lsEmpresa}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${c:l('editarEstacionController.lbNumEmpresa.value')}" />
|
||||
<intbox id="txtNumEmpresa" width="90%" maxlength="4"
|
||||
value="@{winEditarEstacion$composer.estacion.estacionSitefId.numempresa}"/>
|
||||
<intbox id="txtNumEmpresa" width="90%" maxlength="4" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${c:l('editarEstacionController.lbNumFilial.value')}" />
|
||||
<intbox id="txtNumFilial" width="90%" maxlength="4"
|
||||
value="@{winEditarEstacion$composer.estacion.estacionSitefId.numfilial}"/>
|
||||
<intbox id="txtNumFilial" width="90%" maxlength="4" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${c:l('editarEstacionController.lbNumPdv.value')}" />
|
||||
<intbox id="txtNumPdv" width="90%" maxlength="3"
|
||||
value="@{winEditarEstacion$composer.estacion.estacionSitefId.numpdv}"/>
|
||||
<intbox id="txtNumPdv" width="90%" maxlength="3" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<toolbar>
|
||||
<hbox spacing="5px" style="padding:1px"
|
||||
align="right">
|
||||
<button id="btnAddConfSitef" height="20"
|
||||
image="/gui/img/add.png" width="35px"
|
||||
tooltiptext="${c:l('editarEstacionController.btnAddSitef.tooltiptext')}" />
|
||||
<button id="btnRemConfSitef" height="20"
|
||||
image="/gui/img/remove.png" width="35px"
|
||||
tooltiptext="${c:l('editarEstacionController.btnBorrarSitef.tooltiptext')}" />
|
||||
</hbox>
|
||||
</toolbar>
|
||||
<listbox id="estacionSitefList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox" vflex="true" multiple="false"
|
||||
height="100px">
|
||||
<listhead sizable="true">
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
width="25%"
|
||||
label="${c:l('editarEstacionController.empresa.label')}"/>
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
width="25%"
|
||||
label="${c:l('editarEstacionController.numEmpresa.label')}" />
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
width="25%"
|
||||
label="${c:l('editarEstacionController.numFilial.label')}"/>
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
width="25%"
|
||||
label="${c:l('editarEstacionController.numPdv.label')}"/>
|
||||
|
||||
</listhead>
|
||||
</listbox>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
|
|
Loading…
Reference in New Issue