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

View File

@ -16,6 +16,9 @@ class OrdenTrabajo {
this.tareaCommentModal = new Modal($("#modalCommentTarea"))
this.alertOrdenTrabajo = this.item.find("#alert-orden-trabajo");
this.btnFinalizarPedido = this.item.find("#btn-finalizar-orden-pedido")
this.btnReactivarOt = this.item.find("#btn-reactivar-orden-pedido")
this.isOtFinalizada = false;
this.btnResetTareas = this.item.find("#btn-reset-tareas")
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
this.pedidoEnEsperaBy = this.item.find("#pedido_espera_by");
@ -140,6 +143,8 @@ class OrdenTrabajo {
this.otForm.on("click", "#btn-upload-portada", this.handleUploadPortada.bind(this))
this.otForm.on("click", "#btn-delete-portada", this.handleDeletePortada.bind(this))
this.btnFinalizarPedido.on("click", this.handleFinalizarPedido.bind(this))
this.btnReactivarOt.on("click", this.handleReactivarPedido.bind(this))
this.tareasTableItem.on("click", ".ot-tarea-btn-delete", this.handleTareaDeleteConfirmation.bind(this))
this.item.on("click", "#btn-reset-tareas", this.handleResetTareasDeleteConfirmation.bind(this))
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
@ -190,14 +195,14 @@ class OrdenTrabajo {
}
_renderMaquinaSelectTable(d, t) {
this.tareasId.push(d.id)
return `<select id="select-maquina-tarea-${d.id}" data-maquina-id="${d.maquina_id}" data-id="${d.id}" name="maquina_id" class="select2 form-select select-maquina-tarea-datatable ${d.maquina_id ? '' : 'is-invalid'}">
return `<select id="select-maquina-tarea-${d.id}" data-maquina-id="${d.maquina_id}" data-id="${d.id}" name="maquina_id" class="select2 form-select select-maquina-tarea-datatable ${d.maquina_id ? '' : 'is-invalid'}" ${this.isOtFinalizada ? "disabled" : ""}>
<option value="${d.maquina_id}" selected="selected">${d.maquina_name ?? ''}</option>
</select>`
}
_renderImposicionSelectTable(d, t) {
let render = `<select id="select-imposicion-tarea-${d.id}" data-imposicion-id="${d.imposicion_id}" data-id="${d.id}" name="imposicion_id" class="select2 form-select select-imposicion-tarea-datatable ${d.imposicion_id ? '' : 'is-invalid'}">
let render = `<select id="select-imposicion-tarea-${d.id}" data-imposicion-id="${d.imposicion_id}" data-id="${d.id}" name="imposicion_id" class="select2 form-select select-imposicion-tarea-datatable ${d.imposicion_id ? '' : 'is-invalid'}" ${this.isOtFinalizada ? "disabled" : ""}>
<option value="${d.imposicion_id}" selected="selected">${d.name ?? ''}</option>
</select>`
return render
@ -206,8 +211,10 @@ class OrdenTrabajo {
_renderActionCell(d, t) {
let cell = `<div class="d-flex justify-content-start align-items-center gap-1">
<a type="button" class="btn btn-xs ot-tarea-comment" data-id="${d.id}"><i class="ti ti-${d.comment ? "message" : "note"} ti-sm mx-2"></i></a>
<a type="button" class="btn btn-xs ot-tarea-btn-delete" data-id="${d.id}"><i class="ti ti-trash ti-sm mx-2"></i></a>
<a type="button" class="btn btn-xs ot-tarea-comment" data-id="${d.id}">
<i class="ti ti-${d.comment ? "message" : "note"} ti-sm mx-2"></i>
</a>
<a type="button" class="btn btn-xs ot-tarea-btn-delete" data-id="${d.id}"><i class="ti ti-trash ti-sm mx-2 ${this.isOtFinalizada ? "d-none" : ""}" ></i></a>
</div>`
return cell;
}
@ -215,7 +222,7 @@ class OrdenTrabajo {
return `
<div class="d-flex justify-content-between aling-items-center gap-2 orden-tarea-cell">
<input type="text" style="min-width:5rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}">
<input type="text" style="min-width:5rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}" ${this.isOtFinalizada ? "disabled" : ""}>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary btn-outlined btn-xs increase-order"><i class="ti ti-chevron-up ti-xs"></i></button>
<button type="button" class="btn btn-primary btn-xs decrease-order" data-id="${d.id}"><i class="ti ti-chevron-down ti-xs"></i></button>
@ -351,6 +358,7 @@ class OrdenTrabajo {
this.fillOtDetails()
this.fillOtDates()
this.fillPreimpresionReview()
this.isOtFinalizada = this.summaryData.ot.estado == "F";
this.datatableTareas.ajax.reload()
} catch (error) {
console.error(error)
@ -649,7 +657,7 @@ class OrdenTrabajo {
this.handleEstadoChangeSuccess.bind(this),
this.handleEstadoChangeError.bind(this)
);
alertConfirmAction("Esta acción marcará la orden de trabjao como FINALIZADA")
alertConfirmAction("Esta acción marcará la orden de trabajo como FINALIZADA")
.then(result => {
if (result.isConfirmed) {
ajax.post()
@ -660,8 +668,28 @@ class OrdenTrabajo {
popSuccessAlert(response.message)
this.alertOrdenTrabajo.removeClass("alert-info").addClass("alert-success")
this.btnFinalizarPedido.prop("disabled", true);
window.location.reload();
}
handleEstadoChangeError() { }
handleReactivarPedido() {
const ajax = new Ajax(
"/produccion/ordentrabajo/update",
{
orden_trabajo_id: this.modelId,
estado: 'I'
},
null,
this.handleEstadoChangeSuccess.bind(this),
this.handleEstadoChangeError.bind(this)
);
alertConfirmAction("Esta acción reactivará la orden de trabajo.")
.then(result => {
if (result.isConfirmed) {
ajax.post()
}
})
}
handleTareaDeleteConfirmation(event) {
const orden_tarea_id = $(event.currentTarget).data("id")
alertConfirmationDelete("¿Estás seguro de realizar esta acción?")

View File

@ -173,10 +173,11 @@ table td{
color: white;
}
.cmyk{
background-image: url('/themes/vuexy/img/safekat/presupuestos/cmyk.png')
background-image: url('/themes/vuexy/img/safekat/presupuestos/cmyk.png');
background-size: 110px;
text-shadow: 0px 0px 1px black;
stroke:black;
color : white;
text-shadow: 0px 0px 2px black;
stroke:white;
}
.bn{
background : black;