mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadido calculo de formas rot y merma automatica para rot
This commit is contained in:
@ -46,6 +46,7 @@ class PresupuestoService extends BaseService
|
||||
$formas = PresupuestoService::getNumFormasPlana($uso, $maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
|
||||
$response['fields'] = $formas;
|
||||
}
|
||||
|
||||
|
||||
if ($response['fields']['num_formas']['posicion_formas'] == 'n/a') {
|
||||
$response['error']['value'] = true;
|
||||
@ -135,8 +136,6 @@ class PresupuestoService extends BaseService
|
||||
$response['fields']['dimensiones_maquina_click'] = [$maquina->ancho_impresion, $maquina->alto_click];
|
||||
$response['fields']['dimensiones_libro'] = [$datosPedido->ancho, $datosPedido->alto];
|
||||
|
||||
//$response['fields']['datos_rotativa'] = $datos_rotativa;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -260,17 +259,74 @@ class PresupuestoService extends BaseService
|
||||
|
||||
$data['alto_click'] = $maquina->alto_click;
|
||||
|
||||
$data['num_formas']['posicion_formas'] = 'n/a';
|
||||
$formas = PresupuestoService::getNumFormasRot($maquina, $datosPedido->ancho, $datosPedido->alto, $datosPedido->isCosido);
|
||||
$data['num_formas'] = $formas;
|
||||
|
||||
/*$data['num_formas']['posicion_formas'] = 'n/a';
|
||||
$data['num_formas']['num_formas_horizontales'] = 0;
|
||||
$data['num_formas']['num_formas_verticales'] = 0;
|
||||
$data['num_formas']['value'] = 0;
|
||||
|
||||
*/
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getNumFormasRot($maquina, $ancho, $alto, $isCosido)
|
||||
{
|
||||
// El ancho si es cosido es el doble
|
||||
$anchoForCalculo = $isCosido ? $ancho * 2 : $ancho;
|
||||
|
||||
|
||||
$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;
|
||||
|
||||
$v1 = floor($maquina->alto_click / $alto);
|
||||
$formas_h = $h1 * $v1; //p1
|
||||
|
||||
|
||||
// verticales
|
||||
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h2_temp);
|
||||
if(count($calles)>0)
|
||||
$h2 = ($h2_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h2_temp : $h2_temp - 1;
|
||||
else
|
||||
$h2 = $h2_temp;
|
||||
$v2 = floor($maquina->alto_click / $anchoForCalculo);
|
||||
$formas_v = $h2 * $v2; //p2
|
||||
|
||||
|
||||
$num_formas = $h1*$h2;
|
||||
|
||||
|
||||
// si no hay formas se devuelve n/a
|
||||
if ($num_formas == 0) {
|
||||
$response['posicion_formas'] = 'n/a'; // not available
|
||||
} else if ($formas_h > $formas_v) {
|
||||
$response['posicion_formas'] = 'h';
|
||||
$response['num_formas_horizontales'] = $h1;
|
||||
$response['num_formas_verticales'] = $v1;
|
||||
$response['value'] = $num_formas;
|
||||
} else {
|
||||
$response['posicion_formas'] = 'v';
|
||||
$response['num_formas_horizontales'] = $h2;
|
||||
$response['num_formas_verticales'] = $v2;
|
||||
$response['value'] = $num_formas;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public static function getNumFormasPlana($uso, $maquina, $ancho, $alto, $isCosido)
|
||||
{
|
||||
$h1_temp = 0;
|
||||
$h2_temp = 0;
|
||||
|
||||
// El ancho si es cosido es el doble
|
||||
if($uso != 'cubierta' && $uso != 'sobrecubierta'){
|
||||
$anchoForCalculo = $isCosido ? $ancho * 2 : $ancho;
|
||||
@ -290,14 +346,6 @@ class PresupuestoService extends BaseService
|
||||
$h2_temp = $maquina->forzar_num_formas_verticales_cubierta;
|
||||
//$num_formas = $h1_temp * $h2_temp;
|
||||
}
|
||||
else{
|
||||
$h1_temp == 0;
|
||||
$h2_temp == 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$h1_temp == 0;
|
||||
$h2_temp == 0;
|
||||
}
|
||||
}
|
||||
// No es cubierta ni sobrecubierta
|
||||
|
||||
Reference in New Issue
Block a user