mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
tareas corte y tiempo procesamiento
This commit is contained in:
@ -188,6 +188,14 @@ class ProductionService extends BaseService
|
||||
* @var boolean
|
||||
*/
|
||||
public bool $isCorte = false; //* CHECK DONE
|
||||
|
||||
/**
|
||||
* Indica si hay una tarea de preparacion interior de guillotina ya se cubierta o interior
|
||||
* Se usa para mostrar la fecha correspondiente en la vista
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public bool $isPrepInteriorGuillotina = false; //* CHECK DONE
|
||||
/**
|
||||
* Pedido Entity
|
||||
*
|
||||
@ -436,13 +444,14 @@ class ProductionService extends BaseService
|
||||
{
|
||||
$maquina_id = $this->presupuesto->solapas == 1 ? $this->trimmingMaquinaId : $this->defaultMaquinaCorte->id;
|
||||
$presupuestoLineaImpresion = $this->presupuesto->presupuestoLineaImpresion();
|
||||
$maquinaCorteEntity = $this->maquinaModel->find($maquina_id);
|
||||
$data = [
|
||||
'orden_trabajo_id' => $this->ot->id,
|
||||
'presupuesto_linea_id' => $presupuestoLineaImpresion->id,
|
||||
'nombre' => lang('Produccion.end_cut'),
|
||||
'maquina_id' => $maquina_id,
|
||||
'orden' => $this->maquinaModel->find($maquina_id)->orden_planning,
|
||||
'tiempo_estimado' => 0,
|
||||
'orden' => $maquinaCorteEntity->orden_planning,
|
||||
'tiempo_estimado' => $this->tiempoCorteFinalEstimado($maquinaCorteEntity),
|
||||
'tiempo_real' => 0,
|
||||
'is_corte' => true,
|
||||
'tipo_corte' => "bobina",
|
||||
@ -463,6 +472,7 @@ class ProductionService extends BaseService
|
||||
$otCorte = null;
|
||||
$presupuestoTipo = $this->presupuesto->tipo_presupuesto()->codigo;
|
||||
$isRusticaFresado = str_contains($presupuestoTipo, "Fresado");
|
||||
$maquinaCorteEntity = $this->maquinaModel->find($this->guillotinaPreparacionInteriorMaquinaId);
|
||||
$data = [
|
||||
'orden_trabajo_id' => $this->ot->id,
|
||||
'presupuesto_linea_id' => $pLinea->id,
|
||||
@ -476,10 +486,14 @@ class ProductionService extends BaseService
|
||||
];
|
||||
if ($pLinea->isCubierta()) {
|
||||
$data['nombre'] = lang('Produccion.cover_cut');
|
||||
$data['tiempo_estimado'] = $this->tiempoCortePrepInterior($maquinaCorteEntity);
|
||||
$tareaId = $this->otTarea->insert($data);
|
||||
$otCorte = $this->otTarea->find($tareaId);
|
||||
}
|
||||
if ($pLinea->isImpresionInteriorPlana() || $pLinea->isRotativa()) {
|
||||
if ($pLinea->isImpresionInteriorPlana()) {
|
||||
$data['tiempo_estimado'] = $this->tiempoCortePrepInterior($maquinaCorteEntity);
|
||||
}
|
||||
$data['nombre'] = lang('Produccion.interior_cut');
|
||||
//* Si es rustica fresado y rotativa no se añade preparación de interior en guillotina
|
||||
if (!$isRusticaFresado && !$pLinea->isRotativa()) {
|
||||
@ -939,7 +953,7 @@ class ProductionService extends BaseService
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||
->join("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right")
|
||||
->join('lg_maquinas',"lg_maquinas.id = orden_trabajo_tareas.maquina_id","left")
|
||||
->join('lg_maquinas', "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
||||
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
|
||||
@ -1364,7 +1378,7 @@ class ProductionService extends BaseService
|
||||
}
|
||||
return $query->get()->getResultArray();
|
||||
}
|
||||
public function querySelectMaquinaPlanningPlana($q,?string $padreId)
|
||||
public function querySelectMaquinaPlanningPlana($q, ?string $padreId)
|
||||
{
|
||||
$query = $this->otModel->builder()->select([
|
||||
"orden_trabajo_tareas.maquina_id as id",
|
||||
@ -1381,8 +1395,8 @@ class ProductionService extends BaseService
|
||||
if ($q) {
|
||||
$query->like('lg_maquinas.nombre', $q);
|
||||
}
|
||||
if($padreId){
|
||||
$query->where('lg_maquinas.padre_id',$padreId);
|
||||
if ($padreId) {
|
||||
$query->where('lg_maquinas.padre_id', $padreId);
|
||||
}
|
||||
return $query->get()->getResultArray();
|
||||
}
|
||||
@ -1889,6 +1903,7 @@ class ProductionService extends BaseService
|
||||
"isColor" => $this->isColor,
|
||||
"isBN" => $this->isBN,
|
||||
"isCorte" => $this->corte(),
|
||||
"isPrepInteriorGuillotina" => $this->hasPrepInteriorGuillotina(),
|
||||
"isGrapado" => $this->isGrapado,
|
||||
"isCosido" => $this->cosido(),
|
||||
];
|
||||
@ -2054,6 +2069,17 @@ class ProductionService extends BaseService
|
||||
}
|
||||
return $this->isCorte;
|
||||
}
|
||||
public function hasPrepInteriorGuillotina(): bool
|
||||
{
|
||||
$ot_tareas = $this->ot->tareas();
|
||||
foreach ($ot_tareas as $key => $tarea) {
|
||||
if ($tarea->is_corte && $tarea->tipo_corte = "prep") {
|
||||
$this->isPrepInteriorGuillotina = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $this->isPrepInteriorGuillotina;
|
||||
}
|
||||
public function getFileBarCode()
|
||||
{
|
||||
return $this->ot->getBarCodeFile();
|
||||
@ -2359,6 +2385,12 @@ class ProductionService extends BaseService
|
||||
if ($tarea->isEncuadernado()) {
|
||||
$dateName = "encuadernacion_at";
|
||||
}
|
||||
if ($tarea->is_corte) {
|
||||
$dateName = "corte_at";
|
||||
}
|
||||
if ($tarea->is_corte && $tarea->tipo_corte == "prep") {
|
||||
$dateName = "preparacion_interiores_at";
|
||||
}
|
||||
return $dateName;
|
||||
}
|
||||
public function getTitleTareaEstado($tarea_id): array
|
||||
@ -2380,4 +2412,38 @@ class ProductionService extends BaseService
|
||||
"userName" => $userName ?? "",
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Devuelve en segundos el tiempo que tarda una máquina de corte en realizar el corte de la tirada completa
|
||||
*
|
||||
* $t = tirada[libros] / velocidad_maquina[libros/minutos]$
|
||||
*
|
||||
* @param MaquinaEntity $maquina
|
||||
* @return float $seconds
|
||||
*/
|
||||
public function tiempoCorteFinalEstimado(MaquinaEntity $maquina): float
|
||||
{
|
||||
$seconds = 0;
|
||||
if ($this->presupuesto->tirada > 0) {
|
||||
$minutos = $this->presupuesto->tirada / $maquina->velocidad;
|
||||
$seconds = $minutos * 60;
|
||||
}
|
||||
return $seconds;
|
||||
}
|
||||
/**
|
||||
* Devuelve en segundos el tiempo que tarda una máquina de corte en realizar
|
||||
*
|
||||
* $t = tirada[libros] / velocidad_maquina[libros/minutos]$
|
||||
*
|
||||
* @param MaquinaEntity $maquina
|
||||
* @return float $seconds
|
||||
*/
|
||||
public function tiempoCortePrepInterior(MaquinaEntity $maquina)
|
||||
{
|
||||
$seconds = 0;
|
||||
if ($this->presupuesto->tirada > 0) {
|
||||
$minutos = $this->presupuesto->tirada / $maquina->velocidad;
|
||||
$seconds = $minutos * 60;
|
||||
}
|
||||
return $seconds;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user