From 2a8c4b9da605dd4e2e763f98f9e8b21bc2b05061 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Wed, 16 Apr 2025 19:55:30 +0200 Subject: [PATCH] fix ot --- .../Produccion/OrdenTrabajoUserEntity.php | 2 + .../Models/OrdenTrabajo/OrdenTrabajoUser.php | 1 + ci4/app/Services/ProductionService.php | 23 ++++++----- .../produccion/ot/otPreimpresionReview.php | 2 +- .../Views/themes/vuexy/pdfs/orden_trabajo.php | 2 +- .../assets/js/safekat/pages/produccion/ot.js | 40 ++++++++++++++++--- httpdocs/themes/vuexy/css/pdf.ot.css | 7 ++-- 7 files changed, 57 insertions(+), 20 deletions(-) diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php index 57356b8b..0a95037a 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php @@ -32,6 +32,8 @@ class OrdenTrabajoUserEntity extends Entity "retractilado5_user_id" => null, "prototipo_user_id" => null, "marcapaginas_user_id" => null, + "espiral_user_id" => null, + //FERRO "pendiente_ferro_user_id" => null, "ferro_en_cliente_user_id" => null, diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php index df4d0541..443bbcd0 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php @@ -36,6 +36,7 @@ class OrdenTrabajoUser extends Model "retractilado5_user_id", "prototipo_user_id", "marcapaginas_user_id", + "espiral_user_id", //FERRO "pendiente_ferro_user_id", "ferro_en_cliente_user_id", diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 784365a7..e90f025c 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -188,6 +188,7 @@ class ProductionService extends BaseService $this->setPedido($pedido); $this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first(); $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; + $this->updateProgress(); return $this; } catch (\Throwable $th) { throw $th; @@ -305,6 +306,7 @@ class ProductionService extends BaseService $status = false; if ($this->otDate->where('orden_trabajo_id', $this->ot->id)->countAllResults() == 0) { $status = $this->storeOrdenTrabajoDates(); + $this->resetAllTareas(); } return $status; } @@ -1266,7 +1268,7 @@ class ProductionService extends BaseService } return $pedidoUserDates; } - public function getTiempoProcesamientoHHMM(): string + public function getTiempoProcesamientoHHMM(): ?string { $time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas()); $seconds = array_sum($time_tareas_seconds); @@ -1303,15 +1305,18 @@ class ProductionService extends BaseService $status = false; $total = count($userDates) + count($pedidoUserDates); if ($this->ot->estado != "F") { - foreach ($userDates as $key => $value) { - if ($this->ot->dates()->{$key} != null) $fill_dates++; - } - foreach ($pedidoUserDates as $key => $value) { - if ($this->pedido->{$key} != null) $fill_dates++; - } + if ($this->ot->dates()) { - $progreso = (float) $fill_dates / $total * 100; - $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]); + foreach ($userDates as $key => $value) { + if ($this->ot->dates()->{$key} != null) $fill_dates++; + } + foreach ($pedidoUserDates as $key => $value) { + if ($this->pedido->{$key} != null) $fill_dates++; + } + + $progreso = (float) $fill_dates / $total * 100; + $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]); + } } else { $status = $this->otModel->update($this->ot->id, ["progreso" => 100]); } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php index d9f0fcfd..1d2d2524 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php @@ -14,7 +14,7 @@ Revisar formato