Merge branch 'fix/planning-plana-select-maquina-papel' into feat/maquinas-corte-ot

This commit is contained in:
amazuecos
2025-05-31 08:35:50 +02:00
7 changed files with 58 additions and 29 deletions

View File

@ -212,6 +212,7 @@ class ProductionService extends BaseService
public function __construct()
{
$this->otModel = model(OrdenTrabajoModel::class);
$this->maquinaModel = model(MaquinaModel::class);
$this->otDate = model(OrdenTrabajoDate::class);
$this->otTarea = model(OrdenTrabajoTarea::class);
$this->otUser = model(OrdenTrabajoUser::class);
@ -245,8 +246,6 @@ class ProductionService extends BaseService
public function init(int $orden_trabajo_id): self
{
try {
$this->maquinaModel = model(MaquinaModel::class);
$this->otModel = model(OrdenTrabajoModel::class);
$ot = $this->otModel->find($orden_trabajo_id);
if ($ot == null) {
throw new Exception(lang('Produccion.errors.ot_not_found', ['ot_id' => $orden_trabajo_id]));
@ -802,6 +801,7 @@ class ProductionService extends BaseService
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
->whereIn("presupuesto_linea.tipo", $this->TIPOS_ROTATIVA)
->where('lg_maquinas.is_rotativa', true)
->where('lg_maquinas.tipo', 'impresion')
->where("orden_trabajo_tareas.deleted_at", null)
->orderBy("orden_trabajo_tareas.orden", "ASC")
->groupBy('ordenes_trabajo.id');
@ -844,6 +844,7 @@ class ProductionService extends BaseService
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
->where('lg_maquinas.is_rotativa', false)
->where('lg_maquinas.tipo', 'impresion')
->where("orden_trabajo_tareas.deleted_at", null)
->orderBy("orden_trabajo_tareas.orden", "ASC")
->groupBy('ordenes_trabajo.id');
@ -957,6 +958,8 @@ class ProductionService extends BaseService
->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)
->where('lg_maquinas.tipo', 'impresion')
// ->where('lg_maquinas.padre_id', 0)
->groupBy('lg_maquinas.id');
@ -1410,10 +1413,8 @@ class ProductionService extends BaseService
->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)
->where('lg_maquinas.is_padre !=', 0)
->groupBy("mp.id");
if ($q) {
$query->like('lg_maquinas.nombre', $q);
@ -1440,7 +1441,7 @@ class ProductionService extends BaseService
}
return $query->get()->getResultArray();
}
public function querySelectPapelPlanningPlana($q)
public function querySelectPapelPlanningPlana($q, ?string $maquinaId)
{
$query = $this->otModel->builder()->select([
"lg_papel_impresion.id",
@ -1458,6 +1459,9 @@ class ProductionService extends BaseService
if ($q) {
$query->like('lg_papel_impresion.nombre', $q);
}
if ($maquinaId) {
$query->where('orden_trabajo_tareas.maquina_id', $maquinaId);
}
return $query->get()->getResultArray();
}
public function tareaUpdateMaquinaCorte($orden_trabajo_id): bool