This commit is contained in:
amazuecos
2025-04-16 19:55:30 +02:00
parent 173afe403e
commit 2a8c4b9da6
7 changed files with 57 additions and 20 deletions

View File

@ -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]);
}