mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
añadidos limites cuando lomo interior es menor que 10
This commit is contained in:
1700
logs/erp.log
1700
logs/erp.log
File diff suppressed because it is too large
Load Diff
@ -248,7 +248,7 @@ public class skApiClient {
|
||||
return (Long) result.get("data");
|
||||
}
|
||||
|
||||
public Integer getMaxSolapas(Map<String, Object> requestBody, Locale locale) {
|
||||
public Map<String, Object> getMaxSolapas(Map<String, Object> requestBody, Locale locale) {
|
||||
try {
|
||||
String jsonResponse = performWithRetry(() -> {
|
||||
String url = this.skApiUrl + "api/calcular-solapas";
|
||||
@ -289,7 +289,11 @@ public class skApiClient {
|
||||
messageSource.getMessage("presupuesto.errores.error-interior", new Object[] { 1 }, locale));
|
||||
}
|
||||
|
||||
return root.get("data").asInt();
|
||||
Integer maxSolapas = root.get("data").asInt();
|
||||
Double lomo = root.get("lomo").asDouble();
|
||||
return Map.of(
|
||||
"maxSolapas", maxSolapas,
|
||||
"lomo", lomo);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
// Fallback al 80% del ancho
|
||||
@ -302,7 +306,9 @@ public class skApiClient {
|
||||
throw new RuntimeException("Tamaño no válido en la solicitud: " + requestBody);
|
||||
else {
|
||||
int ancho = (int) tamanio.get("ancho");
|
||||
return (int) Math.floor(ancho * 0.8); // 80% del ancho
|
||||
return Map.of(
|
||||
"maxSolapas", (int) (ancho * 0.8 ),
|
||||
"lomo", 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,9 @@ public class PresupuestoController {
|
||||
return ResponseEntity.badRequest().body(errores);
|
||||
}
|
||||
Map<String, Object> resultado = new HashMap<>();
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
resultado.putAll(presupuestoService.obtenerOpcionesAcabadosCubierta(presupuesto, locale));
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
@ -267,7 +269,10 @@ public class PresupuestoController {
|
||||
}
|
||||
}
|
||||
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
@ -300,7 +305,10 @@ public class PresupuestoController {
|
||||
presupuesto.setGramajeInterior(Integer.parseInt(opciones.get(0))); // Asignar primera opción
|
||||
}
|
||||
}
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
@ -323,7 +331,10 @@ public class PresupuestoController {
|
||||
}
|
||||
|
||||
Map<String, Object> resultado = new HashMap<>();
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ public class PresupuestoPapeles {
|
||||
);
|
||||
|
||||
private static final Map<String, String> CABEZADA_COLOR_KEYS = Map.of(
|
||||
"NOCABE", "presupuesto.cabezada-sin-cabezada",
|
||||
"WHI", "presupuesto.cabezada-blanca",
|
||||
"GRE", "presupuesto.cabezada-verde",
|
||||
"BLUE", "presupuesto.cabezada-azul",
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
databaseChangeLog:
|
||||
- changeSet:
|
||||
id: 0018-change-presupuesto-ch-3
|
||||
author: jjo
|
||||
preConditions:
|
||||
- dbms:
|
||||
type: mysql
|
||||
|
||||
changes:
|
||||
- sql:
|
||||
splitStatements: false
|
||||
stripComments: true
|
||||
sql: |
|
||||
ALTER TABLE presupuesto
|
||||
DROP CHECK presupuesto_chk_3;
|
||||
|
||||
rollback:
|
||||
- sql:
|
||||
splitStatements: false
|
||||
stripComments: true
|
||||
sql: |
|
||||
ALTER TABLE presupuesto
|
||||
ADD CONSTRAINT presupuesto_chk_3
|
||||
CHECK (tipo_cubierta BETWEEN 0 AND 2);
|
||||
@ -33,3 +33,5 @@ databaseChangeLog:
|
||||
file: db/changelog/changesets/0016-fix-enum-estado-pedidos-lineas.yml
|
||||
- include:
|
||||
file: db/changelog/changesets/0017-add-fecha-entrega-to-pedidos-lineas.yml
|
||||
- include:
|
||||
file: db/changelog/changesets/0018-change-presupuesto-ch-3.yml
|
||||
@ -138,6 +138,7 @@ presupuesto.papel-guardas=Papel de guardas
|
||||
presupuesto.guardas-impresas=Guardas impresas
|
||||
presupuesto.no=No
|
||||
presupuesto.cabezada=Cabezada
|
||||
presupuesto.cabezada-sin-cabezada=Sin cabezada
|
||||
presupuesto.cabezada-blanca=Blanca
|
||||
presupuesto.cabezada-verde=Verde
|
||||
presupuesto.cabezada-azul=Azul
|
||||
|
||||
@ -925,6 +925,7 @@ export default class PresupuestoWizard {
|
||||
this.#changeTab('pills-general-data');
|
||||
} else {
|
||||
const maxSolapas = data.solapas ?? 120;
|
||||
const lomo = data.lomo ?? 0;
|
||||
$('.solapas-presupuesto').attr('max', maxSolapas);
|
||||
$('.max-solapa-text').text(function (_, textoActual) {
|
||||
return textoActual.replace(/\d+/, maxSolapas);
|
||||
@ -949,6 +950,20 @@ export default class PresupuestoWizard {
|
||||
this.acabadoSobrecubierta.val(this.formData.cubierta.sobrecubierta.acabado);
|
||||
this.fajaSobrecubierta.val(this.formData.cubierta.faja.acabado);
|
||||
|
||||
if(lomo < 10){
|
||||
this.formData.cubierta.cabezada = "NOCAB";
|
||||
this.cabezada.val("NOCAB");
|
||||
this.cabezada.prop("disabled", true);
|
||||
if(this.formData.cubierta.tipoCubierta === 'tapaDuraLomoRedondo'){
|
||||
this.formData.cubierta.tipoCubierta = 'tapaDura';
|
||||
}
|
||||
$("#tapaDuraLomoRedondo").addClass("d-none");
|
||||
}
|
||||
else{
|
||||
this.cabezada.prop("disabled", false);
|
||||
$("#tapaDuraLomoRedondo").removeClass("d-none");
|
||||
}
|
||||
|
||||
this.#loadCubiertaData();
|
||||
this.summaryTableCubierta.removeClass('d-none');
|
||||
if (this.sobrecubierta.hasClass('active')) {
|
||||
|
||||
@ -151,6 +151,7 @@
|
||||
<div class="col-auto mb-3">
|
||||
<label for="cabezada" class="form-label" th:text="#{presupuesto.cabezada}">Cabezada</label>
|
||||
<select class="form-select select2 datos-cubierta tapa-cubierta-summary" id="cabezada">
|
||||
<option value="NOCAB" th:text="#{presupuesto.cabezada-sin-cabezada}">Sin cabezada</option>
|
||||
<option value="WHI" th:text="#{presupuesto.cabezada-blanca}" selected>Blanca</option>
|
||||
<option value="GRE" th:text="#{presupuesto.cabezada-verde}">Verde</option>
|
||||
<option value="BLUE" th:text="#{presupuesto.cabezada-azul}">Azul</option>
|
||||
|
||||
Reference in New Issue
Block a user