mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/revision-ot-2' into 'main'
Feat/revision ot 2 See merge request jjimenez/safekat!766
This commit is contained in:
@ -12,14 +12,14 @@ class OrdenTrabajo extends BaseConfig
|
||||
"interior_bn_at" => "interior_bn_user_id",
|
||||
"interior_color_at" => "interior_color_user_id",
|
||||
"cubierta_at" => "cubierta_user_id",
|
||||
"sobrecubierta_at" => "sobrecubierta_user_id", //TODO
|
||||
"guarda_at" => "guarda_user_id", //TODO
|
||||
"sobrecubierta_at" => "sobrecubierta_user_id",
|
||||
"guarda_at" => "guarda_user_id",
|
||||
//ACABADO
|
||||
"plastificado_at" => "plastificado_user_id",
|
||||
"plakene_at" => "plakene_user_id", //TODO
|
||||
"plakene_at" => "plakene_user_id",
|
||||
"retractilado_at" => "retractilado_user_id",
|
||||
"estampado_at" => "estampado_user_id", //TODO
|
||||
"uvi_at" => "uvi_user_id", //TODO
|
||||
"estampado_at" => "estampado_user_id",
|
||||
"uvi_at" => "uvi_user_id",
|
||||
"encuadernacion_at" => "encuadernacion_user_id",
|
||||
"corte_at" => "corte_user_id",
|
||||
"preparacion_interiores_at" => "preparacion_interior_user_id",
|
||||
@ -121,6 +121,14 @@ class OrdenTrabajo extends BaseConfig
|
||||
"default" => ["bg" => "white", "color" => "black"],
|
||||
];
|
||||
|
||||
public array $OT_TAREA_STATUS_COLOR = [
|
||||
"P" => '#FFB22C',
|
||||
"F" => '#67AE6E',
|
||||
"S" => '#EB5B00',
|
||||
"I" => '#3A59D1',
|
||||
"E" => '#FF0B55',
|
||||
"D" => '#FFA725',
|
||||
];
|
||||
|
||||
|
||||
public function __construct()
|
||||
|
||||
@ -40,8 +40,8 @@ foreach (glob(APPPATH . 'Config/Routes/*Routes.php') as $routeFile) {
|
||||
|
||||
$routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Users::index', ['as' => 'userList']);
|
||||
$routes->get('maquinista/change/user','Users::index_maquinista_change_user',['as' => 'maquinistaUserChangeList']);
|
||||
$routes->get('maquinista/change/session/(:num)','Users::change_user_session/$1',['as' => 'maquinistaChangeUserSession']);
|
||||
$routes->get('maquinista/change/user', 'Users::index_maquinista_change_user', ['as' => 'maquinistaUserChangeList']);
|
||||
$routes->get('maquinista/change/session/(:num)', 'Users::change_user_session/$1', ['as' => 'maquinistaChangeUserSession']);
|
||||
$routes->get('list', 'Users::index', ['as' => 'userList2']);
|
||||
$routes->get('add', 'Users::add', ['as' => 'newUser']);
|
||||
$routes->post('add', 'Users::add', ['as' => 'createUser']);
|
||||
@ -742,19 +742,28 @@ $routes->group('soporte', ['namespace' => 'App\Controllers\Soporte'], function (
|
||||
|
||||
$routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->group('ordentrabajo', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
/** VIEWS */
|
||||
$routes->get('', 'Ordentrabajo::index', ['as' => 'viewOrdenTrabajoIndex']);
|
||||
$routes->get('edit/(:num)', 'Ordentrabajo::edit/$1', ['as' => 'viewOrdenTrabajoEdit']);
|
||||
$routes->delete('reset/tareas/(:num)', 'Ordentrabajo::reset_tareas/$1');
|
||||
$routes->delete('tareas/(:num)', 'Ordentrabajo::delete_tarea/$1');
|
||||
|
||||
/** GET */
|
||||
$routes->get('summary/(:num)', 'Ordentrabajo::get_orden_trabajo_summary/$1', ['as' => 'getOrdenTrabajoSumary']);
|
||||
$routes->get("tarea/progress/(:num)", "Ordentrabajo::get_orden_trabajo_progress_date/$1");
|
||||
$routes->get('tarea/(:num)', 'Ordentrabajo::find_tarea/$1');
|
||||
$routes->get('tarea/dates/(:num)', 'Ordentrabajo::get_orden_trabajo_tareas_dates/$1');
|
||||
$routes->get('tareas/maquina/(:num)/(:num)','Ordentrabajo::get_tareas_ot_maquina/$1/$2');
|
||||
/** DATATABLES */
|
||||
$routes->get('datatable', 'Ordentrabajo::datatable');
|
||||
$routes->get('datatable_pendientes', 'Ordentrabajo::datatable_pendientes');
|
||||
$routes->get('datatable_ferro_pendiente', 'Ordentrabajo::datatable_ferro_pendiente');
|
||||
$routes->get('datatable_ferro_ok', 'Ordentrabajo::datatable_ferro_ok');
|
||||
$routes->get('datatable_news', 'Ordentrabajo::datatable_news');
|
||||
$routes->get('datatable_prod', 'Ordentrabajo::datatable_prod');
|
||||
$routes->get('datatable_waiting', 'Ordentrabajo::datatable_waiting');
|
||||
$routes->get('datatable_revision_com', 'Ordentrabajo::datatable_revision_com');
|
||||
$routes->get('tareas/datatable/(:num)', 'Ordentrabajo::tareas_datatable/$1', ['as' => 'datatableTareasOrdenTrabajo']);
|
||||
$routes->get("tarea/progress/(:num)", "Ordentrabajo::get_orden_trabajo_progress_date/$1");
|
||||
$routes->get('tarea/(:num)', 'Ordentrabajo::find_tarea/$1');
|
||||
$routes->get('tarea/dates/(:num)','Ordentrabajo::get_orden_trabajo_tareas_dates/$1');
|
||||
$routes->get('maquinas/ots/datatable/(:num)','Ordentrabajo::datatable_maquina_ordenes_trabajo/$1');
|
||||
$routes->get('maquinas/ots/(:num)','Ordentrabajo::get_maquina_ots/$1');
|
||||
/**======================
|
||||
* UPDATES
|
||||
*========================**/
|
||||
@ -763,18 +772,27 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
||||
$routes->post("reset/date", 'Ordentrabajo::reset_orden_trabajo_date');
|
||||
$routes->post("update/pedido/date", 'Ordentrabajo::update_orden_trabajo_pedido_date');
|
||||
$routes->post("reset/pedido/date", 'Ordentrabajo::reset_orden_trabajo_pedido_date');
|
||||
$routes->post("update/pod/pedido/date/(:num)",'Ordentrabajo::update_pod_pedido_dates/$1');
|
||||
$routes->post("update/pod/pedido/date/(:num)", 'Ordentrabajo::update_pod_pedido_dates/$1');
|
||||
$routes->post("update/pedido", 'Ordentrabajo::update_orden_trabajo_pedido');
|
||||
$routes->post("update/user", 'Ordentrabajo::update_orden_trabajo_user');
|
||||
$routes->post("update", 'Ordentrabajo::update_orden_trabajo');
|
||||
$routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada');
|
||||
$routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1');
|
||||
$routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1');
|
||||
$routes->post("update/tarea/progress", "Ordentrabajo::store_orden_trabajo_progress_date");
|
||||
$routes->post("update/tarea/pliegos", "Ordentrabajo::update_orden_trabajo_pliegos");
|
||||
$routes->post("update/tarea/proveedor", "Ordentrabajo::update_presupuesto_tarea_proveedor");
|
||||
$routes->delete("tarea/progress/(:num)", "Ordentrabajo::delete_orden_trabajo_progress_date/$1");
|
||||
$routes->post("fa/tareas/finish", 'Ordentrabajo::update_orden_trabajo_fa_tareas');
|
||||
$routes->post('maquinas/ots','Ordentrabajo::store_maquina_ordenes_trabajo');
|
||||
$routes->post('maquinas/ots/estado','Ordentrabajo::update_maquina_ordenes_trabajo_estado');
|
||||
|
||||
|
||||
/**DELETES */
|
||||
$routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1');
|
||||
$routes->delete("tarea/progress/(:num)", "Ordentrabajo::delete_orden_trabajo_progress_date/$1");
|
||||
$routes->delete('reset/tareas/(:num)', 'Ordentrabajo::reset_tareas/$1');
|
||||
$routes->delete('tareas/(:num)', 'Ordentrabajo::delete_tarea/$1');
|
||||
$routes->delete('maquinas/ots/(:num)', 'Ordentrabajo::delete_maquina_orden_trabajo_tarea/$1');
|
||||
$routes->delete('maquinas/ots/all/(:num)', 'Ordentrabajo::delete_maquina_orden_trabajo_all/$1');
|
||||
/**======================
|
||||
* FILES
|
||||
*========================**/
|
||||
@ -788,6 +806,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
||||
$routes->get('pdf/ferro/(:num)', 'Ordentrabajo::get_ferro_pdf/$1');
|
||||
$routes->get('pdf/prototipo/(:num)', 'Ordentrabajo::get_prototipo_pdf/$1');
|
||||
$routes->get('portada/(:num)', 'Ordentrabajo::get_portada_img/$1');
|
||||
/** PLANNING */
|
||||
$routes->group('planning', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->get('select/maquina/rotativa', 'Ordentrabajo::select_maquina_planning_rot');
|
||||
$routes->get('select/papel/rotativa', 'Ordentrabajo::select_papel_planning_rot');
|
||||
@ -803,12 +822,21 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
||||
});
|
||||
|
||||
$routes->group('maquinista', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
/**
|
||||
* VIEWS
|
||||
*/
|
||||
$routes->get('maquinas/view', 'Ordentrabajo::maquinista_maquinas_view', ['as' => 'viewProduccionMaquinistaMaquinas']);
|
||||
$routes->get('maquinas/view/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_list/$1', ['as' => 'viewProduccionMaquinaTareasList']);
|
||||
$routes->get('maquinas/tareas/datatable/(:alpha)/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_datatable/$1/$2', ['as' => 'viewMaquinistaMaquinaTareaDatatable']);
|
||||
|
||||
$routes->get('maquinas/view/auto/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_fichaje_automatico/$1', ['as' => 'viewMaquinistaFichajeAutomatico']);
|
||||
$routes->get('maquinas/view/scan/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_scan/$1', ['as' => 'viewMaquinistaTareaScan']);
|
||||
$routes->get('maquinas/view/tarea/(:num)', 'Ordentrabajo::maquinista_maquina_tarea_view/$1', ['as' => 'viewProduccionMaquinistaTareaView']);
|
||||
$routes->get('maquinas/view/maquina/ot/tareas/(:num)', 'Ordentrabajo::maquinista_maquina_ot_tareas_view/$1', ['as' => 'viewProduccionMaquinistaOtTareasView']);
|
||||
|
||||
$routes->get('colas/view', 'Ordentrabajo::maquinista_colas_view', ['as' => 'viewProduccionMaquinistaColas']);
|
||||
|
||||
/** DATATABLE */
|
||||
$routes->get('maquinas/tareas/datatable/(:alpha)/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_datatable/$1/$2', ['as' => 'viewMaquinistaMaquinaTareaDatatable']);
|
||||
$routes->get('maquinas/tareas/aplazadas/datatable/(:num)', 'Ordentrabajo::maquinista_maquina_tareas_aplazada_datatable/$1', ['as' => 'viewMaquinistaMaquinaTareaAplazadaDatatable']);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -839,7 +867,6 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi
|
||||
$routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas');
|
||||
|
||||
$routes->get('listAlbaranes', 'LogisticaController::listAlbaranes', ['as' => 'albaranesList']);
|
||||
|
||||
});
|
||||
|
||||
$routes->group('etiquetasTitulos', ['namespace' => 'App\Controllers\Logistica'], function ($routes) {
|
||||
|
||||
@ -172,6 +172,40 @@ class Validation extends BaseConfig
|
||||
"label" => "Orden trabajo"
|
||||
],
|
||||
|
||||
];
|
||||
public array $orden_trabajo_fichaje_auto = [
|
||||
"orden_trabajo_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Orden trabajo"
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Máquina"
|
||||
],
|
||||
"tareas" => [
|
||||
"rules" => "required",
|
||||
"label" => "Tareas"
|
||||
],
|
||||
"click_init" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Click init"
|
||||
],
|
||||
"click_end" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Click end"
|
||||
],
|
||||
|
||||
];
|
||||
public array $maquina_ordenes_trabajo = [
|
||||
"ordenes_trabajo" => [
|
||||
"rules" => "required",
|
||||
"label" => "Orden trabajo"
|
||||
],
|
||||
"maquina_id" => [
|
||||
"rules" => "required|integer",
|
||||
"label" => "Máquina"
|
||||
],
|
||||
|
||||
];
|
||||
public array $chat_department =
|
||||
[
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Compras\ProveedorModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Configuracion\MaquinaOtTareaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
|
||||
@ -31,6 +32,7 @@ class Ordentrabajo extends BaseController
|
||||
protected OrdenTrabajoTarea $otTarea;
|
||||
protected ProveedorModel $proveedorModel;
|
||||
protected MaquinaModel $maquinaModel;
|
||||
protected MaquinaOtTareaModel $maquinaOtTareaModel;
|
||||
protected UserModel $userModel;
|
||||
protected Validation $validation;
|
||||
protected static $viewPath = 'themes/vuexy/form/produccion/';
|
||||
@ -47,6 +49,7 @@ class Ordentrabajo extends BaseController
|
||||
$this->produccionService = new ProductionService();
|
||||
$this->otTarea = model(OrdenTrabajoTarea::class);
|
||||
$this->maquinaModel = model(MaquinaModel::class);
|
||||
$this->maquinaOtTareaModel = model(MaquinaOtTareaModel::class);
|
||||
$this->proveedorModel = model(ProveedorModel::class);
|
||||
$this->validation = service("validation");
|
||||
helper("time");
|
||||
@ -141,7 +144,8 @@ class Ordentrabajo extends BaseController
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function update_presupuesto_tarea_proveedor(){
|
||||
public function update_presupuesto_tarea_proveedor()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "proveedor_tarea");
|
||||
if ($validated) {
|
||||
@ -151,7 +155,6 @@ class Ordentrabajo extends BaseController
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
|
||||
}
|
||||
public function reset_orden_trabajo_date()
|
||||
{
|
||||
@ -242,7 +245,7 @@ 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"])->where('ordenes_trabajo.preimpresion_revisada', true);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
@ -257,7 +260,7 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro',1)->where("ferro_ok_at", null);
|
||||
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro', 1)->where("ferro_ok_at", null);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
@ -272,7 +275,7 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro',1)->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
||||
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro', 1)->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
@ -283,6 +286,62 @@ class Ordentrabajo extends BaseController
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_news()
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where('ordenes_trabajo.preimpresion_revisada', false);
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_prod()
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where('ordenes_trabajo.preimpresion_revisada', true)->where('pedidos.estado', 'produccion');
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_waiting()
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where('ordenes_trabajo.is_pedido_espera', 1);
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_revision_com()
|
||||
{
|
||||
$logo = config(LogoImpresion::class);
|
||||
|
||||
$q = $this->otModel->getDatatableQuery()->where('presupuestos.ferro', 1)->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name, "color" => $this->produccionService->init($q->id)->getOtColorStatus()])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d H:i:s", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
public function papel_gramaje_datatable()
|
||||
{
|
||||
|
||||
@ -318,8 +377,9 @@ class Ordentrabajo extends BaseController
|
||||
return DataTable::of($q)
|
||||
->add("action", fn($q) => $q)
|
||||
->edit("orden", fn($q) => ["id" => $q->id, "orden" => $q->orden])
|
||||
->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmm_string($q->tiempo_estimado))
|
||||
->edit("tiempo_real", fn($q) => float_seconds_to_hhmm_string($q->tiempo_real))
|
||||
->add("tarea_estado", fn($q) => $this->produccionService->getTitleTareaEstado($q->id))
|
||||
->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmmss_string($q->tiempo_estimado))
|
||||
->edit("tiempo_real", fn($q) => float_seconds_to_hhmmss_string($q->tiempo_real))
|
||||
->add("proveedor", fn($q) => $this->produccionService->getProveedorTarea($q->id))
|
||||
->edit("maquina_tarea", fn($q) => ["id" => $q->id, "maquina_id" => $q->maquina_tarea, "maquina_name" => $q->maquina_nombre])
|
||||
->add("imposicion", fn($q) => ["id" => $q->id, "imposicion_id" => $q->imposicion_id, "name" => $q->imposicion_name, "is_presupuesto_linea" => $q->presupuesto_linea_id ? true : false])
|
||||
@ -544,8 +604,26 @@ class Ordentrabajo extends BaseController
|
||||
['title' => $maquina->nombre, 'route' => route_to("viewProduccionMaquinistaMaquina", $maquina_id), 'active' => true],
|
||||
];
|
||||
$this->viewData["maquinaEntity"] = $maquina;
|
||||
$tareasRunning = $this->maquinaOtTareaModel->queryDatatableJoinOrdenTrabajo($maquina->id)->countAllResults();
|
||||
if ($tareasRunning) {
|
||||
return view(static::$viewPath . '/maquinista/viewProduccionMaquinistaOtTareasView', $this->viewData);
|
||||
} else {
|
||||
return view(static::$viewPath . '/maquinista/viewMaquinistaMaquinaTareas', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function maquinista_maquina_tareas_fichaje_automatico(int $maquina_id)
|
||||
{
|
||||
$maquina = $this->maquinaModel->find($maquina_id);
|
||||
$this->viewData["maquinaEntity"] = $maquina;
|
||||
return view(static::$viewPath . '/maquinista/viewMaquinistaFichajeAutomatico', $this->viewData);
|
||||
}
|
||||
public function maquinista_maquina_tareas_scan(int $maquina_id)
|
||||
{
|
||||
$maquina = $this->maquinaModel->find($maquina_id);
|
||||
$this->viewData["maquinaEntity"] = $maquina;
|
||||
return view(static::$viewPath . '/maquinista/viewMaquinistaTareaScan', $this->viewData);
|
||||
}
|
||||
|
||||
public function maquinista_maquina_tarea_view(int $orden_trabajo_tarea_id)
|
||||
{
|
||||
$otTareaEntity = $this->otTarea->find($orden_trabajo_tarea_id);
|
||||
@ -558,9 +636,19 @@ class Ordentrabajo extends BaseController
|
||||
['title' => $otTareaEntity->nombre, 'route' => route_to("viewProduccionMaquinistaTareaView", $otTareaEntity->id), 'active' => true]
|
||||
|
||||
];
|
||||
|
||||
return view(static::$viewPath . '/maquinista/viewMaquinistaMaquinaTarea', $this->viewData);
|
||||
}
|
||||
public function maquinista_maquina_ot_tareas_view(int $maquina_id)
|
||||
{
|
||||
$maquinaEntity = $this->maquinaModel->find($maquina_id);
|
||||
$this->viewData['maquinaEntity'] = $maquinaEntity;
|
||||
$tareasRunning = $this->maquinaOtTareaModel->queryDatatableJoinOrdenTrabajo($maquina_id)->countAllResults();
|
||||
if ($tareasRunning) {
|
||||
return view(static::$viewPath . '/maquinista/viewProduccionMaquinistaOtTareasView', $this->viewData);
|
||||
} else {
|
||||
return view(static::$viewPath . '/maquinista/viewMaquinistaMaquinaTareas', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function maquinista_colas_view()
|
||||
{
|
||||
return view(static::$viewPath . '/maquinista/viewMaquinistaPlanningList', $this->viewData);
|
||||
@ -573,6 +661,16 @@ class Ordentrabajo extends BaseController
|
||||
}
|
||||
return DataTable::of($pm)
|
||||
->edit('fecha_impresion', fn($q) => $q->fecha_impresion ? Time::createFromFormat('Y-m-d H:i:s', $q->fecha_impresion)->format('d/m/Y') : '')
|
||||
->add("tareaEstado", fn($q) => $this->produccionService->getTitleTareaEstado($q->ot_tarea_id))
|
||||
->add('action', fn($q) => $this->produccionService->buttonActionDatatableTareaList($q->ot_tarea_id))
|
||||
->toJson(true);
|
||||
}
|
||||
public function maquinista_maquina_tareas_aplazada_datatable(int $maquina_id)
|
||||
{
|
||||
$pm = $this->produccionService->getMaquinaImpresionTareasList($maquina_id)->where("tarea_progress.estado", 'D');
|
||||
return DataTable::of($pm)
|
||||
->edit('fecha_impresion', fn($q) => $q->fecha_impresion ? Time::createFromFormat('Y-m-d H:i:s', $q->fecha_impresion)->format('d/m/Y') : '')
|
||||
->add("tareaEstado", fn($q) => $this->produccionService->getTitleTareaEstado($q->ot_tarea_id))
|
||||
->add('action', fn($q) => $this->produccionService->buttonActionDatatableTareaList($q->ot_tarea_id))
|
||||
->toJson(true);
|
||||
}
|
||||
@ -583,10 +681,16 @@ class Ordentrabajo extends BaseController
|
||||
try {
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "orden_trabajo_tarea_progress_date");
|
||||
// return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $this->validation->getValidated(),"errors" => $this->validation->getErrors()]);
|
||||
if ($validated) {
|
||||
$r = $this->produccionService->storeOrdenTrabajoTareaProgressDate($this->validation->getValidated());
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]);
|
||||
$validatedData = $this->validation->getValidated();
|
||||
$r = $this->produccionService->storeOrdenTrabajoTareaProgressDate($validatedData);
|
||||
$otTareaEntity = $this->otTarea->find($validatedData['ot_tarea_id']);
|
||||
$data = [
|
||||
"tiempo_trabajado" => float_seconds_to_hhmm_string($otTareaEntity->tiempo_real),
|
||||
"tarea" => $otTareaEntity,
|
||||
"estado" => $validatedData['estado'],
|
||||
];
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $data]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
@ -612,18 +716,179 @@ class Ordentrabajo extends BaseController
|
||||
{
|
||||
|
||||
$this->produccionService->init($orden_trabajo_id);
|
||||
if($this->produccionService->isPOD){
|
||||
if ($this->produccionService->isPOD) {
|
||||
$status = $this->produccionService->updatePodDates();
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status, "data" => $this->produccionService->getPedido()]);
|
||||
}else{
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => false, "data" => $this->produccionService->getPedido()]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public function get_orden_trabajo_tareas_dates($orden_trabajo_id)
|
||||
{
|
||||
$data = $this->produccionService->init($orden_trabajo_id)->getOrdenTrabajoTareaDates();
|
||||
return $this->response->setJSON(["data" => $data ]);
|
||||
return $this->response->setJSON(["data" => $data]);
|
||||
}
|
||||
public function get_tareas_ot_maquina(int $orden_trabajo_id, int $maquina_id)
|
||||
{
|
||||
$tareasWithMaquina = $this->produccionService->init($orden_trabajo_id)->getTareasWithMaquina($maquina_id, ['P', 'I', 'S', 'D']);
|
||||
if ($tareasWithMaquina) {
|
||||
$data = [
|
||||
'tareas' => $tareasWithMaquina,
|
||||
'ot' => $this->produccionService->getOrdenTrabajo(),
|
||||
'presupuesto' => $this->produccionService->getPresupuesto()
|
||||
];
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_fetch_success"), "data" => $data]);
|
||||
} else {
|
||||
$tareasWithMaquina = $this->produccionService->init($orden_trabajo_id)->getTareasWithMaquina($maquina_id, ['F']);
|
||||
if ($tareasWithMaquina) {
|
||||
return $this->response->setJSON(["message" => lang("Produccion.errors.tareas_finalizadas"), "data" => $tareasWithMaquina])->setStatusCode(400);
|
||||
} else {
|
||||
return $this->response->setJSON(["message" => lang("Produccion.errors.maquina_not_in_ot"), "data" => null])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update_orden_trabajo_fa_tareas()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "orden_trabajo_fichaje_auto");
|
||||
if ($validated) {
|
||||
$validatedData = $this->validation->getValidated();
|
||||
$this->produccionService->init($validatedData['orden_trabajo_id']);
|
||||
foreach ($validatedData['tareas'] as $key => $tareaId) {
|
||||
$this->produccionService->storeOrdenTrabajoTareaProgressDate(
|
||||
[
|
||||
'estado' => 'F',
|
||||
'ot_tarea_id' => $tareaId
|
||||
]
|
||||
);
|
||||
$tareaEntity = $this->otTarea->find($tareaId);
|
||||
$tiempo_trabajado = $tareaEntity->tiempo_trabajado();
|
||||
$tareaEntity->tiempo_real = $tiempo_trabajado / count($validatedData['tareas']);
|
||||
$tareaEntity->click_init = $validatedData['click_init'] / count($validatedData['tareas']);
|
||||
$tareaEntity->click_end = $validatedData['click_end'] / count($validatedData['tareas']);
|
||||
|
||||
$this->otTarea->save($tareaEntity);
|
||||
}
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $validatedData]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function store_maquina_ordenes_trabajo()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$validated = $this->validation->run($bodyData, "maquina_ordenes_trabajo");
|
||||
if ($validated) {
|
||||
$validatedData = $this->validation->getValidated();
|
||||
|
||||
foreach ($validatedData['ordenes_trabajo'] as $key => $orden_trabajo_id) {
|
||||
$maquinaOtTarea = $this->maquinaOtTareaModel->where('orden_trabajo_id', $orden_trabajo_id)->where('maquina_id', $validatedData['maquina_id'])->where('deleted_at',null)->countAllResults();
|
||||
if ($maquinaOtTarea) {
|
||||
continue;
|
||||
}
|
||||
$this->maquinaOtTareaModel->insert(['maquina_id' => $validatedData['maquina_id'], 'orden_trabajo_id' => $orden_trabajo_id]);
|
||||
}
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => true, "data" => $validatedData]);
|
||||
} else {
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
public function update_maquina_ordenes_trabajo_estado()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$maquina_id = $bodyData['maquina_id'];
|
||||
$estado = $bodyData['estado'];
|
||||
$maquina_ots = $this->maquinaOtTareaModel->where('maquina_id', $maquina_id)->findAll();
|
||||
$totalTareas = [];
|
||||
|
||||
foreach ($maquina_ots as $key => $maquina_ot) {
|
||||
$tareas = $this->produccionService->init($maquina_ot->orden_trabajo_id)
|
||||
->getTareasWithMaquina($maquina_id, ['P', 'I', 'S', 'D']);
|
||||
foreach ($tareas as $key => $tarea) {
|
||||
$this->produccionService->storeOrdenTrabajoTareaProgressDate(
|
||||
[
|
||||
'estado' => $estado,
|
||||
'ot_tarea_id' => $tarea->id
|
||||
]
|
||||
);
|
||||
$tarea->click_init = $bodyData['click_init'];
|
||||
$tarea->click_end = $bodyData['click_end'];
|
||||
$totalTareas[] = $tarea;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
foreach ($totalTareas as $key => $tarea) {
|
||||
$tiempo_trabajado = $tarea->tiempo_trabajado();
|
||||
$tarea->tiempo_real = $tiempo_trabajado / count($totalTareas);
|
||||
$tarea->click_init = $tarea->click_init / count($totalTareas);
|
||||
$tarea->click_end = $tarea->click_end / count($totalTareas);
|
||||
|
||||
$this->otTarea->save($tarea);
|
||||
}
|
||||
if ($estado == "F") {
|
||||
$this->maquinaOtTareaModel->where('maquina_id', $maquina_id)->delete();
|
||||
}
|
||||
|
||||
return $this->response->setJSON(["message" => lang("Produccion.responses.update_maquina_ordenes_trabajo_estado")]);
|
||||
}
|
||||
public function delete_maquina_orden_trabajo_tarea($maquina_orden_trabajo_tarea_id)
|
||||
{
|
||||
|
||||
$status = $this->maquinaOtTareaModel->delete($maquina_orden_trabajo_tarea_id);
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $status]);
|
||||
}
|
||||
public function delete_maquina_orden_trabajo_all($maquina_id)
|
||||
{
|
||||
$maquina_ots = $this->maquinaOtTareaModel->where('maquina_id', $maquina_id)->findAll();
|
||||
foreach ($maquina_ots as $key => $maquina_ot) {
|
||||
$tareas = $this->produccionService->init($maquina_ot->orden_trabajo_id)
|
||||
->getTareasWithMaquina($maquina_id, ['P', 'I', 'S', 'D']);
|
||||
foreach ($tareas as $key => $tarea) {
|
||||
$this->produccionService->deleteOrdenTrabajoTareaProgressDates($tarea->id);
|
||||
}
|
||||
}
|
||||
$status = $this->maquinaOtTareaModel->where('maquina_id',$maquina_id)->delete();
|
||||
return $this->response->setJSON(["message" => lang("App.user_alert_delete"), "status" => $status]);
|
||||
}
|
||||
|
||||
public function datatable_maquina_ordenes_trabajo($maquina_id)
|
||||
{
|
||||
$query = $this->maquinaOtTareaModel->queryDatatableJoinOrdenTrabajo($maquina_id);
|
||||
return DataTable::of($query)
|
||||
->add('action', fn($q) => $q->otId)
|
||||
->add('titulo', fn($q) => $this->otModel->find($q->otId)->presupuesto()->titulo)
|
||||
->add('barcode', fn($q) => $this->otModel->find($q->otId)->getBarCode())
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_maquina_ots($maquina_id)
|
||||
{
|
||||
$responseData = [
|
||||
"tiempo_total_estimado" => 0,
|
||||
"tiempo_total_real" => 0,
|
||||
"clicks_total" => 0,
|
||||
"tirada_total" => 0,
|
||||
"estado" => "P",
|
||||
];
|
||||
$maquina_ots = $this->maquinaOtTareaModel->where('maquina_id', $maquina_id)->findAll();
|
||||
foreach ($maquina_ots as $key => $maquina_ot) {
|
||||
$tareas = $this->produccionService->init($maquina_ot->orden_trabajo_id)
|
||||
->getTareasWithMaquina($maquina_id, ['P', 'I', 'S', 'D']);
|
||||
foreach ($tareas as $key => $tarea) {
|
||||
$responseData['tiempo_total_estimado']+= $tarea->tiempo_estimado;
|
||||
$responseData['tiempo_total_real']+= $tarea->tiempo_real;
|
||||
$responseData["estado"] = $tarea->lastState()->estado;
|
||||
if($tarea->presupuesto_linea_id){
|
||||
$responseData["clicks_total"] += $tarea->presupuesto_linea()->rotativa_clicks_total;
|
||||
$responseData["tirada_total"] += $tarea->orden_trabajo()->presupuesto()->tirada;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$responseData['tiempo_total_estimado'] = float_seconds_to_hhmmss_string($responseData['tiempo_total_estimado']);
|
||||
$responseData['tiempo_total_real'] = float_seconds_to_hhmmss_string($responseData['tiempo_total_real']);
|
||||
return $this->response->setJSON($responseData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AlterOrdenesTrabajoAddCommentColumns extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
'preimpresion_revisada' => [
|
||||
'type' => 'BOOL',
|
||||
'default' => false
|
||||
],
|
||||
'preimpresion_revisada_by' => [
|
||||
'type' => 'INT',
|
||||
'unsigned' => true,
|
||||
'constraint' => 11,
|
||||
],
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
|
||||
$this->forge->addColumn('ordenes_trabajo',$this->COLUMNS);
|
||||
$this->forge->addForeignKey('preimpresion_revisada_by','users','id','NULL','NULL');
|
||||
$this->forge->processIndexes('ordenes_trabajo');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropForeignKey('ordenes_trabajo','ordenes_trabajo_preimpresion_revisada_by_foreign');
|
||||
$this->forge->dropColumn('ordenes_trabajo',array_keys($this->COLUMNS));
|
||||
}
|
||||
}
|
||||
58
ci4/app/Database/Migrations/2025-05-04-172900_MaquinaOtTareasTable.php
Executable file
58
ci4/app/Database/Migrations/2025-05-04-172900_MaquinaOtTareasTable.php
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class MaquinaOtTareasTable extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
|
||||
'id' => [
|
||||
'type' => 'INT',
|
||||
'unsigned' => true,
|
||||
'auto_increment' => true,
|
||||
],
|
||||
'maquina_id' => [
|
||||
'type' => 'INT',
|
||||
'unsigned' => true,
|
||||
'constraint' => 11
|
||||
],
|
||||
'orden_trabajo_id' => [
|
||||
'type' => 'INT',
|
||||
'unsigned' => true,
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql('CURRENT_TIMESTAMP');
|
||||
$this->forge->addField([
|
||||
'created_at' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'default' => $currenttime,
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'null' => true,
|
||||
],
|
||||
'deleted_at' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'null' => true,
|
||||
|
||||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('maquina_id','lg_maquinas','id','CASCADE','CASCADE','maquina_ot_tareas_maquina_id_fk');
|
||||
$this->forge->addForeignKey('orden_trabajo_id','ordenes_trabajo','id','CASCADE','CASCADE','maquina_ot_tareas_ot_id_fk');
|
||||
$this->forge->createTable("maquina_ot_tareas");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("maquina_ot_tareas");
|
||||
}
|
||||
}
|
||||
@ -45,6 +45,9 @@ class OrdenTrabajoEntity extends Entity
|
||||
"portada_path" => null,
|
||||
"is_pedido_espera" => null,
|
||||
"pedido_espera_by" => null,
|
||||
"preimpresion_revisada" => false,
|
||||
"preimpresion_revisada_by" => null,
|
||||
|
||||
];
|
||||
protected $casts = [
|
||||
"pedido_id" => "integer",
|
||||
@ -72,6 +75,7 @@ class OrdenTrabajoEntity extends Entity
|
||||
"enviar_impresion" => "bool",
|
||||
"portada_path" => "string",
|
||||
"is_pedido_espera" => "bool",
|
||||
"preimpresion_revisada" => "bool",
|
||||
];
|
||||
|
||||
|
||||
@ -178,10 +182,23 @@ class OrdenTrabajoEntity extends Entity
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public function preimpresionRevisadaUser(): ?UserEntity
|
||||
{
|
||||
$m = model(UserModel::class);
|
||||
if ($this->attributes['preimpresion_revisada_by']) {
|
||||
return $m->findById($this->attributes['preimpresion_revisada_by']);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public function getPedidoEsperaBy(): ?UserEntity
|
||||
{
|
||||
return $this->pedidoEsperaBy();
|
||||
}
|
||||
public function getPreimpresionRevisadaBy(): ?UserEntity
|
||||
{
|
||||
return $this->preimpresionRevisadaUser();
|
||||
}
|
||||
public function getFullPath(): ?string
|
||||
{
|
||||
helper('filesystem');
|
||||
|
||||
@ -178,6 +178,12 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
$m = model(OrdenTrabajoTareaProgressDate::class);
|
||||
return $m->where('ot_tarea_id', $this->attributes["id"])->findAll() ?? [];
|
||||
}
|
||||
public function lastState(): ?OrdenTrabajoTareaProgressDateEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoTareaProgressDate::class);
|
||||
$progressDates = $m->where('ot_tarea_id', $this->attributes["id"])->orderBy('action_at', 'DESC')->first();
|
||||
return $progressDates;
|
||||
}
|
||||
public function tiempo_trabajado()
|
||||
{
|
||||
$dates = $this->progress_dates();
|
||||
@ -187,12 +193,12 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
foreach ($dates as $key => $date) {
|
||||
if ($date->estado == "I") {
|
||||
if ($date->action_at) {
|
||||
$init = Time::createFromFormat('Y-m-d H:i:s', $date->action_at);
|
||||
$init = $date->action_at;
|
||||
}
|
||||
}
|
||||
if ($date->estado == "S" || $date->estado == "F") {
|
||||
if ($date->action_at && $init) {
|
||||
$end = Time::createFromFormat('Y-m-d H:i:s', $date->action_at);
|
||||
$end = $date->action_at;
|
||||
$intervals[] = $init->difference($end)->getSeconds();
|
||||
}
|
||||
}
|
||||
@ -212,23 +218,23 @@ class OrdenTrabajoTareaEntity extends Entity
|
||||
}
|
||||
return $isTareaCosido;
|
||||
}
|
||||
public function isImpresion() : bool
|
||||
public function isImpresion(): bool
|
||||
{
|
||||
return $this->attributes['presupuesto_linea_id'] != null;
|
||||
}
|
||||
public function isAcabado() : bool
|
||||
public function isAcabado(): bool
|
||||
{
|
||||
return $this->attributes['presupuesto_acabado_id'] != null;
|
||||
}
|
||||
public function isManipulado() : bool
|
||||
public function isManipulado(): bool
|
||||
{
|
||||
return $this->attributes['presupuesto_manipulado_id'] != null;
|
||||
}
|
||||
public function isEncuadernado() : bool
|
||||
public function isEncuadernado(): bool
|
||||
{
|
||||
return $this->attributes['presupuesto_encuadernado_id'] != null;
|
||||
}
|
||||
public function isCorte() : bool
|
||||
public function isCorte(): bool
|
||||
{
|
||||
return $this->attributes['is_corte'];
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use App\Entities\Usuarios\UserEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
@ -20,12 +21,21 @@ class OrdenTrabajoTareaProgressDateEntity extends Entity
|
||||
/**
|
||||
* Orden de trabajo de la tarea
|
||||
*
|
||||
* @return OrdenTrabajoEntity
|
||||
* @return OrdenTrabajoTareaEntity
|
||||
*/
|
||||
public function orden_trabajo_tarea() : OrdenTrabajoTareaEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoTarea::class);
|
||||
return $m->find($this->attributes["ot_tarea_id"]);
|
||||
}
|
||||
public function user() : ?UserEntity
|
||||
{
|
||||
$user = null;
|
||||
if($this->attributes['action_user_id'])
|
||||
{
|
||||
$user = auth()->getProvider()->findById($this->attributes['action_user_id']);
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,11 +24,11 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
|
||||
"deleted_at" => null,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
'plastificado' => false,
|
||||
'plakene' => false,
|
||||
'rectractilado' => false,
|
||||
'estampado' => false,
|
||||
'uvi' => false,
|
||||
'plastificado' => null,
|
||||
'plakene' => null,
|
||||
'rectractilado' => null,
|
||||
'estampado' => null,
|
||||
'uvi' => null,
|
||||
'plastificado_tipo' => null,
|
||||
'plakene_tipo' => null,
|
||||
'rectractilado_tipo' => null,
|
||||
|
||||
45
ci4/app/Entities/Tarifas/Maquinas/MaquinaOtTareaEntity.php
Executable file
45
ci4/app/Entities/Tarifas/Maquinas/MaquinaOtTareaEntity.php
Executable file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Tarifas\Maquinas;
|
||||
|
||||
use App\Entities\Configuracion\Maquina;
|
||||
use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class MaquinaOtTareaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"maquina_id" => null,
|
||||
"orden_trabajo_id" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"id" => "integer",
|
||||
"maquina_id" => "integer",
|
||||
"orden_trabajo_id" => "integer",
|
||||
];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
/**
|
||||
* Orden de trabajo
|
||||
*
|
||||
* @return OrdenTrabajoEntity
|
||||
*/
|
||||
public function orden_trabajo_tarea(): OrdenTrabajoEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoModel::class);
|
||||
return $m->find($this->attributes["orden_trabajo_id"]);
|
||||
}
|
||||
/**
|
||||
* Maquina
|
||||
*
|
||||
* @return Maquina
|
||||
*/
|
||||
public function maquina(): Maquina
|
||||
{
|
||||
$m = model(MaquinaModel::class);
|
||||
return $m->find($this->attributes["maquina_id"]);
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,17 @@ function float_seconds_to_hhmm_string(?float $time):?string
|
||||
}
|
||||
return $time_str;
|
||||
}
|
||||
|
||||
function float_seconds_to_hhmmss_string(?float $time): ?string
|
||||
{
|
||||
$time_str = null;
|
||||
if ($time !== null) {
|
||||
$hours = floor($time / 3600);
|
||||
$minutes = floor(($time % 3600) / 60);
|
||||
$seconds = floor($time % 60);
|
||||
$time_str = sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
|
||||
}
|
||||
return $time_str;
|
||||
}
|
||||
function week_day_humanize(int $week_day,bool $upper = false) : string
|
||||
{
|
||||
$week_days = ["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];
|
||||
|
||||
@ -1,15 +1,27 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"navs" => [
|
||||
'finalizadas' => 'Finalizadas',
|
||||
'pendientes' => 'Pendientes',
|
||||
'pendientes_ferro' => 'Ferro pendiente',
|
||||
'ferro_ok' => 'Ferro/Prototipo OK',
|
||||
'news' => 'Nuevas',
|
||||
'waiting' => 'En espera',
|
||||
'revision_com' => 'Revisión comercial',
|
||||
'prod' => 'Producción'
|
||||
],
|
||||
"datatable" => [
|
||||
"pedido_id"=> "Pedido ID",
|
||||
"fecha_encuadernacion"=> "Fecha encuadernación",
|
||||
"fecha_impresion"=> "Fecha impresión",
|
||||
"cliente"=> "Cliente",
|
||||
"titulo"=> "Título",
|
||||
"ubicacion"=> "Ubicación",
|
||||
"tirada"=> "Tirada",
|
||||
"impresion"=> "Impresión",
|
||||
"ot_id" => "OT ID",
|
||||
"barcode" => "Código",
|
||||
"pedido_id" => "Pedido ID",
|
||||
"fecha_encuadernacion" => "Fecha encuadernación",
|
||||
"fecha_impresion" => "Fecha impresión",
|
||||
"cliente" => "Cliente",
|
||||
"titulo" => "Título",
|
||||
"ubicacion" => "Ubicación",
|
||||
"tirada" => "Tirada",
|
||||
"impresion" => "Impresión",
|
||||
"fecha_entrega_at" => "Fecha entrega prevista",
|
||||
"maquina" => "Máquina",
|
||||
"ancho" => "Ancho",
|
||||
@ -31,8 +43,6 @@ return [
|
||||
"pliegos" => "Pliegos",
|
||||
"pliegos_libro" => "Pliegos",
|
||||
"fecha" => "fecha"
|
||||
|
||||
|
||||
],
|
||||
"task" => [
|
||||
"order" => "Orden",
|
||||
@ -89,6 +99,7 @@ return [
|
||||
"papel_gramajes" => "Papel y gramajes",
|
||||
"estado" => "Estado",
|
||||
"pedido_espera" => "Pedido en espera",
|
||||
"preimpresion_revisada" => "Preimpresión revisada",
|
||||
"imposicion_no_label" => "Sin etiqueta",
|
||||
"pliegos_de" => "pliegos de",
|
||||
"size" => "Tamaño",
|
||||
@ -139,12 +150,32 @@ return [
|
||||
"maquinas" => "Máquinas",
|
||||
"tareas_hoy" => "Tareas para HOY",
|
||||
"tareas_all" => "Todas",
|
||||
"tareas_delay" => "Aplazadas",
|
||||
"play_tarea" => "Continuar",
|
||||
"play_pause" => "Pausar",
|
||||
"play_stop" => "Aplazar",
|
||||
"play_end" => "Finalizar",
|
||||
"cancel" => "Cancelar",
|
||||
"fichaje_auto" => "F.auto",
|
||||
"scan" => "Escanear",
|
||||
"tarea_list" => "Lista de tareas",
|
||||
"fichaje_auto_alert_text" => "Cada vez que introduza un nº de pedido se iniciará la tarea y se finalizará la tarea actual (del pedido anterior)",
|
||||
"next_ot" => "SIGUIENTE OT",
|
||||
"placeholder_ot_id" => "Introduce el ID de la OT",
|
||||
"fa_ot_input_form_text" => "Introduce una OT para terminar la actual e iniciar la siguiente.",
|
||||
"scan_ot_input_form_text" => "Introduce una OT para añadirla al proceso",
|
||||
"next_scan_ot" => "Comenzar",
|
||||
"reset" => "Resetear"
|
||||
|
||||
|
||||
],
|
||||
'tarea_estados' => [
|
||||
'P' => 'Pendiente',
|
||||
'I' => 'Iniciada',
|
||||
'F' => 'Finalizada',
|
||||
'S' => 'Pausada',
|
||||
'D' => 'Aplazada',
|
||||
'E' => 'Error'
|
||||
],
|
||||
'duplicate_estado_tarea_progress' => "Último estado de la tarea repetido",
|
||||
'task_already_finished' => "La tarea se ha marcado como finalizada.",
|
||||
@ -158,4 +189,15 @@ return [
|
||||
"comentariosEncuadernacion" => "Comentarios encuadernación",
|
||||
"comentariosLogistica" => "Comentarios logística",
|
||||
"info_solapa_guillotina" => "Datos solapa y preparación guillotina",
|
||||
"responses" => [
|
||||
"finish_maquina_ordenes_trabajo" => "Tareas finalizadas correctamente",
|
||||
"update_maquina_ordenes_trabajo_estado" => "Tareas actualizadas correctamente",
|
||||
|
||||
],
|
||||
"errors" => [
|
||||
"maquina_not_in_ot" => "Esta OT no tiene ninguna tarea con esta máquina",
|
||||
"tareas_finalizadas" => "Las tareas de esta OT y máquina están marcadas como finalizadas",
|
||||
"ot_not_found" => "La orden de trabajo número {ot_id} no existe"
|
||||
|
||||
]
|
||||
];
|
||||
@ -404,7 +404,9 @@ class MaquinaModel extends \App\Models\BaseModel
|
||||
->select([
|
||||
'lg_maquinas.id as maquinaId',
|
||||
'lg_maquinas.nombre',
|
||||
'COUNT(tarea_progress.ot_tarea_id) as countTareas'
|
||||
'COUNT(tarea_progress.ot_tarea_id) as countTareas',
|
||||
'COUNT(maquina_ot_tareas.orden_trabajo_id) as countMaquinaTareas'
|
||||
|
||||
])
|
||||
->join('orden_trabajo_tareas', 'orden_trabajo_tareas.maquina_id = lg_maquinas.id', 'left')
|
||||
->join(
|
||||
@ -420,6 +422,14 @@ class MaquinaModel extends \App\Models\BaseModel
|
||||
'tarea_progress.ot_tarea_id = orden_trabajo_tareas.id',
|
||||
'left'
|
||||
)
|
||||
->join(
|
||||
"(SELECT orden_trabajo_id,deleted_at,maquina_id
|
||||
FROM maquina_ot_tareas
|
||||
WHERE deleted_at is NULL
|
||||
) as maquina_ot_tareas",
|
||||
'maquina_ot_tareas.maquina_id = lg_maquinas.id',
|
||||
'left'
|
||||
)
|
||||
->join('ordenes_trabajo', 'ordenes_trabajo.id = orden_trabajo_tareas.orden_trabajo_id', 'left')
|
||||
->join('pedidos', 'pedidos.id = ordenes_trabajo.pedido_id', 'left')
|
||||
->where('lg_maquinas.tipo', $maquina_tipo)
|
||||
|
||||
66
ci4/app/Models/Configuracion/MaquinaOtTareaModel.php
Executable file
66
ci4/app/Models/Configuracion/MaquinaOtTareaModel.php
Executable file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
use App\Entities\Tarifas\Maquinas\MaquinaOtTareaEntity;
|
||||
use App\Entities\Tarifas\Maquinas\TareaMaquinaEntity;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class MaquinaOtTareaModel extends Model
|
||||
{
|
||||
protected $table = 'maquina_ot_tareas';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = MaquinaOtTareaEntity::class;
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"maquina_id",
|
||||
"orden_trabajo_id",
|
||||
];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
protected bool $updateOnlyChanged = true;
|
||||
|
||||
protected array $casts = [];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
// Validation
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function queryDatatableJoinOrdenTrabajo($maquina_id){
|
||||
return $this->builder()
|
||||
->select([
|
||||
'maquina_ot_tareas.id as maquinaOtTareaId',
|
||||
'ordenes_trabajo.id as otId'
|
||||
])
|
||||
->join('ordenes_trabajo','ordenes_trabajo.id = maquina_ot_tareas.orden_trabajo_id','left')
|
||||
->where('maquina_ot_tareas.maquina_id',$maquina_id)
|
||||
->where('maquina_ot_tareas.deleted_at',null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ namespace App\Models\OrdenTrabajo;
|
||||
use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class OrdenTrabajoModel extends Model
|
||||
{
|
||||
protected $table = 'ordenes_trabajo';
|
||||
@ -39,7 +40,10 @@ class OrdenTrabajoModel extends Model
|
||||
"enviar_impresion",
|
||||
"portada_path",
|
||||
"is_pedido_espera",
|
||||
"pedido_espera_by"
|
||||
"pedido_espera_by",
|
||||
"preimpresion_revisada",
|
||||
"preimpresion_revisada_by",
|
||||
|
||||
];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
@ -72,7 +76,7 @@ class OrdenTrabajoModel extends Model
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function getDatatableQuery() : BaseBuilder
|
||||
public function getDatatableQuery(): BaseBuilder
|
||||
{
|
||||
$q = $this->builder()
|
||||
->select([
|
||||
@ -91,22 +95,52 @@ class OrdenTrabajoModel extends Model
|
||||
"CONCAT(lg_imposiciones.ancho,'x',lg_imposiciones.alto,'_',COALESCE(lg_imposiciones.unidades,'NULL'),'_',COALESCE(lg_imposiciones.orientacion,'NULL')) as imposicion_name"
|
||||
|
||||
])
|
||||
->join("orden_trabajo_dates","orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id","left")
|
||||
->join("pedidos","pedidos.id = ordenes_trabajo.pedido_id","left")
|
||||
->join("pedidos_linea","pedidos.id = pedidos_linea.pedido_id","left")
|
||||
->join("presupuestos","presupuestos.id = pedidos_linea.presupuesto_id","left")
|
||||
->join("presupuesto_linea","presupuestos.id = presupuesto_linea.presupuesto_id","left")
|
||||
->join("clientes","clientes.id = presupuestos.cliente_id","left")
|
||||
->join("tipos_presupuestos","presupuestos.tipo_impresion_id = tipos_presupuestos.id","left")
|
||||
->join("ubicaciones","ubicaciones.id = pedidos_linea.ubicacion_id","left")
|
||||
->join("orden_trabajo_tareas","orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id","left")
|
||||
->join("lg_imposiciones","lg_imposiciones.id = orden_trabajo_tareas.imposicion_id","left")
|
||||
->join("orden_trabajo_dates", "orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("pedidos", "pedidos.id = ordenes_trabajo.pedido_id", "left")
|
||||
->join("pedidos_linea", "pedidos.id = pedidos_linea.pedido_id", "left")
|
||||
->join("presupuestos", "presupuestos.id = pedidos_linea.presupuesto_id", "left")
|
||||
->join("presupuesto_linea", "presupuestos.id = presupuesto_linea.presupuesto_id", "left")
|
||||
->join("clientes", "clientes.id = presupuestos.cliente_id", "left")
|
||||
->join("tipos_presupuestos", "presupuestos.tipo_impresion_id = tipos_presupuestos.id", "left")
|
||||
->join("ubicaciones", "ubicaciones.id = pedidos_linea.ubicacion_id", "left")
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
|
||||
|
||||
->whereIn("presupuesto_linea.tipo",["lp_bn","lp_bnhq","lp_rot_bn","lp_color","lp_colorhq","lp_rot_color"])
|
||||
->where("ordenes_trabajo.deleted_at",null)
|
||||
->whereIn("presupuesto_linea.tipo", ["lp_bn", "lp_bnhq", "lp_rot_bn", "lp_color", "lp_colorhq", "lp_rot_color"])
|
||||
->where("ordenes_trabajo.deleted_at", null)
|
||||
->groupBy("ordenes_trabajo.id");
|
||||
return $q;
|
||||
}
|
||||
|
||||
|
||||
public function queryMaquinaTareas(int $maquina_id, ?array $tareaEstados = null)
|
||||
{
|
||||
$query = $this->builder()->select([
|
||||
'orden_trabajo_tareas.*',
|
||||
'tarea_progress.estado'
|
||||
])
|
||||
->join('orden_trabajo_tareas', 'orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id', 'left')
|
||||
->join('lg_maquinas', 'orden_trabajo_tareas.maquina_id = lg_maquinas.id', 'left');
|
||||
//* Obtener el ultimo estado de la tarea
|
||||
if ($tareaEstados) {
|
||||
$query->join(
|
||||
'(SELECT ot_tarea_id, estado
|
||||
FROM orden_trabajo_tarea_progress_dates
|
||||
WHERE (ot_tarea_id, created_at) IN (
|
||||
SELECT ot_tarea_id, MAX(created_at)
|
||||
FROM orden_trabajo_tarea_progress_dates
|
||||
GROUP BY ot_tarea_id
|
||||
)
|
||||
) as tarea_progress',
|
||||
'tarea_progress.ot_tarea_id = orden_trabajo_tareas.id',
|
||||
'left'
|
||||
)
|
||||
->groupStart()
|
||||
->whereIn('tarea_progress.estado', $tareaEstados)
|
||||
->orWhere('tarea_progress.estado',null)
|
||||
->groupEnd();
|
||||
}
|
||||
$query->where('orden_trabajo_tareas.deleted_at', null)
|
||||
->where('lg_maquinas.id', $maquina_id)
|
||||
->groupBy('orden_trabajo_tareas.id');
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Models\OrdenTrabajo;
|
||||
|
||||
use App\Entities\Produccion\OrdenTrabajoTareaEntity;
|
||||
use App\Entities\Produccion\OrdenTrabajoTareaProgressDateEntity;
|
||||
use CodeIgniter\Database\MySQLi\Builder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
@ -11,7 +12,7 @@ class OrdenTrabajoTareaProgressDate extends Model
|
||||
protected $table = 'orden_trabajo_tarea_progress_dates';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = OrdenTrabajoTareaEntity::class;
|
||||
protected $returnType = OrdenTrabajoTareaProgressDateEntity::class;
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
|
||||
@ -253,8 +253,7 @@ class PresupuestoService extends BaseService
|
||||
$linea['fields']['precio_libro'] = $linea['fields']['pliegos_libro'] * $linea['fields']['precios_pliegos'];
|
||||
// Precio papel pedido
|
||||
$linea['fields']['precio_pedido'] = $linea['fields']['precio_libro'] * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$linea['fields']['margen_papel_pedido'] = $linea['fields']['pliegos_libro'] * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);
|
||||
;
|
||||
$linea['fields']['margen_papel_pedido'] = $linea['fields']['pliegos_libro'] * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);;
|
||||
|
||||
$linea['fields']['a_favor_fibra'] = $parametrosRotativa->a_favor_fibra;
|
||||
$linea['fields']['maquina'] = $maquina->maquina;
|
||||
@ -1908,7 +1907,7 @@ class PresupuestoService extends BaseService
|
||||
$serviceProduction->setPedido($pedido);
|
||||
if (!$pedido->orden_trabajo()) {
|
||||
|
||||
$r = $serviceProduction->createOrdenTrabajo();
|
||||
$r = $serviceProduction->createOrdenTrabajo(true);
|
||||
$modelPedido->set(['estado' => 'produccion'])->where('id', $pedido_id)->update();
|
||||
}
|
||||
}
|
||||
@ -1984,17 +1983,17 @@ class PresupuestoService extends BaseService
|
||||
return $peso;
|
||||
}
|
||||
|
||||
public static function ajustarPresupuesto($id, $precio_unidad = null, $unidades = null, $precio_total = null, $forzar_descuento = false){
|
||||
public static function ajustarPresupuesto($id, $precio_unidad = null, $unidades = null, $precio_total = null, $forzar_descuento = false)
|
||||
{
|
||||
|
||||
$precio_total_asignado = 0;
|
||||
$precio_unidad_asignado = $precio_unidad;
|
||||
$warning = false;
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoModel');
|
||||
if($precio_unidad != null && $unidades != null){
|
||||
if ($precio_unidad != null && $unidades != null) {
|
||||
$precio_total_asignado = round(floatval($precio_unidad) * intval($unidades), 2);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$precio_total_asignado = floatval($precio_total);
|
||||
}
|
||||
$presupuesto = $model->find($id);
|
||||
@ -2003,13 +2002,12 @@ class PresupuestoService extends BaseService
|
||||
|
||||
$total_descuento = 0;
|
||||
$total_descuentoPercent = 0;
|
||||
if($costes + $envio_base > $precio_total_asignado){
|
||||
if ($costes + $envio_base > $precio_total_asignado) {
|
||||
|
||||
if($forzar_descuento){
|
||||
if ($forzar_descuento) {
|
||||
$total_descuento = $costes + $envio_base - $precio_total_asignado;
|
||||
$total_descuentoPercent = round($total_descuento / ($costes + $envio_base) * 100, 2);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$precio_total_asignado = round($costes + $envio_base, 2);
|
||||
$precio_unidad_asignado = round($precio_total_asignado / intval($unidades), 4);
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ class ProductionService extends BaseService
|
||||
*/
|
||||
public array $TIPOS_ROTATIVA = ['lp_rot_bn', 'lp_rot_color'];
|
||||
|
||||
public array $OT_TAREA_STATUS_TITLE;
|
||||
protected OrdenTrabajoModel $otModel;
|
||||
|
||||
protected OrdenTrabajoTarea $otTarea;
|
||||
@ -110,6 +111,12 @@ class ProductionService extends BaseService
|
||||
* @var boolean
|
||||
*/
|
||||
public bool $isPlastificado = false; //* CHECK DONE
|
||||
/**
|
||||
* Indica si la orden de trabajo contiene retractilado
|
||||
* Se usa para mostrar la fecha correspondiente en la vista
|
||||
* @var boolean
|
||||
*/
|
||||
public bool $isRetractilado = false; //* CHECK DONE
|
||||
/**
|
||||
* Indica si la orden de trabajo contiene gofrado
|
||||
* Se usa para mostrar la fecha correspondiente en la vista
|
||||
@ -205,6 +212,14 @@ class ProductionService extends BaseService
|
||||
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
|
||||
$this->configVariableModel = model(ConfigVariableModel::class);
|
||||
$this->podValue = $this->configVariableModel->getVariable('POD')->value;
|
||||
$this->OT_TAREA_STATUS_TITLE = [
|
||||
"P" => lang('Produccion.tarea_estados.P'),
|
||||
"F" => lang('Produccion.tarea_estados.F'),
|
||||
"S" => lang('Produccion.tarea_estados.S'),
|
||||
"I" => lang('Produccion.tarea_estados.I'),
|
||||
"E" => lang('Produccion.tarea_estados.E'),
|
||||
"D" => lang('Produccion.tarea_estados.D'),
|
||||
];
|
||||
}
|
||||
|
||||
public function init(int $orden_trabajo_id): self
|
||||
@ -212,7 +227,11 @@ class ProductionService extends BaseService
|
||||
try {
|
||||
$this->maquinaModel = model(MaquinaModel::class);
|
||||
$this->otModel = model(OrdenTrabajoModel::class);
|
||||
$this->ot = $this->otModel->find($orden_trabajo_id);
|
||||
$ot = $this->otModel->find($orden_trabajo_id);
|
||||
if($ot == null){
|
||||
throw new Exception(lang('Produccion.errors.ot_not_found',['ot_id' => $orden_trabajo_id]));
|
||||
}
|
||||
$this->ot = $ot;
|
||||
$pedido = $this->ot->pedido();
|
||||
$this->setPedido($pedido);
|
||||
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
||||
@ -253,7 +272,7 @@ class ProductionService extends BaseService
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function createOrdenTrabajo(): OrdenTrabajoEntity|DatabaseException
|
||||
public function createOrdenTrabajo(bool $imported = false): OrdenTrabajoEntity|DatabaseException
|
||||
{
|
||||
|
||||
$auth_user = auth()->user();
|
||||
@ -266,13 +285,18 @@ class ProductionService extends BaseService
|
||||
"user_created_id" => $auth_user->id,
|
||||
"user_updated_id" => $auth_user->id,
|
||||
"total_tirada" => $this->pedido->total_tirada,
|
||||
"total_precio" => $this->pedido->total_precio
|
||||
"total_precio" => $this->pedido->total_precio,
|
||||
"preimpresion_revisada" => $imported
|
||||
];
|
||||
$id = $this->otModel->insert($data);
|
||||
$this->init($id);
|
||||
$this->storeOrdenTrabajoUsers();
|
||||
$this->storeOrdenTrabajoDates();
|
||||
$this->storeAllTareas();
|
||||
try {
|
||||
$this->updatePodDates();
|
||||
} catch (\Throwable $th) {
|
||||
}
|
||||
$this->updatePedidoEspera();
|
||||
return $this->ot;
|
||||
}
|
||||
@ -586,6 +610,12 @@ class ProductionService extends BaseService
|
||||
}
|
||||
return ["tareas" => $tareas];
|
||||
}
|
||||
public function getTareasWithMaquina(int $maquina_id,?array $tareaEstados = null) : ?array
|
||||
{
|
||||
return $this->otModel->queryMaquinaTareas($maquina_id, $tareaEstados)
|
||||
->where('ordenes_trabajo.id', $this->ot->id)
|
||||
->get()->getResult(OrdenTrabajoTareaEntity::class);
|
||||
}
|
||||
|
||||
public function getPdf()
|
||||
{
|
||||
@ -844,6 +874,7 @@ class ProductionService extends BaseService
|
||||
"tareas_preimpresion" => $this->tareas_preimpresion(),
|
||||
"tareas_impresion" => $this->tareas_impresion(),
|
||||
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
|
||||
"tiempo_total" => $this->getTiempoTotalTareas(),
|
||||
"statusColor" => $this->getOtColorStatus(),
|
||||
"tareaCosido" => $this->getTareaCosido(),
|
||||
];
|
||||
@ -982,15 +1013,15 @@ class ProductionService extends BaseService
|
||||
$data["action_user_id"] = auth()->user()->id;
|
||||
$lastDate = $this->otTareaProgressDate->where('ot_tarea_id', $data['ot_tarea_id'])->orderBy('action_at', 'DESC')->first();
|
||||
if ($lastDate) {
|
||||
if ($lastDate->estado == $data['estado']) {
|
||||
throw new Exception(lang('Produccion.duplicate_estado_tarea_progress'));
|
||||
}
|
||||
// if ($lastDate->estado == $data['estado']) {
|
||||
// throw new Exception(lang('Produccion.duplicate_estado_tarea_progress'));
|
||||
// }
|
||||
if ($lastDate->estado == 'F') {
|
||||
throw new Exception(lang('Produccion.task_already_finished'));
|
||||
}
|
||||
}
|
||||
if(isset($data['estado'])){
|
||||
if($data['estado'] == 'F'){
|
||||
if (isset($data['estado'])) {
|
||||
if ($data['estado'] == 'F') {
|
||||
$tareaEntity = $this->otTarea->find($data['ot_tarea_id']);
|
||||
$this->init($tareaEntity->orden_trabajo_id);
|
||||
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
|
||||
@ -1015,11 +1046,15 @@ class ProductionService extends BaseService
|
||||
$data["action_at"] = Time::now()->format('Y-m-d H:i:s');
|
||||
$data["action_user_id"] = auth()->user()->id;
|
||||
$status = $this->otTareaProgressDate->where('ot_tarea_id', $orden_trabajo_tarea_id)->delete();
|
||||
if($status){
|
||||
if ($status) {
|
||||
$tareaEntity = $this->otTarea->find($orden_trabajo_tarea_id);
|
||||
$this->init($tareaEntity->orden_trabajo_id);
|
||||
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
|
||||
$this->emptyOrdenTrabajoDate($this->ot->id,$dateName);
|
||||
$this->emptyOrdenTrabajoDate($this->ot->id, $dateName);
|
||||
$tareaEntity->tiempo_real = 0;
|
||||
$tareaEntity->click_init = 0;
|
||||
$tareaEntity->click_end = 0;
|
||||
$this->otTarea->save($tareaEntity);
|
||||
}
|
||||
if ($status) {
|
||||
$response = $this->storeOrdenTrabajoTareaProgressDate($data);
|
||||
@ -1105,6 +1140,9 @@ class ProductionService extends BaseService
|
||||
if (isset($data["is_pedido_espera"])) {
|
||||
$data["pedido_espera_by"] = auth()->user()->id;
|
||||
}
|
||||
if (isset($data["preimpresion_revisada"])) {
|
||||
$data["preimpresion_revisada_by"] = auth()->user()->id;
|
||||
}
|
||||
return $this->otModel->update($this->ot->id, $data);
|
||||
}
|
||||
public function updateOrdenTrabajoPedido($data)
|
||||
@ -1409,6 +1447,7 @@ class ProductionService extends BaseService
|
||||
}
|
||||
public function getTiempoTareasImpresionHHMM(): string
|
||||
{
|
||||
try {
|
||||
$tareas_impresion = $this->ot->tareas_impresion();
|
||||
$tiempo_seconds = 0;
|
||||
foreach ($tareas_impresion as $key => $tarea) {
|
||||
@ -1417,6 +1456,24 @@ class ProductionService extends BaseService
|
||||
}
|
||||
}
|
||||
return float_seconds_to_hhmm_string($tiempo_seconds);
|
||||
} catch (\Throwable $th) {
|
||||
return '00:00';
|
||||
}
|
||||
}
|
||||
public function getTiempoTotalTareas(): string
|
||||
{
|
||||
try {
|
||||
$tareas = $this->ot->tareas();
|
||||
$tiempo_seconds = 0;
|
||||
foreach ($tareas as $key => $tarea) {
|
||||
if ($tarea->tiempo_real) {
|
||||
$tiempo_seconds += $tarea->tiempo_real;
|
||||
}
|
||||
}
|
||||
return float_seconds_to_hhmm_string($tiempo_seconds);
|
||||
} catch (\Throwable $th) {
|
||||
return '00:00';
|
||||
}
|
||||
}
|
||||
public function getUVI(): ?TarifaAcabadoEntity
|
||||
{
|
||||
@ -1429,6 +1486,7 @@ class ProductionService extends BaseService
|
||||
}
|
||||
return $uvi;
|
||||
}
|
||||
//TODO ACTUALIZAR
|
||||
public function updateProgress(): bool
|
||||
{
|
||||
$userDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING;
|
||||
@ -1735,13 +1793,13 @@ class ProductionService extends BaseService
|
||||
$acabados = $this->presupuesto->acabados();
|
||||
foreach ($acabados as $key => $acabado) {
|
||||
$tarifa_acabado = $acabado->tarifa();
|
||||
if ($tarifa_acabado->retractilado) {
|
||||
if ($tarifa_acabado->rectractilado) {
|
||||
$flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->isPlakene = $flag;
|
||||
return $this->isPlakene;
|
||||
$this->isRetractilado = $flag;
|
||||
return $this->isRetractilado;
|
||||
}
|
||||
public function plakene_tipo(): ?string
|
||||
{
|
||||
@ -1873,10 +1931,12 @@ class ProductionService extends BaseService
|
||||
"pedidos.fecha_impresion",
|
||||
"orden_trabajo_tareas.nombre as tareaName",
|
||||
"orden_trabajo_tareas.maquina_id",
|
||||
"tarea_progress.estado as tareaEstado"
|
||||
"tarea_progress.estado as tareaEstado",
|
||||
"tarea_progress.estado",
|
||||
|
||||
])
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
// Obtener el ultimo estado de la tarea
|
||||
//* Obtener el ultimo estado de la tarea
|
||||
->join(
|
||||
'(SELECT ot_tarea_id, estado
|
||||
FROM orden_trabajo_tarea_progress_dates
|
||||
@ -1892,9 +1952,9 @@ class ProductionService extends BaseService
|
||||
->join("pedidos", "pedidos.id = ordenes_trabajo.pedido_id", "right")
|
||||
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
|
||||
->where('orden_trabajo_tareas.maquina_id', $maquina_id)
|
||||
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false)
|
||||
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false) //! Dejar comentado por ahora
|
||||
->where('ordenes_trabajo.preimpresion_revisada', true)
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->where("tarea_progress.estado", 'P')
|
||||
->orderBy("pedidos.fecha_impresion", "ASC")
|
||||
->groupBy('orden_trabajo_tareas.id');
|
||||
|
||||
@ -2075,7 +2135,7 @@ class ProductionService extends BaseService
|
||||
$data[$tareasAcabado->id] = 'plastificado_at';
|
||||
}
|
||||
if ($tarifaAcabado->rectractilado) {
|
||||
$data[$tareasAcabado->id] = 'rectractilado_at';
|
||||
$data[$tareasAcabado->id] = 'retractilado_at';
|
||||
}
|
||||
if ($tarifaAcabado->estampado) {
|
||||
$data[$tareasAcabado->id] = 'estampado_at';
|
||||
@ -2097,7 +2157,7 @@ class ProductionService extends BaseService
|
||||
$dateName = 'plastificado_at';
|
||||
}
|
||||
if ($tarifaAcabado->rectractilado) {
|
||||
$dateName = 'rectractilado_at';
|
||||
$dateName = 'retractilado_at';
|
||||
}
|
||||
if ($tarifaAcabado->plakene) {
|
||||
$dateName = 'plakene_at';
|
||||
@ -2155,4 +2215,23 @@ class ProductionService extends BaseService
|
||||
}
|
||||
return $dateName;
|
||||
}
|
||||
public function getTitleTareaEstado($tarea_id): array
|
||||
{
|
||||
$estadoTitle = $this->OT_TAREA_STATUS_TITLE["P"];
|
||||
$estadoColor = $this->ordenTrabajoConfig->OT_TAREA_STATUS_COLOR['P'];
|
||||
$userName = null;
|
||||
$progressDateEntity = $this->otTarea->find($tarea_id)->lastState();
|
||||
if ($progressDateEntity) {
|
||||
if (isset($this->OT_TAREA_STATUS_TITLE[$progressDateEntity->estado])) {
|
||||
$estadoTitle = $this->OT_TAREA_STATUS_TITLE[$progressDateEntity->estado];
|
||||
$estadoColor = $this->ordenTrabajoConfig->OT_TAREA_STATUS_COLOR[$progressDateEntity->estado];
|
||||
$userName = $progressDateEntity->user()->fullName();
|
||||
}
|
||||
}
|
||||
return [
|
||||
"title" => $estadoTitle,
|
||||
"color" => $estadoColor,
|
||||
"userName" => $userName ?? "",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<div class="row h-100">
|
||||
<div class="col-9">
|
||||
<div class="d-flex flex-column justify-content-evenly gap-2 h-100">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-12">
|
||||
<h4 class="alert-heading d-flex align-items-center gap-1">
|
||||
<span id="ot-id-header" style="color:red"></span>
|
||||
<span id="presupuesto-id" class="fs-bold"></span>
|
||||
<span id="ot-title" class="fs-bold"></span></h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p class="mb-0">Tiempo estimado</p>
|
||||
<h4 class="mb-0" id="tiempo-estimado-info">00:00:00</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p class="mb-0">Tiempo real</p>
|
||||
<h4 class="mb-0" id="tiempo-real-info">00:00:00</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 form-group form-group-lg">
|
||||
<label for="input-click-init" class="form-label"><?= lang('Produccion.click_init') ?></label>
|
||||
<input class="form-control input-lg ot-tarea-click" min="0" name="click_init" id="input-click-init" placeholder="<?= lang('Produccion.click_init') ?>" value="0">
|
||||
</div>
|
||||
<div class="col-md-12 form-group form-group-lg">
|
||||
<label for="input-click-init" class="form-label input-lg"><?= lang('Produccion.click_end') ?></label>
|
||||
<input class="form-control ot-tarea-click" min="0" name="click_end" id="input-click-end" placeholder="<?= lang('Produccion.click_end') ?>" value="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-3 h-100">
|
||||
<div class="d-flex flex-column justify-content-evenly gap-2 h-100">
|
||||
<button type="button" id="btn-cancel-tarea" class="maquina-btn btn btn-danger w-100 d-flex justify-content-evenly"><span class="ti ti-square-x ti-lg"></span><?= lang('Produccion.maquinista.cancel') ?></button>
|
||||
<button type="button" id="btn-finish-tarea" class="maquina-btn btn btn-primary w-100 d-flex justify-content-evenly action-btn"><span class="ti ti-player-eject ti-lg"></span><?= lang('Produccion.maquinista.play_end') ?></button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,55 @@
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<div class="row h-100">
|
||||
<div class="col-6">
|
||||
<div class="d-flex flex-column justify-content-evenly gap-2 h-100">
|
||||
|
||||
<div class="row mb-2">
|
||||
|
||||
<div class="col-md-6 mb-2">
|
||||
<p class="mb-0">Tirada</p>
|
||||
<h5 class="mb-0" id="tirada-info"></h5>
|
||||
</div>
|
||||
<div class="col-md-6 mb-2 <?= $maquinaEntity->tipo != "impresion" ? "d-none" : "" ?>" >
|
||||
<p class="mb-0">Clicks</p>
|
||||
<h5 class="mb-0" id="clicks-info"></h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-6">
|
||||
<p class="mb-0 text-truncate">Tiempo estimado</p>
|
||||
<h5 class="mb-0" id="tiempo-estimado-info"></h5>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p class="mb-0 text-truncate">Tiempo real</p>
|
||||
<h5 class="mb-0" id="tiempo-real-info"></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" <?= $maquinaEntity->tipo != "impresion" ? "disabled" : "" ?>>
|
||||
<div class="col-md-12 form-group form-group-lg">
|
||||
<label for="input-click-init" class="form-label"><?= lang('Produccion.click_init') ?></label>
|
||||
<input class="form-control input-lg ot-tarea-click" min="0" name="click_init" id="input-click-init" placeholder="<?= lang('Produccion.click_init') ?>" value="0">
|
||||
</div>
|
||||
<div class="col-md-12 form-group form-group-lg">
|
||||
<label for="input-click-init" class="form-label input-lg"><?= lang('Produccion.click_end') ?></label>
|
||||
<input class="form-control ot-tarea-click" min="0" name="click_end" id="input-click-end" placeholder="<?= lang('Produccion.click_end') ?>" value="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-6 h-100">
|
||||
<div class="d-flex flex-column justify-content-evenly gap-2 h-100">
|
||||
<button type="button" data-estado="I" id="btn-start-tarea" class="maquina-btn btn btn-success w-100 d-flex justify-content-evenly action-btn"><span class="ti ti-player-play ti-lg"></span><?= lang('Produccion.maquinista.play_tarea') ?></button>
|
||||
<button type="button" data-estado="S" id="btn-pause-tarea" class="maquina-btn btn btn-info w-100 d-flex justify-content-evenly d-none action-btn"><span class="ti ti-player-pause ti-lg"></span><?= lang('Produccion.maquinista.play_pause') ?></button>
|
||||
<button type="button" data-estado="D" id="btn-stop-tarea" class="maquina-btn btn btn-warning w-100 d-flex justify-content-evenly"><span class="ti ti-player-stop ti-lg"></span><?= lang('Produccion.maquinista.play_stop') ?></button>
|
||||
<button type="button" data-estado="F" id="btn-finish-tarea" class="maquina-btn btn btn-primary w-100 d-flex justify-content-evenly action-btn d-none"><span class="ti ti-player-eject ti-lg"></span><?= lang('Produccion.maquinista.play_end') ?></button>
|
||||
<button type="button" id="btn-delete-tarea" class="maquina-btn btn btn-danger w-100 d-flex justify-content-evenly"><span class="ti ti-square-x ti-lg"></span><?= lang('Produccion.maquinista.cancel') ?></button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -1,9 +1,9 @@
|
||||
<div class="table-maquinista table-responsive">
|
||||
|
||||
<table id="maquinista-tarea-table" class="table table-hover text-dark" style="width: 100%;">
|
||||
<table id="<?= $id ?>" class="table table-hover text-dark" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('ID') ?></th>
|
||||
<th><?= lang('OT ID') ?></th>
|
||||
<th><?= lang('Produccion.task.task') ?></th>
|
||||
<th><?= lang('Produccion.task.estado') ?></th>
|
||||
<th><?= lang('Produccion.datatable.fecha_impresion') ?></th>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
<tr>
|
||||
<th><?= lang('Produccion.task.order') ?></th>
|
||||
<th><?= lang('Produccion.task.task') ?></th>
|
||||
<th><?= lang('Produccion.task.estado') ?></th>
|
||||
<th><?= lang('Produccion.task.maquina_presupuesto') ?></th>
|
||||
<th><?= lang('Produccion.task.maquina_actual') ?></th>
|
||||
<th><?= lang('Produccion.task.imposicion') ?></th>
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
<!--Content Body-->
|
||||
<div class="row" id="viewMaquinistaFichajeAuto" data-id="<?= $maquinaEntity->id ?>">
|
||||
<div class="col-md-12">
|
||||
<div class="d-flex flex-row justify-content-end align-items-stretch mb-2 gap-2">
|
||||
<a type="button" id="tarea-list-link" class="btn btn-primary" href="<?= route_to('viewProduccionMaquinaTareasList', $maquinaEntity->id) ?>"><span class="icon-base ti ti-list ti-xs me-1"></span> <?= lang('Produccion.maquinista.tarea_list') ?></a>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row mb-2">
|
||||
|
||||
<div class="col-md-8 mb-2">
|
||||
<div class="alert alert-primary h-100 w-100" role="alert">
|
||||
<h4 class="alert-heading d-flex align-items-center gap-1"><span style="color:red">AUTO: </span><span class="fs-bold"><?= $maquinaEntity->nombre ?></span></h4>
|
||||
<hr>
|
||||
<p class="mb-0">
|
||||
<?= lang('Produccion.maquinista.fichaje_auto_alert_text') ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-2">
|
||||
<label for="ot-id" class="form-label"><strong><?= lang('Produccion.maquinista.next_ot') ?></strong></label>
|
||||
<input type="text" class="form-control h-50 fs-large" id="ot-id" name="orden_trabajo_id" placeholder="<?= lang('Produccion.maquinista.placeholder_ot_id') ?>">
|
||||
<div class="fs-medium fs-bold mt-2"><?= lang('Produccion.maquinista.fa_ot_input_form_text') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
</div>
|
||||
<div class="row mb-2 section-block d-none" id="ot-fa-card">
|
||||
<div class="col-md-12">
|
||||
<?= view('/themes/vuexy/components/cards/tarea_card_auto.php') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/maquinista.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/notiflix/notiflix.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/notiflix/notiflix.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||
<script type="module" src="<?= site_url("/assets/js/safekat/pages/configuracion/maquinista/viewFichajeAuto.js") ?>"></script>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="row" id="maquinas-impresion">
|
||||
<?php foreach ($maquinas["impresion"] as $key => $maquina): ?>
|
||||
<div class="col-md-4 col-sm-2 col-lg-3 col-xs-12 mb-2 h-100 p-2">
|
||||
<a href="<?= route_to("viewProduccionMaquinaTareasList", $maquina["maquinaId"]) ?>" type="button" class="maquina-btn btn btn-outline-primary w-100">
|
||||
<a href="<?= route_to("viewProduccionMaquinaTareasList", $maquina["maquinaId"]) ?>" type="button" class="maquina-btn btn btn-outline-<?= $maquina['countMaquinaTareas'] > 0 ? "danger" : "primary" ?> w-100">
|
||||
<span class="d-sm-inline-flex justify-content-between align-items-center gap-2">
|
||||
<?= $maquina["nombre"] ?>
|
||||
<?php if ($maquina["countTareas"] > 0): ?>
|
||||
@ -39,7 +39,7 @@
|
||||
<div class="row" id="maquinas-acabado">
|
||||
<?php foreach ($maquinas["acabado"] as $key => $maquina): ?>
|
||||
<div class="col-md-4 col-sm-2 col-lg-3 col-xs-12 mb-2 h-100 p-2">
|
||||
<a href="<?= route_to("viewProduccionMaquinaTareasList", $maquina["maquinaId"]) ?>" type="button" class="maquina-btn btn btn-outline-primary w-100">
|
||||
<a href="<?= route_to("viewProduccionMaquinaTareasList", $maquina["maquinaId"]) ?>" type="button" class="maquina-btn btn btn-outline-<?= $maquina['countMaquinaTareas'] > 0 ? "danger" : "primary" ?> w-100">
|
||||
<span class="d-sm-inline-flex justify-content-between align-items-center gap-2">
|
||||
<?= $maquina["nombre"] ?>
|
||||
<?php if ($maquina["countTareas"] > 0): ?>
|
||||
@ -60,7 +60,7 @@
|
||||
<div class="row" id="maquinas-manipulado">
|
||||
<?php foreach ($maquinas["manipulado"] as $key => $maquina): ?>
|
||||
<div class="col-md-4 col-sm-2 col-lg-3 col-xs-12 mb-2 h-100 p-2">
|
||||
<a href="<?= route_to("viewProduccionMaquinaTareasList", $maquina["maquinaId"]) ?>" type="button" class="maquina-btn btn btn-outline-primary w-100">
|
||||
<a href="<?= route_to("viewProduccionMaquinaTareasList", $maquina["maquinaId"]) ?>" type="button" class="maquina-btn btn btn-outline-<?= $maquina['countMaquinaTareas'] > 0 ? "danger" : "primary" ?> w-100">
|
||||
<span class="d-sm-inline-flex justify-content-between align-items-center gap-2">
|
||||
<?= $maquina["nombre"] ?>
|
||||
<?php if ($maquina["countTareas"] > 0): ?>
|
||||
|
||||
@ -11,23 +11,27 @@ use CodeIgniter\I18n\Time;
|
||||
?>
|
||||
<div class="row" id="viewMaquinistaMaquinaTareas" data-id="<?= $maquinaEntity->id ?>">
|
||||
<div class="col-md-12">
|
||||
<div class="d-flex flex-row justify-content-end align-items-stretch mb-2 gap-2">
|
||||
<a type="button" href="<?= route_to('viewMaquinistaFichajeAutomatico', $maquinaEntity->id) ?>" id="btn-fichaje-automatico" class="btn btn-primary" aria-pressed="true"><span class="icon-base ti ti-wand ti-xs me-1"></span> <?= lang('Produccion.maquinista.fichaje_auto') ?></a>
|
||||
<a type="button" href="<?= route_to('viewMaquinistaTareaScan', $maquinaEntity->id) ?>" id="btn-tarea-scan" class="btn btn-primary" aria-pressed="true"><span class="icon-base ti ti-scan ti-xs me-1"></span><?= lang('Produccion.maquinista.scan') ?></a>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div id="tareas-aplazadas" class="d-none">
|
||||
<?= view("/themes/vuexy/components/tables/maquinista_tarea_table.php", ["id" => "maquinista-tarea-aplazada-table"]) ?>
|
||||
</div>
|
||||
<div class="row mb-2 align-items-center">
|
||||
<div class="col-md-6 col-xs-12 justify-content-start ">
|
||||
<div class="d-flex flex-row justify-content-center align-items-stretch gap-2 h-100">
|
||||
<button type="button" id="btn-tareas-hoy" class="btn btn-primary h-100 active w-50" aria-pressed="true"><?= lang('Produccion.maquinista.tareas_hoy') ?></button>
|
||||
<button type="button" id="btn-all-tareas" class="btn btn-primary h-100 w-50"><?= lang('Produccion.maquinista.tareas_all') ?></button>
|
||||
<div class="d-flex flex-row justify-content-start align-items-stretch gap-2 h-100">
|
||||
<button type="button" id="btn-tareas-hoy" class="btn btn-primary h-100 active" aria-pressed="true"><?= lang('Produccion.maquinista.tareas_hoy') ?></button>
|
||||
<button type="button" id="btn-all-tareas" class="btn btn-primary h-100"><?= lang('Produccion.maquinista.tareas_all') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-xs-12 justify-content-end d-flex">
|
||||
<span class="display-6" id="today-date"><?= Time::now()->format('d/m/Y') ?></span>
|
||||
</div>
|
||||
<!-- <div class="d-flex flex-row justify-content-end align-content-center gap-2">
|
||||
<button type="button" class="btn btn-primary"><?= lang('Produccion.maquinista.maquinas') ?></button>
|
||||
</div> -->
|
||||
</div>
|
||||
<?= view("/themes/vuexy/components/tables/maquinista_tarea_table.php") ?>
|
||||
<?= view("/themes/vuexy/components/tables/maquinista_tarea_table.php", ["id" => "maquinista-tarea-table"]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
<!--Content Body-->
|
||||
<div class="row" id="viewMaquinistaTareaScan" data-id="<?= $maquinaEntity->id ?>">
|
||||
<div class="col-md-12">
|
||||
<div class="d-flex flex-row justify-content-end align-items-stretch mb-2 gap-2">
|
||||
<a type="button" id="tarea-list-link" class="btn btn-primary" href="<?= route_to('viewProduccionMaquinaTareasList', $maquinaEntity->id) ?>"><span class="icon-base ti ti-list ti-xs me-1"></span> <?= lang('Produccion.maquinista.tarea_list') ?></a>
|
||||
</div>
|
||||
<div class="card section-block">
|
||||
<div class="card-body">
|
||||
<h4 class="alert-heading d-flex align-items-center gap-1"><span style="color:red">ESCANEAR: </span><span class="fs-bold"><?= $maquinaEntity->nombre ?></span></h4>
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
<div class="row ot-scan-wrapper">
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-danger" id="btn-reset-ots">
|
||||
<span class="icon-base ti ti-trash me-1"></span>
|
||||
<?= lang('Produccion.maquinista.reset') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2 ot-scan-wrapper">
|
||||
<div class="col-md-8 mb-2">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table-scanned-ots" class="table-maquinista table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Produccion.datatable.ot_id') ?></th>
|
||||
<th><?= lang('Produccion.datatable.titulo') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="ot-id" class="form-label"><strong><?= lang('Produccion.maquinista.next_ot') ?></strong></label>
|
||||
<input type="text" class="form-control h-50 fs-large" id="ot-id" name="orden_trabajo_id" placeholder="<?= lang('Produccion.maquinista.placeholder_ot_id') ?>">
|
||||
<div class="fs-medium fs-bold mt-2"><?= lang('Produccion.maquinista.scan_ot_input_form_text') ?></div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<button type="button" class="maquina-btn btn btn-primary w-100" id="btn-save-maquina-ots" disabled>
|
||||
<span class="icon-base ti ti-arrow-big-right me-1"></span>
|
||||
<?= lang('Produccion.maquinista.next_scan_ot') ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 d-none" id="ot-maquina-tareas-link">
|
||||
<a class="maquina-btn btn btn-primary w-100" href="<?= route_to('viewProduccionMaquinistaOtTareasView', $maquinaEntity->id) ?>">
|
||||
<span class="icon-base ti ti-arrow-big-right me-1"></span>
|
||||
<?= lang('Produccion.maquinista.next_scan_ot') ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/maquinista.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/notiflix/notiflix.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/notiflix/notiflix.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||
<script type="module" src="<?= site_url("/assets/js/safekat/pages/configuracion/maquinista/viewMaquinistaScan.js") ?>"></script>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -0,0 +1,81 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
<!--Content Body-->
|
||||
<div class="row" id="viewProduccionMaquinistaOtTareasView" data-id="<?= $maquinaEntity->id ?>">
|
||||
<div class="nav-align-top">
|
||||
<ul class="nav nav-pills mb-4 nav-fill" role="tablist">
|
||||
<li class="nav-item mb-1 mb-sm-0">
|
||||
<button
|
||||
type="button"
|
||||
class="nav-link active"
|
||||
role="tab"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#navs-tarea"
|
||||
aria-controls="navs-tarea"
|
||||
aria-selected="true">
|
||||
<span class="d-none d-sm-inline-flex align-items-center">
|
||||
<?= lang('Produccion.ots') ?>
|
||||
</span>
|
||||
<i class="icon-base ti tabler-home icon-sm d-sm-none"></i>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="navs-tarea">
|
||||
<div class="container-fluid h-100">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
<div class="row tarea-card-action-block">
|
||||
<div class="col-md-6 mb-2">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table-scanned-ots" class="table-maquinista table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-20"><?= lang('Produccion.datatable.ot_id') ?></th>
|
||||
<th class="w-30"><?= lang('Produccion.datatable.titulo') ?></th>
|
||||
<th class="w-40"><?= lang('Produccion.datatable.barcode') ?></th>
|
||||
<th class="w-10"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-2">
|
||||
<?= view("/themes/vuexy/components/cards/tarea_multiple_card_actions.php") ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/maquinista.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/notiflix/notiflix.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/notiflix/notiflix.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||
<script type="module" src="<?= site_url("/assets/js/safekat/pages/configuracion/maquinista/viewTareaMultipleView.js") ?>"></script>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -22,7 +22,11 @@
|
||||
<i class="ti ti-dimensions ti-lg"></i>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0" id="ot-formato"><?=$presupuesto->papel_formato()->ancho?>x<?=$presupuesto->papel_formato()->alto?></h5>
|
||||
<?php if ($presupuesto->papel_formato_personalizado): ?>
|
||||
<h5 class="mb-0" id="ot-formato"><?= $presupuesto->papel_formato_ancho ?>x<?= $presupuesto->papel_formato_alto ?></h5>
|
||||
<?php else: ?>
|
||||
<h5 class="mb-0" id="ot-formato"><?= $presupuesto->papel_formato()->ancho ?>x<?= $presupuesto->papel_formato()->alto ?></h5>
|
||||
<?php endif; ?>
|
||||
<span class="fx-large"><?= @lang("Produccion.formato") ?></span>
|
||||
</div>
|
||||
</div>
|
||||
@ -33,30 +37,32 @@
|
||||
<i class="ti ti-box-multiple ti-lg"></i>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0" id="ot-paginas"><?=$presupuesto->paginas?></h5>
|
||||
<h5 class="mb-0" id="ot-paginas"><?= $presupuesto->paginas ?></h5>
|
||||
<span class="fx-large"><?= @lang("Produccion.paginas") ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($presupuesto->solapas): ?>
|
||||
<div class="col-md-2 col-6">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="badge rounded-pill bg-label-danger me-3 p-2">
|
||||
<i class="ti ti-bookmark ti-lg"></i>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0" id="ot-solapa"><?=$presupuesto->solapas > 0 ? $presupuesto->solapas : 0?></h5>
|
||||
<h5 class="mb-0" id="ot-solapa"><?= number_format($presupuesto->solapas_ancho, 2, ',', '.') ?> mm</h5>
|
||||
|
||||
<span class="fx-large"><?= @lang("Produccion.solapa") ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="col-md-2 col-6">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="badge rounded-pill bg-label-success me-3 p-2">
|
||||
<i class="ti ti-books ti-lg"></i>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0" id="ot-tirada"><?=$presupuesto->tirada?></h5>
|
||||
<h5 class="mb-0" id="ot-tirada"><?= $presupuesto->tirada ?></h5>
|
||||
|
||||
<span class="fx-large"><?= @lang("Produccion.tirada") ?></span>
|
||||
</div>
|
||||
@ -68,7 +74,7 @@
|
||||
<i class="ti ti-notebook ti-lg"></i>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0" id="ot-merma"><?=$presupuesto->merma?></h5>
|
||||
<h5 class="mb-0" id="ot-merma"><?= $presupuesto->merma ?></h5>
|
||||
|
||||
<span class="fx-large"><?= @lang("Produccion.merma") ?></span>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?= view("themes/vuexy/components/dropzone",data: ['id' => 'dropzone-ot-files','modelId' => $modelId]) ?>
|
||||
<?= view("themes/vuexy/components/dropzone",data: ['id' => 'dropzone-ot-files','modelId' => $presupuesto->id]) ?>
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
@ -12,15 +12,37 @@
|
||||
|
||||
<div id="accordionOtProgressTip" class="accordion-collapse collapse show" data-bs-parent="#accordionOtProgress">
|
||||
<div class="accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="row justify-content-start align-items-center">
|
||||
<div class="col-md-8 mb-3">
|
||||
<label class="form-label" for="ot-progress-bar-parent"><?= @lang("App.progress") ?></label>
|
||||
<div class="progress" style="height: 25px;" id="ot-progress-bar-parent">
|
||||
<div id="ot-progress-bar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-6">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="badge rounded-pill bg-label-primary me-3 p-2">
|
||||
<i class="ti ti-clock ti-lg"></i>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0 tiempo-estimado" id="ot-tiempo-estimado"><?= $tiempo_estimado ?></h5>
|
||||
<span class="fx-large"><?= @lang("Produccion.tiempo_estimado") ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-6">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="badge rounded-pill bg-label-warning me-3 p-2">
|
||||
<i class="ti ti-clock ti-lg"></i>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<h5 class="mb-0 tiempo-estimado" id="tiempo-total"></h5>
|
||||
<span class="fx-large"><?= @lang("Produccion.tiempo_consumido") ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-3 <?= $user_dates["pre_formato_at"] || $user_dates["pre_lomo_at"] || $user_dates["pre_solapa_at"] || $user_dates["pre_codbarras_at"] || $user_dates["pre_imposicion_at"] ? "" : "d-none" ?>">
|
||||
<!-- PREIMPRESION -->
|
||||
<!-- Preformato -->
|
||||
@ -268,7 +290,7 @@
|
||||
|
||||
</div>
|
||||
<!-- Progress -->
|
||||
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= count($ot->tareas_encuadernado()) > 0 ? "" : "d-none" ?>">
|
||||
<div class="col-xs-12 col-md-4 col-lg-4 mb-2 w-100 <?= count($ot->tareas_manipulado()) > 0 ? "" : "d-none" ?>">
|
||||
<label for="ot-manipulado" class="form-label"><?= @lang("Produccion.manipulado") ?></label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control ot-date" placeholder="DD/MM/YYYY" name="entrada_manipulado_at" id="ot-manipulado" data-input <?= $is_finalizada ? "disabled" : "" ?>>
|
||||
@ -318,14 +340,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<p><?= @lang("Produccion.tiempo_estimado") ?> : <?= $tiempo_estimado ?> (HH:MM)</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p><?= @lang("Produccion.tiempo_consumido") ?> :</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="d-flex flex-row justify-content-between align-items-center">
|
||||
@ -342,12 +357,31 @@
|
||||
<span class="switch-label fw-lg"><?= @lang("Produccion.pedido_espera") ?></span>
|
||||
<span class="badge text-bg-warning fw-lg" id="pedido_espera_by"></span>
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-2">
|
||||
<div class="d-flex flex-row justify-content-between align-items-center">
|
||||
|
||||
<label class="switch switch-success switch-lg mt-1">
|
||||
<input type="checkbox" class="switch-input ot-preview" id="ot-preimpresion-revisada" name="preimpresion_revisada" data-input <?= $is_finalizada ? "disabled" : "" ?> />
|
||||
<span class="switch-toggle-slider">
|
||||
<span class="switch-on">
|
||||
<i class="ti ti-check"></i>
|
||||
</span>
|
||||
<span class="switch-off">
|
||||
<i class="ti ti-x"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="switch-label fw-lg"><?= @lang("Produccion.preimpresion_revisada") ?></span>
|
||||
<span class="badge text-bg-primary fw-lg" id="preimpresion_revisada_by"></span>
|
||||
</label>
|
||||
<?php if ($is_finalizada): ?>
|
||||
<button type="button" id="btn-reactivar-orden-pedido" class="btn btn-primary btn-block"><?= @lang("Produccion.reactivar_orden") ?></button>
|
||||
<?php else: ?>
|
||||
<button type="button" id="btn-finalizar-orden-pedido" class="btn btn-warning btn-block"><?= @lang("Produccion.finalizar_orden") ?></button>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -11,17 +11,30 @@
|
||||
<div class="nav-tabs-shadow nav-align-top">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-finalizados-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-finalizados"><?= lang("Produccion.finalizadas") ?></button>
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-news-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-news"><?= lang("Produccion.navs.news") ?></button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link active" role="tab" id="navs-top-align-pendientes-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-pendientes"><?= lang("Produccion.pendientes") ?></button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-waiting-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-waiting"><?= lang("Produccion.navs.waiting") ?></button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-ferro-pendiente-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ferro-pendiente"><?= lang("Produccion.pendiente_ferro") ?></button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-ferro-ok-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ferro-ok"><?= lang("Produccion.ferro_ok") ?></button>
|
||||
</li>
|
||||
|
||||
<li class="nav-item d-none">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-revision-com-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-revision-com"><?= lang("Produccion.navs.revision_com") ?></button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-prod-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-prod"><?= lang("Produccion.navs.prod") ?></button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" id="navs-top-align-finalizados-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-finalizados"><?= lang("Produccion.finalizadas") ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="ots-datatables-container">
|
||||
<div class="tab-pane fade show" id="navs-top-align-finalizados">
|
||||
@ -36,6 +49,19 @@
|
||||
<div class="tab-pane fade show" id="navs-top-align-ferro-ok">
|
||||
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-ferro-ok"]) ?>
|
||||
</div>
|
||||
<div class="tab-pane fade show" id="navs-top-align-news">
|
||||
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-news"]) ?>
|
||||
</div>
|
||||
<div class="tab-pane fade show" id="navs-top-align-waiting">
|
||||
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-waiting"]) ?>
|
||||
</div>
|
||||
<div class="tab-pane fade show" id="navs-top-align-revision-com">
|
||||
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-revision-com"]) ?>
|
||||
</div>
|
||||
<div class="tab-pane fade show" id="navs-top-align-prod">
|
||||
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable-prod"]) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--//.card -->
|
||||
</div>
|
||||
|
||||
@ -22,11 +22,6 @@ if (auth()->user()->inGroup('maquina','admin')) {
|
||||
<div><?= lang("App.menu_maquinista_colas") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("viewProduccionMaquinistaMantenimiento") ?>" class="menu-link beta">
|
||||
<div><?= lang("App.menu_maquinista_mantenimiento") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php } ?>
|
||||
@ -286,9 +286,7 @@ $settings = $session->get('settings');
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 d-flex justify-content-center align-items-center">
|
||||
<span class="footer">© 2024 SAFEKAT. Todos los derechos reservados.</span>
|
||||
</div>
|
||||
|
||||
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
|
||||
|
||||
@ -393,11 +393,6 @@ $settings = $session->get('settings');
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 d-flex justify-content-center align-items-center">
|
||||
<span class="footer">© 2024 SAFEKAT. Todos los derechos reservados.</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
|
||||
|
||||
@ -391,9 +391,7 @@ $settings = $session->get('settings');
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 d-flex justify-content-center align-items-center">
|
||||
<span class="footer">© 2024 SAFEKAT. Todos los derechos reservados.</span>
|
||||
</div>
|
||||
|
||||
<script src=<?= site_url("themes/vuexy/vendor/libs/html2pdf/html2pdf.bundle.min.js") ?>></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/jquery/jquery.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/popper/popper.js') ?>"></script>
|
||||
|
||||
@ -6,6 +6,12 @@ class OrdenTrabajoDatatable {
|
||||
this.datatablePendientesItem = this.item.find("#ot-datatable-pendientes")
|
||||
this.datatableFerroPendienteItem = this.item.find("#ot-datatable-ferro-pendiente")
|
||||
this.datatableFerroOkItem = this.item.find("#ot-datatable-ferro-ok")
|
||||
this.datatableNews = this.item.find("#ot-datatable-news")
|
||||
this.datatableProd = this.item.find("#ot-datatable-prod")
|
||||
this.datatableWaiting = this.item.find("#ot-datatable-waiting")
|
||||
this.datatableRevisionComerical = this.item.find("#ot-datatable-revision-com")
|
||||
|
||||
|
||||
|
||||
|
||||
this.datatableColumns = [
|
||||
@ -37,15 +43,15 @@ class OrdenTrabajoDatatable {
|
||||
render: (d, t) => {
|
||||
return `<div class="btn-group btn-group-sm">
|
||||
<a type="button" href="/produccion/ordentrabajo/edit/${d}" class=" btn btn-outline ot-edit"><i class="ti ti-eye ti-sm mx-2"></i></a>
|
||||
<a type="button" target="_blank" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
|
||||
|
||||
</div>`
|
||||
}
|
||||
// <a type="button" target="_blank" href="/produccion/ordentrabajo/pdf/${d}" class="btn btn-outline ot-pdf"><i class="ti ti-download ti-sm mx-2"></i></a>
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
init() {
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
@ -71,7 +77,7 @@ class OrdenTrabajoDatatable {
|
||||
});
|
||||
}
|
||||
initPendientes() {
|
||||
this.datatable = this.datatablePendientesItem.DataTable({
|
||||
this.datatablePendientesItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
@ -98,7 +104,7 @@ class OrdenTrabajoDatatable {
|
||||
});
|
||||
}
|
||||
initFerroPendiente() {
|
||||
this.datatable = this.datatableFerroPendienteItem.DataTable({
|
||||
this.datatableFerroPendienteItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
@ -124,7 +130,7 @@ class OrdenTrabajoDatatable {
|
||||
});
|
||||
}
|
||||
initFerroOk() {
|
||||
this.datatable = this.datatableFerroOkItem.DataTable({
|
||||
this.datatableFerroOkItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
@ -149,6 +155,110 @@ class OrdenTrabajoDatatable {
|
||||
}
|
||||
});
|
||||
}
|
||||
initNews() {
|
||||
this.datatableNews.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
columnDefs: [
|
||||
{ className: 'dt-center', targets: '_all' },
|
||||
|
||||
],
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_news',
|
||||
createdRow: (row,data,dataIndex) => {
|
||||
$(row).css("border-left",`20px solid ${data.logo.color}`)
|
||||
$(row).css("border-right",`20px solid ${data.logo.color}`)
|
||||
}
|
||||
});
|
||||
}
|
||||
initWaiting() {
|
||||
this.datatableWaiting.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
columnDefs: [
|
||||
{ className: 'dt-center', targets: '_all' },
|
||||
|
||||
],
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_waiting',
|
||||
createdRow: (row,data,dataIndex) => {
|
||||
$(row).css("border-left",`20px solid ${data.logo.color}`)
|
||||
$(row).css("border-right",`20px solid ${data.logo.color}`)
|
||||
}
|
||||
});
|
||||
}
|
||||
initProd() {
|
||||
this.datatableProd.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
columnDefs: [
|
||||
{ className: 'dt-center', targets: '_all' },
|
||||
|
||||
],
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_prod',
|
||||
createdRow: (row,data,dataIndex) => {
|
||||
$(row).css("border-left",`20px solid ${data.logo.color}`)
|
||||
$(row).css("border-right",`20px solid ${data.logo.color}`)
|
||||
}
|
||||
});
|
||||
}
|
||||
initRevisionComercial() {
|
||||
this.datatableRevisionComerical.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
topStart: 'pageLength',
|
||||
topEnd: 'search',
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
columnDefs: [
|
||||
{ className: 'dt-center', targets: '_all' },
|
||||
|
||||
],
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/datatable_revision_com',
|
||||
createdRow: (row,data,dataIndex) => {
|
||||
$(row).css("border-left",`20px solid ${data.logo.color}`)
|
||||
$(row).css("border-right",`20px solid ${data.logo.color}`)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,175 @@
|
||||
|
||||
import Ajax from '../../../components/ajax.js'
|
||||
import { alertConfirmAction, alertError, alertSuccess } from '../../../components/alerts/sweetAlert.js'
|
||||
|
||||
class MaquinistaFichajeAuto {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
/** ELEMENT DOM VARIABLES */
|
||||
this.otInputId = this.item.find('#ot-id')
|
||||
this.wrapperCard = this.item.find('#ot-fa-card')
|
||||
this.btnCancelTarea = this.item.find('#btn-cancel-tarea')
|
||||
this.btnFinishTarea = this.item.find('#btn-finish-tarea')
|
||||
this.inputClickInit = this.item.find("#input-click-init")
|
||||
this.inputClickEnd = this.item.find("#input-click-end")
|
||||
|
||||
this.otId = null
|
||||
this.lastOtId = null
|
||||
this.maquinaId = this.item.data("id")
|
||||
this.tareas = []
|
||||
|
||||
}
|
||||
init() {
|
||||
Notiflix.Block.circle('.section-block');
|
||||
this.otInputId.trigger('focus')
|
||||
this.otInputId.on('change', this._handleGetOt.bind(this))
|
||||
this.btnFinishTarea.on('click', this._handleFinishTareasConfirm.bind(this))
|
||||
}
|
||||
|
||||
hideCard() {
|
||||
this.wrapperCard.addClass('d-none')
|
||||
}
|
||||
showCard() {
|
||||
this.wrapperCard.removeClass('d-none')
|
||||
}
|
||||
actionLoader(status = true) {
|
||||
if (status) {
|
||||
Notiflix.Block.circle('.section-block');
|
||||
} else {
|
||||
Notiflix.Block.remove('.section-block');
|
||||
}
|
||||
}
|
||||
|
||||
getFormData() {
|
||||
return {
|
||||
maquina_id: this.maquinaId,
|
||||
tareas: this.tareas,
|
||||
click_init: this.inputClickInit.val() ?? 0,
|
||||
click_end: this.inputClickEnd.val() ?? 0
|
||||
}
|
||||
}
|
||||
fillData(data) {
|
||||
this.lastOtId = data.ot.id
|
||||
this.item.find('#ot-id-header').text(data.ot.id)
|
||||
this.item.find('#presupuesto-id').text(data.presupuesto.id)
|
||||
this.item.find('#ot-title').text(data.presupuesto.titulo)
|
||||
if (data.tareas) {
|
||||
this.tareas = data.tareas.map(tarea => tarea.id)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
_handleGetOt() {
|
||||
this.otId = this.otInputId.val();
|
||||
this.otInputId.removeClass('is-valid')
|
||||
this.otInputId.removeClass('is-invalid')
|
||||
this.actionLoader(false)
|
||||
let ajax = new Ajax(
|
||||
`/produccion/ordentrabajo/tareas/maquina/${this.otId}/${this.maquinaId}`,
|
||||
null,
|
||||
null,
|
||||
this._handleGetOtSuccess.bind(this),
|
||||
this._handleGetOtError.bind(this)
|
||||
)
|
||||
if (this.otId) {
|
||||
ajax.get();
|
||||
}
|
||||
}
|
||||
_handleGetOtSuccess(response) {
|
||||
this.showCard();
|
||||
if (this.lastOtId) {
|
||||
console.log("Siguiente OT insertada")
|
||||
console.log("Iniciar ", this.otId)
|
||||
if (this.lastOtId != this.otId) {
|
||||
console.log("Finalizar", this.lastOtId)
|
||||
this._handleFinishTareas(this.lastOtId)
|
||||
}
|
||||
} else {
|
||||
console.log("Primera OT insertada")
|
||||
}
|
||||
this.otInputId.addClass('is-valid')
|
||||
popSuccessAlert(response.message)
|
||||
this.actionLoader(false)
|
||||
if (response.data) {
|
||||
this.fillData(response.data)
|
||||
response.data.tareas.forEach(tarea => {
|
||||
this._handleInitTareas(tarea.id, 'I')
|
||||
});
|
||||
}
|
||||
}
|
||||
_handleGetOtError(error) {
|
||||
this.hideCard()
|
||||
this.otInputId.addClass('is-invalid')
|
||||
popErrorAlert(error.responseJSON.message)
|
||||
}
|
||||
_handleInitTareas(tareaId, estado = 'I') {
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/update/tarea/progress',
|
||||
{
|
||||
ot_tarea_id: tareaId,
|
||||
estado: estado
|
||||
}, null,
|
||||
this._handleInitTareasSuccess.bind(this),
|
||||
this._handleInitTareasError.bind(this)
|
||||
);
|
||||
if (tareaId) {
|
||||
ajax.post();
|
||||
}
|
||||
}
|
||||
_handleInitTareasSuccess() { }
|
||||
_handleInitTareasError() { }
|
||||
|
||||
_handleFinishTareas(otId) {
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/finish',
|
||||
{
|
||||
orden_trabajo_id: otId,
|
||||
...this.getFormData()
|
||||
}, null,
|
||||
this._handleFinishTareasSucess.bind(this),
|
||||
this._handleFinishTareasError.bind(this)
|
||||
);
|
||||
ajax.post()
|
||||
|
||||
}
|
||||
_handleFinishTareasConfirm(event) {
|
||||
let otId = this.otInputId.val()
|
||||
console.log("Finalizar", otId);
|
||||
let ajax = new Ajax('/produccion/ordentrabajo/fa/tareas/finish',
|
||||
{
|
||||
orden_trabajo_id: otId,
|
||||
...this.getFormData()
|
||||
}, null,
|
||||
this._handleFinishTareasConfirmSucess.bind(this),
|
||||
this._handleFinishTareasConfirmError.bind(this)
|
||||
);
|
||||
if (otId) {
|
||||
alertConfirmAction('Se va finalizar la tarea actual y se cancelará el modo auto.')
|
||||
.then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
ajax.post();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
_handleFinishTareasConfirmSucess(response) {
|
||||
this.hideCard()
|
||||
this.otInputId.val(null)
|
||||
this.otId = null
|
||||
this.lastOtId = null
|
||||
this.tareas = []
|
||||
popSuccessAlert(response.message)
|
||||
}
|
||||
_handleFinishTareasConfirmError() { }
|
||||
_handleFinishTareasSucess() { }
|
||||
_handleFinishTareasError() { }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default MaquinistaFichajeAuto;
|
||||
@ -0,0 +1,223 @@
|
||||
|
||||
|
||||
import Ajax from '../../../components/ajax.js'
|
||||
import { alertConfirmAction, alertError, alertSuccess } from '../../../components/alerts/sweetAlert.js'
|
||||
class MaquinistaMultipleTarea {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.maquinaId = this.item.data("id");
|
||||
this.btnPlay = this.item.find("#btn-start-tarea")
|
||||
this.btnPause = this.item.find("#btn-pause-tarea")
|
||||
this.btnDelay = this.item.find("#btn-stop-tarea")
|
||||
this.btnFinish = this.item.find("#btn-finish-tarea")
|
||||
this.btnDeleteProgress = this.item.find("#btn-delete-tarea")
|
||||
this.actionButtons = this.item.find('.action-btn')
|
||||
this.tareaCardClass = '.tarea-card-action-block'
|
||||
this.inputClick = $('.ot-tarea-click')
|
||||
this.datatableItem = this.item.find('#table-scanned-ots')
|
||||
this.datatableColumns = [
|
||||
{ data: 'otId', searchable: false, sortable: false },
|
||||
{ data: 'titulo', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'barcode', searchable: false, sortable: false, render: (d, t) => {
|
||||
return `<img class="img-fluid w-100 h-50" src="data:image/png;base64,${d}" alt="barcode" />`
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false, render: (d, t) => {
|
||||
return `<a href="/produccion/ordentrabajo/edit/${d}" type="button" title="OT" class="maquina-btn btn btn-primary d-flex justify-content-center gap-2"><span class="ti ti-eye ti-lg"></span></a>`
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
init() {
|
||||
this.actionButtons.on('click', this.eventActionButton.bind(this))
|
||||
this.btnDelay.on('click', this.delayEventActionButton.bind(this))
|
||||
this.btnDeleteProgress.on('click', this.deleteAll.bind(this))
|
||||
this.actionLoader(true)
|
||||
this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
dom: "",
|
||||
serverSide: true,
|
||||
ordering: false,
|
||||
pageLength: 25,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/produccion/ordentrabajo/maquinas/ots/datatable/' + this.maquinaId,
|
||||
|
||||
});
|
||||
this.initData()
|
||||
}
|
||||
async initData() {
|
||||
try {
|
||||
let responseData = await this.getMaquinaMultipleTarea();
|
||||
this.fillCardData(responseData)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.actionLoader(false)
|
||||
}
|
||||
}
|
||||
fillCardData(responseData) {
|
||||
this.item.find('#tirada-info').text(responseData?.tirada_total ?? 0)
|
||||
this.item.find('#clicks-info').text(responseData?.clicks_total ?? 0)
|
||||
this.item.find('#tiempo-estimado-info').text(responseData.tiempo_total_estimado ?? "00:00:00")
|
||||
this.item.find('#tiempo-real-info').text(responseData.tiempo_total_real ?? "00:00:00")
|
||||
this.showBasedOnStatus(responseData.estado)
|
||||
}
|
||||
async deleteAll() {
|
||||
try {
|
||||
let result = await alertConfirmAction('Se resetearán las tareas y se borrará el progreso')
|
||||
if(result.isConfirmed){
|
||||
let response = await this.deleteMaquinaOrdenesTrabajo()
|
||||
popSuccessAlert(response.message);
|
||||
window.location.reload();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
}
|
||||
async eventActionButton(event) {
|
||||
try {
|
||||
this.actionLoader(true)
|
||||
let statusClick = $(event.currentTarget).data('estado');
|
||||
this.showBasedOnStatus(statusClick);
|
||||
console.info(`Estado ${statusClick}`)
|
||||
this.showBasedOnStatus(statusClick);
|
||||
if (statusClick == "F") {
|
||||
let result = await alertConfirmAction('Se marcarán como finalizadas todas las tareas')
|
||||
if (result.isConfirmed == false) {
|
||||
this.enableButtons()
|
||||
throw new Error('Cancelado')
|
||||
}
|
||||
}
|
||||
let response = await this.updateEstadoOts(statusClick)
|
||||
popSuccessAlert(response.message)
|
||||
let responseData = await this.getMaquinaMultipleTarea()
|
||||
this.fillCardData(responseData)
|
||||
if(statusClick == "F"){
|
||||
window.location.reload();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.actionLoader(false)
|
||||
}
|
||||
}
|
||||
|
||||
async delayEventActionButton(event) {
|
||||
try {
|
||||
this.actionLoader(true)
|
||||
let statusClick = $(event.currentTarget).data('estado');
|
||||
this.showBasedOnStatus(statusClick);
|
||||
let response = await this.updateEstadoOts(statusClick)
|
||||
popSuccessAlert(response.message)
|
||||
let responseData = await this.getMaquinaMultipleTarea()
|
||||
this.fillCardData(responseData)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.actionLoader(false)
|
||||
}
|
||||
}
|
||||
actionLoader(status = true) {
|
||||
if (status) {
|
||||
Notiflix.Block.circle(this.tareaCardClass);
|
||||
} else {
|
||||
Notiflix.Block.remove(this.tareaCardClass);
|
||||
}
|
||||
}
|
||||
showPlay() {
|
||||
this.btnPause.addClass('d-none')
|
||||
this.btnPlay.removeClass('d-none')
|
||||
this.btnFinish.removeClass('d-none')
|
||||
this.btnDelay.removeClass('d-none')
|
||||
|
||||
}
|
||||
showPause() {
|
||||
this.btnPlay.addClass('d-none')
|
||||
this.btnFinish.addClass('d-none')
|
||||
this.btnPause.removeClass('d-none')
|
||||
|
||||
}
|
||||
disableButtons() {
|
||||
this.actionButtons.attr('disabled', 'disabled')
|
||||
this.btnDelay.attr('disabled', 'disabled')
|
||||
this.btnDeleteProgress.attr('disabled', 'disabled')
|
||||
}
|
||||
enableButtons() {
|
||||
this.actionButtons.removeAttr('disabled')
|
||||
this.btnDelay.removeAttr('disabled', 'disabled')
|
||||
this.btnDeleteProgress.removeAttr('disabled', 'disabled')
|
||||
}
|
||||
|
||||
showBasedOnStatus(status) {
|
||||
if (['P', 'S'].includes(status)) {
|
||||
this.enableButtons()
|
||||
this.showPlay()
|
||||
}
|
||||
if (['F', 'E'].includes(status)) {
|
||||
this.disableButtons()
|
||||
this.showPlay()
|
||||
}
|
||||
if (status == 'I') {
|
||||
this.enableButtons()
|
||||
this.showPause()
|
||||
}
|
||||
if (status == "D") {
|
||||
this.showPlay()
|
||||
}
|
||||
|
||||
}
|
||||
getClicks() {
|
||||
return {
|
||||
click_init: this.item.find('#input-click-init').val() ?? 0,
|
||||
click_end: this.item.find('#input-click-end').val() ?? 0,
|
||||
}
|
||||
}
|
||||
/** maquinas/ots/estado */
|
||||
updateEstadoOts(estado) {
|
||||
return new Promise((resolve, reject) => {
|
||||
new Ajax('/produccion/ordentrabajo/maquinas/ots/estado',
|
||||
{
|
||||
maquina_id: this.maquinaId,
|
||||
estado: estado,
|
||||
...this.getClicks()
|
||||
},
|
||||
null,
|
||||
resolve,
|
||||
reject
|
||||
).post()
|
||||
})
|
||||
}
|
||||
getMaquinaMultipleTarea() {
|
||||
return new Promise((resolve, reject) => {
|
||||
new Ajax('/produccion/ordentrabajo/maquinas/ots/' + this.maquinaId,
|
||||
null,
|
||||
null,
|
||||
resolve,
|
||||
reject
|
||||
).get()
|
||||
})
|
||||
}
|
||||
|
||||
deleteMaquinaOrdenesTrabajo() {
|
||||
return new Promise((resolve, reject) => {
|
||||
new Ajax('/produccion/ordentrabajo/maquinas/ots/all/' + this.maquinaId,
|
||||
null,
|
||||
null,
|
||||
resolve,
|
||||
reject
|
||||
).delete()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default MaquinistaMultipleTarea;
|
||||
@ -0,0 +1,164 @@
|
||||
|
||||
import Ajax from '../../../components/ajax.js'
|
||||
import { alertConfirmAction, alertError, alertSuccess } from '../../../components/alerts/sweetAlert.js'
|
||||
|
||||
class MaquinistaScan {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
/** ELEMENT DOM VARIABLES */
|
||||
this.otInputId = this.item.find('#ot-id')
|
||||
this.otId = null
|
||||
this.maquinaId = this.item.data("id")
|
||||
this.ots = []
|
||||
this.datatableItem = this.item.find('#table-scanned-ots')
|
||||
this.btnSave = this.item.find('#btn-save-maquina-ots');
|
||||
this.btnReset = this.item.find('#btn-reset-ots')
|
||||
this.datatableColumns = [
|
||||
{ data: 'id', searchable: false, sortable: false },
|
||||
{ data: 'title', searchable: false, sortable: false },
|
||||
]
|
||||
this.datatableData = [];
|
||||
this.linkAfterSave = this.item.find('#ot-maquina-tareas-link')
|
||||
this.scanWrapper = this.item.find('.ot-scan-wrapper')
|
||||
|
||||
}
|
||||
init() {
|
||||
this.otInputId.trigger('focus')
|
||||
this.otInputId.on('change', this.addOt.bind(this))
|
||||
this.btnReset.on('click',this.reset.bind(this))
|
||||
this.btnSave.on('click',this.saveMultipleOTs.bind(this))
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
ordering: false,
|
||||
dom: "",
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
data: this.datatableData
|
||||
});
|
||||
|
||||
}
|
||||
reset(){
|
||||
this.ots = []
|
||||
this.datatable.clear()
|
||||
this.datatable.draw()
|
||||
this.reloadFocus();
|
||||
this.btnSave.attr('disabled','disabled');
|
||||
}
|
||||
hideWrapper() {
|
||||
this.scanWrapper.addClass('d-none')
|
||||
}
|
||||
showWrapper() {
|
||||
this.scanWrapper.removeClass('d-none')
|
||||
}
|
||||
actionLoader(status = true) {
|
||||
if (status) {
|
||||
Notiflix.Block.circle('.section-block');
|
||||
} else {
|
||||
Notiflix.Block.remove('.section-block');
|
||||
}
|
||||
}
|
||||
reloadFocus() {
|
||||
this.otInputId.val("")
|
||||
this.otInputId.trigger('focus')
|
||||
}
|
||||
async saveMultipleOTs() {
|
||||
try {
|
||||
let result = await alertConfirmAction()
|
||||
if(result.isConfirmed){
|
||||
this.actionLoader(true)
|
||||
let response = await this.postMaquinaOrdenesTrabajo()
|
||||
this.actionLoader(false)
|
||||
popSuccessAlert(response.message)
|
||||
this.hideWrapper()
|
||||
this.linkAfterSave.removeClass('d-none')
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
this.actionLoader(false)
|
||||
if (error?.responseJSON) {
|
||||
popErrorAlert(error.responseJSON.message)
|
||||
} else {
|
||||
popErrorAlert(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
async addOt() {
|
||||
try {
|
||||
if (this.ots.includes(this.otInputId.val())) {
|
||||
throw new Error("Esta OT ya ha sido introducida");
|
||||
}
|
||||
if (this.otInputId.val()) {
|
||||
let response = await this.getOt(this.otInputId.val())
|
||||
console.log(response)
|
||||
const data = response.data
|
||||
this.ots.push(data.ot.id)
|
||||
this.datatable.rows.add([{
|
||||
id: data.ot.id,
|
||||
title: data.presupuesto.titulo
|
||||
}])
|
||||
this.datatable.draw()
|
||||
this.reloadFocus()
|
||||
this.btnSave.removeAttr('disabled')
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
this.reloadFocus()
|
||||
if (error?.responseJSON) {
|
||||
popErrorAlert(error.responseJSON.message)
|
||||
} else {
|
||||
popErrorAlert(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
getOt(otId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let ajax = new Ajax(
|
||||
`/produccion/ordentrabajo/tareas/maquina/${otId}/${this.maquinaId}`,
|
||||
null,
|
||||
null,
|
||||
(response) => {
|
||||
resolve(response)
|
||||
},
|
||||
(error) => {
|
||||
reject(error)
|
||||
}
|
||||
)
|
||||
ajax.get();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
postMaquinaOrdenesTrabajo() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let ajax = new Ajax(
|
||||
`/produccion/ordentrabajo/maquinas/ots`,
|
||||
{
|
||||
maquina_id: this.maquinaId,
|
||||
ordenes_trabajo: this.ots
|
||||
},
|
||||
null,
|
||||
(response) => {
|
||||
resolve(response)
|
||||
},
|
||||
(error) => {
|
||||
reject(error)
|
||||
}
|
||||
)
|
||||
ajax.post();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default MaquinistaScan;
|
||||
@ -4,13 +4,15 @@ class MaquinistaTareaList {
|
||||
this.item = domItem
|
||||
this.maquinaId = this.item.data("id")
|
||||
this.datatableItem = $("#maquinista-tarea-table")
|
||||
this.datatableTareaAplazadaItem = this.item.find('#maquinista-tarea-aplazada-table')
|
||||
this.wrapperDatatableTareaAplazada = this.item.find('#tareas-aplazadas')
|
||||
this.btnTareasHoy = $("#btn-tareas-hoy")
|
||||
this.todayDate = $('#today-date')
|
||||
this.btnAllTareas = $("#btn-all-tareas")
|
||||
this.datatableColumns = [
|
||||
{ data: 'otId', searchable: false, sortable: false },
|
||||
{ data: 'tareaName', searchable: false, sortable: false },
|
||||
{ data: 'tareaEstado', searchable: false, sortable: false,render : this.renderStado.bind(this)},
|
||||
{ data: 'tareaEstado', searchable: false, sortable: false, render: this.renderStado.bind(this) },
|
||||
// { data: 'presupuesto_titulo', searchable: false, sortable: false },
|
||||
// { data: 'papel_impresion', searchable: false, sortable: false },
|
||||
// { data: 'papel_gramaje', searchable: false, sortable: false },
|
||||
@ -18,27 +20,28 @@ class MaquinistaTareaList {
|
||||
{ data: 'action', searchable: false, sortable: false, width: "20rem" },
|
||||
]
|
||||
this.urlAll = '/produccion/ordentrabajo/maquinista/maquinas/tareas/datatable/all/' + this.maquinaId
|
||||
this.urlAplazada = '/produccion/ordentrabajo/maquinista/maquinas/tareas/aplazadas/datatable/' + this.maquinaId
|
||||
this.urlToday = '/produccion/ordentrabajo/maquinista/maquinas/tareas/datatable/today/' + this.maquinaId
|
||||
this.initTable()
|
||||
this.estadoClass = {
|
||||
I : 'primary',
|
||||
P : 'warning',
|
||||
S : 'warning',
|
||||
D : 'danger',
|
||||
F : 'success'
|
||||
I: 'primary',
|
||||
P: 'warning',
|
||||
S: 'warning',
|
||||
D: 'danger',
|
||||
F: 'success'
|
||||
}
|
||||
this.estadoNames = {
|
||||
I : 'Iniciada',
|
||||
P : 'Pendiente',
|
||||
S : 'Pausada',
|
||||
D : 'Aplazada',
|
||||
F : 'Finalizada'
|
||||
I: 'Iniciada',
|
||||
P: 'Pendiente',
|
||||
S: 'Pausada',
|
||||
D: 'Aplazada',
|
||||
F: 'Finalizada'
|
||||
}
|
||||
|
||||
}
|
||||
init(){
|
||||
this.btnTareasHoy.on('click',this.loadToday.bind(this))
|
||||
this.btnAllTareas.on('click',this.loadAll.bind(this))
|
||||
init() {
|
||||
this.btnTareasHoy.on('click', this.loadToday.bind(this))
|
||||
this.btnAllTareas.on('click', this.loadAll.bind(this))
|
||||
}
|
||||
initTable() {
|
||||
|
||||
@ -51,13 +54,28 @@ class MaquinistaTareaList {
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
pageLength: 100,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: this.urlToday
|
||||
});
|
||||
this.datatableAplazada = this.datatableTareaAplazadaItem.DataTable({
|
||||
processing: true,
|
||||
layout: {
|
||||
bottomStart: 'info',
|
||||
bottomEnd: 'paging'
|
||||
},
|
||||
serverSide: true,
|
||||
pageLength: 100,
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: this.urlAplazada
|
||||
});
|
||||
this.datatableAplazada.on('draw.dt', this.handleShowTareasAplazadas.bind(this))
|
||||
}
|
||||
loadToday() {
|
||||
this.btnTareasHoy.removeClass('active')
|
||||
@ -66,25 +84,34 @@ class MaquinistaTareaList {
|
||||
this.btnAllTareas.removeAttr('aria-pressed')
|
||||
this.todayDate.removeClass('d-none')
|
||||
this.btnTareasHoy.addClass('active')
|
||||
this.btnTareasHoy.attr('aria-pressed',true)
|
||||
this.btnTareasHoy.attr('aria-pressed', true)
|
||||
this.datatable.ajax.url(this.urlToday)
|
||||
this.datatable.ajax.reload()
|
||||
|
||||
|
||||
}
|
||||
loadAll(){
|
||||
loadAll() {
|
||||
this.btnTareasHoy.removeClass('active')
|
||||
this.btnTareasHoy.removeAttr('aria-pressed')
|
||||
this.todayDate.addClass('d-none')
|
||||
this.btnAllTareas.addClass('active')
|
||||
this.btnAllTareas.attr('aria-pressed',true)
|
||||
this.btnAllTareas.attr('aria-pressed', true)
|
||||
this.datatable.ajax.url(this.urlAll)
|
||||
this.datatable.ajax.reload()
|
||||
|
||||
}
|
||||
renderStado(d){
|
||||
renderStado(d) {
|
||||
|
||||
return `<span class="badge text-bg-${this.estadoClass[d]}">${this.estadoNames[d]}</span>`
|
||||
return `<span class="badge" style="background-color:${d.color};color:white">${d.title}</span>`
|
||||
}
|
||||
handleShowTareasAplazadas() {
|
||||
let totalTareasAplazadas = this.datatableAplazada.page.info().recordsTotal
|
||||
console.log(totalTareasAplazadas)
|
||||
if (totalTareasAplazadas > 0) {
|
||||
this.wrapperDatatableTareaAplazada.removeClass('d-none')
|
||||
} else {
|
||||
this.wrapperDatatableTareaAplazada.addClass('d-none')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -53,6 +53,8 @@ class MaquinistaTareaView {
|
||||
}
|
||||
disableButtons() {
|
||||
this.actionButtons.attr('disabled', 'disabled')
|
||||
this.btnDelay.attr('disabled','disabled')
|
||||
this.btnDeleteProgress.attr('disabled','disabled')
|
||||
}
|
||||
enableButtons() {
|
||||
this.actionButtons.removeAttr('disabled')
|
||||
@ -121,14 +123,14 @@ class MaquinistaTareaView {
|
||||
}
|
||||
}
|
||||
handleGetTareaProgressSuccess(response) {
|
||||
if (response.progress_dates) {
|
||||
if (response.progress_dates.length > 0) {
|
||||
let lastStatus = response.progress_dates.findLast(e => e.estado != null).estado
|
||||
console.log("Last status :", lastStatus)
|
||||
this.showBasedOnStatus(lastStatus)
|
||||
}else{
|
||||
this.showBasedOnStatus('P')
|
||||
}
|
||||
if (response.tiempo_trabajado) {
|
||||
this.item.find('#tiempo-real-info').html(response.tiempo_trabajado)
|
||||
}
|
||||
this.item.find('#tiempo-real-info').html(response.tiempo_trabajado ?? "00:00")
|
||||
this.actionLoader(false)
|
||||
|
||||
}
|
||||
@ -146,15 +148,25 @@ class MaquinistaTareaView {
|
||||
this.handleUpdateTareaProgressError.bind(this),
|
||||
)
|
||||
if (this.tareaId) {
|
||||
if(status == "F"){
|
||||
alertConfirmAction('La tarea se marcará como finalizada')
|
||||
.then(result => {
|
||||
if (result.isConfirmed) {
|
||||
ajax.post();
|
||||
}
|
||||
})
|
||||
}else{
|
||||
ajax.post();
|
||||
}
|
||||
}
|
||||
}
|
||||
handleUpdateTareaProgressSuccess(response) {
|
||||
if (response.data) {
|
||||
if (response.data.estado == 'D') {
|
||||
if (response.data.tarea) {
|
||||
if (response.data.tarea.estado == 'D') {
|
||||
window.location.href = '/produccion/ordentrabajo/maquinista/maquinas/view'
|
||||
}
|
||||
this.showBasedOnStatus(response.data.status)
|
||||
this.item.find('#tiempo-real-info').html(response.data.tiempo_trabajado ?? "00:00")
|
||||
this.showBasedOnStatus(response.data.estado)
|
||||
alertSuccess(response.message, null, { position: 'top' }).fire()
|
||||
}
|
||||
this.actionLoader(false)
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
import MaquinistaFichajeAuto from "./maquinistaFichajeAuto.js";
|
||||
|
||||
$(() => {
|
||||
console.info("MAQUINISTA FA")
|
||||
let maquinistaFA = new MaquinistaFichajeAuto($("#viewMaquinistaFichajeAuto"))
|
||||
maquinistaFA.init();
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import MaquinistaScan from "./maquinistaScan.js";
|
||||
|
||||
$(() => {
|
||||
console.info("MAQUINISTA SCAN")
|
||||
let maquinistaScan = new MaquinistaScan($("#viewMaquinistaTareaScan"))
|
||||
maquinistaScan.init();
|
||||
})
|
||||
@ -0,0 +1,7 @@
|
||||
import MaquinistaMultipleTarea from "./maquinistaMultipleTarea.js"
|
||||
|
||||
$(() => {
|
||||
console.info("MAQUINISTA MAQUINA OT TAREAS")
|
||||
let tareaMultiple = new MaquinistaMultipleTarea($("#viewProduccionMaquinistaOtTareasView"))
|
||||
tareaMultiple.init()
|
||||
})
|
||||
@ -1,9 +1,13 @@
|
||||
import OrdenTrabajoDatatable from '../../components/datatables/otDatatable.js'
|
||||
|
||||
$(function() {
|
||||
$(function () {
|
||||
const otDatatable = new OrdenTrabajoDatatable($("#ots-datatables-container"))
|
||||
otDatatable.init()
|
||||
otDatatable.initPendientes()
|
||||
otDatatable.initFerroPendiente()
|
||||
otDatatable.initFerroOk()
|
||||
otDatatable.initNews()
|
||||
otDatatable.initProd()
|
||||
otDatatable.initWaiting()
|
||||
// otDatatable.initRevisionComercial()
|
||||
})
|
||||
@ -21,15 +21,19 @@ class OrdenTrabajo {
|
||||
this.btnErasePedidoDate = this.item.find('.btn-erase-pedido-date');
|
||||
|
||||
this.isOtFinalizada = false;
|
||||
|
||||
this.tiempoTotal = this.item.find('#tiempo-total')
|
||||
this.tiempoEstimado = this.item.find('#tiempo-estimado')
|
||||
this.btnResetTareas = this.item.find("#btn-reset-tareas")
|
||||
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
|
||||
this.otPreimpresionRevisadaCheck = this.item.find("#ot-preimpresion-revisada");
|
||||
this.pedidoEnEsperaBy = this.item.find("#pedido_espera_by");
|
||||
this.otPreimpresionRevisadaUser = this.item.find("#preimpresion_revisada_by");
|
||||
this.otEstado = this.item.find("#ot-estado");
|
||||
|
||||
this.datatableColumns = [
|
||||
{ data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this) },
|
||||
{ data: 'nombre', searchable: true, sortable: true },
|
||||
{ data: 'tarea_estado', searchable: false, sortable: false, render: this._renderTareaEstado.bind(this) },
|
||||
{
|
||||
data: 'maquina_presupuesto_linea', searchable: true, sortable: true, render: (d) => {
|
||||
if (d) {
|
||||
@ -65,10 +69,9 @@ class OrdenTrabajo {
|
||||
*/
|
||||
this.configUploadDropzone = {
|
||||
domElement: '#dropzone-ot-files',
|
||||
nameId: "orden_trabajo_id",
|
||||
getUri: '/produccion/ordentrabajo/get_files',
|
||||
postUri: '/produccion/ordentrabajo/upload_files',
|
||||
resourcePath: 'orden_trabajo/' + this.modelId
|
||||
nameId: "presupuesto_id",
|
||||
getUri: '/presupuestos/presupuestocliente/get_files',
|
||||
postUri: '/presupuestos/presupuestocliente/upload_files'
|
||||
}
|
||||
if ($(this.configUploadDropzone.domElement).length > 0) {
|
||||
this.fileUploadDropzone = new FileUploadDropzone(this.configUploadDropzone)
|
||||
@ -263,6 +266,22 @@ class OrdenTrabajo {
|
||||
</div>`
|
||||
return cell;
|
||||
}
|
||||
_renderTareaEstado(d, t) {
|
||||
let html = `
|
||||
<div class="btn-group dropstart">
|
||||
<button style="background-color:${d.color};color:white" class="btn btn-xs dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||
${d.title}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li> <a class="dropdown-item" href="javascript:void(0);">${d.userName}</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
`
|
||||
if(d.userName == ""){
|
||||
html = `<span style="background-color:${d.color};color:white" class="badge">${d.title}</span>`
|
||||
}
|
||||
return html
|
||||
}
|
||||
_renderOrdenTarea(d, t) {
|
||||
|
||||
return `
|
||||
@ -278,7 +297,6 @@ class OrdenTrabajo {
|
||||
createSelectMaquinaTarea() {
|
||||
try {
|
||||
$('.select-proveedor-tarea-datatable').each((index, element) => {
|
||||
console.log(element)
|
||||
this.createSelectProveedor($(element))
|
||||
})
|
||||
this.summaryData.tasks.forEach(async (element) => {
|
||||
@ -429,6 +447,13 @@ class OrdenTrabajo {
|
||||
this.fillPreimpresionReview()
|
||||
this.fillPliegos()
|
||||
this.isOtFinalizada = this.summaryData.ot.estado == "F";
|
||||
if (this.isOtFinalizada) {
|
||||
this.btnEraseDate.addClass('d-none').attr('disabled', 'disabled')
|
||||
this.btnErasePedidoDate.addClass('d-none').attr('disabled', 'disabled')
|
||||
} else {
|
||||
this.btnEraseDate.removeClass('d-none').removeAttr('disabled')
|
||||
this.btnErasePedidoDate.removeClass('d-none').removeAttr('disabled')
|
||||
}
|
||||
this.datatableTareas.ajax.reload()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@ -472,6 +497,8 @@ class OrdenTrabajo {
|
||||
fillOtDetails() {
|
||||
const progreso = this.summaryData.ot.progreso
|
||||
this.otForm.find("#ot-progress-bar").attr('aria-valuenow', progreso).text(progreso + "%").css("width", progreso + "%")
|
||||
this.tiempoEstimado.html(this.summaryData.tiempo_procesamiento)
|
||||
this.tiempoTotal.html(this.summaryData.tiempo_total)
|
||||
}
|
||||
fillOtDates() {
|
||||
this.fechaImpresion.setDate(this.summaryData.pedido.fecha_impresion)
|
||||
@ -514,12 +541,18 @@ class OrdenTrabajo {
|
||||
this.embalaje.setDate(this.summaryData.dates.embalaje_at)
|
||||
this.envio.setDate(this.summaryData.dates.envio_at)
|
||||
this.pedidoEnEsperaCheck.prop("checked", this.summaryData.ot.is_pedido_espera);
|
||||
this.otPreimpresionRevisadaCheck.prop("checked", this.summaryData.ot.preimpresion_revisada);
|
||||
this.tiempoProcesamiento.val(this.summaryData.tiempo_procesamiento);
|
||||
if (this.summaryData.ot.pedido_espera_by) {
|
||||
this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name, this.summaryData.ot.pedido_espera_by.last_name].join(" "))
|
||||
} else {
|
||||
this.pedidoEnEsperaBy.text("");
|
||||
}
|
||||
if (this.summaryData.ot.preimpresion_revisada_by) {
|
||||
this.otPreimpresionRevisadaUser.text([this.summaryData.ot.preimpresion_revisada_by.first_name, this.summaryData.ot.preimpresion_revisada_by.last_name].join(" "))
|
||||
} else {
|
||||
this.otPreimpresionRevisadaUser.text("")
|
||||
}
|
||||
this.otEstado.val(this.summaryData.ot.estado)
|
||||
this.preFormatoAt.setDate(this.summaryData.dates.pre_formato_at)
|
||||
this.preLomoAt.setDate(this.summaryData.dates.pre_lomo_at)
|
||||
@ -861,7 +894,6 @@ class OrdenTrabajo {
|
||||
alertConfirmationDelete()
|
||||
.then(result => {
|
||||
if (result.isConfirmed) {
|
||||
console.log(name)
|
||||
ajax.post()
|
||||
}
|
||||
})
|
||||
@ -892,7 +924,6 @@ class OrdenTrabajo {
|
||||
alertConfirmationDelete()
|
||||
.then(result => {
|
||||
if (result.isConfirmed) {
|
||||
console.log(name)
|
||||
ajax.post()
|
||||
}
|
||||
})
|
||||
|
||||
@ -4,6 +4,12 @@
|
||||
width : 100%;
|
||||
font-size : 20px;
|
||||
}
|
||||
.maquina-btn-v
|
||||
{
|
||||
height : 5rem;
|
||||
width : 1rem;
|
||||
font-size : 20px;
|
||||
}
|
||||
.table-maquinista td{
|
||||
height : 7rem;
|
||||
}
|
||||
Reference in New Issue
Block a user