mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ot new features
This commit is contained in:
@ -222,6 +222,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
|
||||
return $nombre;
|
||||
}
|
||||
|
||||
public function isGuarda(): bool
|
||||
{
|
||||
return in_array($this->attributes["tipo"], ["lp_guardas"]);
|
||||
|
||||
@ -15,8 +15,15 @@ class OrdenTrabajoDateEntity extends Entity
|
||||
"interior_bn_at" => null,
|
||||
"interior_color_at" => null,
|
||||
"cubierta_at" => null,
|
||||
"sobrecubierta_at" => null, //TODO
|
||||
"guarda_at" => null, //TODO
|
||||
//ACABADO
|
||||
"plastificado_at" => null,
|
||||
"plakene_at" => null, //TODO
|
||||
"retractilado_at"=> null,
|
||||
"estampado_at" => null, //TODO
|
||||
"uvi_at" => null, //TODO
|
||||
//MANIPULADO
|
||||
"encuadernacion_at" => null,
|
||||
"corte_at" => null,
|
||||
"preparacion_interiores_at" => null,
|
||||
@ -24,9 +31,8 @@ class OrdenTrabajoDateEntity extends Entity
|
||||
"cosido_at" => null,
|
||||
"solapa_at" => null,
|
||||
"grapado_at" => null,
|
||||
"retractilado_at"=> null,
|
||||
"retractilado5_at"=> null,
|
||||
"prototipo_at"=> null,
|
||||
"retractilado5_at"=> null, // !DELETE
|
||||
"prototipo_at"=> null, // !DELETE
|
||||
"marcapaginas_at"=> null,
|
||||
"espiral_at"=> null,
|
||||
//FERRO
|
||||
|
||||
@ -30,10 +30,11 @@ class OrdenTrabajoEntity extends Entity
|
||||
"progreso" => 0.00,
|
||||
"estado" => "I",
|
||||
"comentarios" => null,
|
||||
"comment_interior"=> null,
|
||||
"comment_cubierta"=> null,
|
||||
"comment_encuadernacion"=> null,
|
||||
"comment_logistica"=> null,
|
||||
"comment_interior" => null,
|
||||
"comment_cubierta" => null,
|
||||
"comment_encuadernacion" => null,
|
||||
"comment_logistica" => null,
|
||||
"info_solapa_guillotina" => null,
|
||||
"revisar_formato" => null,
|
||||
"revisar_lomo" => null,
|
||||
"revisar_solapa" => null,
|
||||
@ -57,10 +58,11 @@ class OrdenTrabajoEntity extends Entity
|
||||
"progreso" => "float",
|
||||
"estado" => "string",
|
||||
"comentarios" => "?string",
|
||||
"comment_interior"=> "?string",
|
||||
"comment_cubierta"=> "?string",
|
||||
"comment_encuadernacion"=> "?string",
|
||||
"comment_logistica"=> "?string",
|
||||
"comment_interior" => "?string",
|
||||
"comment_cubierta" => "?string",
|
||||
"comment_encuadernacion" => "?string",
|
||||
"comment_logistica" => "?string",
|
||||
"info_solapa_guillotina" => "?string",
|
||||
"revisar_formato" => "bool",
|
||||
"revisar_lomo" => "bool",
|
||||
"revisar_solapa" => "bool",
|
||||
@ -88,7 +90,22 @@ class OrdenTrabajoEntity extends Entity
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
|
||||
}
|
||||
/**
|
||||
public function tareas_acabado(): array
|
||||
{
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
|
||||
}
|
||||
public function tareas_encuadernado(): array
|
||||
{
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_encuadernado_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
|
||||
}
|
||||
public function tareas_manipulado(): array
|
||||
{
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll() ?? [];
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto de la orden de trabajo
|
||||
*
|
||||
* @return PresupuestoEntity
|
||||
@ -191,4 +208,5 @@ class OrdenTrabajoEntity extends Entity
|
||||
];
|
||||
return $estados[$this->attributes["estado"]];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Entities\Produccion;
|
||||
use App\Entities\Configuracion\Imposicion;
|
||||
use App\Entities\Configuracion\Maquina;
|
||||
use App\Entities\Presupuestos\PresupuestoAcabadosEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoEncuadernacionesEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoLineaEntity;
|
||||
use App\Entities\Presupuestos\PresupuestoManipuladosEntity;
|
||||
use App\Models\Configuracion\ImposicionModel;
|
||||
@ -12,6 +13,7 @@ use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTareaProgressDate;
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
||||
use App\Models\Presupuestos\PresupuestoLineaModel;
|
||||
use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
@ -23,6 +25,11 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
"id" => null,
|
||||
"orden_trabajo_id" => null,
|
||||
"presupuesto_linea_id" => null,
|
||||
"presupuesto_acabado_id" => null,
|
||||
"presupuesto_preimpresion_id" => null,
|
||||
"presupuesto_encuadernado_id" => null,
|
||||
"presupuesto_extra_id" => null,
|
||||
"presupuesto_manipulado_id" => null,
|
||||
"nombre" => null,
|
||||
"orden" => null,
|
||||
"maquina_id" => null,
|
||||
@ -96,10 +103,15 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
*
|
||||
* @return PresupuestoLineaEntity
|
||||
*/
|
||||
public function presupuesto_linea(): PresupuestoLineaEntity
|
||||
public function presupuesto_linea(): ?PresupuestoLineaEntity
|
||||
{
|
||||
$presupuesto_linea = null;
|
||||
$m = model(PresupuestoLineaModel::class);
|
||||
return $m->find($this->attributes["presupuesto_linea_id"]);
|
||||
if ($this->attributes['presupuesto_linea_id']) {
|
||||
|
||||
$presupuesto_linea = $m->find($this->attributes["presupuesto_linea_id"]);
|
||||
}
|
||||
return $presupuesto_linea;
|
||||
}
|
||||
/**
|
||||
* Devuelve la maquina original del presupuesto linea
|
||||
@ -108,17 +120,35 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
*/
|
||||
public function maquina_presupuesto_linea(): Maquina
|
||||
{
|
||||
return $this->presupuesto_linea()->maquina();
|
||||
return $this->presupuesto_linea()?->maquina();
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto acabado origen de esta tarea
|
||||
*
|
||||
* @return PresupuestoAcabadosEntity
|
||||
*/
|
||||
public function presupuesto_acabado(): PresupuestoAcabadosEntity
|
||||
public function presupuesto_acabado(): ?PresupuestoAcabadosEntity
|
||||
{
|
||||
$presupuesto_acabado = null;
|
||||
$m = model(PresupuestoAcabadosModel::class);
|
||||
return $m->find($this->attributes["presupuesto_linea_id"]);
|
||||
if ($this->attributes["presupuesto_acabado_id"]) {
|
||||
$presupuesto_acabado = $m->find($this->attributes["presupuesto_acabado_id"]);
|
||||
}
|
||||
return $presupuesto_acabado;
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto enducadernacion origen de esta tarea
|
||||
*
|
||||
* @return PresupuestoEncuadernacionesEntity
|
||||
*/
|
||||
public function presupuesto_encuadernacion(): ?PresupuestoEncuadernacionesEntity
|
||||
{
|
||||
$presupuesto_encuadernacion = null;
|
||||
$m = model(PresupuestoEncuadernacionesModel::class);
|
||||
if ($this->attributes["presupuesto_encuadernado_id"]) {
|
||||
$presupuesto_encuadernacion = $m->find($this->attributes["presupuesto_encuadernado_id"]);
|
||||
}
|
||||
return $presupuesto_encuadernacion;
|
||||
}
|
||||
/**
|
||||
* Devuelve el presupuesto acabado origen de esta tarea
|
||||
@ -152,8 +182,8 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
{
|
||||
$dates = $this->progress_dates();
|
||||
$intervals = [];
|
||||
$init = [];
|
||||
$end = [];
|
||||
$init = null;
|
||||
$end = null;
|
||||
foreach ($dates as $key => $date) {
|
||||
if ($date->estado == "I") {
|
||||
if ($date->action_at) {
|
||||
@ -161,7 +191,7 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
}
|
||||
}
|
||||
if ($date->estado == "S" || $date->estado == "F") {
|
||||
if ($date->action_at) {
|
||||
if ($date->action_at && $init) {
|
||||
$end = Time::createFromFormat('Y-m-d H:i:s', $date->action_at);
|
||||
$intervals[] = $init->difference($end)->getSeconds();
|
||||
}
|
||||
@ -182,4 +212,24 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
}
|
||||
return $isTareaCosido;
|
||||
}
|
||||
public function isImpresion() : bool
|
||||
{
|
||||
return $this->attributes['presupuesto_linea_id'] != null;
|
||||
}
|
||||
public function isAcabado() : bool
|
||||
{
|
||||
return $this->attributes['presupuesto_acabado_id'] != null;
|
||||
}
|
||||
public function isManipulado() : bool
|
||||
{
|
||||
return $this->attributes['presupuesto_manipulado_id'] != null;
|
||||
}
|
||||
public function isEncuadernado() : bool
|
||||
{
|
||||
return $this->attributes['presupuesto_encuadernado_id'] != null;
|
||||
}
|
||||
public function isCorte() : bool
|
||||
{
|
||||
return $this->attributes['is_corte'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,13 @@ class OrdenTrabajoUserEntity extends Entity
|
||||
"interior_bn_user_id" => null,
|
||||
"interior_color_user_id" => null,
|
||||
"cubierta_user_id" => null,
|
||||
"sobrecubierta_user_id" => null,
|
||||
"guarda_user_id" => null,
|
||||
//ACABADO
|
||||
"plastificado_user_id" => null,
|
||||
"plakene_user_id" => null,
|
||||
"estampado_user_id" => null,
|
||||
"uvi_user_id" => null,
|
||||
"encuadernacion_user_id" => null,
|
||||
"corte_user_id" => null,
|
||||
"preparacion_interior_user_id" => null,
|
||||
|
||||
Reference in New Issue
Block a user