revert de alteração pois a aba autobus é utilizada no ugy fixes bug#7639
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@59000 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
240614c4b0
commit
d6d0d1a5c8
|
@ -5,7 +5,9 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -18,12 +20,15 @@ import org.zkoss.zk.ui.event.Event;
|
|||
import org.zkoss.zul.Button;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Autobus;
|
||||
import com.rjconsultores.ventaboletos.entidad.AutobusDoc;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.MarcaAutobus;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus;
|
||||
import com.rjconsultores.ventaboletos.service.AutobusDocService;
|
||||
import com.rjconsultores.ventaboletos.service.AutobusService;
|
||||
import com.rjconsultores.ventaboletos.service.CiudadService;
|
||||
|
@ -32,10 +37,17 @@ import com.rjconsultores.ventaboletos.service.CorridaService;
|
|||
import com.rjconsultores.ventaboletos.service.DiagramaAutobusService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.MarcaAutobusService;
|
||||
import com.rjconsultores.ventaboletos.service.TipoDocAutobusService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyDatebox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderAutobusDoc;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
*/
|
||||
@Controller("editarAutobusController")
|
||||
@Scope("prototype")
|
||||
public class EditarAutobusController extends MyGenericForwardComposer {
|
||||
|
@ -57,19 +69,25 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
@Autowired
|
||||
private CiudadService ciudadService;
|
||||
@Autowired
|
||||
private TipoDocAutobusService tipoDocAutobusService;
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
|
||||
private List<DiagramaAutobus> lsDiagramaAutobus;
|
||||
private List<Ciudad> lsCiudad;
|
||||
private List<ClaseServicio> lsClaseServicio;
|
||||
private List<MarcaAutobus> lsMarcas;
|
||||
private List<TipoDocAutobus> lsTipoDocAutobus;
|
||||
private List<Empresa> lsEmpresas;
|
||||
private Autobus autobus;
|
||||
private MyListbox autobusList;
|
||||
private MyListbox docsList;
|
||||
private MyDatebox fecCaducidad;
|
||||
private Textbox txtNome;
|
||||
private Textbox txtNumvagon;
|
||||
private Combobox cmbDiagramaAutobus;
|
||||
private Combobox cmbDiagramaAutobusPiso;
|
||||
private Combobox cmbTipoDocAutobus;
|
||||
private Combobox cmbMarcas;
|
||||
private Combobox cmbClaseServicio;
|
||||
private Combobox cmbCiudad;
|
||||
|
@ -141,6 +159,14 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
this.lsMarcas = lsMarcas;
|
||||
}
|
||||
|
||||
public List<TipoDocAutobus> getLsTipoDocAutobus() {
|
||||
return lsTipoDocAutobus;
|
||||
}
|
||||
|
||||
public void setLsTipoDocAutobus(List<TipoDocAutobus> lsTipoDocAutobus) {
|
||||
this.lsTipoDocAutobus = lsTipoDocAutobus;
|
||||
}
|
||||
|
||||
public List<Empresa> getLsEmpresas() {
|
||||
return lsEmpresas;
|
||||
}
|
||||
|
@ -155,6 +181,7 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
lsCiudad = ciudadService.obtenerTodos();
|
||||
lsClaseServicio = claseServicioService.obtenerTodos();
|
||||
lsMarcas = marcaAutobusService.obtenerTodos();
|
||||
lsTipoDocAutobus = tipoDocAutobusService.obtenerTodos();
|
||||
lsEmpresas = empresaService.obtenerTodos();
|
||||
|
||||
autobus = (Autobus) Executions.getCurrent().getArg().get("autobus");
|
||||
|
@ -162,8 +189,11 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
docsList.setItemRenderer(new RenderAutobusDoc());
|
||||
|
||||
if (autobus.getAutobusId() != null){
|
||||
autobus.setAutobusDocList(autobusDocService.obtenerPorAutobus(autobus));
|
||||
docsList.setData(autobus.getAutobusDocList());
|
||||
}
|
||||
|
||||
txtNome.focus();
|
||||
|
@ -173,6 +203,32 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
public void onClick$btnAddDoc(Event ev) throws InterruptedException {
|
||||
Date fec = fecCaducidad.getValue();
|
||||
AutobusDoc doc = new AutobusDoc();
|
||||
doc.setAutobus(autobus);
|
||||
doc.setFechaCaducidad(fec);
|
||||
doc.setTipoDocAutobus((TipoDocAutobus)cmbTipoDocAutobus.getSelectedItem().getValue());
|
||||
doc.setActivo(Boolean.TRUE);
|
||||
doc.setFecmodif(Calendar.getInstance().getTime());
|
||||
doc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
docsList.addItemNovo(doc);
|
||||
}
|
||||
|
||||
public void onClick$btnRemDoc(Event ev) throws InterruptedException {
|
||||
AutobusDoc doc = (AutobusDoc) docsList.getSelected();
|
||||
docsList.removeSelectedItem();
|
||||
|
||||
if (doc.getAutobusDocId() != null) {
|
||||
doc.setFecmodif(Calendar.getInstance().getTime());
|
||||
doc.setActivo(Boolean.FALSE);
|
||||
doc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
docsList.addItemNovo(doc);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||
txtNome.getValue();
|
||||
txtNumvagon.getValue();
|
||||
|
@ -182,25 +238,21 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
autobus.setActivo(Boolean.TRUE);
|
||||
autobus.setFecmodif(Calendar.getInstance().getTime());
|
||||
autobus.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
autobus.setEmpresa(cmbEmpresas.getSelectedItem() == null ? null
|
||||
: (Empresa) cmbEmpresas.getSelectedItem().getValue());
|
||||
autobus.setMarcaAutobus(cmbMarcas.getSelectedItem() == null ? null
|
||||
: (MarcaAutobus) cmbMarcas.getSelectedItem().getValue());
|
||||
autobus.setCiudad(cmbCiudad.getSelectedItem() == null ? null
|
||||
: (Ciudad) cmbCiudad.getSelectedItem().getValue());
|
||||
autobus.setClaseServicio(cmbClaseServicio.getSelectedItem() == null ? null
|
||||
: (ClaseServicio) cmbClaseServicio.getSelectedItem().getValue());
|
||||
autobus.setDiagramaAutobusPiso(cmbDiagramaAutobusPiso.getSelectedItem() == null ? null
|
||||
: (DiagramaAutobus) cmbDiagramaAutobusPiso.getSelectedItem().getValue());
|
||||
autobus.setEmpresa(cmbEmpresas.getSelectedItem() == null ? null : (Empresa)cmbEmpresas.getSelectedItem().getValue());
|
||||
autobus.setMarcaAutobus(cmbMarcas.getSelectedItem() == null ? null : (MarcaAutobus)cmbMarcas.getSelectedItem().getValue());
|
||||
autobus.setCiudad(cmbCiudad.getSelectedItem() == null ? null : (Ciudad)cmbCiudad.getSelectedItem().getValue());
|
||||
autobus.setClaseServicio(cmbClaseServicio.getSelectedItem() == null ? null : (ClaseServicio)cmbClaseServicio.getSelectedItem().getValue());
|
||||
autobus.setDiagramaAutobusPiso(cmbDiagramaAutobusPiso.getSelectedItem() == null ? null : (DiagramaAutobus)cmbDiagramaAutobusPiso.getSelectedItem().getValue());
|
||||
|
||||
List<Autobus> lsAutobus = autobusService.buscar(autobus.getNumautobus(),
|
||||
autobus.setAutobusDocList(docsList.getListData());
|
||||
List<Autobus> lsAutobus =
|
||||
autobusService.buscar(autobus.getNumautobus(),
|
||||
autobus.getDiagramaAutobus());
|
||||
|
||||
boolean podeSalvar = false;
|
||||
if (lsAutobus.isEmpty()) {
|
||||
podeSalvar = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (autobus.getAutobusId() != null) {
|
||||
for (Autobus c : lsAutobus) {
|
||||
if (c.getAutobusId().equals(autobus.getAutobusId())) {
|
||||
|
@ -211,32 +263,32 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
}
|
||||
if (!podeSalvar) {
|
||||
|
||||
Messagebox.show(Labels.getLabel("MSG.Registro.Existe"),
|
||||
Labels.getLabel("editarAutobusController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
}
|
||||
else {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("MSG.Registro.Existe"),
|
||||
Labels.getLabel("editarAutobusController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
} else {
|
||||
if (autobus.getAutobusId() == null) {
|
||||
autobusService.suscribir(autobus);
|
||||
autobusList.addItem(autobus);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
autobusService.actualizacion(autobus);
|
||||
autobusList.updateItem(autobus);
|
||||
}
|
||||
|
||||
Messagebox.show(Labels.getLabel("editarAutobusController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarAutobusController.window.title"), Messagebox.OK,
|
||||
Messagebox.INFORMATION);
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarAutobusController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarAutobusController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
closeWindow();
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
log.error("editarAutobusController: " + ex);
|
||||
Messagebox.show(Labels.getLabel("MSG.Error"),
|
||||
Labels.getLabel("editarAutobusController.window.title"), Messagebox.OK,
|
||||
Messagebox.ERROR);
|
||||
Messagebox.show(
|
||||
Labels.getLabel("MSG.Error"),
|
||||
Labels.getLabel("editarAutobusController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,31 +301,27 @@ public class EditarAutobusController extends MyGenericForwardComposer {
|
|||
|
||||
if (resp == Messagebox.YES) {
|
||||
|
||||
if ((corridaService.buscarPorAutobusCorridasFuturas(autobus.getDiagramaAutobus())
|
||||
.isEmpty())
|
||||
&& (corridaService
|
||||
.buscarPorRolOperativoCorridasFuturas(autobus.getDiagramaAutobus())
|
||||
.isEmpty())) {
|
||||
if ((corridaService.buscarPorAutobusCorridasFuturas(autobus.getDiagramaAutobus()).isEmpty()) &&
|
||||
(corridaService.buscarPorRolOperativoCorridasFuturas(autobus.getDiagramaAutobus()).isEmpty())) {
|
||||
|
||||
autobusService.borrar(autobus);
|
||||
|
||||
Messagebox.show(Labels.getLabel("editarAutobusController.MSG.borrarOK"),
|
||||
Labels.getLabel("editarAutobusController.window.title"), Messagebox.OK,
|
||||
Messagebox.INFORMATION);
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarAutobusController.MSG.borrarOK"),
|
||||
Labels.getLabel("editarAutobusController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
autobusList.removeItem(autobus);
|
||||
|
||||
closeWindow();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarDiagramaAutobusController.MSG.Corrida.Futura"),
|
||||
Labels.getLabel("editarDiagramaAutobusController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
log.error(ex);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue