add revision preimpresion ot

This commit is contained in:
amazuecos
2025-05-02 21:02:53 +02:00
parent 5138681718
commit a88ffda50d
8 changed files with 119 additions and 20 deletions

View File

@ -259,7 +259,7 @@ class ProductionService extends BaseService
*
* @return self
*/
public function createOrdenTrabajo(): OrdenTrabajoEntity|DatabaseException
public function createOrdenTrabajo(bool $imported = false): OrdenTrabajoEntity|DatabaseException
{
$auth_user = auth()->user();
@ -272,7 +272,8 @@ class ProductionService extends BaseService
"user_created_id" => $auth_user->id,
"user_updated_id" => $auth_user->id,
"total_tirada" => $this->pedido->total_tirada,
"total_precio" => $this->pedido->total_precio
"total_precio" => $this->pedido->total_precio,
"preimpresion_revisada" => $imported
];
$id = $this->otModel->insert($data);
$this->init($id);
@ -1116,6 +1117,9 @@ class ProductionService extends BaseService
if (isset($data["is_pedido_espera"])) {
$data["pedido_espera_by"] = auth()->user()->id;
}
if (isset($data["preimpresion_revisada"])) {
$data["preimpresion_revisada_by"] = auth()->user()->id;
}
return $this->otModel->update($this->ot->id, $data);
}
public function updateOrdenTrabajoPedido($data)
@ -1906,7 +1910,7 @@ class ProductionService extends BaseService
"tarea_progress.estado as tareaEstado"
])
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
// Obtener el ultimo estado de la tarea
//* Obtener el ultimo estado de la tarea
->join(
'(SELECT ot_tarea_id, estado
FROM orden_trabajo_tarea_progress_dates
@ -1922,7 +1926,8 @@ class ProductionService extends BaseService
->join("pedidos", "pedidos.id = ordenes_trabajo.pedido_id", "right")
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
->where('orden_trabajo_tareas.maquina_id', $maquina_id)
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false)
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false) //! Dejar comentado por ahora
->where('ordenes_trabajo.preimpresion_revisada', true)
->where("orden_trabajo_tareas.deleted_at", null)
->where("tarea_progress.estado", 'P')
->orderBy("pedidos.fecha_impresion", "ASC")