mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add filter padre - hija - papel
This commit is contained in:
@ -199,6 +199,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);
|
||||
@ -227,8 +228,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]));
|
||||
@ -777,6 +776,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');
|
||||
@ -819,6 +819,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');
|
||||
@ -928,10 +929,12 @@ 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)
|
||||
->where('lg_maquinas.tipo', 'impresion')
|
||||
// ->where('lg_maquinas.padre_id', 0)
|
||||
->groupBy('lg_maquinas.id');
|
||||
|
||||
|
||||
@ -1353,7 +1356,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",
|
||||
@ -1370,8 +1373,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();
|
||||
}
|
||||
@ -1385,10 +1388,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);
|
||||
@ -1415,7 +1416,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",
|
||||
@ -1433,6 +1434,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
|
||||
|
||||
Reference in New Issue
Block a user