- MERGE precoLinha
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@25799 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
6d2f4ff4a8
commit
3f4017b691
|
@ -9,11 +9,9 @@ import java.util.Map;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.zkoss.util.resource.Labels;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zkplus.databind.DataBinder;
|
||||
import org.zkoss.zkplus.spring.SpringUtil;
|
||||
import org.zkoss.zul.Column;
|
||||
|
@ -30,7 +28,6 @@ import org.zkoss.zul.RendererCtrl;
|
|||
import org.zkoss.zul.Row;
|
||||
import org.zkoss.zul.RowRenderer;
|
||||
import org.zkoss.zul.Spinner;
|
||||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
|
@ -41,9 +38,7 @@ import com.rjconsultores.ventaboletos.service.TramoService;
|
|||
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.HoraSistema;
|
||||
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoVO;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintNumberBD;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter;
|
||||
|
||||
/**
|
||||
* Grid con la representacion de los tramos y secuencias de la ruta
|
||||
|
@ -96,8 +91,7 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
}
|
||||
|
||||
/**
|
||||
* Indica cuál es la clase de servicio usada para hacer la búsqueda de los
|
||||
* tramos
|
||||
* Indica cuál es la clase de servicio usada para hacer la búsqueda de los tramos
|
||||
*
|
||||
* @param claseServicio
|
||||
*/
|
||||
|
@ -127,8 +121,7 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
}
|
||||
|
||||
/**
|
||||
* Agrega un nuevo tramo. Si la origen es la ultima parada, agrega al fin.
|
||||
* Sino agrega al medio de la secuencia.
|
||||
* Agrega un nuevo tramo. Si la origen es la ultima parada, agrega al fin. Sino agrega al medio de la secuencia.
|
||||
*
|
||||
* La parada destino es la que tienes que agregar.
|
||||
*
|
||||
|
@ -275,14 +268,6 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
columnSecuencia.setWidth("6%");
|
||||
columns.appendChild(columnIDTramo);
|
||||
|
||||
// Column columnNumLinha = new Column(Labels.getLabel("gridRutaSecuencia.columnNumLinha.label"));
|
||||
// columnIDTramo.setWidth("10%");
|
||||
// columns.appendChild(columnNumLinha);
|
||||
//
|
||||
// Column columnSentido = new Column(Labels.getLabel("gridRutaSecuencia.columnSentido.label"));
|
||||
// columnIDTramo.setWidth("4%");
|
||||
// columns.appendChild(columnSentido);
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
|
@ -388,10 +373,7 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
boolean tramoEditable = (secuenciaRutaTramoVO.getTramoId() == null);
|
||||
boolean tramoServicioEditable = (secuenciaRutaTramoVO.getTramoServicioId() == null);
|
||||
|
||||
if (!tramoEditable) {// cuando el tramo no es editable, es
|
||||
// porque ya existe. Entonces lleno
|
||||
// la pantalla con los nuevos
|
||||
// valores
|
||||
if (!tramoEditable) {// cuando el tramo no es editable, es porque ya existe. Entonces lleno la pantalla con los nuevos valores
|
||||
dKmsReal.setValueBigDecimal(secuenciaRutaTramoVO.getKmReal());
|
||||
} else {
|
||||
secuenciaRutaTramoVO.setKmReal(kmRealAntigo);
|
||||
|
@ -399,12 +381,7 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
|
||||
lblID.setValue((secuenciaRutaTramoVO.getTramoId() != null) ? secuenciaRutaTramoVO.getTramoId().toString() : "");
|
||||
|
||||
|
||||
if (!tramoServicioEditable) {// cuando el tramoServicio no
|
||||
// es editable, es porque ya
|
||||
// existe. Entonces lleno la
|
||||
// pantalla
|
||||
// con los nuevos valores
|
||||
if (!tramoServicioEditable) {// cuando el tramoServicio no es editable, es porque ya existe. Entonces lleno la pantalla con los nuevos valores
|
||||
spHora.setValue(secuenciaRutaTramoVO.getTiempoRecorrido().getHora());
|
||||
spMinuto.setValue(secuenciaRutaTramoVO.getTiempoRecorrido().getMinuto());
|
||||
} else {
|
||||
|
@ -413,7 +390,11 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
|
||||
dKmsReal.setReadonly(!tramoEditable);
|
||||
spHora.setDisabled(!tramoServicioEditable);
|
||||
spHora.setButtonVisible(tramoServicioEditable);
|
||||
spHora.setReadonly(!tramoServicioEditable);
|
||||
spMinuto.setDisabled(!tramoServicioEditable);
|
||||
spMinuto.setButtonVisible(tramoServicioEditable);
|
||||
spMinuto.setReadonly(!tramoServicioEditable);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +445,6 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
}
|
||||
row.appendChild(lblID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -635,51 +615,4 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
dataBinder.saveAll();
|
||||
return lsSecuenciaRutaTramoVO;
|
||||
}
|
||||
|
||||
class MyCustomTextboxDecimal extends Textbox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MyCustomTextboxDecimal() {
|
||||
super();
|
||||
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||
ejecutaJavaScript();
|
||||
}
|
||||
|
||||
public void setValueBigDecimal(BigDecimal kmPagoConductor) {
|
||||
this.setValue(getBigDecimal(kmPagoConductor));
|
||||
|
||||
}
|
||||
|
||||
public MyCustomTextboxDecimal(String value) throws WrongValueException {
|
||||
super(value);
|
||||
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||
ejecutaJavaScript();
|
||||
}
|
||||
|
||||
public MyCustomTextboxDecimal(BigDecimal value) throws WrongValueException {
|
||||
super();
|
||||
this.setValue(getBigDecimal(value));
|
||||
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||
ejecutaJavaScript();
|
||||
}
|
||||
|
||||
private void ejecutaJavaScript() {
|
||||
Clients.evalJavaScript("jQuery('#" + this.getUuid()
|
||||
+ "').format({allow_negative:false,precision: 2,decimal:'.',autofix:true});");
|
||||
}
|
||||
|
||||
private String getBigDecimal(BigDecimal val) {
|
||||
return (String) new StringDecimalToDecimalConverter().coerceToUi(val, this);
|
||||
|
||||
}
|
||||
|
||||
public BigDecimal getValueBigDecimal() {
|
||||
return getBigDecimal(this.getValue());
|
||||
}
|
||||
|
||||
private BigDecimal getBigDecimal(String val) {
|
||||
return (BigDecimal) new StringDecimalToDecimalConverter().coerceToBean(val, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,508 @@
|
|||
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.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 GridRutaTramoCoeficiente 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 boolean mostraPopupGrid;
|
||||
private static Logger log = Logger.getLogger(GridRutaTramoCoeficiente.class);
|
||||
|
||||
public GridRutaTramoCoeficiente() {
|
||||
lsSecuenciaRutaTramoCoeficienteVO = new ArrayList<SecuenciaRutaTramoCoeficienteVO>();
|
||||
this.setRowRenderer(this);
|
||||
this.appendChild(generarColumns());
|
||||
dataBinder = new DataBinder();
|
||||
mostraPopupGrid = true;
|
||||
}
|
||||
|
||||
public boolean isMostraPopupGrid() {
|
||||
return mostraPopupGrid;
|
||||
}
|
||||
|
||||
public void setMostraPopupGrid(boolean mostraPopupGrid) {
|
||||
this.mostraPopupGrid = mostraPopupGrid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Informa la lista de vias disponibles
|
||||
*
|
||||
* @param lsVias
|
||||
*/
|
||||
public void setLsVias(List<Via> lsVias) {
|
||||
this.lsVias = lsVias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cuás 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("gridRutaSecuencia.columnOrigen.label"));
|
||||
columnOrigen.setWidth("20%");
|
||||
columns.appendChild(columnOrigen);
|
||||
|
||||
Column columnDestino = new Column(Labels.getLabel("gridRutaSecuencia.columnDestino.label"));
|
||||
columnDestino.setWidth("20%");
|
||||
columns.appendChild(columnDestino);
|
||||
|
||||
Column columnVia = new Column(Labels.getLabel("gridRutaSecuencia.columnVia.label"));
|
||||
columnVia.setWidth("15%");
|
||||
columns.appendChild(columnVia);
|
||||
|
||||
Column kmsReal = new Column(Labels.getLabel("gridRutaSecuencia.columnKmsReal.label"));
|
||||
kmsReal.setWidth("6%");
|
||||
columns.appendChild(kmsReal);
|
||||
|
||||
Column tiempoRecorrido = new Column(Labels.getLabel("gridRutaSecuencia.columnTiempoRecorrido.label"));
|
||||
tiempoRecorrido.setWidth("10%");
|
||||
columns.appendChild(tiempoRecorrido);
|
||||
|
||||
Column columnIDTramo = new Column(Labels.getLabel("gridRutaSecuencia.columnIDTramo.label"));
|
||||
columnSecuencia.setWidth("6%");
|
||||
columns.appendChild(columnIDTramo);
|
||||
|
||||
Column columnCoeficiente1 = new Column(Labels.getLabel("gridRutaSecuencia.columnCoeficiente1.label"));
|
||||
columnCoeficiente1.setWidth("12%");
|
||||
columns.appendChild(columnCoeficiente1);
|
||||
|
||||
Column columnKmCoeficiente1 = new Column(Labels.getLabel("gridRutaSecuencia.columnKmCoeficiente1.label"));
|
||||
columnKmCoeficiente1.setWidth("5%");
|
||||
columns.appendChild(columnKmCoeficiente1);
|
||||
|
||||
Column columnCoeficiente2 = new Column(Labels.getLabel("gridRutaSecuencia.columnCoeficiente2.label"));
|
||||
columnCoeficiente2.setWidth("12%");
|
||||
columns.appendChild(columnCoeficiente2);
|
||||
|
||||
Column columnKmCoeficiente2 = new Column(Labels.getLabel("gridRutaSecuencia.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 Combobox cboCoeficiente2 = new Combobox();
|
||||
final Intbox ibxKm2 = new Intbox();
|
||||
|
||||
// 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.setValue(secuenciaRutaTramoCoeficienteVO.getKmCoeficiente1());
|
||||
|
||||
cboCoeficiente2.setSelectedIndex(-1);
|
||||
ibxKm2.setValue(0);
|
||||
|
||||
if (secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa2() != null){
|
||||
cboCoeficiente2.setText(secuenciaRutaTramoCoeficienteVO.getCoeficienteTarifa2().getDescCoeficiente());
|
||||
ibxKm2.setValue(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.setValue((secuenciaRutaTramoCoeficienteVO.getKmCoeficiente1() != null) ? secuenciaRutaTramoCoeficienteVO.getKmCoeficiente1() : 0);
|
||||
ibxKm1.setWidth("80%");
|
||||
ibxKm1.setReadonly(!esTramoCoeficienteEditable);
|
||||
dataBinder.addBinding(ibxKm1, "value", row.getUuid() + ".kmCoeficiente1", null, null, "save", null, 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.setValue((secuenciaRutaTramoCoeficienteVO.getKmCoeficiente2() != null) ? secuenciaRutaTramoCoeficienteVO.getKmCoeficiente2() : 0);
|
||||
ibxKm2.setWidth("80%");
|
||||
ibxKm2.setReadonly(!esTramoCoeficienteEditable);
|
||||
dataBinder.addBinding(ibxKm2, "value", row.getUuid() + ".kmCoeficiente2", null, null, "save", null, 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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintNumberBD;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter;
|
||||
|
||||
class MyCustomTextboxDecimal extends Textbox {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MyCustomTextboxDecimal() {
|
||||
super();
|
||||
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||
ejecutaJavaScript();
|
||||
}
|
||||
|
||||
public void setValueBigDecimal(BigDecimal kmPagoConductor) {
|
||||
this.setValue(getBigDecimal(kmPagoConductor));
|
||||
|
||||
}
|
||||
|
||||
public MyCustomTextboxDecimal(String value) throws WrongValueException {
|
||||
super(value);
|
||||
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||
ejecutaJavaScript();
|
||||
}
|
||||
|
||||
public MyCustomTextboxDecimal(BigDecimal value) throws WrongValueException {
|
||||
super();
|
||||
this.setValue(getBigDecimal(value));
|
||||
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||
ejecutaJavaScript();
|
||||
}
|
||||
|
||||
private void ejecutaJavaScript() {
|
||||
Clients.evalJavaScript("jQuery('#" + this.getUuid() + "').format({allow_negative:false,precision: 2,decimal:'.',autofix:true});");
|
||||
}
|
||||
|
||||
private String getBigDecimal(BigDecimal val) {
|
||||
return (String) new StringDecimalToDecimalConverter().coerceToUi(val, this);
|
||||
|
||||
}
|
||||
|
||||
public BigDecimal getValueBigDecimal() {
|
||||
return getBigDecimal(this.getValue());
|
||||
}
|
||||
|
||||
private BigDecimal getBigDecimal(String val) {
|
||||
return (BigDecimal) new StringDecimalToDecimalConverter().coerceToBean(val, this);
|
||||
}
|
||||
}
|
|
@ -8,10 +8,12 @@ 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.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Button;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||
import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||
|
@ -61,16 +63,17 @@ public class EditarCoeficienteTarifaController extends MyGenericForwardComposer
|
|||
|
||||
if (coeficienteTarifa.getCoeficienteId() == null) {
|
||||
coeficienteTarifaService.suscribir(coeficienteTarifa);
|
||||
coeficienteTarifaList.addItem(coeficienteTarifa);
|
||||
} else {
|
||||
coeficienteTarifaService.actualizacion(coeficienteTarifa);
|
||||
coeficienteTarifaList.updateItem(coeficienteTarifa);
|
||||
|
||||
}
|
||||
|
||||
coeficienteTarifaList.updateItem(coeficienteTarifa);
|
||||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarCoeficienteTarifaController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarCoeficienteTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
Labels.getLabel("editarCoeficienteTarifaController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarCoeficienteTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
closeWindow();
|
||||
}
|
||||
|
@ -78,22 +81,29 @@ public class EditarCoeficienteTarifaController extends MyGenericForwardComposer
|
|||
public void onClick$btnApagar(Event ev) throws InterruptedException {
|
||||
|
||||
Integer resp = Messagebox.show(
|
||||
Labels.getLabel("editarCoeficienteTarifaController.MSG.borrarPergunta"),
|
||||
Labels.getLabel("editarCoeficienteTarifaController.window.title"),
|
||||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
Labels.getLabel("editarCoeficienteTarifaController.MSG.borrarPergunta"),
|
||||
Labels.getLabel("editarCoeficienteTarifaController.window.title"),
|
||||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
|
||||
if (resp.equals(Messagebox.YES)) {
|
||||
|
||||
coeficienteTarifaService.borrar(coeficienteTarifa);
|
||||
|
||||
Messagebox.show(
|
||||
try {
|
||||
coeficienteTarifaService.borrar(coeficienteTarifa);
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarCoeficienteTarifaController.MSG.borrarOK"),
|
||||
Labels.getLabel("editarCoeficienteTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
coeficienteTarifaList.removeItem(coeficienteTarifa);
|
||||
coeficienteTarifaList.removeItem(coeficienteTarifa);
|
||||
|
||||
closeWindow();
|
||||
} catch (RegistroConDependenciaException e) {
|
||||
Clients.alert(
|
||||
e.getLocalizedMessage(),
|
||||
Labels.getLabel("editarCoeficienteTarifaController.window.title"),
|
||||
Messagebox.INFORMATION);
|
||||
}
|
||||
|
||||
closeWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,23 +4,10 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||
import com.rjconsultores.ventaboletos.entidad.TramoKmServicio;
|
||||
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.TramoKmServicioService;
|
||||
import com.rjconsultores.ventaboletos.service.TramoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
@ -37,6 +24,21 @@ import org.zkoss.zul.Combobox;
|
|||
import org.zkoss.zul.Comboitem;
|
||||
import org.zkoss.zul.Messagebox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||
import com.rjconsultores.ventaboletos.entidad.TramoKmServicio;
|
||||
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.TramoKmServicioService;
|
||||
import com.rjconsultores.ventaboletos.service.TramoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrador
|
||||
|
@ -265,10 +267,6 @@ public class EditarTramoKmServicioController extends MyGenericForwardComposer {
|
|||
|
||||
closeWindow();
|
||||
}
|
||||
} catch (RegistroConDependenciaException ex) {
|
||||
Clients.alert(ex.getLocalizedMessage(),
|
||||
Labels.getLabel("editarTramoKmServicioController.window.title"),
|
||||
Messagebox.INFORMATION);
|
||||
} catch (Exception ex) {
|
||||
log.error(ex);
|
||||
Clients.alert(Labels.getLabel("MSG.Error"),
|
||||
|
|
|
@ -4,14 +4,8 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional.generaciontramosrutas;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.Predicate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -24,12 +18,14 @@ import org.zkoss.zul.Messagebox;
|
|||
import org.zkoss.zul.Radio;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
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.web.gui.componente.esquemaoperacional.GridRutaTramo;
|
||||
import com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridRutaTramoCoeficiente;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
||||
/**
|
||||
|
@ -47,10 +43,12 @@ public class EditarCombinacionTramoRutaController extends MyGenericForwardCompos
|
|||
private TramoRutaService tramoRutaService;
|
||||
@Autowired
|
||||
private RutaService rutaService;
|
||||
@Autowired
|
||||
private CoeficienteTarifaService coeficienteTarifaService;
|
||||
private RutaTramoVO rutaTramoIdaVO;
|
||||
private RutaTramoVO rutaTramoRegresoVO;
|
||||
private GridRutaTramo gridRutaSecuenciaIda;
|
||||
private GridRutaTramo gridRutaSecuenciaVolta;
|
||||
private GridRutaTramoCoeficiente gridRutaSecuenciaIda;
|
||||
private GridRutaTramoCoeficiente gridRutaSecuenciaVolta;
|
||||
private Window winEditarTramoRuta;
|
||||
private Intbox txtNumRuta;
|
||||
private Radio radIda;
|
||||
|
@ -63,22 +61,26 @@ public class EditarCombinacionTramoRutaController extends MyGenericForwardCompos
|
|||
super.doAfterCompose(comp);
|
||||
gridRutaSecuenciaIda.setMostraPopupGrid(false);
|
||||
gridRutaSecuenciaIda.setClaseServicio(rutaTramoIdaVO.getClaseServicio());
|
||||
gridRutaSecuenciaIda.setOrgaoConcedente(rutaTramoIdaVO.getOrgaoConcedente());
|
||||
gridRutaSecuenciaIda.setLsVias(viaService.obtenerTodos());
|
||||
gridRutaSecuenciaIda.setLsCoeficientes(coeficienteTarifaService.obtenerTodos());
|
||||
gridRutaSecuenciaIda.agregarTodos(tramoRutaService.generarCombinacion(rutaTramoIdaVO));
|
||||
gridRutaSecuenciaVolta.setMostraPopupGrid(false);
|
||||
gridRutaSecuenciaVolta.setClaseServicio(rutaTramoIdaVO.getClaseServicio());
|
||||
gridRutaSecuenciaVolta.setOrgaoConcedente(rutaTramoIdaVO.getOrgaoConcedente());
|
||||
gridRutaSecuenciaVolta.setLsVias(viaService.obtenerTodos());
|
||||
if(rutaTramoIdaVO.getIndSentidoIda()){
|
||||
gridRutaSecuenciaVolta.setLsCoeficientes(coeficienteTarifaService.obtenerTodos());
|
||||
if (rutaTramoIdaVO.getIndSentidoIda()) {
|
||||
radIda.setChecked(false);
|
||||
radVolta.setChecked(true);
|
||||
}else{
|
||||
} else {
|
||||
radIda.setChecked(true);
|
||||
radVolta.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick$btnSalvar(Event e) throws InterruptedException {
|
||||
rutaTramoIdaVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaIda.getLsSecuenciaRutaTramoVO());
|
||||
rutaTramoIdaVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaIda.getLsSecuenciaRutaTramoCoeficienteVO());
|
||||
|
||||
try {
|
||||
Ruta rutaIda = tramoRutaService.generarTramosRutas(rutaTramoIdaVO);
|
||||
|
@ -96,7 +98,7 @@ public class EditarCombinacionTramoRutaController extends MyGenericForwardCompos
|
|||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
|
||||
if (resp == Messagebox.YES) {
|
||||
rutaTramoRegresoVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaVolta.getLsSecuenciaRutaTramoVO());
|
||||
rutaTramoRegresoVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaVolta.getLsSecuenciaRutaTramoCoeficienteVO());
|
||||
Ruta rutaRegresso = tramoRutaService.generarTramosRutas(rutaTramoRegresoVO);
|
||||
|
||||
if (rutaRegresso != null) {
|
||||
|
@ -119,16 +121,16 @@ public class EditarCombinacionTramoRutaController extends MyGenericForwardCompos
|
|||
}
|
||||
|
||||
public void onClick$btnRutaRegreso(Event e) throws InterruptedException {
|
||||
|
||||
rutaTramoIdaVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaIda.getLsSecuenciaRutaTramoVO());
|
||||
txtNumRuta.getValue();
|
||||
rutaTramoIdaVO.setLsCombinacionRutaTramoVO(gridRutaSecuenciaIda.getLsSecuenciaRutaTramoCoeficienteVO());
|
||||
List<Ruta> listRuta = rutaService.buscarNumRuta(txtNumRuta.getValue());
|
||||
Integer in = txtNumRuta.getValue();
|
||||
if((!listRuta.isEmpty()) ||(txtNumRuta.getValue().equals(rutaTramoIdaVO.getNumRuta()))){
|
||||
|
||||
if ((!listRuta.isEmpty()) || (txtNumRuta.getValue().equals(rutaTramoIdaVO.getNumRuta()))) {
|
||||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarCatalogoDeRutaController.registroNumRutaExiste"),
|
||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
Labels.getLabel("editarCatalogoDeRutaController.registroNumRutaExiste"),
|
||||
Labels.getLabel("editarCatalogoDeRutaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
||||
return;
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import com.rjconsultores.ventaboletos.service.RutaService;
|
|||
import com.rjconsultores.ventaboletos.service.TramoRutaService;
|
||||
import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.ViaService;
|
||||
import com.rjconsultores.ventaboletos.service.impl.RutaServiceImpl;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO;
|
||||
import com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridRutaTramo;
|
||||
|
@ -112,6 +111,13 @@ public class EditarTramoRutaController extends MyGenericForwardComposer {
|
|||
return;
|
||||
}
|
||||
|
||||
if (gridRutaSecuencia.getLsSecuenciaRutaTramoVO().isEmpty()){
|
||||
Messagebox.show(Labels.getLabel("editarTramoRutaController.msg.trechoObligatoria"),
|
||||
Labels.getLabel("editarTramoRutaController.window.title"), Messagebox.OK,
|
||||
Messagebox.INFORMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
RutaTramoVO rutaTramoVO = new RutaTramoVO();
|
||||
rutaTramoVO.setClaseServicio((ClaseServicio) cmbClaseServicio.getSelectedItem().getValue());
|
||||
rutaTramoVO.setOrgaoConcedente((OrgaoConcedente) cmbOrgaoConcedente.getSelectedItem().getValue());
|
||||
|
@ -154,8 +160,6 @@ public class EditarTramoRutaController extends MyGenericForwardComposer {
|
|||
return lsClaseServicio;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onChange$cmbClaseServicio(Event e) {
|
||||
gridRutaSecuencia.setClaseServicio((ClaseServicio) cmbClaseServicio.getSelectedItem().getValue());
|
||||
}
|
||||
|
@ -164,9 +168,6 @@ public class EditarTramoRutaController extends MyGenericForwardComposer {
|
|||
return lsOrgaoConcedente;
|
||||
}
|
||||
|
||||
public void setLsOrgaoConcedente(List<OrgaoConcedente> lsOrgaoConcedente) {
|
||||
this.lsOrgaoConcedente = lsOrgaoConcedente;
|
||||
}
|
||||
|
||||
public void onClick$btnDebugCombinacion(Event e) {
|
||||
RutaTramoVO rutaTramoVO = new RutaTramoVO();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.zkoss.zul.Listcell;
|
||||
import org.zkoss.zul.Listitem;
|
||||
import org.zkoss.zul.ListitemRenderer;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# <controler>. <id>. <propiedade> = XXX
|
||||
|
||||
#Versao do VentaBoleto:
|
||||
versao = ADM_20130411_1RC141
|
||||
versao = ADM_20130415_1RC142
|
||||
|
||||
# MSG Defaut:
|
||||
MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100
|
||||
|
@ -3420,6 +3420,7 @@ editarTramoRutaController.tabRuta.value=Sequência
|
|||
editarTramoRutaController.tabEmpresa.value=Empresa
|
||||
editarTramoRutaController.lbEmpresa.value=Empresa
|
||||
editarTramoRutaController.msg.empresaObligatoria=Informe a empresa
|
||||
editarTramoRutaController.msg.trechoObligatoria=Informe as localidades da linha
|
||||
editarTramoRutaController.btnBorrarEmpresa.tooltiptext=Eliminar
|
||||
editarTramoRutaController.btnAddEmpresa.tooltiptext=Salvar
|
||||
editarTramoRutaController.radVolta.value = Volta
|
||||
|
@ -3449,7 +3450,10 @@ gridRutaSecuencia.paradaExisteException.msg=A localidade {0} já existe
|
|||
gridRutaSecuencia.msg.eliminarPaso=Eliminar localidade
|
||||
gridRutaSecuencia.msg.agregarDespues=Incluir Depois
|
||||
gridRutaSecuencia.columnNumLinha.label = N° Linha
|
||||
gridRutaSecuencia.columnSentido.label = Sentido
|
||||
gridRutaSecuencia.columnCoeficiente1.label = Coeficiente 1
|
||||
gridRutaSecuencia.columnCoeficiente2.label = Coeficiente 2
|
||||
gridRutaSecuencia.columnKmCoeficiente2.label = Km 2
|
||||
gridRutaSecuencia.columnKmCoeficiente1.label = Km 1
|
||||
#TramoRutaServiceImpl
|
||||
tramoRutaServiceImpl.msg.combinacionObligatorio=A combinação deve de ser informada
|
||||
tramoRutaServiceImpl.msg.secuenciaObligatorio=A sequência deve ser informada
|
||||
|
|
|
@ -4,15 +4,16 @@
|
|||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winEditarCombinacionTramoRuta"?>
|
||||
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||
|
||||
|
||||
<zk>
|
||||
<window id="winEditarCombinacionTramoRuta" border="normal"
|
||||
width="950px" apply="${editarCombinacionTramoRutaController}"
|
||||
width="1324px" apply="${editarCombinacionTramoRutaController}"
|
||||
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>
|
||||
|
@ -41,7 +42,7 @@
|
|||
<tabpanels>
|
||||
<tabpanel width="100%">
|
||||
<grid id="gridRutaSecuenciaIda" mold="paging" pageSize="14" width="98%"
|
||||
use="com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridRutaTramo"
|
||||
use="com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridRutaTramoCoeficiente"
|
||||
height="445px">
|
||||
</grid>
|
||||
</tabpanel>
|
||||
|
@ -73,9 +74,9 @@
|
|||
<button tooltiptext="${c:l('editarCombinacionTramoRutaController.btnRutaRegreso.tooltiptext')}"
|
||||
image="/gui/img/create_doc.gif" id="btnRutaRegreso" />
|
||||
</toolbar>
|
||||
<grid id="gridRutaSecuenciaVolta" mold="paging" pageSize="14" width="98%"
|
||||
use="com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridRutaTramo"
|
||||
height="445px">
|
||||
<grid id="gridRutaSecuenciaVolta" mold="paging" pageSize="12" width="98%"
|
||||
use="com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional.GridRutaTramoCoeficiente"
|
||||
height="350px">
|
||||
</grid>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
<column width="30%" />
|
||||
</columns>
|
||||
<rows>
|
||||
|
||||
<row>
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('editarTramoRutaController.lblRuta.value')}" />
|
||||
<textbox id="txtDscRuta" width="89%" sclass="mydb"
|
||||
|
@ -47,11 +46,8 @@
|
|||
<row>
|
||||
<label value="${c:l('editarTramoRutaController.lbSentidoLinha.value')}" />
|
||||
<radiogroup Id="indConfigRuta">
|
||||
<radio id="radIda"
|
||||
label="${c:l('editarTramoRutaController.radIda.value')}"
|
||||
/>
|
||||
<radio id="radVolta"
|
||||
label="${c:l('editarTramoRutaController.radVolta.value')}" />
|
||||
<radio id="radIda" label="${c:l('editarTramoRutaController.radIda.value')}" checked="true" />
|
||||
<radio id="radVolta" label="${c:l('editarTramoRutaController.radVolta.value')}" />
|
||||
</radiogroup>
|
||||
|
||||
<label value="${c:l('editarTramoRutaController.lblOrgao.value')}" />
|
||||
|
|
Loading…
Reference in New Issue