mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'add/calculo_credito_cliente'
Main See merge request jjimenez/safekat!616
This commit is contained in:
@ -293,6 +293,10 @@ $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracio
|
|||||||
$routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
|
$routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
|
||||||
$routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
|
$routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
|
||||||
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
|
$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']);
|
$routes->resource('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesimpresion', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|||||||
@ -468,4 +468,15 @@ 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);
|
||||||
|
}
|
||||||
|
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);
|
$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 $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
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(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"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)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
@ -147,14 +147,14 @@ class Ordentrabajo extends BaseController
|
|||||||
{
|
{
|
||||||
$logo = config(LogoImpresion::class);
|
$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 $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
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(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"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)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
@ -162,14 +162,14 @@ class Ordentrabajo extends BaseController
|
|||||||
{
|
{
|
||||||
$logo = config(LogoImpresion::class);
|
$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 $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
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(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"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)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
@ -177,14 +177,14 @@ class Ordentrabajo extends BaseController
|
|||||||
{
|
{
|
||||||
$logo = config(LogoImpresion::class);
|
$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 $this->response->setJSON($q->get()->getResultArray());
|
||||||
return DataTable::of($q)
|
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(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"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)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
@ -194,6 +194,8 @@ class Ordentrabajo extends BaseController
|
|||||||
$q = $this->produccionService->papelGramajeDatatableQuery();
|
$q = $this->produccionService->papelGramajeDatatableQuery();
|
||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->edit("tiempoReal", fn($q) => float_seconds_to_hhmm_string($q->tiempoReal * 3600))
|
->edit("tiempoReal", fn($q) => float_seconds_to_hhmm_string($q->tiempoReal * 3600))
|
||||||
|
->add("metros", fn($q) => $q->papel_ancho*$q->totalTirada/1000)
|
||||||
|
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'), 'data' => $q])
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
public function reset_tareas(int $orden_trabajo_id)
|
public function reset_tareas(int $orden_trabajo_id)
|
||||||
@ -262,6 +264,10 @@ class Ordentrabajo extends BaseController
|
|||||||
$q = $this->produccionService->planningRotativaQueryDatatable();
|
$q = $this->produccionService->planningRotativaQueryDatatable();
|
||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->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") : "")
|
->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("metros_check", fn($q) => $q->otId)
|
||||||
|
->add("corte", fn($q) => $q->otId)
|
||||||
|
->add("metros", fn($q) => $q->papel_ancho*$q->ot_tirada/1000)
|
||||||
|
|
||||||
->add("action", fn($q) => $q)
|
->add("action", fn($q) => $q)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,28 +37,28 @@ class OrdenTrabajoDateEntity extends Entity
|
|||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
'deleted_at',
|
'deleted_at',
|
||||||
'fecha_entrega_at',
|
// 'fecha_entrega_at',
|
||||||
'fecha_entrega_change_at',
|
// 'fecha_entrega_change_at',
|
||||||
'fecha_entrega_real_at',
|
// 'fecha_entrega_real_at',
|
||||||
'fecha_entrega_real_warning',
|
// 'fecha_entrega_real_warning',
|
||||||
'fecha_impresion_at',
|
// 'fecha_impresion_at',
|
||||||
'fecha_encuadernado_at',
|
// 'fecha_encuadernado_at',
|
||||||
'fecha_externo_at',
|
// 'fecha_externo_at',
|
||||||
'fecha_entrega_warning',
|
// 'fecha_entrega_warning',
|
||||||
'fecha_entrega_warning_revised',
|
// 'fecha_entrega_warning_revised',
|
||||||
'pendiente_ferro_at',
|
// 'pendiente_ferro_at',
|
||||||
'ferro_en_cliente_at',
|
// 'ferro_en_cliente_at',
|
||||||
'ferro_ok_at',
|
// 'ferro_ok_at',
|
||||||
'interior_bn_at',
|
// 'interior_bn_at',
|
||||||
'interior_color_at',
|
// 'interior_color_at',
|
||||||
'preparacion_interiores_at',
|
// 'preparacion_interiores_at',
|
||||||
'cubierta_at',
|
// 'cubierta_at',
|
||||||
'plastificado_at',
|
// 'plastificado_at',
|
||||||
'encuadernacion_at',
|
// 'encuadernacion_at',
|
||||||
'corte_at',
|
// 'corte_at',
|
||||||
'embalaje_at',
|
// 'embalaje_at',
|
||||||
'envio_at',
|
// 'envio_at',
|
||||||
'entrada_manipulado_at'
|
// 'entrada_manipulado_at'
|
||||||
];
|
];
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
// "fecha_entrada_at" => "?datetime",
|
// "fecha_entrada_at" => "?datetime",
|
||||||
|
|||||||
@ -79,12 +79,12 @@ class OrdenTrabajoEntity extends Entity
|
|||||||
public function dates(): ?OrdenTrabajoDateEntity
|
public function dates(): ?OrdenTrabajoDateEntity
|
||||||
{
|
{
|
||||||
$m = model(OrdenTrabajoDate::class);
|
$m = model(OrdenTrabajoDate::class);
|
||||||
return $m->find($this->attributes["id"]);
|
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
|
||||||
}
|
}
|
||||||
public function users(): ?OrdenTrabajoUserEntity
|
public function users(): ?OrdenTrabajoUserEntity
|
||||||
{
|
{
|
||||||
$m = model(OrdenTrabajoUser::class);
|
$m = model(OrdenTrabajoUser::class);
|
||||||
return $m->find($this->attributes["id"]);
|
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -8,33 +8,7 @@ class OrdenTrabajoUserEntity extends Entity
|
|||||||
{
|
{
|
||||||
protected $datamap = [];
|
protected $datamap = [];
|
||||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||||
protected array $casts = [
|
|
||||||
"orden_trabajo_id" => "integer",
|
|
||||||
"user_created_id" => "?integer",
|
|
||||||
"user_update_id" => "?integer",
|
|
||||||
"inaplazable_revised_change_user_id" => "?integer",
|
|
||||||
"ferro_disponible_hecho_user_id" => "?integer",
|
|
||||||
"ferro_disponible_ok_user_id" => "?integer",
|
|
||||||
"ferro_entregado_user_id" => "?integer",
|
|
||||||
"pendiente_ferro_user_id" => "?integer",
|
|
||||||
"ferro_en_cliente_user_id" => "?integer",
|
|
||||||
"ferro_ok_user_id" => "?integer",
|
|
||||||
"interior_bn_user_id" => "?integer",
|
|
||||||
"interior_color_user_id" => "?integer",
|
|
||||||
"preparacion_interior_user_id" => "?integer",
|
|
||||||
"cubierta_user_id" => "?integer",
|
|
||||||
"plastificado_user_id" => "?integer",
|
|
||||||
"encuadernacion_user_id" => "?integer",
|
|
||||||
"corte_user_id" => "?integer",
|
|
||||||
"embalaje_user_id" => "?integer",
|
|
||||||
"entrada_manipulado_user_id" => "?integer",
|
|
||||||
"pre_formato_user_id" => "?integer",
|
|
||||||
"pre_lomo_user_id" => "?integer",
|
|
||||||
"pre_solapa_user_id" => "?integer",
|
|
||||||
"pre_codbarras_user_id" => "?integer",
|
|
||||||
"pre_imposicion_user_id" => "?integer",
|
|
||||||
"pre_imprimir_user_id" => "?integer"
|
|
||||||
];
|
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
"orden_trabajo_id"=> null,
|
"orden_trabajo_id"=> null,
|
||||||
"user_created_id"=> null,
|
"user_created_id"=> null,
|
||||||
@ -62,4 +36,31 @@ class OrdenTrabajoUserEntity extends Entity
|
|||||||
"pre_imposicion_user_id"=> null,
|
"pre_imposicion_user_id"=> null,
|
||||||
"pre_imprimir_user_id" => null
|
"pre_imprimir_user_id" => null
|
||||||
];
|
];
|
||||||
|
// protected array $casts = [
|
||||||
|
// "orden_trabajo_id" => "integer",
|
||||||
|
// "user_created_id" => "?integer",
|
||||||
|
// "user_update_id" => "?integer",
|
||||||
|
// "inaplazable_revised_change_user_id" => "?integer",
|
||||||
|
// "ferro_disponible_hecho_user_id" => "?integer",
|
||||||
|
// "ferro_disponible_ok_user_id" => "?integer",
|
||||||
|
// "ferro_entregado_user_id" => "?integer",
|
||||||
|
// "pendiente_ferro_user_id" => "?integer",
|
||||||
|
// "ferro_en_cliente_user_id" => "?integer",
|
||||||
|
// "ferro_ok_user_id" => "?integer",
|
||||||
|
// "interior_bn_user_id" => "?integer",
|
||||||
|
// "interior_color_user_id" => "?integer",
|
||||||
|
// "preparacion_interior_user_id" => "?integer",
|
||||||
|
// "cubierta_user_id" => "?integer",
|
||||||
|
// "plastificado_user_id" => "?integer",
|
||||||
|
// "encuadernacion_user_id" => "?integer",
|
||||||
|
// "corte_user_id" => "?integer",
|
||||||
|
// "embalaje_user_id" => "?integer",
|
||||||
|
// "entrada_manipulado_user_id" => "?integer",
|
||||||
|
// "pre_formato_user_id" => "?integer",
|
||||||
|
// "pre_lomo_user_id" => "?integer",
|
||||||
|
// "pre_solapa_user_id" => "?integer",
|
||||||
|
// "pre_codbarras_user_id" => "?integer",
|
||||||
|
// "pre_imposicion_user_id" => "?integer",
|
||||||
|
// "pre_imprimir_user_id" => "?integer"
|
||||||
|
// ];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,10 @@ return [
|
|||||||
"tiempo" => "Tiempo",
|
"tiempo" => "Tiempo",
|
||||||
"progreso" => "Progreso",
|
"progreso" => "Progreso",
|
||||||
"logo" => "Logo impresion",
|
"logo" => "Logo impresion",
|
||||||
|
"filter_by_task" => "Filtrar por tarea",
|
||||||
|
"metros" => "Metros",
|
||||||
|
"corte" => "Corte"
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
"task" => [
|
"task" => [
|
||||||
@ -67,7 +71,7 @@ return [
|
|||||||
"preview_pdf" => "Previsualizar PDF",
|
"preview_pdf" => "Previsualizar PDF",
|
||||||
"imprimir_codigo_safekat" => "Imprimir código SAFEKAT",
|
"imprimir_codigo_safekat" => "Imprimir código SAFEKAT",
|
||||||
"imprimir_ferro" => "Imprimir ferro",
|
"imprimir_ferro" => "Imprimir ferro",
|
||||||
"planning_rotativa" => "Planning rotativa",
|
"planning_rotativa" => "Tareas rotativa",
|
||||||
"solapa" => "Solapa",
|
"solapa" => "Solapa",
|
||||||
"papel_gramajes" => "Papel y gramajes"
|
"papel_gramajes" => "Papel y gramajes"
|
||||||
|
|
||||||
|
|||||||
@ -369,5 +369,16 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function querySelect(?string $query)
|
||||||
|
{
|
||||||
|
$q = $this->builder()->select([
|
||||||
|
"id",
|
||||||
|
"nombre as name",
|
||||||
|
]);
|
||||||
|
if ($query) {
|
||||||
|
$q->orLike("nombre", $query);
|
||||||
|
}
|
||||||
|
return $q;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,11 +98,11 @@ class OrdenTrabajoDate extends Model
|
|||||||
if(!isset($data["data"])){
|
if(!isset($data["data"])){
|
||||||
return $data;
|
return $data;
|
||||||
}else{
|
}else{
|
||||||
$this->updateUserDateMap($data["data"]);
|
$this->updateUserDateMap($data["id"],$data["data"]);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
protected function updateUserDateMap($data){
|
protected function updateUserDateMap($data,$values){
|
||||||
$mapping = [
|
$mapping = [
|
||||||
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
||||||
// "fecha_externo_at" => "null",
|
// "fecha_externo_at" => "null",
|
||||||
@ -121,7 +121,7 @@ class OrdenTrabajoDate extends Model
|
|||||||
];
|
];
|
||||||
$otUser = model(OrdenTrabajoUser::class);
|
$otUser = model(OrdenTrabajoUser::class);
|
||||||
$auth_user_id = auth()->user()->id;
|
$auth_user_id = auth()->user()->id;
|
||||||
foreach ($data as $key => $value) {
|
foreach ($values as $key => $value) {
|
||||||
if(isset($mapping[$key])){
|
if(isset($mapping[$key])){
|
||||||
if($value){
|
if($value){
|
||||||
$otUser->where('orden_trabajo_id',$data['orden_trabajo_id'])
|
$otUser->where('orden_trabajo_id',$data['orden_trabajo_id'])
|
||||||
|
|||||||
@ -45,9 +45,7 @@ class OrdenTrabajoUser extends Model
|
|||||||
protected bool $allowEmptyInserts = false;
|
protected bool $allowEmptyInserts = false;
|
||||||
protected bool $updateOnlyChanged = true;
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
protected array $casts = [
|
|
||||||
|
|
||||||
];
|
|
||||||
protected array $castHandlers = [];
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
// Dates
|
// Dates
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class ProductionService extends BaseService
|
|||||||
protected array $MAPPING_DATE_USER = [
|
protected array $MAPPING_DATE_USER = [
|
||||||
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
||||||
// "fecha_externo_at" => "null",
|
// "fecha_externo_at" => "null",
|
||||||
"fecha_impresion_at" => "null",
|
"fecha_impresion_at" => null,
|
||||||
"pendiente_ferro_at" => "pendiente_ferro_user_id",
|
"pendiente_ferro_at" => "pendiente_ferro_user_id",
|
||||||
"ferro_en_cliente_at" => "ferro_en_cliente_user_id",
|
"ferro_en_cliente_at" => "ferro_en_cliente_user_id",
|
||||||
"ferro_ok_at" => "ferro_ok_user_id",
|
"ferro_ok_at" => "ferro_ok_user_id",
|
||||||
@ -60,13 +60,13 @@ class ProductionService extends BaseService
|
|||||||
*/
|
*/
|
||||||
protected PresupuestoEntity $presupuesto;
|
protected PresupuestoEntity $presupuesto;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->otModel = model(OrdenTrabajoModel::class);
|
$this->otModel = model(OrdenTrabajoModel::class);
|
||||||
$this->otDate = model(OrdenTrabajoDate::class);
|
$this->otDate = model(OrdenTrabajoDate::class);
|
||||||
$this->otTarea = model(OrdenTrabajoTarea::class);
|
$this->otTarea = model(OrdenTrabajoTarea::class);
|
||||||
$this->otUser = model(OrdenTrabajoUser::class);
|
$this->otUser = model(OrdenTrabajoUser::class);
|
||||||
$this->userModel = model(UserModel::class);
|
$this->userModel = model(UserModel::class);
|
||||||
|
|
||||||
}
|
}
|
||||||
public function init(int $orden_trabajo_id): self
|
public function init(int $orden_trabajo_id): self
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ class ProductionService extends BaseService
|
|||||||
* @param OrdenTrabajoEntity $ot
|
* @param OrdenTrabajoEntity $ot
|
||||||
* @return integer|boolean|string ID
|
* @return integer|boolean|string ID
|
||||||
*/
|
*/
|
||||||
protected function storeOrdenTrabajoDates() : int|bool|string
|
protected function storeOrdenTrabajoDates(): int|bool|string
|
||||||
{
|
{
|
||||||
$fecha_encuadernado = Time::now()->addDays(2)->format("Y-m-d");
|
$fecha_encuadernado = Time::now()->addDays(2)->format("Y-m-d");
|
||||||
$fecha_entrega_real = Time::now()->addDays(5)->format("Y-m-d");
|
$fecha_entrega_real = Time::now()->addDays(5)->format("Y-m-d");
|
||||||
@ -149,7 +149,7 @@ class ProductionService extends BaseService
|
|||||||
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
|
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
protected function storeOrdenTrabajoUsers() : int|bool|string
|
protected function storeOrdenTrabajoUsers(): int|bool|string
|
||||||
{
|
{
|
||||||
return $this->otUser->insert([
|
return $this->otUser->insert([
|
||||||
"orden_trabajo_id" => $this->ot->id,
|
"orden_trabajo_id" => $this->ot->id,
|
||||||
@ -351,7 +351,7 @@ class ProductionService extends BaseService
|
|||||||
|
|
||||||
public function getPdf()
|
public function getPdf()
|
||||||
{
|
{
|
||||||
return view("themes/vuexy/pdfs/orden_trabajo",$this->getDataPdf());
|
return view("themes/vuexy/pdfs/orden_trabajo", $this->getDataPdf());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Query para mostrar en datatable
|
* Query para mostrar en datatable
|
||||||
@ -388,7 +388,7 @@ class ProductionService extends BaseService
|
|||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Query para mostrar en datatable
|
* Query para mostrar en datatable
|
||||||
*
|
*
|
||||||
* @return BaseBuilder
|
* @return BaseBuilder
|
||||||
@ -402,8 +402,8 @@ class ProductionService extends BaseService
|
|||||||
"orden_trabajo_tareas.maquina_id",
|
"orden_trabajo_tareas.maquina_id",
|
||||||
"lg_maquinas.nombre as maquina_planning_nombre",
|
"lg_maquinas.nombre as maquina_planning_nombre",
|
||||||
"ordenes_trabajo.total_tirada as ot_tirada",
|
"ordenes_trabajo.total_tirada as ot_tirada",
|
||||||
"lg_papel_formato.ancho as maquina_ancho",
|
"lg_papel_formato.ancho as papel_ancho",
|
||||||
"lg_papel_formato.alto as maquina_alto",
|
"lg_papel_formato.alto as papel_alto",
|
||||||
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') as maquina_ancho",
|
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') as maquina_ancho",
|
||||||
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') as maquina_alto",
|
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') as maquina_alto",
|
||||||
"lg_papel_impresion.nombre as papel_impresion",
|
"lg_papel_impresion.nombre as papel_impresion",
|
||||||
@ -422,7 +422,7 @@ class ProductionService extends BaseService
|
|||||||
->join("lg_maquinas as lgmp", "lgmp.id = presupuesto_linea.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")
|
->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.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo", ["lp_rot_bn","lp_rot_color"])
|
->whereIn("presupuesto_linea.tipo", ["lp_rot_bn", "lp_rot_color"])
|
||||||
->where("orden_trabajo_tareas.deleted_at", null)
|
->where("orden_trabajo_tareas.deleted_at", null)
|
||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
return $q;
|
return $q;
|
||||||
@ -440,6 +440,7 @@ class ProductionService extends BaseService
|
|||||||
"orden_trabajo_tareas.nombre",
|
"orden_trabajo_tareas.nombre",
|
||||||
"lgmp.nombre as maquina_presupuesto_linea",
|
"lgmp.nombre as maquina_presupuesto_linea",
|
||||||
"orden_trabajo_tareas.maquina_id as maquina_tarea",
|
"orden_trabajo_tareas.maquina_id as maquina_tarea",
|
||||||
|
|
||||||
"lg_maquinas.nombre as maquina_nombre",
|
"lg_maquinas.nombre as maquina_nombre",
|
||||||
"lg_imposiciones.id as imposicion_id",
|
"lg_imposiciones.id as imposicion_id",
|
||||||
"orden_trabajo_tareas.tiempo_estimado",
|
"orden_trabajo_tareas.tiempo_estimado",
|
||||||
@ -460,20 +461,28 @@ class ProductionService extends BaseService
|
|||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function papelGramajeDatatableQuery() : BaseBuilder
|
public function papelGramajeDatatableQuery(): BaseBuilder
|
||||||
{
|
{
|
||||||
$q = $this->otModel->builder()->select([
|
$q = $this->otModel->builder()->select([
|
||||||
|
"lg_papel_impresion.id as papelImpresionId",
|
||||||
"lg_papel_impresion.nombre as papelImpresionNombre",
|
"lg_papel_impresion.nombre as papelImpresionNombre",
|
||||||
"lg_papel_impresion.gramaje as papelImpresionGramaje",
|
"lg_papel_impresion.gramaje as papelImpresionGramaje",
|
||||||
"COUNT(orden_trabajo_tareas.id) as tareasCount",
|
"COUNT(orden_trabajo_tareas.id) as tareasCount",
|
||||||
|
"lg_papel_formato.ancho as papel_ancho",
|
||||||
|
"lg_papel_formato.alto as papel_alto",
|
||||||
|
// "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(ordenes_trabajo.total_tirada) as totalTirada",
|
||||||
"SUM(orden_trabajo_tareas.tiempo_real) as tiempoReal"
|
"SUM(orden_trabajo_tareas.tiempo_real) as tiempoReal"
|
||||||
])
|
])
|
||||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
->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")
|
->join("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right")
|
||||||
->where("orden_trabajo_tareas.deleted_at", null)
|
->join("lg_papel_impresion", "presupuesto_linea.papel_impresion_id = lg_papel_impresion.id", "left")
|
||||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL,FALSE);
|
->join("lg_papel_formato", "lg_papel_formato.id = presupuestos.papel_formato_id", "left")
|
||||||
|
->where("orden_trabajo_tareas.deleted_at", null)
|
||||||
|
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
||||||
|
->groupBy('lg_papel_impresion.id');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -514,7 +523,8 @@ class ProductionService extends BaseService
|
|||||||
];
|
];
|
||||||
return $summary;
|
return $summary;
|
||||||
}
|
}
|
||||||
public function getDataPdf(){
|
public function getDataPdf()
|
||||||
|
{
|
||||||
$logistica_data = $this->logistica_data();
|
$logistica_data = $this->logistica_data();
|
||||||
return [
|
return [
|
||||||
"ot" => $this->ot,
|
"ot" => $this->ot,
|
||||||
@ -535,88 +545,92 @@ class ProductionService extends BaseService
|
|||||||
"peso_pedido" => $logistica_data["peso_pedido"]
|
"peso_pedido" => $logistica_data["peso_pedido"]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getTareaImpresionSobreCubierta() : array
|
public function getTareaImpresionSobreCubierta(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo",["lp_sobrecubierta"])->findAll();
|
->whereIn("presupuesto_linea.tipo", ["lp_sobrecubierta"])->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function getTareaImpresionCubierta() : array
|
public function getTareaImpresionCubierta(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo",["lp_cubierta"])->findAll();
|
->whereIn("presupuesto_linea.tipo", ["lp_cubierta"])->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function getTareaImpresionInteriorBn() : array
|
public function getTareaImpresionInteriorBn(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo",["lp_rot_bn","lp_bn","lp_bnhq"])->findAll();
|
->whereIn("presupuesto_linea.tipo", ["lp_rot_bn", "lp_bn", "lp_bnhq"])->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function getTareaImpresionInteriorColor() : array
|
public function getTareaImpresionInteriorColor(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo",["lp_rot_color","lp_color","lp_colorhq"])->findAll();
|
->whereIn("presupuesto_linea.tipo", ["lp_rot_color", "lp_color", "lp_colorhq"])->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function getPresupuestoLineaImpresion(){
|
public function getPresupuestoLineaImpresion() {}
|
||||||
}
|
|
||||||
public function tareas_acabado(): array
|
public function tareas_acabado(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL",NULL,FALSE)->findAll();
|
$q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function tareas_impresion(): array
|
public function tareas_impresion(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->where("presupuesto_linea_id IS NOT NULL",NULL,FALSE)->findAll();
|
$q = $this->otTarea->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function tareas_encuadernacion(): array
|
public function tareas_encuadernacion(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->where("presupuesto_encuadernado_id IS NOT NULL",NULL,FALSE)->findAll();
|
$q = $this->otTarea->where("presupuesto_encuadernado_id IS NOT NULL", NULL, FALSE)->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function tareas_preimpresion(): array
|
public function tareas_preimpresion(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->where("presupuesto_preimpresion_id IS NOT NULL",NULL,FALSE)->findAll();
|
$q = $this->otTarea->where("presupuesto_preimpresion_id IS NOT NULL", NULL, FALSE)->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
public function tareas_manipulado(): array
|
public function tareas_manipulado(): array
|
||||||
{
|
{
|
||||||
$q = $this->otTarea->where("presupuesto_manipulado_id IS NOT NULL",NULL,FALSE)->findAll();
|
$q = $this->otTarea->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll();
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
/**========================================================================
|
/**========================================================================
|
||||||
* UPDATES
|
* UPDATES
|
||||||
*========================================================================**/
|
*========================================================================**/
|
||||||
|
|
||||||
public function updateOrdenTrabajoTarea($tarea_id,$data) : bool
|
public function updateOrdenTrabajoTarea($tarea_id, $data): bool
|
||||||
{
|
{
|
||||||
return $this->otTarea->update($tarea_id,$data);
|
return $this->otTarea->update($tarea_id, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateOrdenTrabajoDate($data)
|
public function updateOrdenTrabajoDate($data)
|
||||||
{
|
{
|
||||||
// return $this->otDate->find($this->ot->id);
|
// // return $this->otDate->find($this->ot->id);
|
||||||
$r = $this->otDate->update($this->ot->id,$data);
|
$otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id)
|
||||||
|
->set([$data['name'] => $data[$data['name']]])
|
||||||
|
->update($data);
|
||||||
$ot_users = $this->ot->users();
|
$ot_users = $this->ot->users();
|
||||||
$ot_users = $ot_users->toArray();
|
if($this->MAPPING_DATE_USER[$data["name"]]){
|
||||||
$user_id = $ot_users[$this->MAPPING_DATE_USER[$data["name"]]];
|
$user_id = $ot_users->{$this->MAPPING_DATE_USER[$data["name"]]};
|
||||||
$user = $this->userModel->find($user_id);
|
$user = $this->userModel->find($user_id);
|
||||||
return ["user" => $user,"status" => $r];
|
return ["user" => $user, "status" => $otDate];
|
||||||
|
}else{
|
||||||
|
return ["user" => null, "status" => false];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateOrdenTrabajo($data) : bool
|
public function updateOrdenTrabajo($data): bool
|
||||||
{
|
{
|
||||||
return $this->otModel->update($this->ot->id,$data);
|
return $this->otModel->update($this->ot->id, $data);
|
||||||
}
|
}
|
||||||
/**========================================================================
|
/**========================================================================
|
||||||
* RELATION METHODS
|
* RELATION METHODS
|
||||||
@ -674,7 +688,7 @@ class ProductionService extends BaseService
|
|||||||
{
|
{
|
||||||
return $this->presupuesto->extras();
|
return $this->presupuesto->extras();
|
||||||
}
|
}
|
||||||
protected function logistica_data() : array
|
protected function logistica_data(): array
|
||||||
{
|
{
|
||||||
$presupuesto_lineas = $this->presupuesto->presupuestoLineas();
|
$presupuesto_lineas = $this->presupuesto->presupuestoLineas();
|
||||||
$peso = 0;
|
$peso = 0;
|
||||||
@ -683,10 +697,12 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
"peso_unidad" => $peso,
|
"peso_unidad" => $peso,
|
||||||
"peso_pedido" => $peso*$this->ot->total_tirada
|
"peso_pedido" => $peso * $this->ot->total_tirada
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function actionButtonFilterTask(int $id)
|
||||||
|
{
|
||||||
|
return ["title" => lang('ot.filter_by_task'), 'id' => $id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,11 +7,23 @@
|
|||||||
<th><?= lang('Produccion.datatable.gramaje') ?> (gr)</th>
|
<th><?= lang('Produccion.datatable.gramaje') ?> (gr)</th>
|
||||||
<th><?= lang('Produccion.datatable.tareas') ?></th>
|
<th><?= lang('Produccion.datatable.tareas') ?></th>
|
||||||
<th><?= lang('Produccion.datatable.tiradas') ?></th>
|
<th><?= lang('Produccion.datatable.tiradas') ?></th>
|
||||||
|
<th><?= lang('Produccion.datatable.metros') ?></th>
|
||||||
<th><?= lang('Produccion.datatable.tiempo') ?>(HH:MM)</th>
|
<th><?= lang('Produccion.datatable.tiempo') ?>(HH:MM)</th>
|
||||||
|
<th></th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4" style="text-align:right">Total:</th>
|
||||||
|
<th><span class="autonumeric" id="total-metros"></span>(m)</th>
|
||||||
|
<th id="total-tiempo-papel"></th>
|
||||||
|
<th></th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -12,9 +12,9 @@
|
|||||||
<th><?= lang('Produccion.datatable.alto') ?></th>
|
<th><?= lang('Produccion.datatable.alto') ?></th>
|
||||||
<th><?= lang('Produccion.datatable.papel') ?></th>
|
<th><?= lang('Produccion.datatable.papel') ?></th>
|
||||||
<th><?= lang('Produccion.datatable.gramaje') ?></th>
|
<th><?= lang('Produccion.datatable.gramaje') ?></th>
|
||||||
<!-- <th><?= lang('Produccion.datatable.corte') ?></th>
|
<th><?= lang('Produccion.datatable.corte') ?></th>
|
||||||
<th><?= lang('Produccion.datatable.metros_sel') ?></th>
|
<th></th>
|
||||||
<th><?= lang('Produccion.datatable.metros_papel') ?></th> -->
|
<th><?= lang('Produccion.datatable.metros') ?></th>
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -25,14 +25,29 @@
|
|||||||
<th></th>
|
<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_ancho" placeholder="Ancho"></th>
|
||||||
<th><input type="text" class="form-control planning-filter" name="maquina_alto" placeholder="Alto"></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="papel_impresion"></select></th>
|
||||||
<th><input type="text" class="form-control planning-filter" name=""></th>
|
<th><input type="text" class="form-control planning-filter" name="gramaje"></th>
|
||||||
|
<th>
|
||||||
|
<select class="select2 form-select w-100" name="corte">
|
||||||
|
<option value="0" default></option>
|
||||||
|
<option value="1">Guillotina</option>
|
||||||
|
<option value="2">Bobina</option>
|
||||||
|
</select>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<div class="form-check mt-4">
|
||||||
|
<input class="form-check-input" id="metros-check-all" type="checkbox" value="" />
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<th><span class="autonumeric" id="metros-sel-total"></span></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -14,22 +14,58 @@
|
|||||||
<li class="nav-item">
|
<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>
|
<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>
|
||||||
<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>
|
</ul>
|
||||||
<div class="tab-content" id="prot-datatables-container">
|
<div class="tab-content" id="prot-datatables-container">
|
||||||
<div class="tab-pane fade show active" id="navs-top-align-prot">
|
<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>
|
||||||
<div class="tab-pane fade show" id="navs-top-align-papel-gramaje">
|
<div class="tab-pane fade show active" id="navs-top-align-prot">
|
||||||
<?= view("themes/vuexy/components/tables/planning_papel_gramaje_table.php", ["id" => "planning-papel-datatable"]) ?>
|
<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">
|
||||||
|
<h6 id="papel-impresion-name-header" class="text-secondary "></h6>
|
||||||
|
<?= view("themes/vuexy/components/tables/planning_rot_table.php", ["id" => "planning-rotativa-datatable"]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--//.card -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--//.col -->
|
<!--//.card -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--//.col -->
|
||||||
</div>
|
</div>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -3,5 +3,4 @@ import PlanningRotativa from "./planning_rotativa.js";
|
|||||||
$(function(){
|
$(function(){
|
||||||
const planningRotativa = new PlanningRotativa($("#planning-rotativa-page"));
|
const planningRotativa = new PlanningRotativa($("#planning-rotativa-page"));
|
||||||
planningRotativa.init();
|
planningRotativa.init();
|
||||||
console.log("PL")
|
|
||||||
})
|
})
|
||||||
@ -1,21 +1,27 @@
|
|||||||
import ClassSelect from "../../../components/select2.js";
|
import ClassSelect from "../../../components/select2.js";
|
||||||
|
import Ajax from "../../../components/ajax.js";
|
||||||
|
|
||||||
|
|
||||||
class PlanningRotativa {
|
class PlanningRotativa {
|
||||||
constructor(domItem) {
|
constructor(domItem) {
|
||||||
this.item = domItem
|
this.item = domItem
|
||||||
this.tablePlanningRot = this.item.find("#planning-rotativa-datatable")
|
this.tablePlanningRot = this.item.find("#planning-rotativa-datatable")
|
||||||
this.papelGramajeTablePlanning = this.item.find("#planning-papel-datatable")
|
this.papelGramajeTablePlanning = this.item.find("#planning-papel-datatable")
|
||||||
|
this.papelImpresionHeader = this.item.find('#papel-impresion-name-header')
|
||||||
|
this.checkAllMetros = this.item.find("#metros-check-all")
|
||||||
this.datatableColumns = [
|
this.datatableColumns = [
|
||||||
{ data: 'otId', searchable: false, sortable: false },
|
{ data: 'otId', searchable: false, sortable: false },
|
||||||
{ data: 'fecha_entrega_real_at', searchable: true, sortable: false },
|
{ data: 'fecha_entrega_real_at', searchable: true, sortable: false },
|
||||||
{ data: 'presupuesto_titulo', searchable: true, sortable: false },
|
{ data: 'presupuesto_titulo', searchable: true, sortable: false },
|
||||||
{ data: 'maquina_planning_nombre', searchable: true, sortable: false },
|
{ data: 'maquina_planning_nombre', searchable: true, sortable: false },
|
||||||
{ data: 'ot_tirada', searchable: false, sortable: false },
|
{ data: 'ot_tirada', searchable: false, sortable: false, },
|
||||||
{ data: 'maquina_ancho', searchable: false, sortable: false },
|
{ data: 'papel_ancho', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||||
{ data: 'maquina_alto', searchable: false, sortable: false },
|
{ data: 'papel_alto', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||||
{ data: 'papel_impresion', searchable: false, sortable: false },
|
{ data: 'papel_impresion', searchable: false, sortable: false },
|
||||||
{ data: 'papel_gramaje', searchable: false, sortable: false },
|
{ data: 'papel_gramaje', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||||
|
{ data: 'corte', searchable: false, sortable: false, render: d => d },
|
||||||
|
{ 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 },
|
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
|
||||||
|
|
||||||
]
|
]
|
||||||
@ -24,20 +30,39 @@ class PlanningRotativa {
|
|||||||
{ data: 'papelImpresionGramaje', searchable: true, sortable: true },
|
{ data: 'papelImpresionGramaje', searchable: true, sortable: true },
|
||||||
{ data: 'tareasCount', searchable: true, sortable: true },
|
{ data: 'tareasCount', searchable: true, sortable: true },
|
||||||
{ data: 'totalTirada', searchable: false, sortable: false },
|
{ data: 'totalTirada', searchable: false, sortable: false },
|
||||||
|
{ data: 'metros', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||||
{ data: 'tiempoReal', 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-bs-toggle="button">${d.title}</button>`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
this.maquinaSelectFilter = new ClassSelect($("#maquina-select-filter"), `/maquinas/select`, "Seleccione una maquina", 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
|
this.maquinaSelectFilter.config.dropdownParent = this.item
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
this.maquinaSelectFilter.init()
|
this.maquinaSelectFilter.init()
|
||||||
|
this.papelImpresionFilter.init()
|
||||||
|
this.checkAllMetros.on('change', () => {
|
||||||
|
let isChecked = this.checkAllMetros.prop('checked')
|
||||||
|
this.item.find(".metros-check").prop('checked', isChecked).trigger("change")
|
||||||
|
})
|
||||||
|
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({
|
this.datatablePlanningRot = this.tablePlanningRot.DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
|
orderCellsTop: true,
|
||||||
layout: {
|
layout: {
|
||||||
topStart: 'pageLength',
|
topStart: 'info',
|
||||||
topEnd: 'search',
|
topEnd: null,
|
||||||
bottomStart: 'info',
|
bottomStart: 'pageLength',
|
||||||
bottomEnd: 'paging'
|
bottomEnd: 'paging'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -52,10 +77,12 @@ class PlanningRotativa {
|
|||||||
});
|
});
|
||||||
this.papelGramajeDatatable = this.papelGramajeTablePlanning.DataTable({
|
this.papelGramajeDatatable = this.papelGramajeTablePlanning.DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
|
orderCellsTop: true,
|
||||||
|
|
||||||
layout: {
|
layout: {
|
||||||
topStart: 'pageLength',
|
topStart: 'info',
|
||||||
topEnd: 'search',
|
topEnd: null,
|
||||||
bottomStart: 'info',
|
bottomStart: 'pageLength',
|
||||||
bottomEnd: 'paging'
|
bottomEnd: 'paging'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -77,14 +104,75 @@ class PlanningRotativa {
|
|||||||
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
|
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
|
||||||
this.datatablePlanningRot.column(columnIndex).search(this.maquinaSelectFilter.getText()).draw()
|
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()
|
||||||
|
})
|
||||||
|
this.papelGramajeDatatable.on('draw', this.addTotalFooter.bind(this))
|
||||||
|
this.tablePlanningRot.on('change', ".metros-check", this.calcMetrosCheck.bind(this))
|
||||||
|
|
||||||
}
|
}
|
||||||
_renderBtnAction(d) {
|
_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() {
|
_columnFiltering() {
|
||||||
this.api().columns()
|
this.api().columns()
|
||||||
console.log(this.api().columns())
|
console.log(this.api().columns())
|
||||||
}
|
}
|
||||||
|
filterPapelGramaje(event) {
|
||||||
|
const papelImpresionId = $(event.currentTarget).data('id')
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
|
calcMetrosCheck() {
|
||||||
|
const metros_sel = this.datatablePlanningRot.rows((idx, data, node) => {
|
||||||
|
return $(node).find('input[type="checkbox"]').prop('checked');
|
||||||
|
}).data().toArray().reduce((a, b) => {
|
||||||
|
a = a?.metros ?? 0
|
||||||
|
b = b?.metros ?? 0
|
||||||
|
return a + b
|
||||||
|
}, null)
|
||||||
|
this.item.find('#metros-sel-total').text(metros_sel)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default PlanningRotativa;
|
export default PlanningRotativa;
|
||||||
Reference in New Issue
Block a user