mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
tareas
This commit is contained in:
@ -885,6 +885,8 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
||||
$routes->delete('reset/tareas/(:num)', 'Ordentrabajo::reset_tareas/$1');
|
||||
$routes->get('summary/(:num)', 'Ordentrabajo::get_orden_trabajo_summary/$1', ['as' => 'getOrdenTrabajoSumary']);
|
||||
$routes->get('datatable', 'Ordentrabajo::datatable', ['as' => 'datatableOrdenTrabajo']);
|
||||
$routes->get('tareas/datatable/(:num)', 'Ordentrabajo::tareas_datatable/$1', ['as' => 'datatableTareasOrdenTrabajo']);
|
||||
|
||||
});
|
||||
});
|
||||
/*
|
||||
|
||||
@ -79,6 +79,13 @@ class Ordentrabajo extends BaseController
|
||||
$r = $this->produccionService->init($orden_trabajo_id)->resetAllTareas();
|
||||
return $this->response->setJSON(["message" => "Tareas reseteadas" ,"status" => $r]);
|
||||
}
|
||||
public function tareas_datatable(int $orden_trabajo_id){
|
||||
$q = $this->produccionService->init($orden_trabajo_id)->taskDatatableQuery($orden_trabajo_id);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("action" ,fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -96,9 +96,9 @@ class ProductionService extends BaseService
|
||||
$this->otModel->save($ot);
|
||||
$ot_id = $this->otModel->getInsertID();
|
||||
$ot->id = $ot_id;
|
||||
$this->init($ot_id);
|
||||
$this->storeOrdenTrabajoDates($ot);
|
||||
$this->storeAllTareas();
|
||||
$this->init($ot_id);
|
||||
return $ot;
|
||||
}
|
||||
|
||||
@ -127,9 +127,9 @@ class ProductionService extends BaseService
|
||||
$this->storeOrdenTrabajoEncuadernacionTareas();
|
||||
$this->storeOrdenTrabajoExtraTareas();
|
||||
}
|
||||
public function resetAllTareas() : BaseResult|bool
|
||||
public function resetAllTareas(): BaseResult|bool
|
||||
{
|
||||
$r = $this->otTarea->where("orden_trabajo_id",$this->ot->id)->delete(purge:true);
|
||||
$r = $this->otTarea->where("orden_trabajo_id", $this->ot->id)->delete(purge: true);
|
||||
$this->storeAllTareas();
|
||||
return $r;
|
||||
}
|
||||
@ -316,24 +316,32 @@ class ProductionService extends BaseService
|
||||
/**
|
||||
* Query para mostrar en datatable
|
||||
*
|
||||
* @param integer $ot_id Primary key de la orden de trabajo
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function taskDatatableQuery(int $ot_id): BaseBuilder
|
||||
public function taskDatatableQuery(): BaseBuilder
|
||||
{
|
||||
$q = $this->otModel->builder()->select([
|
||||
"orden_trabajo_tareas.id",
|
||||
"orden_trabajo_tareas.orden",
|
||||
"orden_trabajo_tareas.nombre",
|
||||
"presupuesto_lineas.maquina_id as maquina_tarea",
|
||||
"orden_trabajo_tareas.maquina_id as maquina_presupuesto_linea",
|
||||
"lg_imposiciones.id",
|
||||
"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",
|
||||
"orden_trabajo_tareas.tiempo_real"
|
||||
])
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("presupuesto_lineas", "presupuesto_lineas.id = orden_trabajo_tareas.presupuesto_linea_id")
|
||||
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id")
|
||||
->where("orden_trabajo_tareas.orden_trabajo_id", $ot_id)
|
||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||
->join("presupuesto_acabados", "presupuesto_acabados.id = orden_trabajo_tareas.presupuesto_acabado_id", "left")
|
||||
->join("presupuesto_manipulados", "presupuesto_manipulados.id = orden_trabajo_tareas.presupuesto_manipulado_id", "left")
|
||||
->join("presupuesto_preimpresiones", "presupuesto_preimpresiones.id = orden_trabajo_tareas.presupuesto_preimpresion_id", "left")
|
||||
->join("presupuesto_encuadernaciones", "presupuesto_encuadernaciones.id = orden_trabajo_tareas.presupuesto_encuadernado_id", "left")
|
||||
->join("presupuesto_serviciosExtra", "presupuesto_serviciosExtra.id = orden_trabajo_tareas.presupuesto_extra_id", "left")
|
||||
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_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)
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->orderBy("orden_trabajo_tareas.orden", "DESC");
|
||||
return $q;
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
<tr>
|
||||
<th><?= lang('Produccion.task.order') ?></th>
|
||||
<th><?= lang('Produccion.task.task') ?></th>
|
||||
<th><?= lang('Produccion.task.note') ?></th>
|
||||
<th><?= lang('Produccion.task.maquina_presupuesto') ?></th>
|
||||
<th><?= lang('Produccion.task.maquina_actual') ?></th>
|
||||
<th><?= lang('Produccion.task.imposicion_id') ?></th>
|
||||
<th><?= lang('Produccion.task.tiempo_estimado') ?></th>
|
||||
<th><?= lang('Produccion.task.tiempo') ?></th>
|
||||
<th><?= lang('Produccion.task.action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@ -6,11 +6,44 @@ class OrdenTrabajo
|
||||
this.item = domItem
|
||||
this.otForm = this.item.find("#ot-edit-form")
|
||||
this.modelId = this.item.data("id");
|
||||
this.tareasTableItem = this.item.find("#ot-task-table");
|
||||
this.datatableColumns = [
|
||||
{ data: 'orden', searchable: true, sortable: true },
|
||||
{ data: 'nombre', searchable: true, sortable: true },
|
||||
{ data: 'maquina_presupuesto_linea', searchable: true, sortable: true },
|
||||
{ data: 'maquina_tarea', searchable: false, sortable: false ,render : this._renderMaquinaSelectTable.bind(this)},
|
||||
{ data: 'imposicion_id', searchable: false, sortable: false },
|
||||
{ data: 'tiempo_estimado', searchable: false, sortable: false },
|
||||
{ data: 'tiempo_real', searchable: false, sortable: false },
|
||||
{ data: 'action', searchable: false, sortable: false },
|
||||
]
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
init(){
|
||||
this.initDatatableTareas()
|
||||
console.log(this.getFormData())
|
||||
}
|
||||
initDatatableTareas(){
|
||||
this.datatableTareas = this.tareasTableItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 10,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/tareas/datatable/' + this.modelId
|
||||
});
|
||||
}
|
||||
getFormData() {
|
||||
let data = {}
|
||||
this.otForm.serializeArray().forEach((e) => {
|
||||
@ -22,6 +55,10 @@ class OrdenTrabajo
|
||||
_handleGetData(){
|
||||
const ajax = new Ajax(`/produccion/ordentrabajo/${this.modelId}`)
|
||||
}
|
||||
_renderMaquinaSelectTable(d,t){
|
||||
return `<select id="select-maquina-tarea-${d}" data-id="${d}" class="select2 form-select select-maquina-tarea-datatable" data-allow-clear="true"></select>`
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user