Merge branch 'fix/bugs-ot' into 'main'

Fix/bugs ot

See merge request jjimenez/safekat!752
This commit is contained in:
Alvaro
2025-04-28 06:13:50 +00:00
4 changed files with 140 additions and 126 deletions

View File

@ -215,9 +215,9 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
/** /**
* Obtiene las lineas de presupuesto del actual presupuesto * Obtiene las lineas de presupuesto del actual presupuesto
* *
* @return PresupuestoLineaEntity * @return ?PresupuestoLineaEntity
*/ */
public function presupuestoLineaImpresion(): PresupuestoLineaEntity public function presupuestoLineaImpresion(): ?PresupuestoLineaEntity
{ {
$model = model(PresupuestoLineaModel::class); $model = model(PresupuestoLineaModel::class);
@ -230,7 +230,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
* *
* @return PresupuestoLineaEntity * @return PresupuestoLineaEntity
*/ */
public function presupuestoLineaCubierta(): PresupuestoLineaEntity public function presupuestoLineaCubierta(): ?PresupuestoLineaEntity
{ {
$model = model(PresupuestoLineaModel::class); $model = model(PresupuestoLineaModel::class);
@ -261,10 +261,15 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
} }
return $hasSobrecubierta; return $hasSobrecubierta;
} }
public function cliente() : ClienteEntity public function cliente(): ?ClienteEntity
{ {
$m = model(ClienteModel::class); $m = model(ClienteModel::class);
if ($this->attributes['cliente_id']) {
return $m->find($this->attributes["cliente_id"]); return $m->find($this->attributes["cliente_id"]);
} else {
return null;
}
} }
public function encuadernaciones(): array public function encuadernaciones(): array
{ {
@ -310,7 +315,5 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
$tipo_presupuesto = $m->find($this->attributes['tipo_impresion_id']); $tipo_presupuesto = $m->find($this->attributes['tipo_impresion_id']);
} }
return $tipo_presupuesto; return $tipo_presupuesto;
} }
} }

View File

@ -365,7 +365,7 @@ class ProductionService extends BaseService
$ot_tareas["maquina_id"] = $p_linea_maquina->id; $ot_tareas["maquina_id"] = $p_linea_maquina->id;
$ot_tareas["imposicion_id"] = null; $ot_tareas["imposicion_id"] = null;
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina * 3600; $ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina * 3600;
$ot_tareas["tiempo_real"] = $p_linea->horas_maquina * 3600; //? Tiempo real se inserta manual? $ot_tareas["tiempo_real"] = 0;
$insert_query_result = $this->otTarea->insert($ot_tareas); $insert_query_result = $this->otTarea->insert($ot_tareas);
$ot_tareas = []; $ot_tareas = [];
$this->storeTareaCorte($p_linea); $this->storeTareaCorte($p_linea);
@ -389,7 +389,7 @@ class ProductionService extends BaseService
'maquina_id' => $this->defaultMaquinaCorte->id, 'maquina_id' => $this->defaultMaquinaCorte->id,
'orden' => $this->defaultMaquinaCorte->orden_planning, 'orden' => $this->defaultMaquinaCorte->orden_planning,
'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60, 'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60,
'tiempo_real' => $pLinea->rotativa_tiempo_corte * 60, 'tiempo_real' => 0,
'is_corte' => true, 'is_corte' => true,
'tipo_corte' => "bobina", 'tipo_corte' => "bobina",
]); ]);
@ -1526,6 +1526,8 @@ class ProductionService extends BaseService
} }
public function getPapelImpresionBackgroundColor() public function getPapelImpresionBackgroundColor()
{ {
if ($this->presupuesto->presupuestoLineaImpresion()) {
$papel = $this->presupuesto->presupuestoLineaImpresion()->papel_generico(); $papel = $this->presupuesto->presupuestoLineaImpresion()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default']; $color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot; $papel_code = $papel->code_ot;
@ -1551,9 +1553,14 @@ class ProductionService extends BaseService
} }
return $color; return $color;
} else {
return $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
} }
public function getPapelImpresionCubiertaBackgroundColor() public function getPapelImpresionCubiertaBackgroundColor()
{ {
if ($this->presupuesto->presupuestoLineaCubierta()) {
$papel = $this->presupuesto->presupuestoLineaCubierta()->papel_generico(); $papel = $this->presupuesto->presupuestoLineaCubierta()->papel_generico();
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default']; $color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot; $papel_code = $papel->code_ot;
@ -1578,6 +1585,9 @@ class ProductionService extends BaseService
} }
} }
return $color; return $color;
} else {
return $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
} }
public function getPlastificadoColor() public function getPlastificadoColor()
{ {
@ -1849,6 +1859,5 @@ class ProductionService extends BaseService
{ {
$dates = $this->createDatesForPOD(); $dates = $this->createDatesForPOD();
return $this->pedidoModel->update($this->pedido->id, $dates); return $this->pedidoModel->update($this->pedido->id, $dates);
} }
} }

View File

