From 2857697fd205a85eaa889aa5a0928e19dbb7015c Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sun, 6 Apr 2025 09:32:42 +0200 Subject: [PATCH] add padre_id to select in planningPlanaQueryDatatable --- ci4/app/Services/ProductionService.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index f758c344..bbe61afb 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -486,6 +486,7 @@ class ProductionService extends BaseService "presupuestos.titulo as presupuesto_titulo", "orden_trabajo_tareas.maquina_id", "lg_maquinas.nombre as maquina_planning_nombre", + "lg_maquinas.padre_id as padre_id", "ordenes_trabajo.total_tirada as ot_tirada", "lg_papel_formato.ancho as papel_ancho", "lg_papel_formato.alto as papel_alto", @@ -859,7 +860,6 @@ class ProductionService extends BaseService "lg_maquinas.nombre as name", ]) ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left") - ->join("orden_trabajo_dates", "orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id", "left") ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left") ->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left") ->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA) @@ -871,6 +871,26 @@ class ProductionService extends BaseService } return $query->get()->getResultArray(); } + public function querySelectMaquinaPadrePlanningPlana($q) + { + $query = $this->otModel->builder()->select([ + "mp.id as id", + "mp.nombre as name", + ]) + ->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("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left") + ->join("lg_maquinas mp", "mp.id = lg_maquinas.padre_id", "left") + ->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA) + ->where('lg_maquinas.is_rotativa', false) + ->where('mp.is_padre', 0) + ->where("orden_trabajo_tareas.deleted_at", null) + ->groupBy("mp.id"); + if ($q) { + $query->like('lg_maquinas.nombre', $q); + } + return $query->get()->getResultArray(); + } public function querySelectPapelPlanningRot(string $q) { $query = $this->otModel->builder()->select([