diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index 9df7e7ce..743bb5c4 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -74,7 +74,7 @@ class OrdenTrabajoEntity extends Entity $m = model(OrdenTrabajoTarea::class); return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll(); } - public function tareas_impresion() : array + public function tareas_impresion(): array { $m = model(OrdenTrabajoTarea::class); return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? []; @@ -144,11 +144,13 @@ class OrdenTrabajoEntity extends Entity helper('filesystem'); $path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"]; $portada_path = null; - if ($path) { - if (file_exists($path)) { - $portada_path = $path; - } else { - $portada_path = null; + if ($this->attributes["portada_path"]) { + if ($path) { + if (file_exists($path)) { + $portada_path = $path; + } else { + $portada_path = null; + } } } return $portada_path; 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