update flow tareas orden trabajo con tareas de corte final y tras impresión

This commit is contained in:
amazuecos
2025-05-22 17:47:35 +02:00
parent 5f76e0e437
commit 690eaf4195
3 changed files with 79 additions and 5 deletions

View File

@ -23,6 +23,11 @@ class DefaultConfigVariablesSeeder extends Seeder
"value" => 6000,
"description" => "Número de libros máximos que se puede producir al día"
],
[
"name" => "maquina_guillotina_id_default",
"value" => 20,
"description" => "ID de máquina que se asigna a tareas de corte tras impresión"
]
];
public function run()
{

View File

@ -201,5 +201,10 @@ return [
"tareas_finalizadas" => "Las tareas de esta OT y máquina están marcadas como finalizadas",
"ot_not_found" => "La orden de trabajo número {ot_id} no existe"
]
],
'hunkeler' => "Corte HUNKELER",
'tecnau' => "Corte TECNAU",
'end_cut' => "Corte final",
"interior_cut" => "Preparación interior",
"cover_cut" => "Preparación cubierta"
];

View File

@ -84,6 +84,7 @@ class ProductionService extends BaseService
* @var string
*/
public string $statusColor;
public int $guillotinaMaquinaId;
/**
* Valor límite del POD
*
@ -212,6 +213,7 @@ class ProductionService extends BaseService
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
$this->configVariableModel = model(ConfigVariableModel::class);
$this->podValue = $this->configVariableModel->getVariable('POD')->value;
$this->guillotinaMaquinaId = $this->configVariableModel->getVariable('maquina_guillotina_id_default')->value;
$this->OT_TAREA_STATUS_TITLE = [
"P" => lang('Produccion.tarea_estados.P'),
"F" => lang('Produccion.tarea_estados.F'),
@ -368,6 +370,8 @@ class ProductionService extends BaseService
$this->storeOrdenTrabajoManipuladoTareas();
// $this->storeOrdenTrabajoPreimpresionTareas();
$this->storeOrdenTrabajoEncuadernacionTareas();
$this->storeTareaCorteFinal();
// $this->storeOrdenTrabajoExtraTareas();
}
/**
@ -408,10 +412,36 @@ class ProductionService extends BaseService
$ot_tareas["tiempo_real"] = 0;
$insert_query_result = $this->otTarea->insert($ot_tareas);
$ot_tareas = [];
$this->storeTareaCorteBloque($p_linea);
$this->storeTareaCorte($p_linea);
}
return $insert_query_result;
}
/**
* Inserta una tarea de corte si la impresion es en `rotativa`
*
* @return OrdenTrabajoTareaEntity|null
*/
protected function storeTareaCorteFinal(): ?OrdenTrabajoTareaEntity
{
$presupuestoLineaImpresion = $this->presupuesto->presupuestoLineaImpresion();
$data = [
'orden_trabajo_id' => $this->ot->id,
'presupuesto_linea_id' => $presupuestoLineaImpresion->id,
'nombre' => lang('Produccion.end_cut'),
'maquina_id' => $this->defaultMaquinaCorte->id,
'orden' => $this->defaultMaquinaCorte->orden_planning,
'tiempo_estimado' => 0,
'tiempo_real' => 0,
'is_corte' => true,
'tipo_corte' => "bobina",
];
$tareaId = $this->otTarea->insert($data);
$otCorte = $this->otTarea->find($tareaId);
return $otCorte;
}
/**
* Inserta una tarea de corte si la impresion es en `rotativa`
*
@ -421,23 +451,57 @@ class ProductionService extends BaseService
protected function storeTareaCorte(PresupuestoLineaEntity $pLinea): ?OrdenTrabajoTareaEntity
{
$otCorte = null;
$data = [
'orden_trabajo_id' => $this->ot->id,
'presupuesto_linea_id' => $pLinea->id,
'nombre' => 'Corte',
'maquina_id' => $this->guillotinaMaquinaId ?? 20,//!REMOVE LATER
'orden' => $pLinea->maquina()->orden_planning + 1,
'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60,
'tiempo_real' => 0,
'is_corte' => true,
'tipo_corte' => "guillotina",
];
if ($pLinea->isCubierta()) {
$data['nombre'] = lang('Produccion.cover_cut');
}
if($pLinea->isRotativa() ||$pLinea->isColor()||$pLinea->isBN())
{
$data['nombre'] = lang('Produccion.interior_cut');
}
$tareaId = $this->otTarea->insert($data);
$otCorte = $this->otTarea->find($tareaId);
return $otCorte;
}
/**
* Inserta una tarea de corte a bloque
* Se añade después de una tarea de impresión interior en rotativa.
*
*
* @param PresupuestoLineaEntity $pLinea
* @return OrdenTrabajoTareaEntity|null
*/
protected function storeTareaCorteBloque(PresupuestoLineaEntity $pLinea)
{
$otCorte = null;
$name = $this->cosido() ? lang('Produccion.hunkeler') : lang('Produccion.tecnau');
if ($pLinea->isRotativa()) {
$tareaId = $this->otTarea->insert([
'orden_trabajo_id' => $this->ot->id,
'presupuesto_linea_id' => $pLinea->id,
'nombre' => 'Corte',
'nombre' => $name,
'maquina_id' => $this->defaultMaquinaCorte->id,
'orden' => $this->defaultMaquinaCorte->orden_planning,
'orden' => $pLinea->maquina()->orden_planning + 1,
'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60,
'tiempo_real' => 0,
'is_corte' => true,
'tipo_corte' => "bobina",
'tipo_corte' => "bloque",
]);
$otCorte = $this->otTarea->find($tareaId);
}
return $otCorte;
}
/**
* General las tareas de acabado segun las líneas de presupuesto_acabados
*