@ -12,7 +12,7 @@
<div id="accordionOtTasksTip" class="accordion-collapse collapse show" data-bs-parent="#accordionOtTasks"> <div id="accordionOtTasksTip" class="accordion-collapse collapse show" data-bs-parent="#accordionOtTasks">
<div class="accordion-body"> <div class="accordion-body">
<div class="card text-center"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="nav-align-top"> <div class="nav-align-top">
<ul class="nav nav-pills" role="tablist"> <ul class="nav nav-pills" role="tablist">

View File

@ -81,7 +81,7 @@ $settings = $session->get('settings');
<div class="col-3 h-100"> <div class="col-3 h-100">
<div class="row px-2 d-flex flex justify-content-between align-items-center"> <div class="row px-2 d-flex flex justify-content-between align-items-center">
<div class="col-6 w-100 text-center"> <div class="col-6 w-100 text-center">
<span id="fecha_encuadernado_at" style="color:<?= $colors["general"]["color"] ?>;"><strong><?= $pedido->fecha_encuadernado ? Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->format('d/m/Y') : "??" ?></strong></span> <span id="fecha_encuadernado_at" style="color:<?= $colors["general"]["color"] ?>;"><strong><?= $pedido->fecha_encuadernado ? Time::createFromFormat("Y-m-d H:i:s", $pedido->fecha_encuadernado)->format('d/m/Y') : "" ?></strong></span>
</div> </div>
</div> </div>
<div class="row px-2 mt-2 h-100"> <div class="row px-2 mt-2 h-100">
@ -113,18 +113,18 @@ $settings = $session->get('settings');
<div class="col-5"> <div class="col-5">
<div class="row"> <div class="row">
<div class="col-12 w-50 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;"> <div class="col-12 w-50 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;">
<strong><?= isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "?" : "?" ?></strong> <strong><?= isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "" : "" ?></strong>
</div> </div>
</div> </div>
<div class="row h-75"> <div class="row h-75">
<div class="col-6 square text-center" style="background-color: <?= $colors["papel_interior"]["bg"] ?>;color:<?= $colors["papel_interior"]["color"] ?>;"> <div class="col-6 square text-center" style="background-color: <?= $colors["papel_interior"]["bg"] ?>;color:<?= $colors["papel_interior"]["color"] ?>;">
<?= $linea_impresion->papel_impresion()->papel_code_ot ?> <?= $linea_impresion?->papel_impresion()->papel_code_ot ?>
</div> </div>
<div class="col-6 square text-center <?= $linea_impresion->isColor() ? "cmyk" : "bn" ?>"> <div class="col-6 square text-center <?= $linea_impresion->isColor() ? "cmyk" : "bn" ?>">
<?= $tiempo_impresion ?> <?= $tiempo_impresion ?>
</div> </div>
<div class="col-6 square text-center" style="background-color: <?= $colors["papel_cubierta"]["bg"] ?>;color:<?= $colors["papel_cubierta"]["color"] ?>;"> <div class="col-6 square text-center" style="background-color: <?= $colors["papel_cubierta"]["bg"] ?>;color:<?= $colors["papel_cubierta"]["color"] ?>;">
<?= $linea_cubierta->papel_impresion()->papel_code_ot ?> <?= $linea_cubierta?->papel_impresion()->papel_code_ot ?>
</div> </div>
<div class="col-6 square text-center" style="background-color: <?= $colors["plastificado"]["bg"] ?>;color:<?= $colors["plastificado"]["color"] ?>;"> <div class="col-6 square text-center" style="background-color: <?= $colors["plastificado"]["bg"] ?>;color:<?= $colors["plastificado"]["color"] ?>;">
<?= isset($acabados[0]) ? $acabados[0]->tarifa()->code : "" ?> <?= isset($acabados[0]) ? $acabados[0]->tarifa()->code : "" ?>
@ -267,6 +267,7 @@ $settings = $session->get('settings');
</div> </div>
</div> </div>
</div> </div>
<?php if ($linea_cubierta): ?>
<div class="row mb-2"> <div class="row mb-2">
<div class="section-title cubierta">IMP. CUBIERTA</div> <div class="section-title cubierta">IMP. CUBIERTA</div>
<div class="col-12"> <div class="col-12">
@ -305,11 +306,12 @@ $settings = $session->get('settings');
</div> </div>
</div> </div>
<?php endif; ?>
<div class="row mb-2"> <div class="row mb-2">
<div class="section-title encuadernacion">ENCUADERNACIÓN</div> <div class="section-title encuadernacion">ENCUADERNACIÓN</div>
<div class="col-12"> <div class="col-12">
<div class="col-1 w-10 mb-2 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;"> <div class="col-1 w-10 mb-2 text-center" style="background-color: <?= $colors["ot"]["bg"] ?>;color:<?= $colors["ot"]["color"] ?>;">
<span class="fs-bold"><?= isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "?" : "?" ?></span> <span class="fs-bold"><?= isset($encuadernaciones[0]) ? $encuadernaciones[0]->tarifa()->code ?? "" : "" ?></span>
</div> </div>
<table> <table>
<tr> <tr>