Skip to content

Commit

Permalink
Corrección funcionalidad
Browse files Browse the repository at this point in the history
  • Loading branch information
uo287568 committed Jun 17, 2024
1 parent 3f86515 commit 9f8381d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions src/main/java/giis/demo/tkrun/LocalizacionEnvioController.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import giis.demo.util.SwingUtil;
Expand All @@ -27,6 +28,7 @@ public void initController() {
private void buscarEnvio() {
String nref = view.getTfNRef().getText();
if(comprobarNRef(nref)) {
limpiar();
int nrefNum = Integer.parseInt(nref);
EnvioDisplayDTO envio = model.getEnvio(nrefNum);
if(comprobarEnvio(envio, nrefNum)) {
Expand All @@ -36,15 +38,24 @@ private void buscarEnvio() {
}
}

private void limpiar() {
DefaultTableModel model1 = (DefaultTableModel) view.getTbInfo().getModel();
model1.setRowCount(0);
DefaultTableModel model2 = (DefaultTableModel) view.getTbMovimientos().getModel();
model2.setRowCount(0);
}

private void mostrarMovimientos(int nrefNum) {
List<MovimientosDisplayDTO> movimientos = model.getMovimientos(nrefNum);
TableModel tmodel = SwingUtil.getTableModelFromPojos(movimientos, new String[] {"movimiento", "ubicacion","fechaMov"});
view.getTbMovimientos().setModel(tmodel);
SwingUtil.autoAdjustColumns(view.getTbMovimientos());
if (movimientos.get(0).getMovimiento().equals("Entrega")) {
view.getTfEstado().setText("ENTREGADO");
} else {
view.getTfEstado().setText("EN CAMINO");
if(movimientos.size() > 0) {
TableModel tmodel = SwingUtil.getTableModelFromPojos(movimientos, new String[] {"movimiento", "ubicacion","fechaMov"});
view.getTbMovimientos().setModel(tmodel);
SwingUtil.autoAdjustColumns(view.getTbMovimientos());
if (movimientos.get(0).getMovimiento().equals("Entrega")) {
view.getTfEstado().setText("ENTREGADO");
} else {
view.getTfEstado().setText("EN CAMINO");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ insert into transportistas(id) values
(3);

insert into pedidosTransportista(id,nref,nombreEmisor,correoEmisor,direccionEmisor,direccionReceptor,fechaEntrega) values
(1, 1, "Calle Uría 53, 4B", "Juan", "[email protected]", "Calle Julián Clavería 13, 2C", "2024-06-22"),
(1, 1, "Juan", "[email protected]", "Calle Uría 53, 4B", "Calle Julián Clavería 13, 2C", "2024-06-22"),
(1, 4, "Felipe", "[email protected]", "Calle Ramiro I Rey 2, bajo izda", "Calle Quintana 6, 5C", "2024-07-08"),
(1, 9, "Covadonga", "[email protected]", "Calle Caveda 4, 2C", "Calle Burriana 18, 6A", "2024-06-26"),
(2, 3, "Marta", "[email protected]", "Calle Fernando Alonso 33, 3C", "Calle de Argüelles 11, 4A", "2024-07-14"),
Expand Down

0 comments on commit 9f8381d

Please sign in to comment.