Merge branch 'bug/sobrecubierta' into 'main'

Bug/sobrecubierta

See merge request jjimenez/safekat!161
This commit is contained in:
2024-02-22 17:33:40 +00:00
3 changed files with 48 additions and 37 deletions

View File

@ -792,6 +792,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
$tarifamodel = new MaquinasTarifasImpresionModel();
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, ($uso=='guardas')?'interior':$uso, $tipo);
// Generates a message like: User 123 logged into the system from 127.0.0.1
if(!is_float($tarifa)){
continue;
}

View File

@ -390,6 +390,17 @@ class PresupuestoService extends BaseService
}
$altoForCalculo = $alto;
/*
Log ancho y alto de impresion y libro
$info = [
'ancho' => $anchoForCalculo,
'alto' => $altoForCalculo,
'maquina_ancho' => $maquina->ancho_impresion,
'maquina_alto' => $maquina->alto_impresion,
];
if($uso == 'cubierta' )
log_message('error', 'ancho:{ancho} --- alto:{alto} --- ancho2:{maquina_ancho} --- alto2:{maquina_alto} ---', $info);*/
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
@ -447,51 +458,47 @@ class PresupuestoService extends BaseService
$num_formas = $isCosido ? $num_formas * 2 : $num_formas;
}
else if ($forzar_a_favor_fibra){
$num_formas = $formas_h;
$num_formas = $isCosido ? $num_formas * 2 : $num_formas;
}
else{
$num_formas = $h1*$h2;
else{
$num_formas = $h1*$v1;
}
/*
if($uso=='interior'){
$info = [
'h1' => $h2_temp,
'v1' => $alto,
'h2' => $h2,
'v2' => $v2,
'num_formas' => $num_formas
];
log_message('error', 'h1:{h1}, v1:{v1}, h2:{h2}, v2:{v2}, numFormas:{num_formas}', $info);
}*/
// si no hay formas se devuelve n/a
if ($num_formas == 0) {
$response['num_formas']['posicion_formas'] = 'n/a'; // not available
} else if ($formas_h > $formas_v || $forzar_a_favor_fibra) {
$response['num_formas']['posicion_formas'] = 'h';
$response['num_formas']['num_formas_horizontales'] = $h1;
$response['num_formas']['num_formas_verticales'] = $v1;
$response['num_formas']['value'] = $num_formas;
} else {
$response['num_formas']['posicion_formas'] = 'v';
$response['num_formas']['num_formas_horizontales'] = $h2;
$response['num_formas']['num_formas_verticales'] = $v2;
$response['num_formas']['value'] = $num_formas;
}
else{
if ($formas_h > $formas_v || $forzar_a_favor_fibra && $formas_h != 0) {
$response['num_formas']['posicion_formas'] = 'h';
$response['num_formas']['num_formas_horizontales'] = $h1;
$response['num_formas']['num_formas_verticales'] = $v1;
$response['num_formas']['value'] = $num_formas;
}
else {
if($formas_v != 0){
$response['num_formas']['posicion_formas'] = 'v';
$response['num_formas']['num_formas_horizontales'] = $h2;
$response['num_formas']['num_formas_verticales'] = $v2;
$response['num_formas']['value'] = $num_formas;
}
}
if(($uso == 'cubierta' || $uso == 'sobrecubierta') && $num_formas>0) {
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
property_exists($maquina, 'forzar_num_formas_horizontales_cubierta')){
$response['num_formas']['num_formas_verticales'] = $h2_temp;
}
}
}
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
property_exists($maquina, 'forzar_num_formas_horizontales_cubierta')){
$response['num_formas']['num_formas_verticales'] = $h2;
}
}
return $response;
}
@ -565,12 +572,13 @@ class PresupuestoService extends BaseService
$ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo);
// si es cubierta
// Se añaden 20mm de sangre por cada lado + 2 * 6mm de vuelo portada y contraportada -> total 52
// por último se añaden 7mm para tener en cuenta el ancho del carton
if($uso=="cubierta")
$ancho_total += (12+2*self::SANGRE_FORMAS_CUBIERTA);
$ancho_total += (12 + 2*self::SANGRE_FORMAS_CUBIERTA + 7);
// si es sobrecubierta
// Se añaden 5mm de sangre por cada lado + 2 * 6mm de vuelo portada y contraportada -> total 52
else
$ancho_total += (12+2*self::SANGRE_FORMAS);
$ancho_total += (12+2*self::SANGRE_FORMAS) + 7;
}
else{
// En cualquier otro caso se le suma 5mm de sangre por cada lado

View File

@ -200,6 +200,7 @@ function portadaTapaDura(lpTagName, isCosido, isTapaDura) {
let sangradoValor = parseFloat(20); // mm
let anchoPliegue = parseFloat(6); // mm
let altoPliegue = parseFloat(7); // mm
let anchoCarton = parseFloat(7); // mm
// Get the preview Object parameters
getObjetoLP(lpTagName, isCosido, isTapaDura);
@ -306,12 +307,12 @@ function portadaTapaDura(lpTagName, isCosido, isTapaDura) {
previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
// Cotas
previewEC.makeText(pvObj.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.lomoLibro + anchoCarton + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(pvObj.altoLibro + altoPliegue + " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + altoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + +(2 * anchoPliegue) + " mm",
previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm",
origenEC.x,
origenEC.y + (altoLibro / 2) + 50,
styleCotas);