From 3db124ea247c3149b3c789c8233d852a52f23852 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Fri, 30 May 2025 07:31:18 +0200 Subject: [PATCH] add maquinas default corte --- .../Seeds/DefaultConfigVariablesSeeder.php | 29 ++++++++++++++++--- ci4/app/Services/ProductionService.php | 25 +++++++++++----- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/ci4/app/Database/Seeds/DefaultConfigVariablesSeeder.php b/ci4/app/Database/Seeds/DefaultConfigVariablesSeeder.php index 64336be4..a0ee4e15 100755 --- a/ci4/app/Database/Seeds/DefaultConfigVariablesSeeder.php +++ b/ci4/app/Database/Seeds/DefaultConfigVariablesSeeder.php @@ -27,16 +27,37 @@ class DefaultConfigVariablesSeeder extends Seeder "name" => "maquina_guillotina_id_default", "value" => 20, "description" => "ID de máquina que se asigna a tareas de corte tras impresión" - ] + ], + [ + "name" => "maquina_guillotina_prep_id_default", + "value" => 31, + "description" => "ID de máquina que se asigna a tareas de corte tras impresión" + ], + [ + "name" => "maquina_tecnau_id", + "value" => 54, + "description" => "ID de máquina que se asigna a tareas de corte TECNAU" + ], + [ + "name" => "maquina_hunkeler_id", + "value" => 151, + "description" => "ID de máquina que se asigna a tareas de corte HUNKELER" + ], + [ + "name" => "maquina_trimming_id", + "value" => 149, + "description" => "ID de máquina que se asigna a tareas de corte HUNKELER" + ], + ]; public function run() { - + $variableModel = model(ConfigVariableModel::class); foreach ($this->data as $row) { - if($variableModel->where("name",$row["name"])->first() == null){ + if ($variableModel->where("name", $row["name"])->first() == null) { $variableModel->insert($row); } } } -} \ No newline at end of file +} diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 18e769df..02f3cddf 100755 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -85,6 +85,11 @@ class ProductionService extends BaseService */ public string $statusColor; public int $guillotinaMaquinaId; + public int $hunkelerMaquinaId; + public int $tecnauMaquinaId; + public int $trimmingMaquinaId; + public int $guillotinaPreparacionInteriorMaquinaId; + /** * Valor límite del POD * @@ -214,6 +219,11 @@ class ProductionService extends BaseService $this->configVariableModel = model(ConfigVariableModel::class); $this->podValue = $this->configVariableModel->getVariable('POD')->value; $this->guillotinaMaquinaId = $this->configVariableModel->getVariable('maquina_guillotina_id_default')->value; + $this->hunkelerMaquinaId = $this->configVariableModel->getVariable('maquina_hunkeler_id')->value; + $this->tecnauMaquinaId = $this->configVariableModel->getVariable('maquina_tecnau_id')->value; + $this->trimmingMaquinaId = $this->configVariableModel->getVariable('maquina_trimming_id')->value; + $this->guillotinaPreparacionInteriorMaquinaId = $this->configVariableModel->getVariable('maquina_guillotina_prep_id_default')->value; + $this->OT_TAREA_STATUS_TITLE = [ "P" => lang('Produccion.tarea_estados.P'), "F" => lang('Produccion.tarea_estados.F'), @@ -424,14 +434,14 @@ class ProductionService extends BaseService */ protected function storeTareaCorteFinal(): ?OrdenTrabajoTareaEntity { - + $maquina_id = $this->presupuesto->solapas == 1 ? $this->trimmingMaquinaId : $this->defaultMaquinaCorte->id; $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, + 'maquina_id' => $maquina_id, + 'orden' => $this->maquinaModel->find($maquina_id)->orden_planning, 'tiempo_estimado' => 0, 'tiempo_real' => 0, 'is_corte' => true, @@ -457,8 +467,8 @@ class ProductionService extends BaseService 'orden_trabajo_id' => $this->ot->id, 'presupuesto_linea_id' => $pLinea->id, 'nombre' => 'Corte', - 'maquina_id' => $this->guillotinaMaquinaId, - 'orden' => $pLinea->maquina()->orden_planning + 1, + 'maquina_id' => $this->guillotinaPreparacionInteriorMaquinaId, + 'orden' => $this->maquinaModel->find($this->guillotinaPreparacionInteriorMaquinaId)->orden_planning, 'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60, 'tiempo_real' => 0, 'is_corte' => true, @@ -493,13 +503,14 @@ class ProductionService extends BaseService { $otCorte = null; $name = $this->cosido() ? lang('Produccion.hunkeler') : lang('Produccion.tecnau'); + $maquina_id = $this->cosido() ? $this->hunkelerMaquinaId : $this->tecnauMaquinaId; if ($pLinea->isRotativa()) { $tareaId = $this->otTarea->insert([ 'orden_trabajo_id' => $this->ot->id, 'presupuesto_linea_id' => $pLinea->id, 'nombre' => $name, - 'maquina_id' => $this->defaultMaquinaCorte->id, - 'orden' => $pLinea->maquina()->orden_planning + 1, + 'maquina_id' => $maquina_id, + 'orden' => $this->maquinaModel->find($maquina_id)->orden_planning, 'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60, 'tiempo_real' => 0, 'is_corte' => true,