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

@ -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,

View File

@ -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",

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

View File

@ -14,7 +14,7 @@
<span class="switch-label">Revisar formato</span>
</label>
<label class="switch switch-md">
<input type="checkbox" class="switch-input ot-preview" name="revisar_lomo" />
<input type="checkbox" class="switch-input ot-preview" name="revisar_lomo" <?= $is_finalizada ? "disabled" : "" ?> />
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-check"></i>

View File

@ -44,7 +44,7 @@ $settings = $session->get('settings');
</div>
<div class="row mb-2 d-flex flex align-items-stretch">
<div class="col-2">
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->portada_path ? "data:image/png;base64," . base64_encode(file_get_contents(WRITEPATH . "uploads/" . $ot->portada_path)) : '/assets/img/portada_not_found.png' ?>" />
<img class="portada-img border-secondary img-thumbnail img-fluid" src="<?= $ot->full_path ? "data:image/png;base64," . base64_encode(file_get_contents($ot->full_path)) : '/assets/img/portada_not_found.png' ?>" />
</div>
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
<div class="row">