arreglado bug. Ahora se ordenan las filas de lp

This commit is contained in:
2024-01-24 18:14:50 +01:00
parent 07c1b8bc86
commit 32f51e6718
5 changed files with 140 additions and 48 deletions

View File

@ -43,7 +43,9 @@ class PresupuestoService extends BaseService
$response['fields'] = [];
if ($uso!='rotativa') {
$formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
$ancho_calculo = ($uso=='cubierta' || $uso=='sobrecubierta') ? $datosPedido->anchoExteriores : $datosPedido->ancho;
$formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $ancho_calculo, $datosPedido->alto, $datosPedido->isCosido);
$response['fields'] = $formas;
}
@ -103,7 +105,7 @@ class PresupuestoService extends BaseService
$mano = PresupuestoService::computeLomoPortada($papel_impresion->espesor);
// peso
$ancho_total = $datosPedido->solapas? $datosPedido->ancho + $datosPedido->solapas_ancho:$datosPedido->ancho;
$ancho_total = $datosPedido->anchoExteriores + $mano;
$peso = PresupuestoService::computePeso($ancho_total, $datosPedido->alto, $papel_impresion->gramaje);
// impresion
@ -459,16 +461,18 @@ class PresupuestoService extends BaseService
if($uso == 'cubierta' || $uso == 'sobrecubierta') {
if(property_exists($maquina, 'forzar_num_formas_horizontales_cubierta') &&
property_exists($maquina, 'forzar_num_formas_horizontales_cubierta')){
property_exists($maquina, 'forzar_num_formas_verticales_cubierta')){
if($maquina->forzar_num_formas_horizontales_cubierta > 0 &&
$maquina->forzar_num_formas_horizontales_cubierta > 0){
$maquina->forzar_num_formas_verticales_cubierta > 0){
// Hay que comprobar que entran
$h1_temp = $maquina->forzar_num_formas_horizontales_cubierta;
$h2_temp = $maquina->forzar_num_formas_verticales_cubierta;
//$num_formas = $h1_temp * $h2_temp;
}
}
}
// No es cubierta ni sobrecubierta
else{
@ -476,14 +480,18 @@ class PresupuestoService extends BaseService
$h1_temp = floor($maquina->ancho_impresion / $anchoForCalculo);
$h2_temp = floor($maquina->ancho_impresion / $alto);
}
// horizontales
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h1_temp);
// Si son mas de 2 formas
if(count($calles)>0)
$h1 = ($h1_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h1_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h1_temp : $h1_temp - 1;
else
$h1 = $h1_temp;
else{
$h1 = $anchoForCalculo<=$maquina->ancho_impresion?$h1_temp:0;
}
$v1 = floor($maquina->alto_impresion / $alto);
$formas_h = $h1 * $v1; //p1
@ -493,12 +501,14 @@ class PresupuestoService extends BaseService
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h2_temp);
if(count($calles)>0)
$h2 = ($h2_temp * $alto + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h2_temp : $h2_temp - 1;
else
$h2 = $h2_temp;
else{
$h2 = $alto<=$maquina->ancho_impresion?$h2_temp:0;
}
$v2 = floor($maquina->alto_impresion / $anchoForCalculo);
$formas_v = $h2 * $v2; //p2
// Se calcula el numero de formas
if($uso != 'cubierta' && $uso != 'sobrecubierta'){
$num_formas = ($formas_h > $formas_v) ? $formas_h : $formas_v;
@ -531,7 +541,7 @@ class PresupuestoService extends BaseService
$response['num_formas']['num_formas_verticales'] = $h2;
}
}
return $response;
}
@ -579,6 +589,26 @@ class PresupuestoService extends BaseService
}
/**
* Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo.
*/
public static function getAnchoTotalExteriores($datosPedido=null)
{
$ancho_total = 0;
if ($datosPedido) {
$ancho_total = floatval($datosPedido->ancho)*2 + floatval($datosPedido->lomo);
$ancho_total += property_exists($datosPedido, 'lomo_cubierta')?$datosPedido->lomo_cubierta:0;
// añadimos ancho de las solapas
// si se añaden solapas hay que sumar 3mm de los dobleces
if ($datosPedido->solapas) {
$ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + 6;
}
}
return $ancho_total;
}
/**
* Devuelve la dimensión del lomo interior.
*/