mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/ot-bugs' into 'main'
fix ot See merge request jjimenez/safekat!711
This commit is contained in:
@ -32,6 +32,8 @@ class OrdenTrabajoUserEntity extends Entity
|
|||||||
"retractilado5_user_id" => null,
|
"retractilado5_user_id" => null,
|
||||||
"prototipo_user_id" => null,
|
"prototipo_user_id" => null,
|
||||||
"marcapaginas_user_id" => null,
|
"marcapaginas_user_id" => null,
|
||||||
|
"espiral_user_id" => null,
|
||||||
|
|
||||||
//FERRO
|
//FERRO
|
||||||
"pendiente_ferro_user_id" => null,
|
"pendiente_ferro_user_id" => null,
|
||||||
"ferro_en_cliente_user_id" => null,
|
"ferro_en_cliente_user_id" => null,
|
||||||
|
|||||||
@ -36,6 +36,7 @@ class OrdenTrabajoUser extends Model
|
|||||||
"retractilado5_user_id",
|
"retractilado5_user_id",
|
||||||
"prototipo_user_id",
|
"prototipo_user_id",
|
||||||
"marcapaginas_user_id",
|
"marcapaginas_user_id",
|
||||||
|
"espiral_user_id",
|
||||||
//FERRO
|
//FERRO
|
||||||
"pendiente_ferro_user_id",
|
"pendiente_ferro_user_id",
|
||||||
"ferro_en_cliente_user_id",
|
"ferro_en_cliente_user_id",
|
||||||
|
|||||||
@ -188,6 +188,7 @@ class ProductionService extends BaseService
|
|||||||
$this->setPedido($pedido);
|
$this->setPedido($pedido);
|
||||||
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
||||||
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
||||||
|
$this->updateProgress();
|
||||||
return $this;
|
return $this;
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
throw $th;
|
throw $th;
|
||||||
@ -305,6 +306,7 @@ class ProductionService extends BaseService
|
|||||||
$status = false;
|
$status = false;
|
||||||
if ($this->otDate->where('orden_trabajo_id', $this->ot->id)->countAllResults() == 0) {
|
if ($this->otDate->where('orden_trabajo_id', $this->ot->id)->countAllResults() == 0) {
|
||||||
$status = $this->storeOrdenTrabajoDates();
|
$status = $this->storeOrdenTrabajoDates();
|
||||||
|
$this->resetAllTareas();
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
@ -1266,7 +1268,7 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
return $pedidoUserDates;
|
return $pedidoUserDates;
|
||||||
}
|
}
|
||||||
public function getTiempoProcesamientoHHMM(): string
|
public function getTiempoProcesamientoHHMM(): ?string
|
||||||
{
|
{
|
||||||
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
|
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
|
||||||
$seconds = array_sum($time_tareas_seconds);
|
$seconds = array_sum($time_tareas_seconds);
|
||||||
@ -1303,15 +1305,18 @@ class ProductionService extends BaseService
|
|||||||
$status = false;
|
$status = false;
|
||||||
$total = count($userDates) + count($pedidoUserDates);
|
$total = count($userDates) + count($pedidoUserDates);
|
||||||
if ($this->ot->estado != "F") {
|
if ($this->ot->estado != "F") {
|
||||||
foreach ($userDates as $key => $value) {
|
if ($this->ot->dates()) {
|
||||||
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;
|
foreach ($userDates as $key => $value) {
|
||||||
$status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]);
|
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 {
|
} else {
|
||||||
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
|
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<span class="switch-label">Revisar formato</span>
|
<span class="switch-label">Revisar formato</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="switch switch-md">
|
<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-toggle-slider">
|
||||||
<span class="switch-on">
|
<span class="switch-on">
|
||||||
<i class="ti ti-check"></i>
|
<i class="ti ti-check"></i>
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $settings = $session->get('settings');
|
|||||||
</div>
|
</div>
|
||||||
<div class="row mb-2 d-flex flex align-items-stretch">
|
<div class="row mb-2 d-flex flex align-items-stretch">
|
||||||
<div class="col-2">
|
<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>
|
||||||
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
|
<div class="col-10 py-2 rounded border-1 border-secondary" style="background-color: <?= $colors["general"]["bg"] ?>;color:<?= $colors["general"]["color"] ?>;">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@ -16,6 +16,9 @@ class OrdenTrabajo {
|
|||||||
this.tareaCommentModal = new Modal($("#modalCommentTarea"))
|
this.tareaCommentModal = new Modal($("#modalCommentTarea"))
|
||||||
this.alertOrdenTrabajo = this.item.find("#alert-orden-trabajo");
|
this.alertOrdenTrabajo = this.item.find("#alert-orden-trabajo");
|
||||||
this.btnFinalizarPedido = this.item.find("#btn-finalizar-orden-pedido")
|
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.btnResetTareas = this.item.find("#btn-reset-tareas")
|
||||||
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
|
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
|
||||||
this.pedidoEnEsperaBy = this.item.find("#pedido_espera_by");
|
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-upload-portada", this.handleUploadPortada.bind(this))
|
||||||
this.otForm.on("click", "#btn-delete-portada", this.handleDeletePortada.bind(this))
|
this.otForm.on("click", "#btn-delete-portada", this.handleDeletePortada.bind(this))
|
||||||
this.btnFinalizarPedido.on("click", this.handleFinalizarPedido.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.tareasTableItem.on("click", ".ot-tarea-btn-delete", this.handleTareaDeleteConfirmation.bind(this))
|
||||||
this.item.on("click", "#btn-reset-tareas", this.handleResetTareasDeleteConfirmation.bind(this))
|
this.item.on("click", "#btn-reset-tareas", this.handleResetTareasDeleteConfirmation.bind(this))
|
||||||
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
|
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
|
||||||
@ -190,14 +195,14 @@ class OrdenTrabajo {
|
|||||||
}
|
}
|
||||||
_renderMaquinaSelectTable(d, t) {
|
_renderMaquinaSelectTable(d, t) {
|
||||||
this.tareasId.push(d.id)
|
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>
|
<option value="${d.maquina_id}" selected="selected">${d.maquina_name ?? ''}</option>
|
||||||
</select>`
|
</select>`
|
||||||
|
|
||||||
}
|
}
|
||||||
_renderImposicionSelectTable(d, t) {
|
_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>
|
<option value="${d.imposicion_id}" selected="selected">${d.name ?? ''}</option>
|
||||||
</select>`
|
</select>`
|
||||||
return render
|
return render
|
||||||
@ -206,8 +211,10 @@ class OrdenTrabajo {
|
|||||||
_renderActionCell(d, t) {
|
_renderActionCell(d, t) {
|
||||||
|
|
||||||
let cell = `<div class="d-flex justify-content-start align-items-center gap-1">
|
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-comment" data-id="${d.id}">
|
||||||
<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>
|
<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>`
|
</div>`
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
@ -215,7 +222,7 @@ class OrdenTrabajo {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="d-flex justify-content-between aling-items-center gap-2 orden-tarea-cell">
|
<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">
|
<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-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>
|
<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.fillOtDetails()
|
||||||
this.fillOtDates()
|
this.fillOtDates()
|
||||||
this.fillPreimpresionReview()
|
this.fillPreimpresionReview()
|
||||||
|
this.isOtFinalizada = this.summaryData.ot.estado == "F";
|
||||||
this.datatableTareas.ajax.reload()
|
this.datatableTareas.ajax.reload()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@ -649,7 +657,7 @@ class OrdenTrabajo {
|
|||||||
this.handleEstadoChangeSuccess.bind(this),
|
this.handleEstadoChangeSuccess.bind(this),
|
||||||
this.handleEstadoChangeError.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 => {
|
.then(result => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
ajax.post()
|
ajax.post()
|
||||||
@ -660,8 +668,28 @@ class OrdenTrabajo {
|
|||||||
popSuccessAlert(response.message)
|
popSuccessAlert(response.message)
|
||||||
this.alertOrdenTrabajo.removeClass("alert-info").addClass("alert-success")
|
this.alertOrdenTrabajo.removeClass("alert-info").addClass("alert-success")
|
||||||
this.btnFinalizarPedido.prop("disabled", true);
|
this.btnFinalizarPedido.prop("disabled", true);
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
handleEstadoChangeError() { }
|
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) {
|
handleTareaDeleteConfirmation(event) {
|
||||||
const orden_tarea_id = $(event.currentTarget).data("id")
|
const orden_tarea_id = $(event.currentTarget).data("id")
|
||||||
alertConfirmationDelete("¿Estás seguro de realizar esta acción?")
|
alertConfirmationDelete("¿Estás seguro de realizar esta acción?")
|
||||||
|
|||||||
@ -173,10 +173,11 @@ table td{
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.cmyk{
|
.cmyk{
|
||||||
background-image: url('/themes/vuexy/img/safekat/presupuestos/cmyk.png')
|
background-image: url('/themes/vuexy/img/safekat/presupuestos/cmyk.png');
|
||||||
background-size: 110px;
|
background-size: 110px;
|
||||||
text-shadow: 0px 0px 1px black;
|
color : white;
|
||||||
stroke:black;
|
text-shadow: 0px 0px 2px black;
|
||||||
|
stroke:white;
|
||||||
}
|
}
|
||||||
.bn{
|
.bn{
|
||||||
background : black;
|
background : black;
|
||||||
|
|||||||
Reference in New Issue
Block a user