mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ot
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Database\Migrations\OrdenTrabajoUsers;
|
||||
use App\Entities\Clientes\ClienteEntity;
|
||||
use App\Entities\Configuracion\Maquina;
|
||||
use App\Entities\Pedidos\PedidoEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoEntity;
|
||||
@ -23,6 +24,7 @@ class ProductionService extends BaseService
|
||||
protected OrdenTrabajoModel $otModel;
|
||||
protected OrdenTrabajoTarea $otTarea;
|
||||
protected OrdenTrabajoDate $otDate;
|
||||
protected OrdenTrabajoEntity $ot;
|
||||
|
||||
/**
|
||||
* Pedido Entity
|
||||
@ -37,6 +39,14 @@ class ProductionService extends BaseService
|
||||
*/
|
||||
protected PresupuestoEntity $presupuesto;
|
||||
|
||||
public function init(int $orden_trabajo_id): self
|
||||
{
|
||||
$this->otModel = model(OrdenTrabajoModel::class);
|
||||
$this->ot = $this->otModel->find($orden_trabajo_id);
|
||||
$pedido = $this->ot->pedido();
|
||||
$this->setPedido($pedido);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Establece el pedido sobre el que se va a trabajar
|
||||
*
|
||||
@ -66,6 +76,14 @@ class ProductionService extends BaseService
|
||||
{
|
||||
return $this->presupuesto;
|
||||
}
|
||||
public function getCliente(): ClienteEntity
|
||||
{
|
||||
return $this->presupuesto->cliente();
|
||||
}
|
||||
public function getOrdenTrabajo(): OrdenTrabajoEntity
|
||||
{
|
||||
return $this->ot;
|
||||
}
|
||||
/**
|
||||
* Crea una instancia de la orden de trabajo
|
||||
*
|
||||
@ -139,7 +157,7 @@ class ProductionService extends BaseService
|
||||
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina;
|
||||
$ot_tareas["tiempo_real"] = $p_linea->horas_maquina; //? Tiempo real se inserta manual?
|
||||
$insert_query_result = $this->otTarea->insert($ot_tareas);
|
||||
$ot_tareas = [];
|
||||
$ot_tareas = [];
|
||||
}
|
||||
return $insert_query_result;
|
||||
}
|
||||
@ -199,4 +217,35 @@ class ProductionService extends BaseService
|
||||
->orderBy("orden_trabajo_tareas.orden", "DESC");
|
||||
return $q;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a summary from ot with the following structure
|
||||
*
|
||||
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* ```php
|
||||
* [
|
||||
* "ot" => OrdenTrabajoEntity
|
||||
* "dates" => OrdenTrabajoDateEntity
|
||||
* "tasks" => array<OrdenTrabajoTareaEntity>
|
||||
* ];
|
||||
* ```
|
||||
*/
|
||||
public function getSummary(): array
|
||||
{
|
||||
|
||||
$summary = [
|
||||
"ot" => $this->ot,
|
||||
"dates" => $this->ot->dates(),
|
||||
"tasks" => $this->ot->tareas(),
|
||||
"acabados" => $this->presupuesto->acabados(),
|
||||
"preimpresiones" => $this->presupuesto->preimpresiones(),
|
||||
"manipulados" => $this->presupuesto->manipulados(),
|
||||
"encuadernaciones" => $this->presupuesto->encuadernaciones(),
|
||||
|
||||
];
|
||||
return $summary;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user