fixes bug #7459
Merge com Branch mantis7459 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@58622 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
96ec9f4c31
commit
0c82f0766e
|
@ -0,0 +1,507 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
import org.zkoss.zkplus.databind.DataBinder;
|
||||||
|
import org.zkoss.zkplus.spring.SpringUtil;
|
||||||
|
import org.zkoss.zul.Column;
|
||||||
|
import org.zkoss.zul.Columns;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Grid;
|
||||||
|
import org.zkoss.zul.Hbox;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Label;
|
||||||
|
import org.zkoss.zul.ListModelList;
|
||||||
|
import org.zkoss.zul.RendererCtrl;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.RowRenderer;
|
||||||
|
import org.zkoss.zul.Spinner;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OrgaoTramo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.HoraSistema;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grid con la representacion de los tramos y secuencias de la ruta
|
||||||
|
*
|
||||||
|
* @author gleimar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GridCombinacionTramoRutaCoeficiente extends Grid implements RowRenderer, RendererCtrl {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private List<Via> lsVias;
|
||||||
|
private List<CoeficienteTarifa> lsCoeficientes;
|
||||||
|
private List<SecuenciaRutaTramoCoeficienteVO> lsSecuenciaRutaTramoCoeficienteVO;
|
||||||
|
private ClaseServicio claseServicio;
|
||||||
|
private OrgaoConcedente orgaoConcedente;
|
||||||
|
private DataBinder dataBinder;
|
||||||
|
private static Logger log = Logger.getLogger(GridCombinacionTramoRutaCoeficiente.class);
|
||||||
|
|
||||||
|
public GridCombinacionTramoRutaCoeficiente() {
|
||||||
|
lsSecuenciaRutaTramoCoeficienteVO = new ArrayList<SecuenciaRutaTramoCoeficienteVO>();
|
||||||
|
this.setRowRenderer(this);
|
||||||
|
this.appendChild(generarColumns());
|
||||||
|
dataBinder = new DataBinder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informa la lista de vias disponibles
|
||||||
|
*
|
||||||
|
* @param lsVias
|
||||||
|
*/
|
||||||
|
public void setLsVias(List<Via> lsVias) {
|
||||||
|
this.lsVias = lsVias;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cuál es la clase de servicio confiugrada
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ClaseServicio getClaseServicio() {
|
||||||
|
return claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica cuál es la clase de servicio usada para hacer la búsqueda de los tramos
|
||||||
|
*
|
||||||
|
* @param claseServicio
|
||||||
|
*/
|
||||||
|
public void setClaseServicio(ClaseServicio claseServicio) {
|
||||||
|
this.claseServicio = claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrgaoConcedente getOrgaoConcedente() {
|
||||||
|
return orgaoConcedente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) {
|
||||||
|
this.orgaoConcedente = orgaoConcedente;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ListModelList getListViaCombobox() {
|
||||||
|
return new ListModelList(lsVias);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ListModelList getListCoeficienteCombobox() {
|
||||||
|
return new ListModelList(lsCoeficientes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limpia los registros que existen y agrega todos
|
||||||
|
*
|
||||||
|
* @param lsSecuenciaRutaTramoCoeficienteVO
|
||||||
|
*/
|
||||||
|
public void agregarTodos(List<SecuenciaRutaTramoCoeficienteVO> lsSecuenciaRutaTramoCoeficienteVO) {
|
||||||
|
this.lsSecuenciaRutaTramoCoeficienteVO.clear();
|
||||||
|
this.lsSecuenciaRutaTramoCoeficienteVO.addAll(lsSecuenciaRutaTramoCoeficienteVO);
|
||||||
|
|
||||||
|
actualizaModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Columns generarColumns() {
|
||||||
|
Columns columns = new Columns();
|
||||||
|
|
||||||
|
Column columnSecuencia = new Column("#");
|
||||||
|
columnSecuencia.setWidth("1%");
|
||||||
|
columns.appendChild(columnSecuencia);
|
||||||
|
|
||||||
|
Column columnOrigen = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnOrigen.label"));
|
||||||
|
columnOrigen.setWidth("20%");
|
||||||
|
columns.appendChild(columnOrigen);
|
||||||
|
|
||||||
|
Column columnDestino = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnDestino.label"));
|
||||||
|
columnDestino.setWidth("20%");
|
||||||
|
columns.appendChild(columnDestino);
|
||||||
|
|
||||||
|
Column columnVia = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnVia.label"));
|
||||||
|
columnVia.setWidth("15%");
|
||||||
|
columns.appendChild(columnVia);
|
||||||
|
|
||||||
|
Column kmsReal = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnKmsReal.label"));
|
||||||
|
kmsReal.setWidth("6%");
|
||||||
|
columns.appendChild(kmsReal);
|
||||||
|
|
||||||
|
Column tiempoRecorrido = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnTiempoRecorrido.label"));
|
||||||
|
tiempoRecorrido.setWidth("10%");
|
||||||
|
columns.appendChild(tiempoRecorrido);
|
||||||
|
|
||||||
|
Column columnIDTramo = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnIDTramo.label"));
|
||||||
|
columnSecuencia.setWidth("6%");
|
||||||
|
columns.appendChild(columnIDTramo);
|
||||||
|
|
||||||
|
Column columnCoeficiente1 = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnCoeficiente1.label"));
|
||||||
|
columnCoeficiente1.setWidth("12%");
|
||||||
|
columns.appendChild(columnCoeficiente1);
|
||||||
|
|
||||||
|
Column columnKmCoeficiente1 = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnKmCoeficiente1.label"));
|
||||||
|
columnKmCoeficiente1.setWidth("5%");
|
||||||
|
columns.appendChild(columnKmCoeficiente1);
|
||||||
|
|
||||||
|
Column columnCoeficiente2 = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnCoeficiente2.label"));
|
||||||
|
columnCoeficiente2.setWidth("12%");
|
||||||
|
columns.appendChild(columnCoeficiente2);
|
||||||
|
|
||||||
|
Column columnKmCoeficiente2 = new Column(Labels.getLabel("gridCombinacionTramoRuta.columnKmCoeficiente2.label"));
|
||||||
|
columnKmCoeficiente2.setWidth("5%");
|
||||||
|
columns.appendChild(columnKmCoeficiente2);
|
||||||
|
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Row row, Object obj) throws Exception {
|
||||||
|
final SecuenciaRutaTramoCoeficienteVO secuenciaRutaTramoCoeficienteVO = (SecuenciaRutaTramoCoeficienteVO) obj;
|
||||||
|
// binder row->bean
|
||||||
|
dataBinder.bindBean(row.getUuid(), secuenciaRutaTramoCoeficienteVO);
|
||||||
|
|
||||||
|
// Cell secuencia
|
||||||
|
Intbox ibxSumSecuencia = new Intbox(secuenciaRutaTramoCoeficienteVO.getSecuencia());
|
||||||
|
ibxSumSecuencia.setWidth("50%");
|
||||||
|
ibxSumSecuencia.setReadonly(true);
|
||||||
|
row.appendChild(ibxSumSecuencia);
|
||||||
|
|
||||||
|
// Cell Origen
|
||||||
|
String strOrigem = secuenciaRutaTramoCoeficienteVO.getOrigen().getCveparada() + " - " + secuenciaRutaTramoCoeficienteVO.getOrigen().getDescparada();
|
||||||
|
Label lblOrigen = new Label(strOrigem);
|
||||||
|
lblOrigen.setWidth("80%");
|
||||||
|
row.appendChild(lblOrigen);
|
||||||
|
|
||||||
|
// Cell Destino
|
||||||
|
String strDestino = secuenciaRutaTramoCoeficienteVO.getDestino().getCveparada() + " - " + secuenciaRutaTramoCoeficienteVO.getDestino().getDescparada();
|
||||||
|
Label lblDestino = new Label(strDestino);
|
||||||
|
lblDestino.setWidth("80%");
|
||||||
|
row.appendChild(lblDestino);
|
||||||
|
|
||||||
|
// son creados antes pues el cboVia los estan ocupando
|
||||||
|
final MyCustomTextboxDecimal dKmsReal = new MyCustomTextboxDecimal((secuenciaRutaTramoCoeficienteVO.getKmReal() == null) ? BigDecimal.ZERO : secuenciaRutaTramoCoeficienteVO.getKmReal());
|
||||||
|
dKmsReal.setWidth("90%");
|
||||||
|
|
||||||
|
final Spinner spHora = new Spinner();
|
||||||
|
final Spinner spMinuto = new Spinner();
|
||||||
|
final Label lblID = new Label("");
|
||||||
|
|
||||||
|
// Campos coeficientes tarifario
|
||||||
|
final Combobox cboCoeficiente1 = new Combobox();
|
||||||
|
// final Intbox ibxKm1 = new Intbox();
|
||||||
|
final MyCustomTextboxDecimal ibxKm1 = new MyCustomTextboxDecimal();
|
||||||
|
|
||||||
|
final Combobox cboCoeficiente2 = new Combobox();
|
||||||
|
// final Intbox ibxKm2 = new Intbox();
|
||||||
|
final MyCustomTextboxDecimal ibxKm2 = new MyCustomTextboxDecimal();
|
||||||
|
|
||||||
|
// Cell Via
|
||||||
|
final Combobox cboVia = new Combobox();
|
||||||
|
cboVia.setId(cboVia.getUuid());
|
||||||
|
cboVia.setReadonly(true);
|
||||||
|
ListModelList listModelList = getListViaCombobox();
|
||||||
|
if (secuenciaRutaTramoCoeficienteVO.getVia() != null) {
|
||||||
|
listModelList.addSelection(secuenciaRutaTramoCoeficienteVO.getVia());
|
||||||
|
}
|
||||||
|
cboVia.setModel(listModelList);
|
||||||
|
cboVia.setConstraint("no empty");
|
||||||
|
cboVia.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event evt) throws Exception {
|
||||||
|
if (cboVia.getSelectedItem() != null) {
|
||||||
|
|
||||||
|
BigDecimal kmRealAntigo = secuenciaRutaTramoCoeficienteVO.getKmReal();
|
||||||
|
HoraSistema tiempoRecorridoAntigo = secuenciaRutaTramoCoeficienteVO.getTiempoRecorrido();
|
||||||
|
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setVia((Via) cboVia.getSelectedItem().getValue());
|
||||||
|
llenarTramo(secuenciaRutaTramoCoeficienteVO);
|
||||||
|
|
||||||
|
boolean tramoEditable = (secuenciaRutaTramoCoeficienteVO.getTramoId() == null);
|
||||||
|
boolean tramoCoeficienteEditable = (secuenciaRutaTramoCoeficienteVO.getOrgaoTramoId() == null);
|
||||||
|
boolean tramoServicioEditable = (secuenciaRutaTramoCoeficienteVO.getTramoServicioId() == null);
|
||||||
|
|
||||||
|
if (!tramoEditable) {// cuando el tramo no es editable, es porque ya existe. Entonces lleno la pantalla con los nuevos valores
|
||||||
|
dKmsReal.setValueBigDecimal(secuenciaRutaTramoCoeficienteVO.getKmReal());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmReal(kmRealAntigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
lblID.setValue((secuenciaRutaTramoCoeficienteVO.getTramoId() != null) ? secuenciaRutaTramoCoeficienteVO.getTramoId().toString() : "");
|
||||||
|
|
||||||
|
if (!tramoServicioEditable) {// cuando el tramoServicio no es editable, es porque ya existe. Entonces lleno la pantalla con los nuevos valores
|
||||||
|
spHora.setValue(secuenciaRutaTramoCoeficienteVO.getTiempoRecorrido().getHora());
|
||||||
|
spMinuto.setValue(secuenciaRutaTramoCoeficienteVO.getTiempoRecorrido().getMinuto());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTiempoRecorrido(tiempoRecorridoAntigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tramoCoeficienteEditable) {
|
||||||
|
cboCoeficiente1.setText(secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa1().getDescCoeficiente());
|
||||||
|
ibxKm1.setValueBigDecimal(secuenciaRutaTramoCoeficienteVO.getKmCoeficiente1());
|
||||||
|
|
||||||
|
cboCoeficiente2.setSelectedIndex(-1);
|
||||||
|
ibxKm2.setValueBigDecimal(BigDecimal.ZERO);
|
||||||
|
|
||||||
|
if (secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa2() != null) {
|
||||||
|
cboCoeficiente2.setText(secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa2().getDescCoeficiente());
|
||||||
|
ibxKm2.setValueBigDecimal(secuenciaRutaTramoCoeficienteVO.getKmCoeficiente2());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dKmsReal.setReadonly(!tramoEditable);
|
||||||
|
spHora.setReadonly(!tramoServicioEditable);
|
||||||
|
spHora.setButtonVisible(tramoServicioEditable);
|
||||||
|
spMinuto.setReadonly(!tramoServicioEditable);
|
||||||
|
spMinuto.setButtonVisible(tramoServicioEditable);
|
||||||
|
cboCoeficiente1.setDisabled(!tramoCoeficienteEditable);
|
||||||
|
ibxKm1.setReadonly(!tramoCoeficienteEditable);
|
||||||
|
cboCoeficiente2.setDisabled(!tramoCoeficienteEditable);
|
||||||
|
ibxKm2.setReadonly(!tramoCoeficienteEditable);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
row.appendChild(cboVia);
|
||||||
|
|
||||||
|
boolean esTramoEditable = (secuenciaRutaTramoCoeficienteVO.getTramoId() == null);
|
||||||
|
boolean esTramoServicioEditable = (secuenciaRutaTramoCoeficienteVO.getTramoServicioId() == null);
|
||||||
|
boolean esTramoCoeficienteEditable = (secuenciaRutaTramoCoeficienteVO.getOrgaoTramoId() == null);
|
||||||
|
|
||||||
|
// Cell Kms Real
|
||||||
|
dKmsReal.setReadonly(!esTramoEditable);
|
||||||
|
dataBinder.addBinding(dKmsReal, "value", row.getUuid() + ".kmReal", null, null, "save",
|
||||||
|
"com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter", null, null, null);
|
||||||
|
row.appendChild(dKmsReal);
|
||||||
|
|
||||||
|
// Cell Tiempo Recorrido
|
||||||
|
Hbox hbox = new Hbox();
|
||||||
|
|
||||||
|
spHora.setWidth("40px");
|
||||||
|
spHora.setConstraint("max 99,no negative,no empty");
|
||||||
|
spHora.setReadonly(!esTramoServicioEditable);
|
||||||
|
spHora.setButtonVisible(esTramoServicioEditable);
|
||||||
|
|
||||||
|
hbox.appendChild(spHora);
|
||||||
|
Label lbl = new Label(":");
|
||||||
|
hbox.appendChild(lbl);
|
||||||
|
|
||||||
|
spMinuto.setWidth("40px");
|
||||||
|
spMinuto.setConstraint("max 59,no negative,no empty");
|
||||||
|
spMinuto.setReadonly(!esTramoServicioEditable);
|
||||||
|
spMinuto.setButtonVisible(esTramoServicioEditable);
|
||||||
|
hbox.appendChild(spMinuto);
|
||||||
|
|
||||||
|
if (secuenciaRutaTramoCoeficienteVO.getTiempoRecorrido() != null) {
|
||||||
|
HoraSistema hora = secuenciaRutaTramoCoeficienteVO.getTiempoRecorrido();
|
||||||
|
spHora.setValue(hora.getHora());
|
||||||
|
spMinuto.setValue(hora.getMinuto());
|
||||||
|
}
|
||||||
|
dataBinder.addBinding(spHora, "value", row.getUuid() + ".tiempoRecorrido.hora", null, null, "save", null, null, null, null);
|
||||||
|
dataBinder.addBinding(spMinuto, "value", row.getUuid() + ".tiempoRecorrido.minuto", null, null, "save", null, null, null, null);
|
||||||
|
row.appendChild(hbox);
|
||||||
|
|
||||||
|
// Cell ID Tramo
|
||||||
|
if (secuenciaRutaTramoCoeficienteVO.getTramoId() != null) {
|
||||||
|
lblID.setValue(secuenciaRutaTramoCoeficienteVO.getTramoId().toString());
|
||||||
|
} else {
|
||||||
|
lblID.setValue("");
|
||||||
|
}
|
||||||
|
row.appendChild(lblID);
|
||||||
|
|
||||||
|
// Coeficiente tarifário 1
|
||||||
|
|
||||||
|
cboCoeficiente1.setId(cboCoeficiente1.getUuid());
|
||||||
|
cboCoeficiente1.setWidth("99%");
|
||||||
|
|
||||||
|
ListModelList lmlCoeficiente = getListCoeficienteCombobox();
|
||||||
|
if (secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa1() != null) {
|
||||||
|
lmlCoeficiente.addSelection(secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa1());
|
||||||
|
}
|
||||||
|
cboCoeficiente1.setModel(lmlCoeficiente);
|
||||||
|
cboCoeficiente1.setConstraint("no empty");
|
||||||
|
cboCoeficiente1.setDisabled(!esTramoCoeficienteEditable);
|
||||||
|
cboCoeficiente1.setReadonly(true);
|
||||||
|
cboCoeficiente1.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event arg0) throws Exception {
|
||||||
|
if (cboCoeficiente1.getSelectedItem() == null) {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(null);
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1((CoeficienteTarifa) cboCoeficiente1.getSelectedItem().getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
row.appendChild(cboCoeficiente1);
|
||||||
|
// Km 1 do coeficiente 1
|
||||||
|
ibxKm1.setValueBigDecimal((secuenciaRutaTramoCoeficienteVO.getKmCoeficiente1() != null) ?
|
||||||
|
secuenciaRutaTramoCoeficienteVO.getKmCoeficiente1() : BigDecimal.ZERO);
|
||||||
|
|
||||||
|
ibxKm1.setWidth("80%");
|
||||||
|
ibxKm1.setReadonly(!esTramoCoeficienteEditable);
|
||||||
|
dataBinder.addBinding(ibxKm1, "value", row.getUuid() + ".kmCoeficiente1", null, null,
|
||||||
|
"save", "com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter", null, null, null);
|
||||||
|
row.appendChild(ibxKm1);
|
||||||
|
// Coeficiente tarifário 2
|
||||||
|
cboCoeficiente2.setId(cboCoeficiente2.getUuid());
|
||||||
|
cboCoeficiente2.setWidth("99%");
|
||||||
|
cboCoeficiente2.setDisabled(!esTramoCoeficienteEditable);
|
||||||
|
cboCoeficiente2.setReadonly(true);
|
||||||
|
ListModelList lmlCoeficiente2 = getListCoeficienteCombobox();
|
||||||
|
if (secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa2() != null) {
|
||||||
|
lmlCoeficiente2.addSelection(secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa2());
|
||||||
|
}
|
||||||
|
cboCoeficiente2.setModel(lmlCoeficiente2);
|
||||||
|
cboCoeficiente2.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event arg0) throws Exception {
|
||||||
|
if (cboCoeficiente2.getSelectedItem() == null) {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(null);
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2((CoeficienteTarifa) cboCoeficiente2.getSelectedItem().getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
row.appendChild(cboCoeficiente2);
|
||||||
|
// Km 2 do coeficiente 2
|
||||||
|
ibxKm2.setValueBigDecimal((secuenciaRutaTramoCoeficienteVO.getKmCoeficiente2() != null) ?
|
||||||
|
secuenciaRutaTramoCoeficienteVO.getKmCoeficiente2() : BigDecimal.ZERO);
|
||||||
|
ibxKm2.setWidth("80%");
|
||||||
|
ibxKm2.setReadonly(!esTramoCoeficienteEditable);
|
||||||
|
dataBinder.addBinding(ibxKm2, "value", row.getUuid() + ".kmCoeficiente2", null, null,
|
||||||
|
"save", "com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter", null, null, null);
|
||||||
|
row.appendChild(ibxKm2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualiza el modelo de grid
|
||||||
|
*/
|
||||||
|
private void actualizaModel() {
|
||||||
|
this.setModel(new ListModelList(lsSecuenciaRutaTramoCoeficienteVO, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica si hay tramos
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return lsSecuenciaRutaTramoCoeficienteVO.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Llena el tramo con los datos de una busqueda
|
||||||
|
*
|
||||||
|
* @param secuenciaRutaTramoCoeficienteVO
|
||||||
|
*/
|
||||||
|
private void llenarTramo(SecuenciaRutaTramoCoeficienteVO secuenciaRutaTramoCoeficienteVO) {
|
||||||
|
TramoServicioService tramoServicioService = (TramoServicioService) SpringUtil.getBean("tramoServicioService");
|
||||||
|
|
||||||
|
Parada destino = secuenciaRutaTramoCoeficienteVO.getDestino();
|
||||||
|
Parada origen = secuenciaRutaTramoCoeficienteVO.getOrigen();
|
||||||
|
Via via = secuenciaRutaTramoCoeficienteVO.getVia();
|
||||||
|
|
||||||
|
TramoServicio tramoServicio = null;
|
||||||
|
if ((destino != null) && (origen != null) && (via != null) && (claseServicio != null)) {
|
||||||
|
tramoServicio = tramoServicioService.buscar(origen, destino, via, claseServicio);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tramo tramo = null;
|
||||||
|
if (tramoServicio != null) {
|
||||||
|
tramo = tramoServicio.getTramo();
|
||||||
|
} else {
|
||||||
|
TramoService tramoService = (TramoService) SpringUtil.getBean("tramoService");
|
||||||
|
if ((destino != null) && (origen != null) && (via != null)) {
|
||||||
|
tramo = tramoService.buscar(origen, destino, via);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tramoServicio != null) {
|
||||||
|
HoraSistema hora = new HoraSistema(tramoServicio.getTiemporecorrido());
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTiempoRecorrido(hora);
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTramoServicioId(tramoServicio.getTramoservicioId());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTiempoRecorrido(null);
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTramoServicioId(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tramo != null) {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmReal(tramo.getKmReal());
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTramoId(tramo.getTramoId());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmReal(BigDecimal.ZERO);
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setTramoId(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
OrgaoTramoDAO orgaoTramoDAO = (OrgaoTramoDAO) SpringUtil.getBean("orgaoTramoDAO");
|
||||||
|
OrgaoTramo orgaoTramo = orgaoTramoDAO.buscar(origen.getParadaId(), destino.getParadaId(), via.getViaId(), orgaoConcedente.getOrgaoConcedenteId(), claseServicio.getClaseservicioId());
|
||||||
|
|
||||||
|
if (orgaoTramo != null) {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId());
|
||||||
|
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(orgaoTramo.getCoeficienteTarifa1());
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1());
|
||||||
|
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(orgaoTramo.getCoeficienteTarifa2());
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setOrgaoTramoId(null);
|
||||||
|
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(null);
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmCoeficiente1(null);
|
||||||
|
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(null);
|
||||||
|
secuenciaRutaTramoCoeficienteVO.setKmCoeficiente2(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doCatch(Throwable arg0) throws Throwable {
|
||||||
|
throw arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFinally() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTry() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debugList() {
|
||||||
|
dataBinder.saveAll();
|
||||||
|
for (SecuenciaRutaTramoCoeficienteVO s : lsSecuenciaRutaTramoCoeficienteVO) {
|
||||||
|
log.debug(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SecuenciaRutaTramoCoeficienteVO> getLsSecuenciaRutaTramoCoeficienteVO() {
|
||||||
|
dataBinder.saveAll();
|
||||||
|
return lsSecuenciaRutaTramoCoeficienteVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsCoeficientes(List<CoeficienteTarifa> lsCoeficientes) {
|
||||||
|
this.lsCoeficientes = lsCoeficientes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,18 +7,22 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.Predicate;
|
import org.apache.commons.collections.Predicate;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.log4j.lf5.util.DateFormatManager;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -35,6 +39,7 @@ import org.zkoss.zul.Comboitem;
|
||||||
import org.zkoss.zul.Constraint;
|
import org.zkoss.zul.Constraint;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zul.Hbox;
|
||||||
import org.zkoss.zul.Intbox;
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.ListModel;
|
||||||
import org.zkoss.zul.ListModelList;
|
import org.zkoss.zul.ListModelList;
|
||||||
import org.zkoss.zul.Listcell;
|
import org.zkoss.zul.Listcell;
|
||||||
import org.zkoss.zul.Listitem;
|
import org.zkoss.zul.Listitem;
|
||||||
|
@ -44,18 +49,19 @@ import org.zkoss.zul.Paging;
|
||||||
import org.zkoss.zul.Radio;
|
import org.zkoss.zul.Radio;
|
||||||
import org.zkoss.zul.Spinner;
|
import org.zkoss.zul.Spinner;
|
||||||
import org.zkoss.zul.Textbox;
|
import org.zkoss.zul.Textbox;
|
||||||
import org.zkoss.zul.Toolbar;
|
|
||||||
import org.zkoss.zul.Window;
|
import org.zkoss.zul.Window;
|
||||||
|
import org.zkoss.zul.event.ListDataListener;
|
||||||
|
import org.zkoss.zul.ext.Constrainted;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
|
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuenciaCombinacaoLinha;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
import com.rjconsultores.ventaboletos.entidad.RutaCaseta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.RutaCombinacion;
|
import com.rjconsultores.ventaboletos.entidad.RutaCombinacion;
|
||||||
|
@ -66,7 +72,6 @@ import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Via;
|
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
import com.rjconsultores.ventaboletos.service.CorridaService;
|
|
||||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
import com.rjconsultores.ventaboletos.service.EsquemaCorridaService;
|
import com.rjconsultores.ventaboletos.service.EsquemaCorridaService;
|
||||||
import com.rjconsultores.ventaboletos.service.GrupoRutaService;
|
import com.rjconsultores.ventaboletos.service.GrupoRutaService;
|
||||||
|
@ -79,8 +84,12 @@ import com.rjconsultores.ventaboletos.service.TramoService;
|
||||||
import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService;
|
import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService;
|
||||||
import com.rjconsultores.ventaboletos.service.ViaService;
|
import com.rjconsultores.ventaboletos.service.ViaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.HoraSistema;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoVO;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
@ -125,9 +134,6 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
private GrupoRutaService grupoRutaService;
|
private GrupoRutaService grupoRutaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient PagedListWrapper<RutaCombinacion> plwRutaCombinacion;
|
private transient PagedListWrapper<RutaCombinacion> plwRutaCombinacion;
|
||||||
@Autowired
|
|
||||||
CorridaService corridaService;
|
|
||||||
|
|
||||||
private Ruta ruta;
|
private Ruta ruta;
|
||||||
private MyListbox rutaList;
|
private MyListbox rutaList;
|
||||||
private MyListbox rutaSecuenciaList;
|
private MyListbox rutaSecuenciaList;
|
||||||
|
@ -167,7 +173,8 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
private Intbox txtCantAsientos;
|
private Intbox txtCantAsientos;
|
||||||
private Checkbox chkIndVentaRioCard;
|
private Checkbox chkIndVentaRioCard;
|
||||||
private MyTextbox txtNumRioCard;
|
private MyTextbox txtNumRioCard;
|
||||||
private Button btnCancelarRetomar;
|
private Window winEditarRuta;
|
||||||
|
private List<ParadaSecuencia> sequenciasInformadas;
|
||||||
|
|
||||||
public Ruta getRuta() {
|
public Ruta getRuta() {
|
||||||
return ruta;
|
return ruta;
|
||||||
|
@ -276,52 +283,55 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
ruta = (Ruta) Executions.getCurrent().getArg().get("ruta");
|
ruta = (Ruta) Executions.getCurrent().getArg().get("ruta");
|
||||||
rutaList = (MyListbox) Executions.getCurrent().getArg().get("rutaList");
|
rutaList = (MyListbox) Executions.getCurrent().getArg().get("rutaList");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
// Secuencia
|
// Secuencia
|
||||||
rutaSecuenciaList.setItemRenderer(new RenderCatalogoDeRutasSecuencia());
|
rutaSecuenciaList.setItemRenderer(new RenderCatalogoDeRutasSecuencia());
|
||||||
lsRutaSecuencia = new ArrayList<RutaSecuencia>();
|
lsRutaSecuencia = new ArrayList<RutaSecuencia>();
|
||||||
|
sequenciasInformadas = new ArrayList<ParadaSecuencia>();
|
||||||
|
|
||||||
rutaSecuenciaList.addEventListener("onDoubleClick", new EventListener() {
|
rutaSecuenciaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (ruta.getRutaId() == null) {
|
if(ruta.getRutaId() == null){
|
||||||
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.salvarRutaPrimeiro"),
|
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.salvarRutaPrimeiro"),
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ParadaSecuencia psOrigen = (ParadaSecuencia) rutaSecuenciaList.getSelected();
|
ParadaSecuencia psOrigen = (ParadaSecuencia)rutaSecuenciaList.getSelected();
|
||||||
int indexSelecto = rutaSecuenciaList.getSelectedIndex();
|
int indexSelecto = rutaSecuenciaList.getSelectedIndex();
|
||||||
ParadaSecuencia psDestino = new ParadaSecuencia();
|
ParadaSecuencia psDestino = new ParadaSecuencia();
|
||||||
try {
|
try{
|
||||||
psDestino = (ParadaSecuencia) lsParadasSequencia.get(indexSelecto + 1);
|
psDestino = (ParadaSecuencia)lsParadasSequencia.get(indexSelecto+1);
|
||||||
} catch (IndexOutOfBoundsException e) {
|
}catch(IndexOutOfBoundsException e){
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.finRuta"),
|
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.finRuta"),
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psOrigen == null) { // lsRutaSecuencia <-- esse objeto ja tem o id da ruta secuencia ....
|
if (psOrigen == null) { //lsRutaSecuencia <-- esse objeto ja tem o id da ruta secuencia ....
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map args = new HashMap();
|
Map args = new HashMap();
|
||||||
args.put("paradaSecuenciaOrigen", psOrigen);
|
args.put("paradaSecuenciaOrigen", psOrigen);
|
||||||
args.put("paradaSecuenciaDestino", psDestino);
|
args.put("paradaSecuenciaDestino", psDestino);
|
||||||
args.put("lsRutaSecuencia", lsRutaSecuencia);
|
args.put("lsRutaSecuencia", lsRutaSecuencia);
|
||||||
|
|
||||||
args.put("lsParadasSequencia", lsParadasSequencia);
|
args.put("lsParadasSequencia", lsParadasSequencia);
|
||||||
args.put("rutaSecuenciaList", rutaSecuenciaList);
|
args.put("rutaSecuenciaList", rutaSecuenciaList);
|
||||||
args.put("casetasList", getCasetasPeage(psOrigen.getCasetas()));
|
args.put("casetasList", getCasetasPeage(psOrigen.getCasetas()));
|
||||||
openWindow("/gui/esquema_operacional/editarSecuencia.zul", Labels.getLabel("editarSecuenciaController.window.title"), args, MODAL);
|
openWindow("/gui/esquema_operacional/editarSecuencia.zul", Labels.getLabel("editarSecuenciaController.window.title"), args, MODAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
txtNumRioCard.setDisabled(ruta.getIndVentaRioCard() == null || !ruta.getIndVentaRioCard());
|
txtNumRioCard.setDisabled(ruta.getIndVentaRioCard() == null || !ruta.getIndVentaRioCard());
|
||||||
chkIndVentaRioCard.addEventListener("onClick", new EventListener() {
|
chkIndVentaRioCard.addEventListener("onClick", new EventListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
@ -329,6 +339,7 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Combinacion
|
// Combinacion
|
||||||
rutaCombinacionList.setItemRenderer(this);
|
rutaCombinacionList.setItemRenderer(this);
|
||||||
lsRutaCombinacion = new ArrayList<RutaCombinacion>();
|
lsRutaCombinacion = new ArrayList<RutaCombinacion>();
|
||||||
|
@ -376,24 +387,12 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
carregouCombinacao = false;
|
carregouCombinacao = false;
|
||||||
alterarBotaoRetomarCancelar();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void alterarBotaoRetomarCancelar() {
|
|
||||||
if (ruta.getIndRutaCancelada()) {
|
|
||||||
btnCancelarRetomar.setTooltiptext(Labels.getLabel("editarCatalogoDeRutaController.btnRetomarCancelar.tooltipRetomar"));
|
|
||||||
btnCancelarRetomar.setImage("/gui/img/back.png");
|
|
||||||
} else {
|
|
||||||
btnCancelarRetomar.setTooltiptext(Labels.getLabel("editarCatalogoDeRutaController.btnRetomarCancelar.tooltipCancelar"));
|
|
||||||
btnCancelarRetomar.setImage("/gui/img/forbidden.png");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CasetaPeaje> getCasetasPeage(List<RutaCaseta> casetas) {
|
private List<CasetaPeaje> getCasetasPeage(List<RutaCaseta> casetas) {
|
||||||
List<CasetaPeaje> casetasPeage = new ArrayList<CasetaPeaje>();
|
List<CasetaPeaje> casetasPeage = new ArrayList<CasetaPeaje>();
|
||||||
|
|
||||||
if (casetas == null || casetas.isEmpty()) {
|
if(casetas == null || casetas.isEmpty()) {
|
||||||
return casetasPeage;
|
return casetasPeage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,43 +403,8 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
return casetasPeage;
|
return casetasPeage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnCancelarRetomar(Event ev) throws Exception {
|
|
||||||
if (!ruta.getIndRutaCancelada()) {
|
|
||||||
if (!existeEsquemaCorridaVigente() && !existeCorridaVenda()) {
|
|
||||||
ruta.setIndRutaCancelada(true);// cancelar
|
|
||||||
salvarRuta();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ruta.setIndRutaCancelada(false);// retomar
|
|
||||||
}
|
|
||||||
alterarBotaoRetomarCancelar();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean existeCorridaVenda() throws InterruptedException {
|
|
||||||
Corrida corrida = corridaService.buscaCorrridaFutura(ruta, new Date());
|
|
||||||
if (corrida != null) {
|
|
||||||
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.corridaGeradaVigente")
|
|
||||||
+ " " + corrida.getId().getCorridaId()
|
|
||||||
+ " "
|
|
||||||
+ Labels.getLabel("editarCatalogoDeRutaController.msg.corridaGeradaVigentePt2")
|
|
||||||
+ " " + corrida.getId().getFeccorrida());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Boolean existeEsquemaCorridaVigente() throws InterruptedException {
|
|
||||||
EsquemaCorrida esquemaCorrida = esquemaCorridaService.buscaEsquemaPorRuta(ruta);
|
|
||||||
if (esquemaCorrida != null) {
|
|
||||||
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.existeEsquemaCorridaVigente")
|
|
||||||
+ " " + esquemaCorrida.getEsquemacorridaId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void disableEnableNumRioCard() {
|
protected void disableEnableNumRioCard() {
|
||||||
if (chkIndVentaRioCard.isChecked()) {
|
if(chkIndVentaRioCard.isChecked()) {
|
||||||
txtNumRioCard.setDisabled(false);
|
txtNumRioCard.setDisabled(false);
|
||||||
txtNumRioCard.setConstraint("no empty");
|
txtNumRioCard.setConstraint("no empty");
|
||||||
} else {
|
} else {
|
||||||
|
@ -452,8 +416,9 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
|
|
||||||
private void paginarCombinacao() {
|
private void paginarCombinacao() {
|
||||||
if (ruta.getRutaId() != null) {
|
if (ruta.getRutaId() != null) {
|
||||||
HibernateSearchObject<RutaCombinacion> claseServicioBusqueda = new HibernateSearchObject<RutaCombinacion>(RutaCombinacion.class,
|
HibernateSearchObject<RutaCombinacion> claseServicioBusqueda =
|
||||||
pagingRutaCombinacion.getPageSize());
|
new HibernateSearchObject<RutaCombinacion>(RutaCombinacion.class,
|
||||||
|
pagingRutaCombinacion.getPageSize());
|
||||||
|
|
||||||
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
claseServicioBusqueda.addFilterEqual("ruta", ruta);
|
claseServicioBusqueda.addFilterEqual("ruta", ruta);
|
||||||
|
@ -469,7 +434,6 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
paradaSecuencia.setVia(via);
|
paradaSecuencia.setVia(via);
|
||||||
lsParadasSequencia.add(paradaSecuencia);
|
lsParadasSequencia.add(paradaSecuencia);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTramoPardaSecuencia(Parada parada, Via via, Short numsecuencia, List<RutaCaseta> lCas, String tempo, String km) {
|
private void addTramoPardaSecuencia(Parada parada, Via via, Short numsecuencia, List<RutaCaseta> lCas, String tempo, String km) {
|
||||||
ParadaSecuencia paradaSecuencia = new ParadaSecuencia();
|
ParadaSecuencia paradaSecuencia = new ParadaSecuencia();
|
||||||
paradaSecuencia.setParada(parada);
|
paradaSecuencia.setParada(parada);
|
||||||
|
@ -550,10 +514,18 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
cmbParada.getSelectedItem();
|
cmbParada.getSelectedItem();
|
||||||
Parada parada = (Parada) cmbParada.getSelectedItem().getValue();
|
Parada parada = (Parada) cmbParada.getSelectedItem().getValue();
|
||||||
|
|
||||||
|
ParadaSecuencia paradaSecuencia = new ParadaSecuencia();
|
||||||
|
paradaSecuencia.setParada(parada);
|
||||||
|
paradaSecuencia.setSecuencia(numSecuencia.getValue().shortValue());
|
||||||
|
paradaSecuencia.setVia((Via)cmbVia.getSelectedItem().getValue());
|
||||||
|
|
||||||
|
sequenciasInformadas.add(paradaSecuencia);
|
||||||
|
|
||||||
Via via = (Via) cmbVia.getSelectedItem().getValue();
|
Via via = (Via) cmbVia.getSelectedItem().getValue();
|
||||||
boolean existe = false;
|
boolean existe = false;
|
||||||
|
|
||||||
for (ParadaSecuencia ps : lsParadasSequencia) {
|
for (ParadaSecuencia ps : lsParadasSequencia) {
|
||||||
|
|
||||||
if (ps.getParada().equals(parada)) {
|
if (ps.getParada().equals(parada)) {
|
||||||
existe = true;
|
existe = true;
|
||||||
}
|
}
|
||||||
|
@ -564,7 +536,6 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
addTramoPardaSecuencia(parada, via, numSecuencia.getValue().shortValue());
|
addTramoPardaSecuencia(parada, via, numSecuencia.getValue().shortValue());
|
||||||
rutaSecuenciaList.setData(lsParadasSequencia);
|
rutaSecuenciaList.setData(lsParadasSequencia);
|
||||||
numSecuencia.setValue(numSecuencia.getValue() + 1);
|
numSecuencia.setValue(numSecuencia.getValue() + 1);
|
||||||
secuenciaFoiAlterada = Boolean.TRUE;
|
|
||||||
cmbParada.focus();
|
cmbParada.focus();
|
||||||
cmbParada.setText("");
|
cmbParada.setText("");
|
||||||
} else {
|
} else {
|
||||||
|
@ -580,6 +551,7 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
Integer novaSecuencia = lsParadasSequencia.get(i).getSecuencia().intValue() + 1;
|
Integer novaSecuencia = lsParadasSequencia.get(i).getSecuencia().intValue() + 1;
|
||||||
lsParadasSequencia.get(i).setSecuencia(new Short(novaSecuencia.toString()));
|
lsParadasSequencia.get(i).setSecuencia(new Short(novaSecuencia.toString()));
|
||||||
incrementar = Boolean.TRUE;
|
incrementar = Boolean.TRUE;
|
||||||
|
|
||||||
// So continuo incrementando se já houver uma
|
// So continuo incrementando se já houver uma
|
||||||
// secuencia igual
|
// secuencia igual
|
||||||
} else if (incrementar) {
|
} else if (incrementar) {
|
||||||
|
@ -781,25 +753,17 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
if (ruta.getIndRutaCancelada()) {
|
|
||||||
Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.msg.linhaDesativada"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
salvarRuta();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void salvarRuta() throws InterruptedException {
|
|
||||||
txtPrefixo.getValue();
|
txtPrefixo.getValue();
|
||||||
txtNumRioCard.getValue();
|
txtNumRioCard.getValue();
|
||||||
|
|
||||||
if (null != txtCantEixos && txtCantEixos.getValue() != null && txtCantEixos.getValue() == 0) {
|
if(null != txtCantEixos && txtCantEixos.getValue()!= null && txtCantEixos.getValue() == 0){
|
||||||
Messagebox.show(
|
Messagebox.show(
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.lblCantEixosZeroInvalido.value"),
|
Labels.getLabel("editarCatalogoDeRutaController.lblCantEixosZeroInvalido.value"),
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null != txtCantAsientos && txtCantAsientos.getValue() != null && txtCantAsientos.getValue() == 0) {
|
if(null != txtCantAsientos && txtCantAsientos.getValue() != null && txtCantAsientos.getValue() == 0){
|
||||||
Messagebox.show(
|
Messagebox.show(
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.lblCantAsientosZeroInvalido.value"),
|
Labels.getLabel("editarCatalogoDeRutaController.lblCantAsientosZeroInvalido.value"),
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
|
@ -876,7 +840,7 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel(
|
Messagebox.show(Labels.getLabel(
|
||||||
"editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: "
|
"editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: "
|
||||||
+ ruta.getRutaId().toString()),
|
+ ruta.getRutaId().toString()),
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
Messagebox.OK,
|
Messagebox.OK,
|
||||||
Messagebox.INFORMATION);
|
Messagebox.INFORMATION);
|
||||||
|
@ -888,20 +852,19 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
// Gera Secuencia e Combinação Novamente se houve
|
// Gera Secuencia e Combinação Novamente se houve
|
||||||
// modificação na Secuencia.
|
// modificação na Secuencia.
|
||||||
if (secuenciaFoiAlterada) {
|
if (secuenciaFoiAlterada) {
|
||||||
ruta = rutaService.actualizacion(ruta, lsParadasSequencia);
|
gerarCombinacaoTramoRuta(ruta, lsParadasSequencia);
|
||||||
} else {
|
} else {
|
||||||
ruta = rutaService.actualizacion(ruta, null);
|
ruta = rutaService.actualizacion(ruta, null);
|
||||||
|
rutaList.updateItem(ruta);
|
||||||
|
|
||||||
|
Messagebox.show(Labels.getLabel(
|
||||||
|
"editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: "
|
||||||
|
+ ruta.getRutaId().toString()),
|
||||||
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
rutaList.updateItem(ruta);
|
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel(
|
|
||||||
"editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: "
|
|
||||||
+ ruta.getRutaId().toString()),
|
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
|
||||||
Messagebox.OK, Messagebox.INFORMATION);
|
|
||||||
|
|
||||||
closeWindow();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (BusinessException ex) {
|
} catch (BusinessException ex) {
|
||||||
|
@ -914,9 +877,10 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
Messagebox.OK, Messagebox.ERROR);
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnvar(Event ev) {
|
public void onClick$btnApagar(Event ev) {
|
||||||
try {
|
try {
|
||||||
int resp = Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.MSG.borrarPergunta"),
|
int resp = Messagebox.show(Labels.getLabel("editarCatalogoDeRutaController.MSG.borrarPergunta"),
|
||||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
|
@ -957,7 +921,7 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
op.add("Não");
|
op.add("Não");
|
||||||
comboVenda.setModel(new ListModelList(op));
|
comboVenda.setModel(new ListModelList(op));
|
||||||
comboVenda.setValue(rutaCombinacion.getIndventa() == Boolean.TRUE ? "Sim" : "Não");
|
comboVenda.setValue(rutaCombinacion.getIndventa() == Boolean.TRUE ? "Sim" : "Não");
|
||||||
if (rutaCombinacion.getRutacombinacionId() != null) {
|
if(rutaCombinacion.getRutacombinacionId() != null){
|
||||||
comboVenda.setTooltip(rutaCombinacion.getRutacombinacionId().toString());
|
comboVenda.setTooltip(rutaCombinacion.getRutacombinacionId().toString());
|
||||||
}
|
}
|
||||||
comboVenda.addEventListener("onChange", new EventListener() {
|
comboVenda.addEventListener("onChange", new EventListener() {
|
||||||
|
@ -972,10 +936,11 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
lc.appendChild(comboVenda);
|
lc.appendChild(comboVenda);
|
||||||
lc.setParent(lstm);
|
lc.setParent(lstm);
|
||||||
|
|
||||||
Tramo tramo = rutaCombinacion.getTramo();
|
|
||||||
String descTramoDetalhado = tramo.getOrigem().getDescparada() + "|" + tramo.getDestino().getDescparada();
|
|
||||||
|
|
||||||
lc = new Listcell(rutaCombinacion.getTramo().getDesctramo() + "(" + descTramoDetalhado + ")");
|
Tramo tramo = rutaCombinacion.getTramo();
|
||||||
|
String descTramoDetalhado = tramo.getOrigem().getDescparada() + "|" +tramo.getDestino().getDescparada();
|
||||||
|
|
||||||
|
lc = new Listcell(rutaCombinacion.getTramo().getDesctramo() + "("+descTramoDetalhado+")");
|
||||||
lc.setParent(lstm);
|
lc.setParent(lstm);
|
||||||
|
|
||||||
lc = new Listcell();
|
lc = new Listcell();
|
||||||
|
@ -983,8 +948,8 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
final Combobox comboVia = new Combobox();
|
final Combobox comboVia = new Combobox();
|
||||||
comboVia.setMold("rounded");
|
comboVia.setMold("rounded");
|
||||||
comboVia.setWidth("90%");
|
comboVia.setWidth("90%");
|
||||||
if (rutaCombinacion.getRutacombinacionId() != null) {
|
if(rutaCombinacion.getRutacombinacionId() != null){
|
||||||
comboVia.setTooltip(rutaCombinacion.getRutacombinacionId().toString());
|
comboVia.setTooltip(rutaCombinacion.getRutacombinacionId().toString());
|
||||||
}
|
}
|
||||||
List<Via> lsViaCombinacion = tramoService.obtenerViasOrigemDestino(
|
List<Via> lsViaCombinacion = tramoService.obtenerViasOrigemDestino(
|
||||||
rutaCombinacion.getTramo().getOrigem(), rutaCombinacion.getTramo().getDestino());
|
rutaCombinacion.getTramo().getOrigem(), rutaCombinacion.getTramo().getDestino());
|
||||||
|
@ -1093,7 +1058,7 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
|
|
||||||
List<RutaCombinacion> rutaCombinacions = new ArrayList<RutaCombinacion>();
|
List<RutaCombinacion> rutaCombinacions = new ArrayList<RutaCombinacion>();
|
||||||
|
|
||||||
for (RutaCombinacion rc : rutaCombinacionsAntiga) {
|
for (RutaCombinacion rc : rutaCombinacionsAntiga){
|
||||||
RutaCombinacion newrc = (RutaCombinacion) rc.clone();
|
RutaCombinacion newrc = (RutaCombinacion) rc.clone();
|
||||||
newrc.setRuta(ruta);
|
newrc.setRuta(ruta);
|
||||||
newrc.setRutacombinacionId(null);
|
newrc.setRutacombinacionId(null);
|
||||||
|
@ -1143,4 +1108,34 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void gerarCombinacaoTramoRuta(Ruta ruta, List<ParadaSecuencia> sequencias) {
|
||||||
|
List<ParadaSecuenciaCombinacaoLinha> sequenciasAGerar = rutaService.verificarSeqRutaNaoGerada(ruta, sequencias);
|
||||||
|
|
||||||
|
if (sequenciasAGerar != null){
|
||||||
|
|
||||||
|
Map<String, Object> params = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
|
RutaTramoVO rutaTramoVO = new RutaTramoVO();
|
||||||
|
rutaTramoVO.setClaseServicio(ruta.getClaseServicio());
|
||||||
|
rutaTramoVO.setLsEmpresa(getLsEmpresa());
|
||||||
|
rutaTramoVO.setOrgaoConcedente(ruta.getOrgaoConcedente());
|
||||||
|
rutaTramoVO.setSolicitaNombrePasajero(ruta.getIndNombreObligatorio());
|
||||||
|
rutaTramoVO.setNumRuta(txtNumRuta.getValue());
|
||||||
|
rutaTramoVO.setDescRuta(ruta.getDescruta());
|
||||||
|
rutaTramoVO.setPrefixo(txtPrefixo.getValue());
|
||||||
|
rutaTramoVO.setIndSentidoIda(radIda.isChecked());
|
||||||
|
|
||||||
|
rutaTramoVO.setLsParadaSecuenciaCombinacaoLinhas(sequenciasAGerar);
|
||||||
|
|
||||||
|
params.put("rutaTramoVO", rutaTramoVO);
|
||||||
|
params.put("winEditarRuta", winEditarRuta);
|
||||||
|
params.put("ruta", ruta);
|
||||||
|
params.put("rutaList", rutaList);
|
||||||
|
params.put("lsSequencias", sequencias);
|
||||||
|
|
||||||
|
this.openWindow("/gui/esquema_operacional/generacion_tramo_ruta/gerarCombinacionTramoRuta.zul",
|
||||||
|
Labels.getLabel("gerarCombinacionTramoRutaController.window.title"), params, MODAL);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional.generaciontramosrutas;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ParadaSecuenciaCombinacaoLinha;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoRutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ViaService;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridCombinacionTramoRutaCoeficiente;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
|
||||||
|
@Controller("gerarCombinacionTramoRutaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class GerarCombinacionTramoRutaController extends MyGenericForwardComposer {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Autowired
|
||||||
|
private ViaService viaService;
|
||||||
|
@Autowired
|
||||||
|
private TramoRutaService tramoRutaService;
|
||||||
|
@Autowired
|
||||||
|
private RutaService rutaService;
|
||||||
|
@Autowired
|
||||||
|
private CoeficienteTarifaService coeficienteTarifaService;
|
||||||
|
private RutaTramoVO rutaTramoIdaVO;
|
||||||
|
private Ruta ruta;
|
||||||
|
private MyListbox rutaList;
|
||||||
|
private List<ParadaSecuencia> lsSequencias;
|
||||||
|
private GridCombinacionTramoRutaCoeficiente gridRutaSecuenciaIda;
|
||||||
|
private Window winEditarRuta;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
rutaTramoIdaVO = (RutaTramoVO) Executions.getCurrent().getArg().get("rutaTramoVO");
|
||||||
|
ruta = (Ruta)Executions.getCurrent().getArg().get("ruta");
|
||||||
|
rutaList = (MyListbox)Executions.getCurrent().getArg().get("rutaList");
|
||||||
|
lsSequencias = (List<ParadaSecuencia>)Executions.getCurrent().getArg().get("lsSequencias");
|
||||||
|
winEditarRuta = (Window) Executions.getCurrent().getArg().get("winEditarRuta");
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
List<SecuenciaRutaTramoCoeficienteVO> listaSecuenciaRutaTramoCoeficiente = tramoRutaService.generarCombinacionTrechoRuta(rutaTramoIdaVO);
|
||||||
|
|
||||||
|
if (rutaTramoIdaVO.getCoeficienteDefaul1() != null || rutaTramoIdaVO.getCoeficienteDefaul2() != null) {
|
||||||
|
for (SecuenciaRutaTramoCoeficienteVO sv : listaSecuenciaRutaTramoCoeficiente) {
|
||||||
|
sv.setCoeficienteTarifa1(rutaTramoIdaVO.getCoeficienteDefaul1());
|
||||||
|
sv.setCoeficienteTarifa2(rutaTramoIdaVO.getCoeficienteDefaul2());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gridRutaSecuenciaIda.setClaseServicio(rutaTramoIdaVO.getClaseServicio());
|
||||||
|
gridRutaSecuenciaIda.setOrgaoConcedente(rutaTramoIdaVO.getOrgaoConcedente());
|
||||||
|
gridRutaSecuenciaIda.setLsVias(viaService.obtenerTodos());
|
||||||
|
gridRutaSecuenciaIda.setLsCoeficientes(coeficienteTarifaService.obtenerTodos());
|
||||||
|
gridRutaSecuenciaIda.agregarTodos(listaSecuenciaRutaTramoCoeficiente);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event e) throws InterruptedException {
|
||||||
|
|
||||||
|
rutaTramoIdaVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaIda.getLsSecuenciaRutaTramoCoeficienteVO());
|
||||||
|
rutaTramoIdaVO.setLsSecuenciaRutaTramoVO(popularSequencia());
|
||||||
|
|
||||||
|
try {
|
||||||
|
tramoRutaService.generarTramosRutaExistente(rutaTramoIdaVO, ruta);
|
||||||
|
|
||||||
|
List<ParadaSecuencia> secuencias = new ArrayList<ParadaSecuencia>();
|
||||||
|
|
||||||
|
for (ParadaSecuenciaCombinacaoLinha paradaSecuenciaCombinacaoLinha: rutaTramoIdaVO.getLsParadaSecuenciaCombinacaoLinhas()){
|
||||||
|
secuencias.add(paradaSecuenciaCombinacaoLinha.getOrigem());
|
||||||
|
}
|
||||||
|
|
||||||
|
ruta = rutaService.actualizacion(ruta, lsSequencias);
|
||||||
|
rutaList.updateItem(ruta);
|
||||||
|
|
||||||
|
Messagebox.show(Labels.getLabel(
|
||||||
|
"editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: "
|
||||||
|
+ ruta.getRutaId().toString()),
|
||||||
|
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
winEditarRuta.detach();
|
||||||
|
this.closeWindow();
|
||||||
|
} catch (BusinessException e1) {
|
||||||
|
Messagebox.show(e1.getMessage(), Labels.getLabel("editarCombinacionTramoRutaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SecuenciaRutaTramoVO> popularSequencia() {
|
||||||
|
List<SecuenciaRutaTramoVO> lsSecuenciaRutaTramoVO = new ArrayList<SecuenciaRutaTramoVO>();
|
||||||
|
|
||||||
|
for (SecuenciaRutaTramoCoeficienteVO secuencia : gridRutaSecuenciaIda.getLsSecuenciaRutaTramoCoeficienteVO()) {
|
||||||
|
|
||||||
|
SecuenciaRutaTramoVO secuenciaRutaTramoVO = new SecuenciaRutaTramoVO(secuencia.getOrigen(), secuencia.getDestino(),
|
||||||
|
secuencia.getVia(), secuencia.getSecuencia(), secuencia.getKmReal(), secuencia.getTiempoRecorrido());
|
||||||
|
|
||||||
|
lsSecuenciaRutaTramoVO.add(secuenciaRutaTramoVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lsSecuenciaRutaTramoVO;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4682,6 +4682,26 @@ gridRutaSecuencia.columnCoeficiente2.label = Indice 2
|
||||||
gridRutaSecuencia.columnKmCoeficiente2.label = Km 2
|
gridRutaSecuencia.columnKmCoeficiente2.label = Km 2
|
||||||
gridRutaSecuencia.columnKmCoeficiente1.label = Km 1
|
gridRutaSecuencia.columnKmCoeficiente1.label = Km 1
|
||||||
gridRutaSecuencia.columnVenda.label = Venta
|
gridRutaSecuencia.columnVenda.label = Venta
|
||||||
|
|
||||||
|
#GridCombinacionTramoRuta
|
||||||
|
gridCombinacionTramoRuta.btnEliminarPaso.tooltip=Eliminar parada
|
||||||
|
gridCombinacionTramoRuta.columnOrigen.label=Origen
|
||||||
|
gridCombinacionTramoRuta.columnDestino.label=Destino
|
||||||
|
gridCombinacionTramoRuta.columnVia.label=Via
|
||||||
|
gridCombinacionTramoRuta.columnKmsReal.label=Kms Real
|
||||||
|
gridCombinacionTramoRuta.columnKmsConductor.label=Kms conductor
|
||||||
|
gridCombinacionTramoRuta.columnTiempoRecorrido.label=Tiempo recorrido
|
||||||
|
gridCombinacionTramoRuta.columnIDTramo.label=ID
|
||||||
|
gridCombinacionTramoRuta.agregarSecuencia.exception.origenDestinoObligatorio=Origen y destino deben de ser informados
|
||||||
|
gridCombinacionTramoRuta.paradaExisteException.msg=la parada {0} ya existe
|
||||||
|
gridCombinacionTramoRuta.msg.eliminarPaso=Eliminar parada
|
||||||
|
gridCombinacionTramoRuta.msg.agregarDespues=Incluir después
|
||||||
|
gridCombinacionTramoRuta.columnNumLinha.label = No linea
|
||||||
|
gridCombinacionTramoRuta.columnCoeficiente1.label = Indice 1
|
||||||
|
gridCombinacionTramoRuta.columnCoeficiente2.label = Indice 2
|
||||||
|
gridCombinacionTramoRuta.columnKmCoeficiente2.label = Km 2
|
||||||
|
gridCombinacionTramoRuta.columnKmCoeficiente1.label = Km 1
|
||||||
|
|
||||||
#TramoRutaServiceImpl
|
#TramoRutaServiceImpl
|
||||||
tramoRutaServiceImpl.msg.combinacionObligatorio=La combinación debe de ser informada
|
tramoRutaServiceImpl.msg.combinacionObligatorio=La combinación debe de ser informada
|
||||||
tramoRutaServiceImpl.msg.secuenciaObligatorio=La secuencia debe de ser informada
|
tramoRutaServiceImpl.msg.secuenciaObligatorio=La secuencia debe de ser informada
|
||||||
|
@ -4704,6 +4724,22 @@ editarCombinacionTramoRutaController.MSG.generarRutaRegreso=Desea generar a line
|
||||||
editarCombinacionTramoRutaController.MSG.rutaIdaGenerada=Linea de ida generada : {0}
|
editarCombinacionTramoRutaController.MSG.rutaIdaGenerada=Linea de ida generada : {0}
|
||||||
editarCombinacionTramoRutaController.MSG.rutaRegresoGenerada=Linea de regreso generada : {0}
|
editarCombinacionTramoRutaController.MSG.rutaRegresoGenerada=Linea de regreso generada : {0}
|
||||||
|
|
||||||
|
#gerarCombinacionTramoRutaController
|
||||||
|
gerarCombinacionTramoRutaController.window.title=Generar combinación
|
||||||
|
gerarCombinacionTramoRutaController.btnSalvar.tooltiptext=Guardar
|
||||||
|
gerarCombinacionTramoRutaController.btnFechar.tooltiptext= Cerrar
|
||||||
|
gerarCombinacionTramoRutaController.btnRutaRegreso.tooltiptext=Generar linea regreso
|
||||||
|
gerarCombinacionTramoRutaController.MSG.suscribirOK = La linea y el tramo se registraron exitosamente
|
||||||
|
gerarCombinacionTramoRutaController.MSG.suscribirOK = La linea y el tramo se registraron exitosamente
|
||||||
|
gerarCombinacionTramoRutaController.tabRegreso.label=Regreso
|
||||||
|
gerarCombinacionTramoRutaController.tabIda.label=Ida
|
||||||
|
gerarCombinacionTramoRutaController.MSG.generarRutaRegreso=Desea generar a linea de regreso?
|
||||||
|
gerarCombinacionTramoRutaController.MSG.rutaIdaGenerada=Linea de ida generada : {0}
|
||||||
|
gerarCombinacionTramoRutaController.MSG.rutaRegresoGenerada=Linea de regreso generada : {0}
|
||||||
|
gerarCombinacionTramoRutaController.MSG.error.rutaSecuencia = Não foi possível gerar rutaSequencia
|
||||||
|
gerarCombinacionTramoRutaController.MSG.error.rutaCombinacion = Não foi possível gerar a combinação para a Linha (RutaCombinacion)
|
||||||
|
gerarCombinacionTramoRutaController.MSG.error.rutaEmpresa = Não foi possível gerar a empresa para a Linha (RutaEmpresa)
|
||||||
|
|
||||||
#estacionServiceImpl
|
#estacionServiceImpl
|
||||||
estacionServiceImpl.msg.cajaDuplicado = La caja ya existe en el punto informado
|
estacionServiceImpl.msg.cajaDuplicado = La caja ya existe en el punto informado
|
||||||
estacionServiceImpl.msg.macDuplicado = MAC ya dado de alta para otra estación
|
estacionServiceImpl.msg.macDuplicado = MAC ya dado de alta para otra estación
|
||||||
|
|
|
@ -4749,6 +4749,27 @@ gridRutaSecuencia.columnCoeficiente2.label = Coeficiente 2
|
||||||
gridRutaSecuencia.columnKmCoeficiente2.label = Km 2
|
gridRutaSecuencia.columnKmCoeficiente2.label = Km 2
|
||||||
gridRutaSecuencia.columnKmCoeficiente1.label = Km 1
|
gridRutaSecuencia.columnKmCoeficiente1.label = Km 1
|
||||||
gridRutaSecuencia.columnVenda.label = Venda
|
gridRutaSecuencia.columnVenda.label = Venda
|
||||||
|
|
||||||
|
#GridCombinacionTramoRuta
|
||||||
|
gridCombinacionTramoRuta.btnEliminarPaso.tooltip=Eliminar localidade
|
||||||
|
gridCombinacionTramoRuta.columnOrigen.label=Origem
|
||||||
|
gridCombinacionTramoRuta.columnDestino.label=Destino
|
||||||
|
gridCombinacionTramoRuta.columnVia.label=Via
|
||||||
|
gridCombinacionTramoRuta.columnKmsReal.label=Kms Real
|
||||||
|
gridCombinacionTramoRuta.columnKmsConductor.label=Kms Motorista
|
||||||
|
gridCombinacionTramoRuta.columnTiempoRecorrido.label=Tempo Percorrido
|
||||||
|
gridCombinacionTramoRuta.columnIDTramo.label=ID
|
||||||
|
gridCombinacionTramoRuta.agregarSecuencia.exception.origenDestinoObligatorio=Origem e destino devem ser informados
|
||||||
|
gridCombinacionTramoRuta.paradaExisteException.msg=A localidade {0} já existe
|
||||||
|
gridCombinacionTramoRuta.msg.eliminarPaso=Eliminar localidade
|
||||||
|
gridCombinacionTramoRuta.msg.agregarDespues=Incluir Depois
|
||||||
|
gridCombinacionTramoRuta.columnNumLinha.label = N° Linha
|
||||||
|
gridCombinacionTramoRuta.columnCoeficiente1.label = Coeficiente 1
|
||||||
|
gridCombinacionTramoRuta.columnCoeficiente2.label = Coeficiente 2
|
||||||
|
gridCombinacionTramoRuta.columnKmCoeficiente2.label = Km 2
|
||||||
|
gridCombinacionTramoRuta.columnKmCoeficiente1.label = Km 1
|
||||||
|
|
||||||
|
|
||||||
#TramoRutaServiceImpl
|
#TramoRutaServiceImpl
|
||||||
tramoRutaServiceImpl.msg.combinacionObligatorio=A combinação deve de ser informada
|
tramoRutaServiceImpl.msg.combinacionObligatorio=A combinação deve de ser informada
|
||||||
tramoRutaServiceImpl.msg.secuenciaObligatorio=A sequência deve ser informada
|
tramoRutaServiceImpl.msg.secuenciaObligatorio=A sequência deve ser informada
|
||||||
|
@ -4771,6 +4792,23 @@ editarCombinacionTramoRutaController.MSG.generarRutaRegreso=Deseja gerar a linha
|
||||||
editarCombinacionTramoRutaController.MSG.rutaIdaGenerada=Linha de Ida Gerada : {0}
|
editarCombinacionTramoRutaController.MSG.rutaIdaGenerada=Linha de Ida Gerada : {0}
|
||||||
editarCombinacionTramoRutaController.MSG.rutaRegresoGenerada=Linha de Retorno Gerada : {0}
|
editarCombinacionTramoRutaController.MSG.rutaRegresoGenerada=Linha de Retorno Gerada : {0}
|
||||||
|
|
||||||
|
#gerarCombinacionTramoRutaController
|
||||||
|
gerarCombinacionTramoRutaController.window.title=Gerar Combinação
|
||||||
|
gerarCombinacionTramoRutaController.btnSalvar.tooltiptext=Salvar
|
||||||
|
gerarCombinacionTramoRutaController.btnFechar.tooltiptext= Fechar
|
||||||
|
gerarCombinacionTramoRutaController.btnRutaRegreso.tooltiptext=Gerar Linha Retorno
|
||||||
|
gerarCombinacionTramoRutaController.MSG.suscribirOK = A linha e trecho Registrado com Sucesso.
|
||||||
|
gerarCombinacionTramoRutaController.MSG.suscribirOK = A linha e trecho Registrado com Sucesso.
|
||||||
|
gerarCombinacionTramoRutaController.tabRegreso.label=Retorno
|
||||||
|
gerarCombinacionTramoRutaController.tabIda.label=Ida
|
||||||
|
gerarCombinacionTramoRutaController.MSG.generarRutaRegreso=Deseja gerar a linha de retorno?
|
||||||
|
gerarCombinacionTramoRutaController.MSG.rutaIdaGenerada=Linha de Ida Gerada : {0}
|
||||||
|
gerarCombinacionTramoRutaController.MSG.rutaRegresoGenerada=Linha de Retorno Gerada : {0}
|
||||||
|
gerarCombinacionTramoRutaController.MSG.error.rutaSecuencia = Não foi possível gerar a sequencia para a Linha (RutaSequencia)
|
||||||
|
gerarCombinacionTramoRutaController.MSG.error.rutaCombinacion = Não foi possível gerar a combinação para a Linha (RutaCombinacion)
|
||||||
|
gerarCombinacionTramoRutaController.MSG.error.rutaEmpresa = Não foi possível gerar a empresa para a Linha (RutaEmpresa)
|
||||||
|
|
||||||
|
|
||||||
#estacionServiceImpl
|
#estacionServiceImpl
|
||||||
estacionServiceImpl.msg.cajaDuplicado = O caixa já existe no ponto informado.
|
estacionServiceImpl.msg.cajaDuplicado = O caixa já existe no ponto informado.
|
||||||
estacionServiceImpl.msg.macDuplicado = Mac já cadastrado para outra estação.
|
estacionServiceImpl.msg.macDuplicado = Mac já cadastrado para outra estação.
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?page contentType="text/html;charset=UTF-8"?>
|
||||||
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
|
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winGerarCombinacionTramoRuta"?>
|
||||||
|
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||||
|
|
||||||
|
<zk>
|
||||||
|
<window id="winGerarCombinacionTramoRuta" border="normal"
|
||||||
|
width="1324px" apply="${gerarCombinacionTramoRutaController}"
|
||||||
|
height="550px">
|
||||||
|
<style dynamic="true">
|
||||||
|
.z-textbox{background: #ffa99c}
|
||||||
|
.z-intbox{background: #ffa99c}
|
||||||
|
.z-spinner-inp{background: #ffa99c}
|
||||||
|
.z-textbox-real-readonly, .z-textbox-readonly{background:#99beff;color:black;filter:alpha(opacity = 100);}
|
||||||
|
.z-intbox-real-readonly, .z-intbox-readonly{background:#99beff;color:black;filter:alpha(opacity = 100);}
|
||||||
|
.z-spinner-readonly, .z-spinner-text-disd{background:#99beff;color:black;filter:alpha(opacity = 100);}
|
||||||
|
</style>
|
||||||
|
<toolbar>
|
||||||
|
<hbox spacing="5px" style="padding:1px" align="right">
|
||||||
|
<button id="btnSalvar" height="20"
|
||||||
|
image="/gui/img/save.png" width="35px"
|
||||||
|
tooltiptext="${c:l('gerarCombinacionTramoRutaController.btnSalvar.tooltiptext')}" />
|
||||||
|
|
||||||
|
<button id="btnFechar" height="20" width="35px"
|
||||||
|
image="/gui/img/exit.png"
|
||||||
|
onClick="winGerarCombinacionTramoRuta.detach()"
|
||||||
|
tooltiptext="${c:l('gerarCombinacionTramoRutaController.btnFechar.tooltiptext')}" />
|
||||||
|
|
||||||
|
</hbox>
|
||||||
|
</toolbar>
|
||||||
|
<vbox width="100%">
|
||||||
|
<tabbox id="tb" width="100%" >
|
||||||
|
<tabs id="tabs">
|
||||||
|
<tab id="A"
|
||||||
|
label="${c:l('gerarCombinacionTramoRutaController.tabIda.label')}" />
|
||||||
|
<!--tab id="B"
|
||||||
|
label="${c:l('gerarCombinacionTramoRutaController.tabRegreso.label')}" /-->
|
||||||
|
</tabs>
|
||||||
|
<tabpanels>
|
||||||
|
<tabpanel width="100%">
|
||||||
|
<grid id="gridRutaSecuenciaIda" mold="paging" pageSize="14" width="98%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridCombinacionTramoRutaCoeficiente"
|
||||||
|
height="445px">
|
||||||
|
</grid>
|
||||||
|
</tabpanel>
|
||||||
|
<tabpanel width="100%">
|
||||||
|
<grid fixedLayout="true">
|
||||||
|
<columns>
|
||||||
|
<column width="20%" />
|
||||||
|
<column width="79.5%" />
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<label value="${c:l('winGerarCombinacionTramoRuta.lblNumRuta.value')}"/>
|
||||||
|
<textbox id="txtNumRuta" maxlength="5" width="50%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<label value="${c:l('winGerarCombinacionTramoRuta.lbSentidoLinha.value')}" />
|
||||||
|
<radiogroup Id="indConfigRuta" >
|
||||||
|
<radio id="radIda" disabled="true"
|
||||||
|
label="${c:l('editarTramoRutaController.radIda.value')}"
|
||||||
|
/>
|
||||||
|
<radio id="radVolta" disabled="true"
|
||||||
|
label="${c:l('editarTramoRutaController.radVolta.value')}" />
|
||||||
|
</radiogroup>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<toolbar>
|
||||||
|
<button tooltiptext="${c:l('winGerarCombinacionTramoRuta.btnRutaRegreso.tooltiptext')}"
|
||||||
|
image="/gui/img/create_doc.gif" id="btnRutaRegreso" />
|
||||||
|
</toolbar>
|
||||||
|
<!--grid id="gridRutaSecuenciaVolta" mold="paging" pageSize="12" width="98%"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridCombinacionTramoRutaCoeficiente"
|
||||||
|
height="350px">
|
||||||
|
</grid -->
|
||||||
|
</tabpanel>
|
||||||
|
</tabpanels>
|
||||||
|
</tabbox>
|
||||||
|
</vbox>
|
||||||
|
</window>
|
||||||
|
</zk>
|
Loading…
Reference in New Issue