fix show form cosido in ot task

This commit is contained in:
amazuecos
2025-05-05 07:53:36 +02:00
parent 058857e51b
commit 46176adc70
6 changed files with 21 additions and 26 deletions

View File

@ -219,8 +219,9 @@ class Ordentrabajo extends BaseController
$this->viewData["user_dates"] = $this->produccionService->userDates();
$this->viewData["pedido_user_dates"] = $this->produccionService->pedidoUserDates();
$this->viewData["colors"] = $this->produccionService->getPdfColors();
$this->viewData["tiempo_estimado"] = $this->produccionService->getTiempoProcesamientoHHMM();
$this->viewData["tiempo_estimado"] = $this->produccionService->getTiempoProcesamientoHHMMSS();
$this->viewData["flags"] = $this->produccionService->getFlags();
$this->viewData["tareaCosido"] = $this->produccionService->getTareaCosido();
return view(static::$viewPath . $this->editRoute, $this->viewData);

View File

@ -212,7 +212,7 @@ class OrdenTrabajoTareaEntity extends Entity
public function isCosido(): bool
{
$isTareaCosido = false;
$pm = $this->presupuesto_manipulado();
$pm = $this->presupuesto_encuadernacion();
if ($pm) {
$isTareaCosido = $pm->tarifa()->isCosido();
}

View File

@ -40,7 +40,10 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
$words_initial = array_map(fn($w) => substr(strtoupper($w),0,1),$words);
return implode("",$words_initial);
}
public function isCosido(): bool
{
return in_array($this->attributes['id'], [3, 17]);
}
}

View File

@ -36,6 +36,6 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
public function isCosido(): bool
{
return in_array($this->attributes['id'], [3, 17]);
return in_array($this->attributes['id'], [2, 3, 17, 45]);
}
}

View File

@ -873,7 +873,7 @@ class ProductionService extends BaseService
"tareas_encuadernacion" => $this->tareas_encuadernacion(),
"tareas_preimpresion" => $this->tareas_preimpresion(),
"tareas_impresion" => $this->tareas_impresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMMSS(),
"tiempo_total" => $this->getTiempoTotalTareas(),
"statusColor" => $this->getOtColorStatus(),
"tareaCosido" => $this->getTareaCosido(),
@ -902,8 +902,8 @@ class ProductionService extends BaseService
"peso_unidad" => $logistica_data["peso_unidad"],
"peso_pedido" => $logistica_data["peso_pedido"],
"imposicion" => $this->getImposicionTareaImpresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_impresion" => $this->getTiempoTareasImpresionHHMM(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMMSS(),
"tiempo_impresion" => $this->getTiempoTareasImpresionHHMMSS(),
"colors" => $this->getPdfColors(),
"isPOD" => $this->isPOD,
"uvi" => $this->getUVI(),
@ -1435,17 +1435,17 @@ class ProductionService extends BaseService
}
return $pedidoUserDates;
}
public function getTiempoProcesamientoHHMM(): ?string
public function getTiempoProcesamientoHHMMSS(): ?string
{
try {
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
$seconds = array_sum($time_tareas_seconds);
return float_seconds_to_hhmm_string($seconds);
return float_seconds_to_hhmmss_string($seconds);
} catch (\Throwable $th) {
return '00:00';
return '00:00:00';
}
}
public function getTiempoTareasImpresionHHMM(): string
public function getTiempoTareasImpresionHHMMSS(): string
{
try {
$tareas_impresion = $this->ot->tareas_impresion();
@ -1455,7 +1455,7 @@ class ProductionService extends BaseService
$tiempo_seconds += $tarea->tiempo_estimado;
}
}
return float_seconds_to_hhmm_string($tiempo_seconds);
return float_seconds_to_hhmmss_string($tiempo_seconds);
} catch (\Throwable $th) {
return '00:00';
}
@ -1845,10 +1845,10 @@ class ProductionService extends BaseService
public function cosido(): bool
{
$flag = false;
$manipulados = $this->presupuesto->manipulados();
foreach ($manipulados as $key => $manipulado) {
$tarifa_manipulado = $manipulado->tarifa();
if ($tarifa_manipulado->isCosido()) {
$encuadernaciones = $this->presupuesto->encuadernaciones();
foreach ($encuadernaciones as $key => $encuadernacion) {
$tarifaEncuadernacionEntity = $encuadernacion->tarifa();
if ($tarifaEncuadernacionEntity->isCosido()) {
$flag = true;
break;
}

View File

@ -15,7 +15,7 @@
<div class="row">
<!-- Date 1-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-tiempo-procesamiento" class="form-label"><?= @lang("Produccion.tiempo_procesamiento") ?> (HH:MM)</label>
<label for="ot-tiempo-procesamiento" class="form-label"><?= @lang("Produccion.tiempo_procesamiento") ?> (HH:MM:SS)</label>
<div class="input-group">
<input type="text" class="form-control" name="tiempo_procesamiento" placeholder="HH:MM" id="ot-tiempo-procesamiento" data-input disabled>
<button class="btn btn-outline-warning btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
@ -99,15 +99,6 @@
</div>
</div>
<!-- Date 6-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_entrega_estimada") ?></label>
<div class="input-group">
<input type="date" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_entrega_estimada_at" id="ot-fecha-entrega-estimada" data-input disabled />
<button class="btn btn-outline-warning btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
</div>
</div>
</div>
</div>