mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
papel rotativa
This commit is contained in:
@ -294,6 +294,8 @@ $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracio
|
||||
$routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
|
||||
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
|
||||
$routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
|
||||
$routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);
|
||||
|
||||
|
||||
});
|
||||
$routes->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -474,4 +474,9 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$data = $this->model->querySelect($q)->get()->getResultArray();
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function papel_impresion_find(int $papel_impresion_id)
|
||||
{
|
||||
$piEntity = $this->model->find($papel_impresion_id);
|
||||
return $this->response->setJSON($piEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,14 +132,14 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado","F");
|
||||
$q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F");
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo",fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
@ -147,14 +147,14 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado",["I","PM"]);
|
||||
$q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo",fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
@ -162,14 +162,14 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at",null);
|
||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo",fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
@ -177,14 +177,14 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL",NULL,FALSE);
|
||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo",fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => Time::createFromFormat("Y-m-d",$q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
@ -194,7 +194,8 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->produccionService->papelGramajeDatatableQuery();
|
||||
return DataTable::of($q)
|
||||
->edit("tiempoReal", fn($q) => float_seconds_to_hhmm_string($q->tiempoReal * 3600))
|
||||
->add("action" , fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'),'data' => $q])
|
||||
->add("metros", fn($q) => $q->maquina_ancho*$q->totalTirada/1000)
|
||||
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'), 'data' => $q])
|
||||
->toJson(true);
|
||||
}
|
||||
public function reset_tareas(int $orden_trabajo_id)
|
||||
|
||||
@ -23,7 +23,9 @@ return [
|
||||
"tiempo" => "Tiempo",
|
||||
"progreso" => "Progreso",
|
||||
"logo" => "Logo impresion",
|
||||
"filter_by_task" => "Filtrar por tarea"
|
||||
"filter_by_task" => "Filtrar por tarea",
|
||||
"metros" => "Metros"
|
||||
|
||||
|
||||
],
|
||||
"task" => [
|
||||
@ -68,7 +70,7 @@ return [
|
||||
"preview_pdf" => "Previsualizar PDF",
|
||||
"imprimir_codigo_safekat" => "Imprimir código SAFEKAT",
|
||||
"imprimir_ferro" => "Imprimir ferro",
|
||||
"planning_rotativa" => "Planning rotativa",
|
||||
"planning_rotativa" => "Tareas rotativa",
|
||||
"solapa" => "Solapa",
|
||||
"papel_gramajes" => "Papel y gramajes"
|
||||
|
||||
|
||||
@ -376,7 +376,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
"nombre as name",
|
||||
]);
|
||||
if ($query) {
|
||||
$q->like("name", $query);
|
||||
$q->orLike("nombre", $query);
|
||||
}
|
||||
return $q;
|
||||
}
|
||||
|
||||
@ -440,6 +440,7 @@ class ProductionService extends BaseService
|
||||
"orden_trabajo_tareas.nombre",
|
||||
"lgmp.nombre as maquina_presupuesto_linea",
|
||||
"orden_trabajo_tareas.maquina_id as maquina_tarea",
|
||||
|
||||
"lg_maquinas.nombre as maquina_nombre",
|
||||
"lg_imposiciones.id as imposicion_id",
|
||||
"orden_trabajo_tareas.tiempo_estimado",
|
||||
@ -467,6 +468,8 @@ class ProductionService extends BaseService
|
||||
"lg_papel_impresion.nombre as papelImpresionNombre",
|
||||
"lg_papel_impresion.gramaje as papelImpresionGramaje",
|
||||
"COUNT(orden_trabajo_tareas.id) as tareasCount",
|
||||
"CAST(JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') AS DOUBLE) as maquina_ancho",
|
||||
"CAST(JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') AS DOUBLE) as maquina_alto",
|
||||
"SUM(ordenes_trabajo.total_tirada) as totalTirada",
|
||||
"SUM(orden_trabajo_tareas.tiempo_real) as tiempoReal"
|
||||
])
|
||||
@ -474,7 +477,8 @@ class ProductionService extends BaseService
|
||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||
->join("lg_papel_impresion","presupuesto_linea.papel_impresion_id = lg_papel_impresion.id","left")
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL,FALSE);
|
||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL,FALSE)
|
||||
->groupBy('lg_papel_impresion.id');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<th><?= lang('Produccion.datatable.gramaje') ?> (gr)</th>
|
||||
<th><?= lang('Produccion.datatable.tareas') ?></th>
|
||||
<th><?= lang('Produccion.datatable.tiradas') ?></th>
|
||||
<th><?= lang('Produccion.datatable.metros') ?></th>
|
||||
<th><?= lang('Produccion.datatable.tiempo') ?>(HH:MM)</th>
|
||||
<th></th>
|
||||
|
||||
@ -15,5 +16,14 @@
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="4" style="text-align:right">Total:</th>
|
||||
<th id="total-metros"></th>
|
||||
<th id="total-tiempo-papel"></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@ -25,7 +25,7 @@
|
||||
<th></th>
|
||||
<th><input type="text" class="form-control planning-filter" name="maquina_ancho" placeholder="Ancho"></th>
|
||||
<th><input type="text" class="form-control planning-filter" name="maquina_alto" placeholder="Alto"></th>
|
||||
<th><select class="select2 form-select select-maquina" id="papel-impresion-select-filter" name="maquina_planning_nombre"></select></th>
|
||||
<th><select class="select2 form-select select-maquina" id="papel-impresion-select-filter" name="papel_impresion"></select></th>
|
||||
<th><input type="text" class="form-control planning-filter" name=""></th>
|
||||
<th></th>
|
||||
|
||||
@ -34,5 +34,6 @@
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
@ -50,6 +50,7 @@
|
||||
<div id="accordionPlanningRotativaContainer" class="accordion-collapse collapse show"
|
||||
data-bs-parent="#accordionPlanningRotativa">
|
||||
<div class="accordion-body">
|
||||
<h6 id="papel-impresion-name-header" class="text-secondary "></h6>
|
||||
<?= view("themes/vuexy/components/tables/planning_rot_table.php", ["id" => "planning-rotativa-datatable"]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
import ClassSelect from "../../../components/select2.js";
|
||||
import Ajax from "../../../components/ajax.js";
|
||||
|
||||
|
||||
class PlanningRotativa {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.tablePlanningRot = this.item.find("#planning-rotativa-datatable")
|
||||
this.papelGramajeTablePlanning = this.item.find("#planning-papel-datatable")
|
||||
|
||||
this.papelImpresionHeader = this.item.find('#papel-impresion-name-header')
|
||||
this.datatableColumns = [
|
||||
{ data: 'otId', searchable: false, sortable: false },
|
||||
{ data: 'fecha_entrega_real_at', searchable: true, sortable: false },
|
||||
{ data: 'presupuesto_titulo', searchable: true, sortable: false },
|
||||
{ data: 'maquina_planning_nombre', searchable: true, sortable: false },
|
||||
{ data: 'ot_tirada', searchable: false, sortable: false },
|
||||
{ data: 'maquina_ancho', searchable: false, sortable: false },
|
||||
{ data: 'maquina_alto', searchable: false, sortable: false },
|
||||
{ data: 'maquina_ancho', searchable: false, sortable: false,render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'maquina_alto', searchable: false, sortable: false ,render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'papel_impresion', searchable: false, sortable: false },
|
||||
{ data: 'papel_gramaje', searchable: false, sortable: false },
|
||||
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
|
||||
@ -24,31 +26,35 @@ class PlanningRotativa {
|
||||
{ data: 'papelImpresionGramaje', searchable: true, sortable: true },
|
||||
{ data: 'tareasCount', searchable: true, sortable: true },
|
||||
{ data: 'totalTirada', searchable: false, sortable: false },
|
||||
{ data: 'metros', searchable: false, sortable: false },
|
||||
{ data: 'tiempoReal', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false, render: (d) => {
|
||||
return `<button type="button" class="btn btn-primary btn-sm w-100 papel-gramaje-btn" data-id="${d.data.papelImpresionId}" data-name="${d.data.papelImpresionNombre}" data-bs-toggle="button">${d.title}</button>`
|
||||
return `<button type="button" class="btn btn-primary btn-sm w-100 papel-gramaje-btn" data-id="${d.data.papelImpresionId}" data-bs-toggle="button">${d.title}</button>`
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
this.maquinaSelectFilter = new ClassSelect($("#maquina-select-filter"), `/maquinas/select`, "Seleccione una maquina", true);
|
||||
this.papelImpresionFilter = new ClassSelect($("#papel-impresion-select-filter"), `/papelesimpresion/select`, "Seleccione un papel", true);
|
||||
this.maquinaSelectFilter = new ClassSelect($("#maquina-select-filter"), `/maquinas/select`, "Seleccione una maquina", true, {}, $('body'));
|
||||
this.papelImpresionFilter = new ClassSelect($("#papel-impresion-select-filter"), `/papelesimpresion/select`, "Seleccione un papel", true, {}, $('body'));
|
||||
this.maquinaSelectFilter.config.dropdownParent = this.item
|
||||
}
|
||||
init() {
|
||||
this.maquinaSelectFilter.init()
|
||||
this.papelImpresionFilter.init()
|
||||
this.papelGramajeTablePlanning.on('click','.papel-gramaje-btn',this.filterPapelGramaje.bind(this))
|
||||
|
||||
this.papelGramajeTablePlanning.on('click', '.papel-gramaje-btn', this.filterPapelGramaje.bind(this))
|
||||
this.papelImpresionFilter.onChange(() => {
|
||||
this.papelImpresionHeader.text(this.papelImpresionFilter.getText())
|
||||
})
|
||||
|
||||
this.datatablePlanningRot = this.tablePlanningRot.DataTable({
|
||||
processing: true,
|
||||
orderCellsTop : true,
|
||||
orderCellsTop: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
topStart: 'info',
|
||||
topEnd: null,
|
||||
bottomStart: 'pageLength',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
|
||||
@ -63,11 +69,12 @@ class PlanningRotativa {
|
||||
});
|
||||
this.papelGramajeDatatable = this.papelGramajeTablePlanning.DataTable({
|
||||
processing: true,
|
||||
orderCellsTop : true,
|
||||
orderCellsTop: true,
|
||||
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
topStart: 'info',
|
||||
topEnd: null,
|
||||
bottomStart: 'pageLength',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
|
||||
@ -93,6 +100,7 @@ class PlanningRotativa {
|
||||
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
|
||||
this.datatablePlanningRot.column(columnIndex).search(this.papelImpresionFilter.getText()).draw()
|
||||
})
|
||||
this.papelGramajeDatatable.on('draw', this.addTotalFooter.bind(this))
|
||||
}
|
||||
_renderBtnAction(d) {
|
||||
return `<a href="/produccion/ordentrabajo/edit/${d.otId}" class="ot-tarea-comment" data-id="${d.otId}"><i class="ti ti-eye"></i></a>`
|
||||
@ -101,15 +109,49 @@ class PlanningRotativa {
|
||||
this.api().columns()
|
||||
console.log(this.api().columns())
|
||||
}
|
||||
filterPapelGramaje(event)
|
||||
{
|
||||
filterPapelGramaje(event) {
|
||||
const papelImpresionId = $(event.currentTarget).data('id')
|
||||
const papelImpresionName = $(event.currentTarget).data('name')
|
||||
|
||||
|
||||
this.papelImpresionFilter.setOption(papelImpresionId,papelImpresionName)
|
||||
this.getPapelImpresion(papelImpresionId)
|
||||
}
|
||||
getPapelImpresion(papelImpresionId) {
|
||||
let ajax = new Ajax('/papelesimpresion/show/' + papelImpresionId,
|
||||
null,
|
||||
null,
|
||||
this.getPapelImpresionSuccess.bind(this),
|
||||
this.getPapelImpresionError.bind(this)
|
||||
)
|
||||
ajax.get()
|
||||
}
|
||||
getPapelImpresionSuccess(response) {
|
||||
this.papelImpresionFilter.setOption(response.id, response.nombre)
|
||||
this.papelImpresionHeader.text(response.nombre)
|
||||
}
|
||||
getPapelImpresionError(response) { }
|
||||
formatSeconds(s){
|
||||
return [parseInt(s / 60 / 60), parseInt(s / 60 % 60)].join(':').replace(/\b(\d)\b/g, '0$1');
|
||||
}
|
||||
addTotalFooter() {
|
||||
const data = this.papelGramajeDatatable.column(5).data().reduce((a, b) => {
|
||||
let sa = a.split(":")
|
||||
let ha = parseInt(sa[0]) * 3600
|
||||
let ma = parseInt(sa[1]) * 60
|
||||
let sb = b.split(":")
|
||||
let hb = parseInt(sb[0]) * 3600
|
||||
let mb = parseInt(sb[1]) * 60
|
||||
return hb + mb + ha + ma
|
||||
})
|
||||
const metros = this.papelGramajeDatatable.column(4).data().reduce((a, b) => {
|
||||
|
||||
return a + b
|
||||
})
|
||||
$('#total-tiempo-papel').text(this.formatSeconds(data))
|
||||
$('#total-metros').text(metros)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export default PlanningRotativa;
|
||||
Reference in New Issue
Block a user