rodrigo 2013-03-02 17:54:25 +00:00
parent d03b6e0704
commit b5e825a13b
4 changed files with 104 additions and 94 deletions

View File

@ -29,7 +29,6 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Estacion; import com.rjconsultores.ventaboletos.entidad.Estacion;
import com.rjconsultores.ventaboletos.entidad.EstacionSitef; import com.rjconsultores.ventaboletos.entidad.EstacionSitef;
import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.EstacionService; import com.rjconsultores.ventaboletos.service.EstacionService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
@ -48,14 +47,13 @@ public class EditarEstacionController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Autowired @Autowired
private EstacionService estacionService; private EstacionService estacionService;
@Autowired
private EmpresaService empresaService;
private MyListbox estacionList; private MyListbox estacionList;
private MyListbox estacionSitefList; private MyListbox estacionSitefList;
private Combobox cmbEmpresa; private Combobox cmbEmpresa;
private Button btnApagar; private Button btnApagar;
private Textbox txtDescEstacion; private Textbox txtDescEstacion;
private Textbox txtDescMac; private Textbox txtDescMac;
private Textbox txtIpServidor;
private Longbox txtNumCaja; private Longbox txtNumCaja;
private Estacion estacion; private Estacion estacion;
private MyComboboxPuntoVenta cmbPuntoVenta; private MyComboboxPuntoVenta cmbPuntoVenta;
@ -74,11 +72,15 @@ public class EditarEstacionController extends MyGenericForwardComposer {
this.estacion = estacion; this.estacion = estacion;
} }
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
}
@Override @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp); super.doAfterCompose(comp);
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa(); lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
estacionSitefList.setItemRenderer(new EstacionSitefRender()); estacionSitefList.setItemRenderer(new EstacionSitefRender());
estacion = (Estacion) Executions.getCurrent().getArg().get("estacion"); estacion = (Estacion) Executions.getCurrent().getArg().get("estacion");
estacionList = (MyListbox) Executions.getCurrent().getArg().get("estacionList"); estacionList = (MyListbox) Executions.getCurrent().getArg().get("estacionList");
@ -100,7 +102,7 @@ public class EditarEstacionController extends MyGenericForwardComposer {
txtDescMac.setText(descMac.toUpperCase()); txtDescMac.setText(descMac.toUpperCase());
} }
lsEstacionSitef = estacion.getEstacionSitefList(); lsEstacionSitef = estacion.getEstacionSitefList();
estacionSitefList.setData(lsEstacionSitef); estacionSitefList.setData(lsEstacionSitef);
@ -116,7 +118,7 @@ public class EditarEstacionController extends MyGenericForwardComposer {
txtNumPdv.getValue(); txtNumPdv.getValue();
txtDescEstacion.getValue(); txtDescEstacion.getValue();
txtNumCaja.getValue(); txtNumCaja.getValue();
String descMac = txtDescMac.getText(); String descMac = txtDescMac.getText();
estacion.setActivo(Boolean.TRUE); estacion.setActivo(Boolean.TRUE);
@ -124,8 +126,6 @@ public class EditarEstacionController extends MyGenericForwardComposer {
estacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); estacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
estacion.setDescmac(estacionService.getDecimalMAC(descMac).toString()); estacion.setDescmac(estacionService.getDecimalMAC(descMac).toString());
try { try {
estacion.setEstacionSitefList(estacionSitefList.getListData()); estacion.setEstacionSitefList(estacionSitefList.getListData());
estacionService.suscribirActualizar(estacion); estacionService.suscribirActualizar(estacion);
@ -140,7 +140,7 @@ public class EditarEstacionController extends MyGenericForwardComposer {
Messagebox.show(e.getMessage(), Labels.getLabel("editarEstacionController.window.title"), Messagebox.show(e.getMessage(), Labels.getLabel("editarEstacionController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION); Messagebox.OK, Messagebox.EXCLAMATION);
} }
} }
public void onClick$btnApagar(Event ev) { public void onClick$btnApagar(Event ev) {
@ -169,33 +169,33 @@ public class EditarEstacionController extends MyGenericForwardComposer {
public void onClick$btnAddConfSitef(Event e) { public void onClick$btnAddConfSitef(Event e) {
if ( (cmbEmpresa.getSelectedItem() == null) || (txtNumEmpresa.getValue() == null) || (txtNumFilial.getValue() == null) || (txtNumPdv.getValue() == null) ) { if ((cmbEmpresa.getSelectedItem() == null) || (txtNumEmpresa.getValue() == null) || (txtNumFilial.getValue() == null) || (txtNumPdv.getValue() == null) || (txtIpServidor.getValue() == null)) {
Clients.alert(Labels.getLabel("editarEstacionController.MSG.sitef"),Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION); Clients.alert(Labels.getLabel("editarEstacionController.MSG.sitef"), Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION);
return; return;
} }
final Integer empresaId = ((Empresa) cmbEmpresa.getSelectedItem().getValue()).getEmpresaId(); final Integer empresaId = ((Empresa) cmbEmpresa.getSelectedItem().getValue()).getEmpresaId();
boolean empresaExiste = CollectionUtils.exists(estacionSitefList.getListData(), new Predicate() { boolean empresaExiste = CollectionUtils.exists(estacionSitefList.getListData(), new Predicate() {
@Override @Override
public boolean evaluate(Object obj) { public boolean evaluate(Object obj) {
EstacionSitef e = (EstacionSitef)obj; EstacionSitef e = (EstacionSitef) obj;
return (e.getActivo() && e.getEmpresa().getEmpresaId().equals(empresaId)); return (e.getActivo() && e.getEmpresa().getEmpresaId().equals(empresaId));
} }
}); });
if (empresaExiste){ if (empresaExiste) {
Clients.alert(Labels.getLabel("editarEstacionController.MSG.empresaYaExiste"),Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION); Clients.alert(Labels.getLabel("editarEstacionController.MSG.empresaYaExiste"), Labels.getLabel("editarEstacionController.window.title"), Messagebox.INFORMATION);
return; return;
} }
EstacionSitef es =new EstacionSitef(); EstacionSitef es = new EstacionSitef();
es.setActivo(Boolean.TRUE); es.setActivo(Boolean.TRUE);
es.setEmpresa((Empresa) cmbEmpresa.getSelectedItem().getValue()); es.setEmpresa((Empresa) cmbEmpresa.getSelectedItem().getValue());
es.setFecmodif(Calendar.getInstance().getTime()); es.setFecmodif(Calendar.getInstance().getTime());
@ -204,36 +204,28 @@ public class EditarEstacionController extends MyGenericForwardComposer {
es.setNumfilial(txtNumFilial.getValue()); es.setNumfilial(txtNumFilial.getValue());
es.setNumpdv(txtNumPdv.getValue()); es.setNumpdv(txtNumPdv.getValue());
es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
es.setIpServidor(txtIpServidor.getValue());
estacionSitefList.addItem(es);
estacionSitefList.addItem(es);
} }
public void onClick$btnRemConfSitef(Event e) { public void onClick$btnRemConfSitef(Event e) {
if (estacionSitefList.getSelected() == null){ if (estacionSitefList.getSelected() == null) {
return; return;
} }
EstacionSitef es = (EstacionSitef) estacionSitefList.getSelected(); EstacionSitef es = (EstacionSitef) estacionSitefList.getSelected();
estacionSitefList.removeSelectedItem(); estacionSitefList.removeSelectedItem();
if (es.getEstacionsitefId() != null){ if (es.getEstacionsitefId() != null) {
es.setFecmodif(Calendar.getInstance().getTime()); es.setFecmodif(Calendar.getInstance().getTime());
es.setActivo(Boolean.FALSE); es.setActivo(Boolean.FALSE);
es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
estacionSitefList.addItemNovo(es); estacionSitefList.addItemNovo(es);
} }
}
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
} }
} }

View File

@ -11,31 +11,33 @@ import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.entidad.EstacionSitef; import com.rjconsultores.ventaboletos.entidad.EstacionSitef;
/** /**
* *
* @author Desenvolvimento * @author Desenvolvimento
*/ */
public class EstacionSitefRender implements ListitemRenderer { public class EstacionSitefRender implements ListitemRenderer {
public void render(Listitem lstm, Object o) throws Exception { public void render(Listitem lstm, Object o) throws Exception {
EstacionSitef es = (EstacionSitef) o; EstacionSitef es = (EstacionSitef) o;
if (!es.getActivo()){
return;
}
Listcell lc = new Listcell(es.getEmpresa().getNombempresa()); if (!es.getActivo()) {
lc.setParent(lstm); return;
}
lc = new Listcell(es.getNumempresa().toString()); Listcell lc = new Listcell(es.getEmpresa().getNombempresa());
lc.setParent(lstm); lc.setParent(lstm);
lc = new Listcell(es.getNumfilial().toString());
lc.setParent(lstm);
lc = new Listcell(es.getNumpdv().toString());
lc.setParent(lstm);
lc = new Listcell(es.getNumempresa().toString());
lc.setParent(lstm);
lstm.setValue(es); lc = new Listcell(es.getNumfilial().toString());
} lc.setParent(lstm);
lc = new Listcell(es.getNumpdv().toString());
lc.setParent(lstm);
lc = new Listcell(es.getIpServidor());
lc.setParent(lstm);
lstm.setValue(es);
}
} }

View File

@ -2632,6 +2632,7 @@ editarEstacionController.empresa.label=Empresa
editarEstacionController.numEmpresa.label=Cód. Empresa editarEstacionController.numEmpresa.label=Cód. Empresa
editarEstacionController.numFilial.label=Cód. Filial editarEstacionController.numFilial.label=Cód. Filial
editarEstacionController.numPdv.label=Num. PDV editarEstacionController.numPdv.label=Num. PDV
editarEstacionController.txtIpServidor.value = IP Sitef
#Editar Estacion Sitef #Editar Estacion Sitef
editarEstacionController.tab.label.sitef = SiTef editarEstacionController.tab.label.sitef = SiTef

View File

@ -25,8 +25,10 @@
</toolbar> </toolbar>
<tabbox> <tabbox>
<tabs width="200px"> <tabs width="200px">
<tab label="${c:l('editarEstacionController.window.title')}" /> <tab
<tab label="${c:l('editarEstacionController.tab.label.sitef')}" /> label="${c:l('editarEstacionController.window.title')}" />
<tab
label="${c:l('editarEstacionController.tab.label.sitef')}" />
</tabs> </tabs>
<tabpanels> <tabpanels>
<tabpanel> <tabpanel>
@ -39,8 +41,8 @@
<row> <row>
<label <label
value="${c:l('busquedaEstacionController.lhDescEstacion.label')}" /> value="${c:l('busquedaEstacionController.lhDescEstacion.label')}" />
<textbox id="txtDescEstacion" width="90%" rows="3" <textbox id="txtDescEstacion"
constraint="no empty" maxlength="60" width="90%" rows="3" constraint="no empty" maxlength="60"
value="@{winEditarEstacion$composer.estacion.descestacion}" value="@{winEditarEstacion$composer.estacion.descestacion}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" /> use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
</row> </row>
@ -62,28 +64,29 @@
<row> <row>
<label <label
value="${c:l('busquedaEstacionController.nomeImpressora.label')}" /> value="${c:l('busquedaEstacionController.nomeImpressora.label')}" />
<textbox id="txtNomImpressoara" width="90%" <textbox id="txtNomImpressoara"
maxlength="20" width="90%" maxlength="20"
value="@{winEditarEstacion$composer.estacion.nomeImpressora}" /> value="@{winEditarEstacion$composer.estacion.nomeImpressora}" />
</row> </row>
<row> <row>
<label <label
value="${c:l('busquedaEstacionController.nomeArquivoLayout.label')}" /> value="${c:l('busquedaEstacionController.nomeArquivoLayout.label')}" />
<textbox id="txtNomeArquivoLayout" width="90%" <textbox id="txtNomeArquivoLayout"
maxlength="20" width="90%" maxlength="20"
value="@{winEditarEstacion$composer.estacion.nomeArquivoLayout}" /> value="@{winEditarEstacion$composer.estacion.nomeArquivoLayout}" />
</row> </row>
<row> <row>
<label <label
value="${c:l('busquedaEstacionController.nomeImpressoraRelatorio.label')}" /> value="${c:l('busquedaEstacionController.nomeImpressoraRelatorio.label')}" />
<textbox id="txtNomImpressoaraRelatorio" width="90%" <textbox id="txtNomImpressoaraRelatorio"
maxlength="20" width="90%" maxlength="20"
value="@{winEditarEstacion$composer.estacion.nomeImpressoraRelatorio}" /> value="@{winEditarEstacion$composer.estacion.nomeImpressoraRelatorio}" />
</row> </row>
<row> <row>
<label <label
value="${c:l('busquedaEstacionController.lhPuntoVenta.label')}" /> value="${c:l('busquedaEstacionController.lhPuntoVenta.label')}" />
<combobox id="cmbPuntoVenta" constraint="no empty" <combobox id="cmbPuntoVenta"
constraint="no empty"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta"
initialValue="@{winEditarEstacion$composer.estacion.puntoVenta}" initialValue="@{winEditarEstacion$composer.estacion.puntoVenta}"
selectedItem="@{winEditarEstacion$composer.estacion.puntoVenta}" selectedItem="@{winEditarEstacion$composer.estacion.puntoVenta}"
@ -104,7 +107,7 @@
label="${c:l('editarEstacionController.IndTipo.4')}" /> label="${c:l('editarEstacionController.IndTipo.4')}" />
</combobox> </combobox>
</row> </row>
</rows> </rows>
</grid> </grid>
</tabpanel> </tabpanel>
@ -116,22 +119,36 @@
</columns> </columns>
<rows> <rows>
<row> <row>
<label value="${c:l('editarEstacionController.empresa.label')}" /> <label
<combobox id="cmbEmpresa" width="90%" value="${c:l('editarEstacionController.empresa.label')}" />
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" <combobox id="cmbEmpresa" width="90%"
mold="rounded" buttonVisible="true" model="@{winEditarEstacion$composer.lsEmpresa}"/> use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true"
model="@{winEditarEstacion$composer.lsEmpresa}" />
</row> </row>
<row> <row>
<label value="${c:l('editarEstacionController.lbNumEmpresa.value')}" /> <label
<intbox id="txtNumEmpresa" width="90%" maxlength="4" /> value="${c:l('editarEstacionController.lbNumEmpresa.value')}" />
<intbox id="txtNumEmpresa" width="90%"
maxlength="4" />
</row> </row>
<row> <row>
<label value="${c:l('editarEstacionController.lbNumFilial.value')}" /> <label
<intbox id="txtNumFilial" width="90%" maxlength="4" /> value="${c:l('editarEstacionController.lbNumFilial.value')}" />
<intbox id="txtNumFilial" width="90%"
maxlength="4" />
</row> </row>
<row> <row>
<label value="${c:l('editarEstacionController.lbNumPdv.value')}" /> <label
<intbox id="txtNumPdv" width="90%" maxlength="3" /> value="${c:l('editarEstacionController.lbNumPdv.value')}" />
<intbox id="txtNumPdv" width="90%"
maxlength="3" />
</row>
<row>
<label
value="${c:l('editarEstacionController.txtIpServidor.value')}" />
<textbox id="txtIpServidor" width="90%"
maxlength="17" />
</row> </row>
</rows> </rows>
</grid> </grid>
@ -146,22 +163,20 @@
tooltiptext="${c:l('editarEstacionController.btnBorrarSitef.tooltiptext')}" /> tooltiptext="${c:l('editarEstacionController.btnBorrarSitef.tooltiptext')}" />
</hbox> </hbox>
</toolbar> </toolbar>
<listbox id="estacionSitefList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox" vflex="true" multiple="false" <listbox id="estacionSitefList"
height="100px"> use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="false" height="100px">
<listhead sizable="true"> <listhead sizable="true">
<listheader image="/gui/img/create_doc.gif" <listheader image="/gui/img/create_doc.gif"
width="25%" label="${c:l('editarEstacionController.empresa.label')}" />
label="${c:l('editarEstacionController.empresa.label')}"/>
<listheader image="/gui/img/create_doc.gif" <listheader image="/gui/img/create_doc.gif"
width="25%"
label="${c:l('editarEstacionController.numEmpresa.label')}" /> label="${c:l('editarEstacionController.numEmpresa.label')}" />
<listheader image="/gui/img/create_doc.gif" <listheader image="/gui/img/create_doc.gif"
width="25%" label="${c:l('editarEstacionController.numFilial.label')}" />
label="${c:l('editarEstacionController.numFilial.label')}"/>
<listheader image="/gui/img/create_doc.gif" <listheader image="/gui/img/create_doc.gif"
width="25%" label="${c:l('editarEstacionController.numPdv.label')}" />
label="${c:l('editarEstacionController.numPdv.label')}"/> <listheader image="/gui/img/create_doc.gif"
label="${c:l('editarEstacionController.txtIpServidor.value')}" />
</listhead> </listhead>
</listbox> </listbox>
</tabpanel> </tabpanel>