mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-12 16:38:48 +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");
|
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 {
|
try {
|
||||||
String jsonResponse = performWithRetry(() -> {
|
String jsonResponse = performWithRetry(() -> {
|
||||||
String url = this.skApiUrl + "api/calcular-solapas";
|
String url = this.skApiUrl + "api/calcular-solapas";
|
||||||
@ -289,7 +289,11 @@ public class skApiClient {
|
|||||||
messageSource.getMessage("presupuesto.errores.error-interior", new Object[] { 1 }, locale));
|
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) {
|
} catch (JsonProcessingException e) {
|
||||||
// Fallback al 80% del ancho
|
// Fallback al 80% del ancho
|
||||||
@ -302,7 +306,9 @@ public class skApiClient {
|
|||||||
throw new RuntimeException("Tamaño no válido en la solicitud: " + requestBody);
|
throw new RuntimeException("Tamaño no válido en la solicitud: " + requestBody);
|
||||||
else {
|
else {
|
||||||
int ancho = (int) tamanio.get("ancho");
|
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);
|
return ResponseEntity.badRequest().body(errores);
|
||||||
}
|
}
|
||||||
Map<String, Object> resultado = new HashMap<>();
|
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));
|
resultado.putAll(presupuestoService.obtenerOpcionesAcabadosCubierta(presupuesto, locale));
|
||||||
return ResponseEntity.ok(resultado);
|
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);
|
return ResponseEntity.ok(resultado);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +305,10 @@ public class PresupuestoController {
|
|||||||
presupuesto.setGramajeInterior(Integer.parseInt(opciones.get(0))); // Asignar primera opción
|
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);
|
return ResponseEntity.ok(resultado);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +331,10 @@ public class PresupuestoController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> resultado = new HashMap<>();
|
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);
|
return ResponseEntity.ok(resultado);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public class PresupuestoPapeles {
|
|||||||
);
|
);
|
||||||
|
|
||||||
private static final Map<String, String> CABEZADA_COLOR_KEYS = Map.of(
|
private static final Map<String, String> CABEZADA_COLOR_KEYS = Map.of(
|
||||||
|
"NOCABE", "presupuesto.cabezada-sin-cabezada",
|
||||||
"WHI", "presupuesto.cabezada-blanca",
|
"WHI", "presupuesto.cabezada-blanca",
|
||||||
"GRE", "presupuesto.cabezada-verde",
|
"GRE", "presupuesto.cabezada-verde",
|
||||||
"BLUE", "presupuesto.cabezada-azul",
|
"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);
|
||||||
@ -32,4 +32,6 @@ databaseChangeLog:
|
|||||||
- include:
|
- include:
|
||||||
file: db/changelog/changesets/0016-fix-enum-estado-pedidos-lineas.yml
|
file: db/changelog/changesets/0016-fix-enum-estado-pedidos-lineas.yml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/changesets/0017-add-fecha-entrega-to-pedidos-lineas.yml
|
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.guardas-impresas=Guardas impresas
|
||||||
presupuesto.no=No
|
presupuesto.no=No
|
||||||
presupuesto.cabezada=Cabezada
|
presupuesto.cabezada=Cabezada
|
||||||
|
presupuesto.cabezada-sin-cabezada=Sin cabezada
|
||||||
presupuesto.cabezada-blanca=Blanca
|
presupuesto.cabezada-blanca=Blanca
|
||||||
presupuesto.cabezada-verde=Verde
|
presupuesto.cabezada-verde=Verde
|
||||||
presupuesto.cabezada-azul=Azul
|
presupuesto.cabezada-azul=Azul
|
||||||
|
|||||||
@ -925,6 +925,7 @@ export default class PresupuestoWizard {
|
|||||||
this.#changeTab('pills-general-data');
|
this.#changeTab('pills-general-data');
|
||||||
} else {
|
} else {
|
||||||
const maxSolapas = data.solapas ?? 120;
|
const maxSolapas = data.solapas ?? 120;
|
||||||
|
const lomo = data.lomo ?? 0;
|
||||||
$('.solapas-presupuesto').attr('max', maxSolapas);
|
$('.solapas-presupuesto').attr('max', maxSolapas);
|
||||||
$('.max-solapa-text').text(function (_, textoActual) {
|
$('.max-solapa-text').text(function (_, textoActual) {
|
||||||
return textoActual.replace(/\d+/, maxSolapas);
|
return textoActual.replace(/\d+/, maxSolapas);
|
||||||
@ -949,6 +950,20 @@ export default class PresupuestoWizard {
|
|||||||
this.acabadoSobrecubierta.val(this.formData.cubierta.sobrecubierta.acabado);
|
this.acabadoSobrecubierta.val(this.formData.cubierta.sobrecubierta.acabado);
|
||||||
this.fajaSobrecubierta.val(this.formData.cubierta.faja.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.#loadCubiertaData();
|
||||||
this.summaryTableCubierta.removeClass('d-none');
|
this.summaryTableCubierta.removeClass('d-none');
|
||||||
if (this.sobrecubierta.hasClass('active')) {
|
if (this.sobrecubierta.hasClass('active')) {
|
||||||
|
|||||||
@ -151,6 +151,7 @@
|
|||||||
<div class="col-auto mb-3">
|
<div class="col-auto mb-3">
|
||||||
<label for="cabezada" class="form-label" th:text="#{presupuesto.cabezada}">Cabezada</label>
|
<label for="cabezada" class="form-label" th:text="#{presupuesto.cabezada}">Cabezada</label>
|
||||||
<select class="form-select select2 datos-cubierta tapa-cubierta-summary" id="cabezada">
|
<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="WHI" th:text="#{presupuesto.cabezada-blanca}" selected>Blanca</option>
|
||||||
<option value="GRE" th:text="#{presupuesto.cabezada-verde}">Verde</option>
|
<option value="GRE" th:text="#{presupuesto.cabezada-verde}">Verde</option>
|
||||||
<option value="BLUE" th:text="#{presupuesto.cabezada-azul}">Azul</option>
|
<option value="BLUE" th:text="#{presupuesto.cabezada-azul}">Azul</option>
|
||||||
|
|||||||
Reference in New Issue
Block a user