mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/corte-ot-planning' into 'main'
toggle corte rotativa planning See merge request jjimenez/safekat!628
This commit is contained in:
@ -1009,6 +1009,8 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
|||||||
$routes->get('papel/plana/datatable', 'Ordentrabajo::papel_pliego_datatable');
|
$routes->get('papel/plana/datatable', 'Ordentrabajo::papel_pliego_datatable');
|
||||||
$routes->get('rotativa/datatable', 'Ordentrabajo::planning_rotativa_datatable');
|
$routes->get('rotativa/datatable', 'Ordentrabajo::planning_rotativa_datatable');
|
||||||
$routes->get('plana/datatable', 'Ordentrabajo::planning_plana_datatable');
|
$routes->get('plana/datatable', 'Ordentrabajo::planning_plana_datatable');
|
||||||
|
$routes->post('tarea/toggle/corte/(:num)', 'Ordentrabajo::tarea_toggle_corte/$1');
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -138,7 +138,7 @@ class Ordentrabajo extends BaseController
|
|||||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
)
|
)
|
||||||
->add("action", fn($q) => $q->id)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
@ -153,7 +153,7 @@ class Ordentrabajo extends BaseController
|
|||||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
)
|
)
|
||||||
->add("action", fn($q) => $q->id)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
@ -168,7 +168,7 @@ class Ordentrabajo extends BaseController
|
|||||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
fn($q) =>$q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
)
|
)
|
||||||
->add("action", fn($q) => $q->id)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
@ -183,7 +183,7 @@ class Ordentrabajo extends BaseController
|
|||||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||||
->edit(
|
->edit(
|
||||||
"fecha_encuadernado_at",
|
"fecha_encuadernado_at",
|
||||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||||
)
|
)
|
||||||
->add("action", fn($q) => $q->id)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
@ -289,8 +289,7 @@ class Ordentrabajo extends BaseController
|
|||||||
return DataTable::of($q)
|
return DataTable::of($q)
|
||||||
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
||||||
->add("metros_check", fn($q) => $q->otId)
|
->add("metros_check", fn($q) => $q->otId)
|
||||||
->add("corte", fn($q) => $q->otId)
|
->add("corte", fn($q) => ["otId" => $q->otId,"tipo_corte" => $this->produccionService->ordenTrabajoTareaCorte($q->otId)])
|
||||||
|
|
||||||
->add("action", fn($q) => $q)
|
->add("action", fn($q) => $q)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
@ -323,5 +322,10 @@ class Ordentrabajo extends BaseController
|
|||||||
$result = $this->produccionService->querySelectPapelPlanningPlana($q);
|
$result = $this->produccionService->querySelectPapelPlanningPlana($q);
|
||||||
return $this->response->setJSON($result);
|
return $this->response->setJSON($result);
|
||||||
}
|
}
|
||||||
|
public function tarea_toggle_corte($orden_trabajo_id)
|
||||||
|
{
|
||||||
|
$status = $this->produccionService->tareaUpdateMaquinaCorte($orden_trabajo_id);
|
||||||
|
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status ]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Database\Migrations;
|
||||||
|
|
||||||
|
use App\Models\Configuracion\ConfigVariableModel;
|
||||||
|
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||||
|
use CodeIgniter\Database\Migration;
|
||||||
|
|
||||||
|
class AddColumnIsCorteOrdenTrabajoTarea extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
'is_corte' => [
|
||||||
|
'type' => 'TINYINT',
|
||||||
|
'constraint' => 1,
|
||||||
|
'null' => false,
|
||||||
|
'default' => 0,
|
||||||
|
],
|
||||||
|
'tipo_corte' => [
|
||||||
|
'type' => 'ENUM',
|
||||||
|
'constraint' => ['bobina','guillotina'],
|
||||||
|
'default' => 'bobina',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$this->forge->addColumn('orden_trabajo_tareas', $fields);
|
||||||
|
$m = model(OrdenTrabajoTarea::class);
|
||||||
|
$m->where('nombre','Corte')->set(['is_corte' => true,'tipo_corte' => 'bobina'])->update();
|
||||||
|
$cvm = model(ConfigVariableModel::class);
|
||||||
|
$cvm->insert([
|
||||||
|
"name" => "id_maquina_bobina_corte_ot_tarea",
|
||||||
|
"value" => 61,
|
||||||
|
"description" => "Id de máquina por defecto para corte en bobina rotativa. (Asignación máquina orden trabajo tarea)"
|
||||||
|
]);
|
||||||
|
$cvm->insert([
|
||||||
|
"name" => "id_maquina_guillotina_corte_ot_tarea",
|
||||||
|
"value" => 31,
|
||||||
|
"description" => "Id de máquina por defecto para corte guillotina rotativa. (Asignación máquina orden trabajo tarea)"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->forge->dropColumn('orden_trabajo_tareas', 'is_corte');
|
||||||
|
$this->forge->dropColumn('orden_trabajo_tareas', 'tipo_corte');
|
||||||
|
$cvm = model(ConfigVariableModel::class);
|
||||||
|
$cvm->whereIn('name',["id_maquina_bobina_corte_ot_tarea","id_maquina_guillotina_corte_ot_tarea"])->delete(purge:true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,6 +25,8 @@ class OrdenTrabajoTareaEntity extends Entity
|
|||||||
"imposicion_id" => null,
|
"imposicion_id" => null,
|
||||||
"tiempo_estimado" => null,
|
"tiempo_estimado" => null,
|
||||||
"tiempo_real" => null,
|
"tiempo_real" => null,
|
||||||
|
"is_corte" => null,
|
||||||
|
"tipo_corte" => null,
|
||||||
"comment" => null,
|
"comment" => null,
|
||||||
];
|
];
|
||||||
protected $datamap = [];
|
protected $datamap = [];
|
||||||
@ -39,6 +41,8 @@ class OrdenTrabajoTareaEntity extends Entity
|
|||||||
"imposicion_id" => "?integer",
|
"imposicion_id" => "?integer",
|
||||||
"tiempo_estimado" => "?float",
|
"tiempo_estimado" => "?float",
|
||||||
"tiempo_real" => "?float",
|
"tiempo_real" => "?float",
|
||||||
|
"is_corte" => "boolean",
|
||||||
|
"tipo_corte" => "string",
|
||||||
"comment" => "?string"
|
"comment" => "?string"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Entities\Tarifas\Maquinas;
|
namespace App\Entities\Tarifas\Maquinas;
|
||||||
|
|
||||||
use App\Entities\Configuracion\Maquina;
|
|
||||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||||
|
use App\Entities\Configuracion\Maquina;
|
||||||
use App\Models\Configuracion\MaquinaModel;
|
use App\Models\Configuracion\MaquinaModel;
|
||||||
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
|
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
|
||||||
use CodeIgniter\Entity\Entity;
|
use CodeIgniter\Entity\Entity;
|
||||||
|
|||||||
@ -28,6 +28,8 @@ class OrdenTrabajoTarea extends Model
|
|||||||
"imposicion_id",
|
"imposicion_id",
|
||||||
"tiempo_estimado",
|
"tiempo_estimado",
|
||||||
"tiempo_real",
|
"tiempo_real",
|
||||||
|
"is_corte",
|
||||||
|
"tipo_corte",
|
||||||
"comment"
|
"comment"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Database\Migrations\ConfigVariablesApp;
|
||||||
use App\Entities\Clientes\ClienteEntity;
|
use App\Entities\Clientes\ClienteEntity;
|
||||||
use App\Entities\Pedidos\PedidoEntity;
|
use App\Entities\Pedidos\PedidoEntity;
|
||||||
use App\Entities\Presupuestos\PresupuestoEntity;
|
use App\Entities\Presupuestos\PresupuestoEntity;
|
||||||
@ -15,6 +16,7 @@ use App\Models\Usuarios\UserModel;
|
|||||||
use CodeIgniter\Config\BaseService;
|
use CodeIgniter\Config\BaseService;
|
||||||
use App\Entities\Configuracion\Maquina as MaquinaEntity;
|
use App\Entities\Configuracion\Maquina as MaquinaEntity;
|
||||||
use App\Entities\Produccion\OrdenTrabajoTareaEntity;
|
use App\Entities\Produccion\OrdenTrabajoTareaEntity;
|
||||||
|
use App\Models\Configuracion\ConfigVariableModel;
|
||||||
use App\Models\Configuracion\MaquinaModel;
|
use App\Models\Configuracion\MaquinaModel;
|
||||||
use CodeIgniter\Database\BaseBuilder;
|
use CodeIgniter\Database\BaseBuilder;
|
||||||
use CodeIgniter\Database\BaseResult;
|
use CodeIgniter\Database\BaseResult;
|
||||||
@ -208,8 +210,8 @@ class ProductionService extends BaseService
|
|||||||
$ot_tareas["orden"] = $p_linea_maquina->orden_planning ?? 0;
|
$ot_tareas["orden"] = $p_linea_maquina->orden_planning ?? 0;
|
||||||
$ot_tareas["maquina_id"] = $p_linea_maquina->id;
|
$ot_tareas["maquina_id"] = $p_linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina*3600;
|
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina * 3600;
|
||||||
$ot_tareas["tiempo_real"] = $p_linea->horas_maquina*3600; //? Tiempo real se inserta manual?
|
$ot_tareas["tiempo_real"] = $p_linea->horas_maquina * 3600; //? Tiempo real se inserta manual?
|
||||||
$insert_query_result = $this->otTarea->insert($ot_tareas);
|
$insert_query_result = $this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
$this->storeTareaCorte($p_linea);
|
$this->storeTareaCorte($p_linea);
|
||||||
@ -226,8 +228,10 @@ class ProductionService extends BaseService
|
|||||||
'nombre' => 'Corte',
|
'nombre' => 'Corte',
|
||||||
'maquina_id' => $this->defaultMaquinaCorte->id,
|
'maquina_id' => $this->defaultMaquinaCorte->id,
|
||||||
'orden' => $this->defaultMaquinaCorte->orden_planning,
|
'orden' => $this->defaultMaquinaCorte->orden_planning,
|
||||||
'tiempo_estimado' => $pLinea->rotativa_tiempo_corte*60,
|
'tiempo_estimado' => $pLinea->rotativa_tiempo_corte * 60,
|
||||||
'tiempo_real' => $pLinea->rotativa_tiempo_corte*60
|
'tiempo_real' => $pLinea->rotativa_tiempo_corte * 60,
|
||||||
|
'is_corte' => true,
|
||||||
|
'tipo_corte' => "bobina",
|
||||||
]);
|
]);
|
||||||
$otCorte = $this->otTarea->find($tareaId);
|
$otCorte = $this->otTarea->find($tareaId);
|
||||||
}
|
}
|
||||||
@ -293,15 +297,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 100;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 100;
|
||||||
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
||||||
@ -319,15 +323,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 110;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 110;
|
||||||
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
||||||
@ -345,15 +349,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 0;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 0;
|
||||||
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
||||||
@ -715,7 +719,7 @@ class ProductionService extends BaseService
|
|||||||
|
|
||||||
public function updateOrdenTrabajoTarea($tarea_id, $data): bool
|
public function updateOrdenTrabajoTarea($tarea_id, $data): bool
|
||||||
{
|
{
|
||||||
if(isset($data['maquina_id'])){
|
if (isset($data['maquina_id'])) {
|
||||||
$maquina = model(MaquinaModel::class)->find($data['maquina_id']);
|
$maquina = model(MaquinaModel::class)->find($data['maquina_id']);
|
||||||
$data['orden'] = $maquina->orden_planning;
|
$data['orden'] = $maquina->orden_planning;
|
||||||
}
|
}
|
||||||
@ -821,7 +825,8 @@ class ProductionService extends BaseService
|
|||||||
return ["title" => lang('ot.filter_by_task'), 'id' => $id];
|
return ["title" => lang('ot.filter_by_task'), 'id' => $id];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function querySelectMaquinaPlanningRotativa($q){
|
public function querySelectMaquinaPlanningRotativa($q)
|
||||||
|
{
|
||||||
$query = $this->otModel->builder()->select([
|
$query = $this->otModel->builder()->select([
|
||||||
"orden_trabajo_tareas.maquina_id as id",
|
"orden_trabajo_tareas.maquina_id as id",
|
||||||
"lg_maquinas.nombre as name",
|
"lg_maquinas.nombre as name",
|
||||||
@ -833,12 +838,13 @@ class ProductionService extends BaseService
|
|||||||
->where('lg_maquinas.is_rotativa', true)
|
->where('lg_maquinas.is_rotativa', true)
|
||||||
->where("orden_trabajo_tareas.deleted_at", null)
|
->where("orden_trabajo_tareas.deleted_at", null)
|
||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
if($q){
|
if ($q) {
|
||||||
$query->like('lg_maquinas.nombre',$q);
|
$query->like('lg_maquinas.nombre', $q);
|
||||||
}
|
}
|
||||||
return $query->get()->getResultArray();
|
return $query->get()->getResultArray();
|
||||||
}
|
}
|
||||||
public function querySelectMaquinaPlanningPlana($q){
|
public function querySelectMaquinaPlanningPlana($q)
|
||||||
|
{
|
||||||
$query = $this->otModel->builder()->select([
|
$query = $this->otModel->builder()->select([
|
||||||
"orden_trabajo_tareas.maquina_id as id",
|
"orden_trabajo_tareas.maquina_id as id",
|
||||||
"lg_maquinas.nombre as name",
|
"lg_maquinas.nombre as name",
|
||||||
@ -851,12 +857,13 @@ class ProductionService extends BaseService
|
|||||||
->where('lg_maquinas.is_rotativa', false)
|
->where('lg_maquinas.is_rotativa', false)
|
||||||
->where("orden_trabajo_tareas.deleted_at", null)
|
->where("orden_trabajo_tareas.deleted_at", null)
|
||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
if($q){
|
if ($q) {
|
||||||
$query->like('lg_maquinas.nombre',$q);
|
$query->like('lg_maquinas.nombre', $q);
|
||||||
}
|
}
|
||||||
return $query->get()->getResultArray();
|
return $query->get()->getResultArray();
|
||||||
}
|
}
|
||||||
public function querySelectPapelPlanningRot(string $q){
|
public function querySelectPapelPlanningRot(string $q)
|
||||||
|
{
|
||||||
$query = $this->otModel->builder()->select([
|
$query = $this->otModel->builder()->select([
|
||||||
"lg_papel_impresion.id",
|
"lg_papel_impresion.id",
|
||||||
"lg_papel_impresion.nombre as name",
|
"lg_papel_impresion.nombre as name",
|
||||||
@ -870,12 +877,13 @@ class ProductionService extends BaseService
|
|||||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
||||||
->whereIn("presupuesto_linea.tipo", $this->TIPOS_ROTATIVA)
|
->whereIn("presupuesto_linea.tipo", $this->TIPOS_ROTATIVA)
|
||||||
->groupBy('lg_papel_impresion.id');
|
->groupBy('lg_papel_impresion.id');
|
||||||
if($q){
|
if ($q) {
|
||||||
$query->like('lg_papel_impresion.nombre',$q);
|
$query->like('lg_papel_impresion.nombre', $q);
|
||||||
}
|
}
|
||||||
return $query->get()->getResultArray();
|
return $query->get()->getResultArray();
|
||||||
}
|
}
|
||||||
public function querySelectPapelPlanningPlana($q){
|
public function querySelectPapelPlanningPlana($q)
|
||||||
|
{
|
||||||
$query = $this->otModel->builder()->select([
|
$query = $this->otModel->builder()->select([
|
||||||
"lg_papel_impresion.id",
|
"lg_papel_impresion.id",
|
||||||
"lg_papel_impresion.nombre as name",
|
"lg_papel_impresion.nombre as name",
|
||||||
@ -889,11 +897,33 @@ class ProductionService extends BaseService
|
|||||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
||||||
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
|
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
|
||||||
->groupBy('lg_papel_impresion.id');
|
->groupBy('lg_papel_impresion.id');
|
||||||
if($q){
|
if ($q) {
|
||||||
$query->like('lg_papel_impresion.nombre',$q);
|
$query->like('lg_papel_impresion.nombre', $q);
|
||||||
}
|
}
|
||||||
return $query->get()->getResultArray();
|
return $query->get()->getResultArray();
|
||||||
}
|
}
|
||||||
|
public function tareaUpdateMaquinaCorte($orden_trabajo_id): bool
|
||||||
|
{
|
||||||
|
$cvm = model(ConfigVariableModel::class);
|
||||||
|
$otTarea = $this->otTarea->where('orden_trabajo_id', $orden_trabajo_id)->where('is_corte', true)->first();
|
||||||
|
$toggleCorte = "bobina";
|
||||||
|
if ($otTarea->tipo_corte == "bobina") {
|
||||||
|
$maquina_id = $cvm->where('name', "id_maquina_guillotina_corte_ot_tarea")->first()["value"];
|
||||||
|
$toggleCorte = "guillotina";
|
||||||
|
} elseif ($otTarea->tipo_corte == "guillotina") {
|
||||||
|
$maquina_id = $cvm->where('name', "id_maquina_bobina_corte_ot_tarea")->first()["value"];
|
||||||
|
$toggleCorte = "bobina";
|
||||||
|
} else {
|
||||||
|
$maquina_id = null;
|
||||||
|
}
|
||||||
|
return $this->otTarea
|
||||||
|
->where('orden_trabajo_id', $orden_trabajo_id)
|
||||||
|
->where('is_corte', true)
|
||||||
|
->set(["maquina_id" => $maquina_id, "tipo_corte" => $toggleCorte])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
public function ordenTrabajoTareaCorte(int $ot_id): ?string
|
||||||
|
{
|
||||||
|
return $this->otTarea->where('orden_trabajo_id', $ot_id)->where('is_corte', true)?->first()->tipo_corte ?? null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,11 +119,13 @@
|
|||||||
|
|
||||||
<?= $this->section('css') ?>
|
<?= $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/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
|
||||||
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
<script type="module" src="<?= site_url("assets/js/safekat/pages/produccion/planning_rotativa/index.js") ?>"></script>
|
<script type="module" src="<?= site_url("assets/js/safekat/pages/produccion/planning_rotativa/index.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/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/Bootstrap5.min.js") ?>"></script>
|
||||||
|
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.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/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -176,10 +176,10 @@ class OrdenTrabajo {
|
|||||||
console.log("Create selects")
|
console.log("Create selects")
|
||||||
this.summaryData.tasks.forEach(element => {
|
this.summaryData.tasks.forEach(element => {
|
||||||
let selectItem = this.item.find("#select-maquina-tarea-" + element.id);
|
let selectItem = this.item.find("#select-maquina-tarea-" + element.id);
|
||||||
if (element.presupuesto_linea_id) this.createSelectMaquinaImpresion(selectItem)
|
if (element.presupuesto_linea_id && element.is_corte == false) this.createSelectMaquinaImpresion(selectItem)
|
||||||
if (element.presupuesto_acabado_id) this.createSelectMaquinaAcabado(selectItem)
|
if (element.presupuesto_acabado_id) this.createSelectMaquinaAcabado(selectItem)
|
||||||
if (element.presupuesto_encuadernado_id) this.createSelectMaquinaEncuadernacion(selectItem)
|
if (element.presupuesto_encuadernado_id) this.createSelectMaquinaEncuadernacion(selectItem)
|
||||||
if (element.presupuesto_manipulado_id) this.createSelectMaquinaManipulado(selectItem)
|
if (element.presupuesto_manipulado_id || element.is_corte) this.createSelectMaquinaManipulado(selectItem)
|
||||||
if (element.presupuesto_preimpresion_id) this.createSelectMaquinaAll(selectItem)
|
if (element.presupuesto_preimpresion_id) this.createSelectMaquinaAll(selectItem)
|
||||||
if (element.presupuesto_extra_id) this.createSelectMaquinaAll(selectItem)
|
if (element.presupuesto_extra_id) this.createSelectMaquinaAll(selectItem)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import ClassSelect from "../../../components/select2.js";
|
import ClassSelect from "../../../components/select2.js";
|
||||||
import Ajax from "../../../components/ajax.js";
|
import Ajax from "../../../components/ajax.js";
|
||||||
|
import { alertError, alertSuccess } from "../../../components/alerts/sweetAlert.js";
|
||||||
|
|
||||||
|
|
||||||
class PlanningRotativa {
|
class PlanningRotativa {
|
||||||
@ -204,7 +205,7 @@ class PlanningRotativa {
|
|||||||
this.papelGramajeDatatable.on('draw', this.addTotalFooter.bind(this))
|
this.papelGramajeDatatable.on('draw', this.addTotalFooter.bind(this))
|
||||||
|
|
||||||
this.tablePlanningRot.on('change', ".metros-check", this.calcMetrosCheck.bind(this))
|
this.tablePlanningRot.on('change', ".metros-check", this.calcMetrosCheck.bind(this))
|
||||||
|
this.tablePlanningRot.on("click",'.change-corte',this.toggleCorte.bind(this))
|
||||||
/**
|
/**
|
||||||
* PLANNING PLANA
|
* PLANNING PLANA
|
||||||
*/
|
*/
|
||||||
@ -307,15 +308,34 @@ class PlanningRotativa {
|
|||||||
this.totalPliegosSel.set(metros_sel.reduce((a, b) => a + b, 0))
|
this.totalPliegosSel.set(metros_sel.reduce((a, b) => a + b, 0))
|
||||||
|
|
||||||
}
|
}
|
||||||
renderCorteImage() {
|
renderCorteImage(data) {
|
||||||
|
const tipo_corte = data.tipo_corte == "bobina" ? "cortadora_bobinas" : "guillotina";
|
||||||
|
console.log(data.tipo_corte)
|
||||||
return `
|
return `
|
||||||
<a type="button" class="btn btn-outline-secondary bg-white btn-xs change-corte">
|
<a type="button" class="btn btn-outline-secondary bg-white btn-xs change-corte" data-id=${data.otId}>
|
||||||
<div class="avatar avatar-size-xs">
|
<div class="avatar avatar-size-xs">
|
||||||
<img src="/assets/img/cortadora_bobinas.png" alt="Guillotina" width="10px" height="10px">
|
<img src="/assets/img/${tipo_corte}.png" alt="${data.tipo_corte}" width="10px" height="10px">
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
toggleCorte(event){
|
||||||
|
let otId = $(event.currentTarget).data('id')
|
||||||
|
let ajax = new Ajax("/produccion/ordentrabajo/planning/tarea/toggle/corte/" + otId,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
this.toggleCorteSuccess.bind(this),
|
||||||
|
this.toggleCorteError.bind(this)
|
||||||
|
)
|
||||||
|
ajax.post()
|
||||||
|
}
|
||||||
|
toggleCorteSuccess(response){
|
||||||
|
this.datatablePlanningRot.ajax.reload()
|
||||||
|
alertSuccess(response.message).fire()
|
||||||
|
}
|
||||||
|
toggleCorteError(){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user