- Validação na remoção/adição de tramos
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@21839 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
c2427f4950
commit
60c3414325
|
@ -36,12 +36,12 @@ import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.OrgaoTramo;
|
import com.rjconsultores.ventaboletos.entidad.OrgaoTramo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TramoKm;
|
import com.rjconsultores.ventaboletos.entidad.TramoKm;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TramoTiempo;
|
import com.rjconsultores.ventaboletos.entidad.TramoTiempo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Via;
|
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService;
|
import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService;
|
||||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
@ -70,7 +70,10 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTramoTiempo;
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class EditarTramosController extends MyGenericForwardComposer {
|
public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(EditarTramosController.class);
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TramoService tramoService;
|
private TramoService tramoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -135,7 +138,8 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
private Button btnApagar;
|
private Button btnApagar;
|
||||||
private ConstraintNumberBD constraintTarifa;
|
private ConstraintNumberBD constraintTarifa;
|
||||||
private Tab tabExcepcionesKm;
|
private Tab tabExcepcionesKm;
|
||||||
private static Logger log = Logger.getLogger(EditarTramosController.class);
|
|
||||||
|
private boolean existeRutaOcupaTramo;
|
||||||
|
|
||||||
public Tramo getTramo() {
|
public Tramo getTramo() {
|
||||||
return tramo;
|
return tramo;
|
||||||
|
@ -219,6 +223,7 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
existeRutaOcupaTramo = false;
|
||||||
lsVias = viaService.obtenerTodos();
|
lsVias = viaService.obtenerTodos();
|
||||||
lsEmpresa = empresaService.obtenerTodos();
|
lsEmpresa = empresaService.obtenerTodos();
|
||||||
lsClaseServicio = claseServicioService.buscarTodosExceto(-1);
|
lsClaseServicio = claseServicioService.buscarTodosExceto(-1);
|
||||||
|
@ -239,6 +244,7 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
tramo = (Tramo) Executions.getCurrent().getArg().get("tramo");
|
tramo = (Tramo) Executions.getCurrent().getArg().get("tramo");
|
||||||
if (tramo.getTramoId() != null) {
|
if (tramo.getTramoId() != null) {
|
||||||
|
existeRutaOcupaTramo = rutaCombinacionService.existeTramo(tramo);
|
||||||
tramo = tramoService.obtenerID(tramo.getTramoId());
|
tramo = tramoService.obtenerID(tramo.getTramoId());
|
||||||
|
|
||||||
for (TramoServicio ta : tramo.getTramoServicioList()) {
|
for (TramoServicio ta : tramo.getTramoServicioList()) {
|
||||||
|
@ -513,8 +519,7 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
cmbParadaDestino.getValue(true);
|
cmbParadaDestino.getValue(true);
|
||||||
|
|
||||||
if (listaTramoServicio.isEmpty()) {
|
if (listaTramoServicio.isEmpty()) {
|
||||||
Messagebox.show(Labels.getLabel("editarTramosController.MSG.obligatorioTramoTiempo"),
|
Messagebox.show(Labels.getLabel("editarTramosController.MSG.obligatorioTramoTiempo"), Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
||||||
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
|
||||||
Messagebox.INFORMATION);
|
Messagebox.INFORMATION);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -522,70 +527,21 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tramo.setLsOrgaoTramo(lsOrgamoTramo);
|
tramo.setLsOrgaoTramo(lsOrgamoTramo);
|
||||||
|
|
||||||
tramo.setActivo(Boolean.TRUE);
|
|
||||||
tramo.setFecmodif(Calendar.getInstance().getTime());
|
|
||||||
tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
||||||
|
|
||||||
Parada origem = tramo.getOrigem();
|
|
||||||
Parada destino = tramo.getDestino();
|
|
||||||
|
|
||||||
tramo.setVia((Via) cmbVia.getSelectedItem().getValue());
|
tramo.setVia((Via) cmbVia.getSelectedItem().getValue());
|
||||||
tramo.setLsTramoTiempo(listaTramosTiempo);
|
tramo.setLsTramoTiempo(listaTramosTiempo);
|
||||||
tramo.setTramoServicioList(listaTramoServicio);
|
tramo.setTramoServicioList(listaTramoServicio);
|
||||||
tramo.setTramoKms(listaTramosKm);
|
tramo.setTramoKms(listaTramosKm);
|
||||||
|
|
||||||
if (!origem.getParadaId().equals(destino.getParadaId())) {
|
tramo = tramoService.suscribirActualizar(tramo);
|
||||||
Tramo tramoConsulta = tramoService.buscar(tramo.getOrigem(), tramo.getDestino(), tramo.getVia());
|
|
||||||
|
|
||||||
boolean podeSalvar = false;
|
|
||||||
if (tramoConsulta == null) {
|
|
||||||
podeSalvar = true;
|
|
||||||
} else {
|
|
||||||
if (tramoConsulta.getTramoId().equals(tramo.getTramoId())) {
|
|
||||||
podeSalvar = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (podeSalvar) {
|
|
||||||
if (tramo.getTramoId() == null) {
|
|
||||||
|
|
||||||
tramoService.suscribir(tramo);
|
|
||||||
tramosList.addItem(tramo);
|
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel("editarTramosController.MSG.suscribirOK"),
|
|
||||||
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
|
||||||
Messagebox.INFORMATION);
|
|
||||||
|
|
||||||
closeWindow();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
tramoService.actualizacion(tramo);
|
|
||||||
tramosList.updateItem(tramo);
|
tramosList.updateItem(tramo);
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel("editarTramosController.MSG.suscribirOK"),
|
Messagebox.show(Labels.getLabel("editarTramosController.MSG.suscribirOK"), Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
||||||
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
|
||||||
Messagebox.INFORMATION);
|
Messagebox.INFORMATION);
|
||||||
|
|
||||||
closeWindow();
|
closeWindow();
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Messagebox.show(Labels.getLabel("MSG.Registro.Existe.Origem.Destino.Via"),
|
|
||||||
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
|
||||||
Messagebox.EXCLAMATION);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Messagebox.show(Labels.getLabel("editarTramosController.MSG.OrigemDestinoIguais"),
|
|
||||||
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK,
|
|
||||||
Messagebox.EXCLAMATION);
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
if (ex instanceof WrongValueException) {
|
|
||||||
throw (WrongValueException) ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.error(ex);
|
} catch (BusinessException ex) {
|
||||||
Messagebox.show(Labels.getLabel("MSG.Error"), Labels.getLabel("editarTramosController.window.title"),
|
Messagebox.show(ex.getLocalizedMessage(), Labels.getLabel("editarTramosController.window.title"), Messagebox.OK, Messagebox.ERROR);
|
||||||
Messagebox.OK, Messagebox.ERROR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,13 +632,10 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
orgaoConcedente = (OrgaoConcedente) cbiOrgaoConcedente.getValue();
|
orgaoConcedente = (OrgaoConcedente) cbiOrgaoConcedente.getValue();
|
||||||
claseServicio = (ClaseServicio) cbiClaseServicio.getValue();
|
claseServicio = (ClaseServicio) cbiClaseServicio.getValue();
|
||||||
|
|
||||||
|
|
||||||
Integer kmCoeficiente1 = txtKMCoeficiente1.getValue();
|
Integer kmCoeficiente1 = txtKMCoeficiente1.getValue();
|
||||||
Integer kmCoeficiente2 = txtKMCoeficiente2.getValue();
|
Integer kmCoeficiente2 = txtKMCoeficiente2.getValue();
|
||||||
Integer kmCoeficiente3 = txtKMCoeficiente3.getValue();
|
Integer kmCoeficiente3 = txtKMCoeficiente3.getValue();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((coeficienteTarifa1 == null) && (kmCoeficiente1 == null)) {
|
if ((coeficienteTarifa1 == null) && (kmCoeficiente1 == null)) {
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel("editarTramosController.msg.coeficiente1Obligatorio"),
|
Messagebox.show(Labels.getLabel("editarTramosController.msg.coeficiente1Obligatorio"),
|
||||||
|
@ -721,7 +674,6 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (orgaoClaseJahInformado) {
|
if (orgaoClaseJahInformado) {
|
||||||
Messagebox.show(Labels.getLabel("editarTramosController.msg.orgaoJahInformado"),
|
Messagebox.show(Labels.getLabel("editarTramosController.msg.orgaoJahInformado"),
|
||||||
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK, Messagebox.EXCLAMATION);
|
Labels.getLabel("editarTramosController.window.title"), Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
@ -756,4 +708,9 @@ public class EditarTramosController extends MyGenericForwardComposer {
|
||||||
txtKMCoeficiente2.setValue(null);
|
txtKMCoeficiente2.setValue(null);
|
||||||
txtKMCoeficiente3.setValue(null);
|
txtKMCoeficiente3.setValue(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isExisteRutaOcupaTramo() {
|
||||||
|
return existeRutaOcupaTramo;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,7 @@ public class TarifaEscalaContorller extends MyGenericForwardComposer {
|
||||||
log.debug("Inicio carga de combiaciones");
|
log.debug("Inicio carga de combiaciones");
|
||||||
for (RutaCombinacion rc : lsRutaCombinacion) {
|
for (RutaCombinacion rc : lsRutaCombinacion) {
|
||||||
Tramo tramo = rc.getTramo();
|
Tramo tramo = rc.getTramo();
|
||||||
Tarifa tarifa = tarifaService.buscar(tramo, marca, claseServicio, vigenciaTarifa, moneda);
|
Tarifa tarifa = tarifaService.buscar(tramo, marca, claseServicio, vigenciaTarifa, moneda, null);
|
||||||
|
|
||||||
if (tarifa == null) {
|
if (tarifa == null) {
|
||||||
tarifa = new Tarifa();
|
tarifa = new Tarifa();
|
||||||
|
|
|
@ -112,14 +112,19 @@ public class MyComboboxParada extends Combobox {
|
||||||
this.setText(initialValue.getDescparada());
|
this.setText(initialValue.getDescparada());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getValue(boolean checaBusqueda) throws WrongValueException {
|
/**
|
||||||
|
*
|
||||||
|
* @param checaBusqueda
|
||||||
|
* @throws WrongValueException
|
||||||
|
*/
|
||||||
|
public String getValue(boolean checaBusqueda) throws WrongValueException {
|
||||||
if (checaBusqueda) {
|
if (checaBusqueda) {
|
||||||
if (this.getSelectedItem() == null) {
|
if (this.getSelectedItem() == null) {
|
||||||
throw new WrongValueException(this, Labels.getLabel("MSG.Error.combobox.hacerBusqueda"));
|
throw new WrongValueException(this, Labels.getLabel("MSG.Error.combobox.hacerBusqueda"));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
super.getValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return super.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSinTodos() {
|
public boolean isSinTodos() {
|
||||||
|
|
|
@ -3788,3 +3788,10 @@ configLayoutImpressaoBoletoController.layout.label = Layout
|
||||||
configLayoutImpressaoBoletoController.campo.label = Campo
|
configLayoutImpressaoBoletoController.campo.label = Campo
|
||||||
configLayoutImpressaoBoletoController.coluna.label = Coluna
|
configLayoutImpressaoBoletoController.coluna.label = Coluna
|
||||||
configLayoutImpressaoBoletoController.linha.label = Linha
|
configLayoutImpressaoBoletoController.linha.label = Linha
|
||||||
|
|
||||||
|
#TramoService
|
||||||
|
tramoServiceImpl.msg.validacionVia=A via não pode ser alterada
|
||||||
|
TramoServiceImpl.msg.validacionOrigen=A origem do trecho não pode ser alterada
|
||||||
|
TramoServiceImpl.msg.validacionDestino=O destino do trecho não pode ser alterado
|
||||||
|
TramoServiceImpl.msg.validacionTramoServicio=Não pode ser apagado o Tempo Geral de um Tipo de Classe que é usado em uma ruta
|
||||||
|
TramoServiceImpl.msg.validacionTramoTiempo=Não pode ser apagado a Exceção de Tempo de um Tipo de Classe que é usado em uma ruta
|
|
@ -38,17 +38,17 @@
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<label value="${c:l('editarTramosController.labelOrigen.value')}" />
|
<label value="${c:l('editarTramosController.labelOrigen.value')}" />
|
||||||
<combobox id="cmbParadaOrigem" constraint="no empty" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada" mold="rounded"
|
<combobox id="cmbParadaOrigem" constraint="no empty" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada" mold="rounded" disabled="@{winEditarTramos$composer.existeRutaOcupaTramo}"
|
||||||
buttonVisible="true" width="80%" initialValue="@{winEditarTramos$composer.tramo.origem}" selectedItem="@{winEditarTramos$composer.tramo.origem}" />
|
buttonVisible="true" width="80%" initialValue="@{winEditarTramos$composer.tramo.origem}" selectedItem="@{winEditarTramos$composer.tramo.origem}" />
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<label value="${c:l('editarTramosController.labelDestino.value')}" />
|
<label value="${c:l('editarTramosController.labelDestino.value')}" />
|
||||||
<combobox id="cmbParadaDestino" constraint="no empty" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada" mold="rounded"
|
<combobox id="cmbParadaDestino" constraint="no empty" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada" mold="rounded" disabled="@{winEditarTramos$composer.existeRutaOcupaTramo}"
|
||||||
buttonVisible="true" width="80%" initialValue="@{winEditarTramos$composer.tramo.destino}" selectedItem="@{winEditarTramos$composer.tramo.destino}" />
|
buttonVisible="true" width="80%" initialValue="@{winEditarTramos$composer.tramo.destino}" selectedItem="@{winEditarTramos$composer.tramo.destino}" />
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<label value="${c:l('editarTramosController.labelVia.value')}" />
|
<label value="${c:l('editarTramosController.labelVia.value')}" />
|
||||||
<combobox id="cmbVia" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" constraint="no empty" mold="rounded"
|
<combobox id="cmbVia" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" constraint="no empty" mold="rounded" disabled="@{winEditarTramos$composer.existeRutaOcupaTramo}"
|
||||||
buttonVisible="true" width="80%" model="@{winEditarTramos$composer.lsVias}" selectedItem="@{winEditarTramos$composer.tramo.via}" />
|
buttonVisible="true" width="80%" model="@{winEditarTramos$composer.lsVias}" selectedItem="@{winEditarTramos$composer.tramo.via}" />
|
||||||
</row>
|
</row>
|
||||||
<!--row>
|
<!--row>
|
||||||
|
|
Loading…
Reference in New Issue