rotativa planning

This commit is contained in:
amazuecos
2025-03-26 21:01:31 +01:00
parent ff73caec21
commit 81573eede4
11 changed files with 101 additions and 18 deletions

View File

@ -293,6 +293,8 @@ $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracio
$routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
$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->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']);

View File

@ -468,4 +468,10 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
}
}
public function papel_impresion_select()
{
$q = $this->request->getGet('q');
$data = $this->model->querySelect($q)->get()->getResultArray();
return $this->response->setJSON($data);
}
}

View File

@ -194,6 +194,7 @@ 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])
->toJson(true);
}
public function reset_tareas(int $orden_trabajo_id)

View File

@ -23,6 +23,7 @@ return [
"tiempo" => "Tiempo",
"progreso" => "Progreso",
"logo" => "Logo impresion",
"filter_by_task" => "Filtrar por tarea"
],
"task" => [

View File

@ -369,5 +369,16 @@ class PapelImpresionModel extends \App\Models\BaseModel
return "";
}
public function querySelect(?string $query)
{
$q = $this->builder()->select([
"id",
"nombre as name",
]);
if ($query) {
$q->like("name", $query);
}
return $q;
}
}

View File

@ -110,7 +110,6 @@ class ProductionService extends BaseService
{
$auth_user = auth()->user();
$ot = new OrdenTrabajoEntity();
$ot_exists = $this->pedido->orden_trabajo();
if ($ot_exists) {
return $ot_exists;
@ -122,13 +121,10 @@ class ProductionService extends BaseService
"total_tirada" => $this->pedido->total_tirada,
"total_precio" => $this->pedido->total_precio
];
$ot->fill($data);
$this->otModel->save($ot);
$ot_id = $this->otModel->getInsertID();
$ot->id = $ot_id;
$ot_id = $this->otModel->insert($data);
$this->init($ot_id);
$this->storeOrdenTrabajoUsers();
$this->storeOrdenTrabajoDates();
// $this->storeOrdenTrabajoUsers();
// $this->storeOrdenTrabajoDates();
$this->storeAllTareas();
return $this->ot;
}
@ -467,6 +463,7 @@ class ProductionService extends BaseService
public function papelGramajeDatatableQuery() : BaseBuilder
{
$q = $this->otModel->builder()->select([
"lg_papel_impresion.id as papelImpresionId",
"lg_papel_impresion.nombre as papelImpresionNombre",
"lg_papel_impresion.gramaje as papelImpresionGramaje",
"COUNT(orden_trabajo_tareas.id) as tareasCount",
@ -692,5 +689,9 @@ class ProductionService extends BaseService
}
protected function actionButtonFilterTask(int $id)
{
return ["title" => lang('ot.filter_by_task'),'id' => $id];
}
}

View File

@ -8,6 +8,8 @@
<th><?= lang('Produccion.datatable.tareas') ?></th>
<th><?= lang('Produccion.datatable.tiradas') ?></th>
<th><?= lang('Produccion.datatable.tiempo') ?>(HH:MM)</th>
<th></th>
</tr>
</thead>
<tbody>

View File

@ -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="form-control" name=""></select></th>
<th><select class="select2 form-select select-maquina" id="papel-impresion-select-filter" name="maquina_planning_nombre"></select></th>
<th><input type="text" class="form-control planning-filter" name=""></th>
<th></th>

View File

@ -14,22 +14,57 @@
<li class="nav-item">
<button type="button" class="nav-link active" role="tab" id="navs-top-align-prot-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-prot"><?= lang("Produccion.planning_rotativa") ?></button>
</li>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" id="navs-top-align-papel-gramaje-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-papel-gramaje"><?= lang("Produccion.papel_gramajes") ?></button>
</li>
</ul>
<div class="tab-content" id="prot-datatables-container">
<div class="tab-pane fade show active" id="navs-top-align-prot">
<?= view("themes/vuexy/components/tables/planning_rot_table.php", ["id" => "planning-rotativa-datatable"]) ?>
<div class="accordion accordion-bordered mt-3" id="accordionPapelGramaje">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionPapelGramajeContainer" aria-expanded="false"
aria-controls="accordionPapelGramajeContainer">
<h4><?= lang("Produccion.papel_gramajes") ?></h4>
</button>
</h2>
<div id="accordionPapelGramajeContainer" class="accordion-collapse collapse show"
data-bs-parent="#accordionPapelGramaje">
<div class="accordion-body">
<?= view("themes/vuexy/components/tables/planning_papel_gramaje_table.php", ["id" => "planning-papel-datatable"]) ?>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade show" id="navs-top-align-papel-gramaje">
<?= view("themes/vuexy/components/tables/planning_papel_gramaje_table.php", ["id" => "planning-papel-datatable"]) ?>
<div class="tab-pane fade show active" id="navs-top-align-prot">
<div class="accordion accordion-bordered mt-3" id="accordionPlanningRotativa">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse"
data-bs-target="#accordionPlanningRotativaContainer" aria-expanded="false"
aria-controls="accordionPlanningRotativaContainer">
<h4><?= lang("Produccion.planning_rotativa") ?></h4>
</button>
</h2>
<div id="accordionPlanningRotativaContainer" class="accordion-collapse collapse show"
data-bs-parent="#accordionPlanningRotativa">
<div class="accordion-body">
<?= view("themes/vuexy/components/tables/planning_rot_table.php", ["id" => "planning-rotativa-datatable"]) ?>
</div>
</div>
</div>
</div>
</div>
</div>
<!--//.card -->
</div>
</div>
<!--//.col -->
<!--//.card -->
</div>
</div>
<!--//.col -->
</div>
<?= $this->endSection() ?>

View File

@ -3,5 +3,4 @@ import PlanningRotativa from "./planning_rotativa.js";
$(function(){
const planningRotativa = new PlanningRotativa($("#planning-rotativa-page"));
planningRotativa.init();
console.log("PL")
})

View File

@ -25,15 +25,26 @@ class PlanningRotativa {
{ data: 'tareasCount', searchable: true, sortable: true },
{ data: 'totalTirada', 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>`
}
},
]
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.config.dropdownParent = this.item
}
init() {
this.maquinaSelectFilter.init()
this.papelImpresionFilter.init()
this.papelGramajeTablePlanning.on('click','.papel-gramaje-btn',this.filterPapelGramaje.bind(this))
this.datatablePlanningRot = this.tablePlanningRot.DataTable({
processing: true,
orderCellsTop : true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
@ -52,6 +63,7 @@ class PlanningRotativa {
});
this.papelGramajeDatatable = this.papelGramajeTablePlanning.DataTable({
processing: true,
orderCellsTop : true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
@ -77,14 +89,27 @@ class PlanningRotativa {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatablePlanningRot.column(columnIndex).search(this.maquinaSelectFilter.getText()).draw()
})
this.item.on("change", "#papel-impresion-select-filter", (event) => {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatablePlanningRot.column(columnIndex).search(this.papelImpresionFilter.getText()).draw()
})
}
_renderBtnAction(d) {
return `<a type="button" href="/produccion/ordentrabajo/edit/${d.otId}" class="btn btn-md btn-primary ot-tarea-comment" data-id="${d.otId}"><i class="ti ti-building-factory-2 ti-sm mx-2"></i> Ver orden</a>`
return `<a href="/produccion/ordentrabajo/edit/${d.otId}" class="ot-tarea-comment" data-id="${d.otId}"><i class="ti ti-eye"></i></a>`
}
_columnFiltering() {
this.api().columns()
console.log(this.api().columns())
}
filterPapelGramaje(event)
{
const papelImpresionId = $(event.currentTarget).data('id')
const papelImpresionName = $(event.currentTarget).data('name')
this.papelImpresionFilter.setOption(papelImpresionId,papelImpresionName)
}
}
export default PlanningRotativa;