add check horas planning plana

This commit is contained in:
amazuecos
2025-04-03 01:08:29 +02:00
parent bb848d391f
commit b79f490f17
6 changed files with 42 additions and 23 deletions

View File

@ -193,8 +193,8 @@ class Ordentrabajo extends BaseController
$q = $this->produccionService->papelGramajeDatatableQuery();
return DataTable::of($q)
->edit("tiempoReal", fn($q) => $q->tiempoReal * 3600)
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'), 'data' => $q])
->edit("tiempoReal", fn($q) => $q->tiempoReal)
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_paper'), 'data' => $q])
->toJson(true);
}
public function papel_pliego_datatable()
@ -202,8 +202,8 @@ class Ordentrabajo extends BaseController
$q = $this->produccionService->papelPliegoDatatableQuery();
return DataTable::of($q)
->edit("tiempoReal", fn($q) => $q->tiempoReal * 3600)
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'), 'data' => $q])
->edit("tiempoReal", fn($q) => $q->tiempoReal)
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_paper'), 'data' => $q])
->toJson(true);
}
public function reset_tareas(int $orden_trabajo_id)
@ -297,6 +297,7 @@ class Ordentrabajo extends BaseController
{
$q = $this->produccionService->planningPlanaQueryDatatable();
return DataTable::of($q)
->edit("tiempo_real_sum", fn($q) => $q->tiempo_real_sum)
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
->add("pliegos_check", fn($q) => $q->otId)
->add("action", fn($q) => $q)

View File

@ -24,6 +24,7 @@ return [
"progreso" => "Progreso",
"logo" => "Logo impresion",
"filter_by_task" => "Filtrar por tarea",
"filter_by_paper" => "Filtrar por papel",
"metros" => "Metros",
"corte" => "Corte",
"pliegos" => "Pliegos",

View File

@ -329,6 +329,8 @@ class ProductionService extends BaseService
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 110;
$ot_tareas["maquina_id"] = $linea_maquina->id;
$ot_tareas["tiempo_estimado"] = $p_linea->tiempo;
$ot_tareas["tiempo_real"] = $p_linea->tiempo;
$ot_tareas["imposicion_id"] = null;
$this->otTarea->insert($ot_tareas);
$ot_tareas = [];
@ -336,6 +338,8 @@ class ProductionService extends BaseService
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre ?? "";
$ot_tareas["tiempo_estimado"] = $p_linea->tiempo;
$ot_tareas["tiempo_real"] = $p_linea->tiempo;
$ot_tareas["orden"] = 110;
$this->otTarea->insert($ot_tareas);
}
@ -443,13 +447,8 @@ class ProductionService extends BaseService
"lg_papel_formato.ancho as papel_ancho",
"lg_papel_formato.alto as papel_alto",
"presupuesto_linea.rotativa_metros_total as metros",
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') as maquina_ancho",
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') as maquina_alto",
"lg_papel_impresion.nombre as papel_impresion",
"presupuesto_linea.gramaje as papel_gramaje",
])
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
->join("orden_trabajo_dates", "orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id", "left")
@ -460,11 +459,12 @@ class ProductionService extends BaseService
->join("lg_papel_impresion", "lg_papel_impresion.id = presupuesto_linea.papel_impresion_id", "left")
->join("lg_maquinas as lgmp", "lgmp.id = presupuesto_linea.maquina_id", "left")
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
->whereIn("presupuesto_linea.tipo", $this->TIPOS_ROTATIVA)
->where('lg_maquinas.is_rotativa', true)
->where("orden_trabajo_tareas.deleted_at", null)
->orderBy("orden_trabajo_tareas.orden", "ASC");
->orderBy("orden_trabajo_tareas.orden", "ASC")
->groupBy('ordenes_trabajo.id');
return $q;
}
/**
@ -488,9 +488,7 @@ class ProductionService extends BaseService
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') as maquina_alto",
"lg_papel_impresion.nombre as papel_impresion",
"presupuesto_linea.gramaje as papel_gramaje",
"SUM(orden_trabajo_tareas.tiempo_real) as tiempo_real_sum"
])
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
->join("orden_trabajo_dates", "orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id", "left")
@ -505,7 +503,9 @@ class ProductionService extends BaseService
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
->where('lg_maquinas.is_rotativa', false)
->where("orden_trabajo_tareas.deleted_at", null)
->orderBy("orden_trabajo_tareas.orden", "ASC");
->orderBy("orden_trabajo_tareas.orden", "ASC")
->groupBy('ordenes_trabajo.id');
return $q;
}
/**

View File

@ -14,6 +14,7 @@
<th><?= lang('Produccion.datatable.gramaje') ?></th>
<th></th>
<th><?= lang('Produccion.datatable.pliegos') ?></th>
<th><?= lang('Produccion.datatable.tiempo') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
<tr>
@ -25,13 +26,14 @@
<th></th>
<th></th>
<th><select class="select2 form-select-sm planning-papel-select" name="papel_impresion"></select></th>
<th><input type="text" class="form-control planning-filter" name="gramaje"></th>
<th><input type="text" class="form-control planning-filter" name="papel_gramaje"></th>
<th>
<div class="form-check mt-4">
<input class="form-check-input" id="pliegos-check-all" type="checkbox" value="" />
</div>
</th>
<th><span id="pliegos-sel-total"></span></th>
<th><span id="horas-sel-total"></span></th>
<th></th>
</tr>
</thead>

View File

@ -15,6 +15,7 @@
<th><?= lang('Produccion.datatable.corte') ?></th>
<th></th>
<th><?= lang('Produccion.datatable.metros') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
<tr>
@ -26,7 +27,7 @@
<th></th>
<th></th>
<th><select class="select2 form-select-sm planning-papel-select" name="papel_impresion"></select></th>
<th><input type="text" class="form-control planning-filter" name="gramaje"></th>
<th><input type="text" class="form-control planning-filter" name="papel_gramaje"></th>
<th>
<select class="select2 form-select-sm w-100" name="corte">
<option value="0" default></option>

View File

@ -13,8 +13,10 @@ class PlanningRotativa {
this.papelImpresionHeader = this.item.find('#papel-impresion-name-header')
this.papelImpresionPlanaHeader = this.item.find('#papel-impresion-name-plana-header')
this.checkAllMetros = this.item.find("#metros-check-all")
this.checkAllPliegos = this.item.find("#pliegos-check-all")
this.tiempoPlanaTotal = this.tablePlanningPlana.find('#horas-sel-total')
this.datatableColumns = [
{ data: 'otId', searchable: false, sortable: false, width: "3rem" },
@ -25,10 +27,11 @@ class PlanningRotativa {
{ data: 'papel_ancho', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_alto', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_impresion', searchable: false, sortable: false },
{ data: 'papel_gramaje', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_gramaje',name:"presupuesto_linea.gramaje", searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'corte', searchable: false, sortable: false, render: this.renderCorteImage.bind(this), width: "10rem" },
{ data: 'metros_check', searchable: false, sortable: false, render: d => `<input class="form-check-input metros-check" data-id="${d}" type="checkbox" value="" />` },
{ data: 'metros', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
]
@ -41,9 +44,10 @@ class PlanningRotativa {
{ data: 'papel_ancho', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_alto', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_impresion', searchable: false, sortable: false },
{ data: 'papel_gramaje', searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'papel_gramaje', name:"presupuesto_linea.gramaje", searchable: false, sortable: false, width: "5rem", render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'pliegos_check', searchable: false, sortable: false, render: d => `<input class="form-check-input pliegos-check" data-id="${d}" type="checkbox" value="" />` },
{ data: 'pliegosPedido', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
{ data: 'tiempo_real_sum', searchable: false, sortable: false,render: d => this.formatSeconds(parseFloat(d))},
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
]
@ -112,6 +116,7 @@ class PlanningRotativa {
this.totalMetrosSel = new AutoNumeric(this.item.find('#metros-sel-total')[0], autoNumericOptions);
this.totalPliegos = new AutoNumeric(this.item.find('#total-pliegos')[0], autoNumericPliegosOptions);
this.totalPliegosSel = new AutoNumeric(this.item.find('#pliegos-sel-total')[0], autoNumericPliegosOptions);
this.maquinaSelectFilter.init()
this.papelImpresionFilter.init()
this.maquinaSelectFilterPlana.init()
@ -261,25 +266,27 @@ class PlanningRotativa {
}
getPapelImpresionSuccess(response) {
this.papelImpresionFilter.setOption(response.id, response.nombre)
this.tablePlanningRot.find('input[name=gramaje]').val(response.gramaje).trigger("change")
this.tablePlanningRot.find('input[name=papel_gramaje]').val(response.gramaje).trigger("change")
this.papelImpresionHeader.text(response.nombre)
}
getPapelImpresionError(response) { }
getPapelImpresionPlanaSuccess(response) {
this.papelImpresionFilterPlana.setOption(response.id, response.nombre)
this.tablePlanningPlana.find('input[name=gramaje]').val(response.gramaje).trigger("change")
this.tablePlanningPlana.find('input[name=papel_gramaje]').val(response.gramaje).trigger("change")
this.papelImpresionPlanaHeader.text(response.nombre)
}
getPapelImpresionPlanaError(response) { }
formatSeconds(s) {
return [parseInt(s / 60 / 60), parseInt(s / 60 % 60)].join(':').replace(/\b(\d)\b/g, '0$1');
const hours = Math.floor(s / 60 / 60)
const minutes = Math.floor(s / 60 % 60)
return [hours, minutes].join(':').replace(/\b(\d)\b/g, '0$1');
}
addTotalFooter() {
const seconds = this.papelGramajeDatatable.column(5).data().reduce((a, b) => {
return parseFloat(a) + parseFloat(b)
}, 0)
const metros = this.papelGramajeDatatable.column(4).data().map((e) => parseFloat(e))
$('#total-tiempo-papel').text(this.formatSeconds(seconds))
$('#total-tiempo-papel').text(this.formatSeconds(parseInt(seconds)))
this.totalMetros.set(metros.reduce((a, b) => a + b, 0))
@ -305,7 +312,14 @@ class PlanningRotativa {
const metros_sel = this.datatablePlanningPlana.rows((idx, data, node) => {
return $(node).find('input[type="checkbox"]').prop('checked');
}).data().toArray().map((e) => parseInt(e.pliegosPedido))
const tiempo_total_sel = this.datatablePlanningPlana.rows((idx, data, node) => {
return $(node).find('input[type="checkbox"]').prop('checked');
}).data().toArray().map((e) => parseFloat(e.tiempo_real_sum))
this.totalPliegosSel.set(metros_sel.reduce((a, b) => a + b, 0))
const totalSeconds = tiempo_total_sel.reduce((a,b) => a+b,0)
console.log("Total seconds",totalSeconds);
this.tiempoPlanaTotal.text(this.formatSeconds(totalSeconds))
}
renderCorteImage(data) {