diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php index 3e9a9b84..4f8be2d4 100755 --- a/ci4/app/Config/OrdenTrabajo.php +++ b/ci4/app/Config/OrdenTrabajo.php @@ -12,8 +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 //ACABADO "plastificado_at" => "plastificado_user_id", + "plakene_at" => "plakene_user_id", //TODO + "retractilado_at" => "retractilado_user_id", + "estampado_at" => "estampado_user_id", //TODO + "uvi_at" => "uvi_user_id", //TODO "encuadernacion_at" => "encuadernacion_user_id", "corte_at" => "corte_user_id", "preparacion_interiores_at" => "preparacion_interior_user_id", @@ -21,7 +27,6 @@ class OrdenTrabajo extends BaseConfig "cosido_at" => "cosido_user_id", "grapado_at" => "grapado_user_id", "solapa_at" => "solapa_user_id", - "retractilado_at" => "retractilado_user_id", "retractilado5_at" => "retractilado5_user_id", "prototipo_at" => "prototipo_user_id", "marcapaginas_at" => "marcapaginas_user_id", diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index de724146..352a871e 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -754,6 +754,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func $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'); /**====================== * UPDATES *========================**/ @@ -771,6 +772,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func $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"); /**====================== diff --git a/ci4/app/Config/Validation.php b/ci4/app/Config/Validation.php index 09717371..f8c5881c 100755 --- a/ci4/app/Config/Validation.php +++ b/ci4/app/Config/Validation.php @@ -184,4 +184,15 @@ class Validation extends BaseConfig "label" => "maquina", ], ]; + public array $proveedor_tarea = + [ + "proveedor_id" => [ + "rules" => "required|integer", + "label" => "Proveedor", + ], + "orden_trabajo_tarea_id" => [ + "rules" => "required|integer", + "label" => "Tarea", + ], + ]; } diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 366ec0d5..413bb991 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -3,6 +3,7 @@ namespace App\Controllers\Produccion; use App\Controllers\BaseController; +use App\Models\Compras\ProveedorModel; use App\Models\Configuracion\MaquinaModel; use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Models\OrdenTrabajo\OrdenTrabajoTarea; @@ -28,6 +29,7 @@ class Ordentrabajo extends BaseController protected OrdenTrabajoModel $otModel; protected OrdenTrabajoUser $otUserModel; protected OrdenTrabajoTarea $otTarea; + protected ProveedorModel $proveedorModel; protected MaquinaModel $maquinaModel; protected UserModel $userModel; protected Validation $validation; @@ -45,6 +47,7 @@ class Ordentrabajo extends BaseController $this->produccionService = new ProductionService(); $this->otTarea = model(OrdenTrabajoTarea::class); $this->maquinaModel = model(MaquinaModel::class); + $this->proveedorModel = model(ProveedorModel::class); $this->validation = service("validation"); helper("time"); parent::initController($request, $response, $logger); @@ -138,6 +141,18 @@ class Ordentrabajo extends BaseController return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400); } } + public function update_presupuesto_tarea_proveedor(){ + $bodyData = $this->request->getPost(); + $validated = $this->validation->run($bodyData, "proveedor_tarea"); + if ($validated) { + $validatedData = $this->validation->getValidated(); + $r = $this->produccionService->updateProveedorLinea($validatedData['orden_trabajo_tarea_id'], $validatedData['proveedor_id']); + return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r]); + } else { + return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400); + } + + } public function reset_orden_trabajo_date() { $bodyData = $this->request->getPost(); @@ -305,6 +320,7 @@ class Ordentrabajo extends BaseController ->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("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]) ->toJson(true); @@ -580,7 +596,6 @@ class Ordentrabajo extends BaseController } public function delete_orden_trabajo_progress_date(int $orden_trabajo_tarea_id) { - $status = $this->produccionService->deleteOrdenTrabajoTareaProgressDates($orden_trabajo_tarea_id); return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status]); } @@ -606,4 +621,9 @@ class Ordentrabajo extends BaseController } } + public function get_orden_trabajo_tareas_dates($orden_trabajo_id) + { + $data = $this->produccionService->init($orden_trabajo_id)->getOrdenTrabajoTareaDates(); + return $this->response->setJSON(["data" => $data ]); + } } diff --git a/ci4/app/Database/Migrations/2025-04-30_083700_AlterOrdenesTrabajoAddCommentColumns.php b/ci4/app/Database/Migrations/2025-04-30_083700_AlterOrdenesTrabajoAddCommentColumns.php index 626e7fc1..3a991162 100755 --- a/ci4/app/Database/Migrations/2025-04-30_083700_AlterOrdenesTrabajoAddCommentColumns.php +++ b/ci4/app/Database/Migrations/2025-04-30_083700_AlterOrdenesTrabajoAddCommentColumns.php @@ -23,6 +23,10 @@ class AlterOrdenesTrabajoAddCommentColumns extends Migration 'type' => 'LONGTEXT', 'null' => true ], + "info_solapa_guillotina" => [ + 'type' => 'LONGTEXT', + 'null' => true + ] ]; public function up() { diff --git a/ci4/app/Database/Migrations/2025-05-01-044600_AddOrdenTrabajoDatesManipuladoImpresion.php b/ci4/app/Database/Migrations/2025-05-01-044600_AddOrdenTrabajoDatesManipuladoImpresion.php new file mode 100644 index 00000000..6f1cb065 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-05-01-044600_AddOrdenTrabajoDatesManipuladoImpresion.php @@ -0,0 +1,82 @@ + [ + "type" => "DATE", + "null" => true, + ], + "guarda_at" => [ + "type" => "DATE", + "null" => true, + ], + "plakene_at" => [ + "type" => "DATE", + "null" => true, + ], + "estampado_at" => [ + "type" => "DATE", + "null" => true, + ], + "uvi_at" => [ + "type" => "DATE", + "null" => true, + ], + + ]; + protected array $USERS = [ + "sobrecubierta_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "guarda_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "plakene_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "estampado_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + "uvi_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + "null" => true, + ], + ]; + + public function up() + { + $this->forge->addColumn("orden_trabajo_dates", $this->DATES); + $this->forge->addColumn("orden_trabajo_users", $this->USERS); + foreach ($this->USERS as $key => $value) { + $this->forge->addForeignKey([$key],"users",["id"]); + } + } + + public function down() + { + $this->forge->dropColumn("orden_trabajo_dates", array_keys($this->DATES)); + $this->forge->dropColumn("orden_trabajo_users", array_keys($this->USERS)); + + + } +} diff --git a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php index 83ad9323..38744e7e 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php @@ -222,6 +222,7 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity return $nombre; } + public function isGuarda(): bool { return in_array($this->attributes["tipo"], ["lp_guardas"]); diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php index 19ad97ab..bd73e401 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoDateEntity.php @@ -15,8 +15,15 @@ class OrdenTrabajoDateEntity extends Entity "interior_bn_at" => null, "interior_color_at" => null, "cubierta_at" => null, + "sobrecubierta_at" => null, //TODO + "guarda_at" => null, //TODO //ACABADO "plastificado_at" => null, + "plakene_at" => null, //TODO + "retractilado_at"=> null, + "estampado_at" => null, //TODO + "uvi_at" => null, //TODO + //MANIPULADO "encuadernacion_at" => null, "corte_at" => null, "preparacion_interiores_at" => null, @@ -24,9 +31,8 @@ class OrdenTrabajoDateEntity extends Entity "cosido_at" => null, "solapa_at" => null, "grapado_at" => null, - "retractilado_at"=> null, - "retractilado5_at"=> null, - "prototipo_at"=> null, + "retractilado5_at"=> null, // !DELETE + "prototipo_at"=> null, // !DELETE "marcapaginas_at"=> null, "espiral_at"=> null, //FERRO diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index b3f38e26..b80de21d 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -30,10 +30,11 @@ class OrdenTrabajoEntity extends Entity "progreso" => 0.00, "estado" => "I", "comentarios" => null, - "comment_interior"=> null, - "comment_cubierta"=> null, - "comment_encuadernacion"=> null, - "comment_logistica"=> null, + "comment_interior" => null, + "comment_cubierta" => null, + "comment_encuadernacion" => null, + "comment_logistica" => null, + "info_solapa_guillotina" => null, "revisar_formato" => null, "revisar_lomo" => null, "revisar_solapa" => null, @@ -57,10 +58,11 @@ class OrdenTrabajoEntity extends Entity "progreso" => "float", "estado" => "string", "comentarios" => "?string", - "comment_interior"=> "?string", - "comment_cubierta"=> "?string", - "comment_encuadernacion"=> "?string", - "comment_logistica"=> "?string", + "comment_interior" => "?string", + "comment_cubierta" => "?string", + "comment_encuadernacion" => "?string", + "comment_logistica" => "?string", + "info_solapa_guillotina" => "?string", "revisar_formato" => "bool", "revisar_lomo" => "bool", "revisar_solapa" => "bool", @@ -88,7 +90,22 @@ class OrdenTrabajoEntity extends Entity $m = model(OrdenTrabajoTarea::class); return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? []; } - /** + public function tareas_acabado(): array + { + $m = model(OrdenTrabajoTarea::class); + return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll() ?? []; + } + public function tareas_encuadernado(): array + { + $m = model(OrdenTrabajoTarea::class); + return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_encuadernado_id IS NOT NULL", NULL, FALSE)->findAll() ?? []; + } + public function tareas_manipulado(): array + { + $m = model(OrdenTrabajoTarea::class); + return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll() ?? []; + } + /** * Devuelve el presupuesto de la orden de trabajo * * @return PresupuestoEntity @@ -191,4 +208,5 @@ class OrdenTrabajoEntity extends Entity ]; return $estados[$this->attributes["estado"]]; } + } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php index 6eb09ce3..1d32be82 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php @@ -5,6 +5,7 @@ namespace App\Entities\Produccion; use App\Entities\Configuracion\Imposicion; use App\Entities\Configuracion\Maquina; use App\Entities\Presupuestos\PresupuestoAcabadosEntity; +use App\Entities\Presupuestos\PresupuestoEncuadernacionesEntity; use App\Entities\Presupuestos\PresupuestoLineaEntity; use App\Entities\Presupuestos\PresupuestoManipuladosEntity; use App\Models\Configuracion\ImposicionModel; @@ -12,6 +13,7 @@ use App\Models\Configuracion\MaquinaModel; use App\Models\OrdenTrabajo\OrdenTrabajoModel; use App\Models\OrdenTrabajo\OrdenTrabajoTareaProgressDate; use App\Models\Presupuestos\PresupuestoAcabadosModel; +use App\Models\Presupuestos\PresupuestoEncuadernacionesModel; use App\Models\Presupuestos\PresupuestoLineaModel; use App\Models\Presupuestos\PresupuestoManipuladosModel; use CodeIgniter\Entity\Entity; @@ -23,6 +25,11 @@ class OrdenTrabajoTareaEntity extends Entity "id" => null, "orden_trabajo_id" => null, "presupuesto_linea_id" => null, + "presupuesto_acabado_id" => null, + "presupuesto_preimpresion_id" => null, + "presupuesto_encuadernado_id" => null, + "presupuesto_extra_id" => null, + "presupuesto_manipulado_id" => null, "nombre" => null, "orden" => null, "maquina_id" => null, @@ -96,10 +103,15 @@ class OrdenTrabajoTareaEntity extends Entity * * @return PresupuestoLineaEntity */ - public function presupuesto_linea(): PresupuestoLineaEntity + public function presupuesto_linea(): ?PresupuestoLineaEntity { + $presupuesto_linea = null; $m = model(PresupuestoLineaModel::class); - return $m->find($this->attributes["presupuesto_linea_id"]); + if ($this->attributes['presupuesto_linea_id']) { + + $presupuesto_linea = $m->find($this->attributes["presupuesto_linea_id"]); + } + return $presupuesto_linea; } /** * Devuelve la maquina original del presupuesto linea @@ -108,17 +120,35 @@ class OrdenTrabajoTareaEntity extends Entity */ public function maquina_presupuesto_linea(): Maquina { - return $this->presupuesto_linea()->maquina(); + return $this->presupuesto_linea()?->maquina(); } /** * Devuelve el presupuesto acabado origen de esta tarea * * @return PresupuestoAcabadosEntity */ - public function presupuesto_acabado(): PresupuestoAcabadosEntity + public function presupuesto_acabado(): ?PresupuestoAcabadosEntity { + $presupuesto_acabado = null; $m = model(PresupuestoAcabadosModel::class); - return $m->find($this->attributes["presupuesto_linea_id"]); + if ($this->attributes["presupuesto_acabado_id"]) { + $presupuesto_acabado = $m->find($this->attributes["presupuesto_acabado_id"]); + } + return $presupuesto_acabado; + } + /** + * Devuelve el presupuesto enducadernacion origen de esta tarea + * + * @return PresupuestoEncuadernacionesEntity + */ + public function presupuesto_encuadernacion(): ?PresupuestoEncuadernacionesEntity + { + $presupuesto_encuadernacion = null; + $m = model(PresupuestoEncuadernacionesModel::class); + if ($this->attributes["presupuesto_encuadernado_id"]) { + $presupuesto_encuadernacion = $m->find($this->attributes["presupuesto_encuadernado_id"]); + } + return $presupuesto_encuadernacion; } /** * Devuelve el presupuesto acabado origen de esta tarea @@ -152,8 +182,8 @@ class OrdenTrabajoTareaEntity extends Entity { $dates = $this->progress_dates(); $intervals = []; - $init = []; - $end = []; + $init = null; + $end = null; foreach ($dates as $key => $date) { if ($date->estado == "I") { if ($date->action_at) { @@ -161,7 +191,7 @@ class OrdenTrabajoTareaEntity extends Entity } } if ($date->estado == "S" || $date->estado == "F") { - if ($date->action_at) { + if ($date->action_at && $init) { $end = Time::createFromFormat('Y-m-d H:i:s', $date->action_at); $intervals[] = $init->difference($end)->getSeconds(); } @@ -182,4 +212,24 @@ class OrdenTrabajoTareaEntity extends Entity } return $isTareaCosido; } + public function isImpresion() : bool + { + return $this->attributes['presupuesto_linea_id'] != null; + } + public function isAcabado() : bool + { + return $this->attributes['presupuesto_acabado_id'] != null; + } + public function isManipulado() : bool + { + return $this->attributes['presupuesto_manipulado_id'] != null; + } + public function isEncuadernado() : bool + { + return $this->attributes['presupuesto_encuadernado_id'] != null; + } + public function isCorte() : bool + { + return $this->attributes['is_corte']; + } } diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php index 0a95037a..076c6d16 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php @@ -19,8 +19,13 @@ class OrdenTrabajoUserEntity extends Entity "interior_bn_user_id" => null, "interior_color_user_id" => null, "cubierta_user_id" => null, + "sobrecubierta_user_id" => null, + "guarda_user_id" => null, //ACABADO "plastificado_user_id" => null, + "plakene_user_id" => null, + "estampado_user_id" => null, + "uvi_user_id" => null, "encuadernacion_user_id" => null, "corte_user_id" => null, "preparacion_interior_user_id" => null, diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index dada2238..ee18d7b6 100755 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -43,6 +43,7 @@ return [ "maquina_actual" => "Máquina actual", "tiempo_estimado" => "Tiempo estimado", "tiempo" => "Tiempo", + "proveedor" => "Proveedor", "imposicion" => "Imposición" ], "finalizadas" => "Finalizadas", @@ -70,6 +71,7 @@ return [ "portada" => "portada", "plakene_traslucido" => "Plakene traslúcido", "plastificado_mate" => "Plastificado mate", + "plastificado" => "Plastificado", "espiral" => "Espiral", "embalaje" => "Embalaje", "tiempo_consumido" => "Tiempo consumido", @@ -98,12 +100,16 @@ return [ "grapado" => "Grapado", "solapa" => "Solapas", "retractilado" => "Retractilado", + "manipulado" => "Entrada manipulado", "retractilado5" => "Retractilado 5", "prototipo" => "Prototipo", "marcapaginas" => "Marcapáginas", //IMPRESION "impresion_bn" => "Impresión BN", "cubierta" => "Cubierta/Portada", + "guarda" => "Guarda", + "encuadernacion" => "Encuadernación", + //PREIMPRESION "pre_formato" => "Revisión formato", "pre_lomo" => "Revisión lomo", @@ -151,6 +157,5 @@ return [ "comentariosCubierta" => "Comentarios cubierta", "comentariosEncuadernacion" => "Comentarios encuadernación", "comentariosLogistica" => "Comentarios logística", - - + "info_solapa_guillotina" => "Datos solapa y preparación guillotina", ]; \ No newline at end of file diff --git a/ci4/app/Models/Compras/ProveedorModel.php b/ci4/app/Models/Compras/ProveedorModel.php index d48e8d8e..da0a6116 100755 --- a/ci4/app/Models/Compras/ProveedorModel.php +++ b/ci4/app/Models/Compras/ProveedorModel.php @@ -214,4 +214,12 @@ class ProveedorModel extends \App\Models\BaseModel return $builder->get()->getResultObject(); } + public function querySelect(?string $q) + { + $query = $this->builder()->select(['id','nombre as name']); + if($q){ + $query->like('nombre',$q); + } + return $query; + } } diff --git a/ci4/app/Models/Configuracion/MaquinaModel.php b/ci4/app/Models/Configuracion/MaquinaModel.php index ff8f3dcd..d462cc08 100755 --- a/ci4/app/Models/Configuracion/MaquinaModel.php +++ b/ci4/app/Models/Configuracion/MaquinaModel.php @@ -427,6 +427,9 @@ class MaquinaModel extends \App\Models\BaseModel ->where('tarea_progress.deleted_at', null) ->groupBy('lg_maquinas.id') ->orderBy('countTareas','DESC'); + if($maquina_tipo == "impresion"){ + $query->where('orden_trabajo_tareas.is_corte',0); + } return $query; } diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php index 51234724..d44055ab 100755 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoDate.php @@ -22,8 +22,14 @@ class OrdenTrabajoDate extends Model "interior_bn_at", "interior_color_at", "cubierta_at", + "sobrecubierta_at", //TODO + "guarda_at", //TODO //ACABADO "plastificado_at", + "plakene_at", //TODO + "retractilado_at", + "estampado_at", //TODO + "uvi_at", //TODO "encuadernacion_at", "corte_at", "preparacion_interiores_at", @@ -31,7 +37,6 @@ class OrdenTrabajoDate extends Model "cosido_at", "solapa_at", "grapado_at", - "retractilado_at", "retractilado5_at", "prototipo_at", "marcapaginas_at", diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php index b9a0cddf..3dc9a95f 100755 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php @@ -29,6 +29,7 @@ class OrdenTrabajoModel extends Model "comment_cubierta", "comment_encuadernacion", "comment_logistica", + "info_solapa_guillotina", "revisar_formato", "revisar_lomo", "revisar_solapa", diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php index 443bbcd0..60114c57 100755 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php @@ -23,11 +23,18 @@ class OrdenTrabajoUser extends Model "interior_bn_user_id", "interior_color_user_id", "cubierta_user_id", + "sobrecubierta_user_id", + "guarda_user_id", //ACABADO "plastificado_user_id", + "plakene_user_id", + "retractilado_user_id", + "estampado_user_id", + "uvi_user_id", + //ENCUADERNADO "encuadernacion_user_id", - "corte_user_id", "preparacion_interior_user_id", + "corte_user_id", "entrada_manipulado_user_id", "cosido_user_id", "solapa_user_id", diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index dc5bfe80..de5c7dfa 100755 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -23,6 +23,8 @@ use App\Models\Configuracion\MaquinaModel; use App\Models\OrdenTrabajo\OrdenTrabajoFileModel; use App\Models\OrdenTrabajo\OrdenTrabajoTareaProgressDate; use App\Models\Pedidos\PedidoModel; +use App\Models\Presupuestos\PresupuestoAcabadosModel; +use App\Models\Presupuestos\PresupuestoEncuadernacionesModel; use App\Models\Usuarios\UserModel; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\BaseResult; @@ -65,6 +67,8 @@ class ProductionService extends BaseService protected MaquinaEntity $defaultMaquinaCorte; protected MaquinaModel $maquinaModel; protected OrdenTrabajo $ordenTrabajoConfig; + protected PresupuestoAcabadosModel $presupuestoAcabadoModel; + protected PresupuestoEncuadernacionesModel $presupuestoEncuadernacionModel; /** @@ -130,7 +134,7 @@ class ProductionService extends BaseService * TODO Hay que implementar un boolean en `lg_tarifa_manipulado` para identificar * @var boolean */ - public bool $isGrapado = true; //TODO + public bool $isGrapado = false; //TODO /** * Indica si la orden de trabajo contiene espiral * Se usa para mostrar la fecha correspondiente en la vista @@ -138,7 +142,7 @@ class ProductionService extends BaseService * DEFAULT true hasta implementacion * @var boolean */ - public bool $isEspiral = true; //TODO + public bool $isEspiral = false; //TODO /** * Indica si la orden de trabajo contiene UVI * Se usa para mostrar la fecha correspondiente en la vista @@ -196,6 +200,8 @@ class ProductionService extends BaseService $this->otTareaProgressDate = model(OrdenTrabajoTareaProgressDate::class); $this->festivoModel = model(FestivoModel::class); $this->ordenTrabajoConfig = config('OrdenTrabajo'); + $this->presupuestoAcabadoModel = model(PresupuestoAcabadosModel::class); + $this->presupuestoEncuadernacionModel = model(PresupuestoEncuadernacionesModel::class); $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; $this->configVariableModel = model(ConfigVariableModel::class); $this->podValue = $this->configVariableModel->getVariable('POD')->value; @@ -613,6 +619,10 @@ class ProductionService extends BaseService "orden_trabajo_tareas.tiempo_real", "orden_trabajo_tareas.comment", "orden_trabajo_tareas.presupuesto_linea_id", + "orden_trabajo_tareas.presupuesto_acabado_id", + "orden_trabajo_tareas.presupuesto_manipulado_id", + "orden_trabajo_tareas.presupuesto_preimpresion_id", + "orden_trabajo_tareas.presupuesto_encuadernado_id", "presupuesto_linea.tipo", ]) @@ -979,6 +989,18 @@ class ProductionService extends BaseService throw new Exception(lang('Produccion.task_already_finished')); } } + 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); + $dataDate = [ + 'name' => $dateName, + ]; + $dataDate[$dateName] = Time::now()->format('Y-m-d'); + $this->updateOrdenTrabajoDate($dataDate); + } + } return $this->otTareaProgressDate->insert($data); } public function getTareaLastState($tarea_id) @@ -993,6 +1015,12 @@ 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){ + $tareaEntity = $this->otTarea->find($orden_trabajo_tarea_id); + $this->init($tareaEntity->orden_trabajo_id); + $dateName = $this->getOrdenTrabajoTareaDate($tareaEntity); + $this->emptyOrdenTrabajoDate($this->ot->id,$dateName); + } if ($status) { $response = $this->storeOrdenTrabajoTareaProgressDate($data); } @@ -1655,9 +1683,14 @@ class ProductionService extends BaseService return [ "isGofrado" => $this->gofrado(), "isEspiral" => $this->isEspiral, //TODO - "isUVI" => $this->uvi(), "isPlastificado" => $this->plastificado(), + "isPlakene" => $this->plakene(), + "isEstampado" => $this->estampado(), + "isRetractilado" => $this->retractilado(), + "isUVI" => $this->uvi(), "isCubierta" => $this->cubierta(), + "isSobrecubierta" => $this->sobreCubierta(), + "isGuarda" => $this->guarda(), "isColor" => $this->isColor, "isBN" => $this->isBN, "isCorte" => $this->corte(), @@ -1696,6 +1729,20 @@ class ProductionService extends BaseService $this->isPlakene = $flag; return $this->isPlakene; } + public function retractilado(): bool + { + $flag = false; + $acabados = $this->presupuesto->acabados(); + foreach ($acabados as $key => $acabado) { + $tarifa_acabado = $acabado->tarifa(); + if ($tarifa_acabado->retractilado) { + $flag = true; + break; + } + } + $this->isPlakene = $flag; + return $this->isPlakene; + } public function plakene_tipo(): ?string { $tipo = ""; @@ -1769,6 +1816,24 @@ class ProductionService extends BaseService } return $this->isCubierta; } + public function sobreCubierta(): bool + { + $flag = false; + $lineaCubierta = $this->presupuesto->presupuestoLineaSobreCubierta(); + if ($lineaCubierta) { + $flag = true; + } + return $flag; + } + public function guarda(): bool + { + $flag = false; + $lineaCubierta = $this->presupuesto->presupuestoLineaGuarda(); + if ($lineaCubierta) { + $flag = true; + } + return $flag; + } public function color(): bool { $linea_impresion = $this->presupuesto->presupuestoLineaImpresion(); @@ -1807,10 +1872,7 @@ class ProductionService extends BaseService "orden_trabajo_tareas.id as ot_tarea_id", "pedidos.fecha_impresion", "orden_trabajo_tareas.nombre as tareaName", - "presupuestos.titulo as presupuesto_titulo", "orden_trabajo_tareas.maquina_id", - "lg_papel_impresion.nombre as papel_impresion", - "presupuesto_linea.gramaje as papel_gramaje", "tarea_progress.estado as tareaEstado" ]) ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left") @@ -1827,21 +1889,14 @@ class ProductionService extends BaseService 'tarea_progress.ot_tarea_id = orden_trabajo_tareas.id', 'left' ) - ->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left") - ->join("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right") ->join("pedidos", "pedidos.id = ordenes_trabajo.pedido_id", "right") - ->join("lg_papel_formato", "lg_papel_formato.id = presupuestos.papel_formato_id", "left") ->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left") - ->join("lg_papel_impresion", "lg_papel_impresion.id = presupuesto_linea.papel_impresion_id", "left") - ->groupStart() - ->orWhere('orden_trabajo_tareas.maquina_id', $maquina_id) //!TODO - ->orWhere('presupuesto_linea.maquina_id', $maquina_id) - ->groupEnd() + ->where('orden_trabajo_tareas.maquina_id', $maquina_id) // ->where('pedidos.fecha_impresion IS NOT NULL', null, false) ->where("orden_trabajo_tareas.deleted_at", null) ->where("tarea_progress.estado", 'P') ->orderBy("pedidos.fecha_impresion", "ASC") - ->groupBy('orden_trabajo_tareas.nombre'); + ->groupBy('orden_trabajo_tareas.id'); return $q; } @@ -1928,4 +1983,176 @@ class ProductionService extends BaseService $dates = $this->createDatesForPOD(); return $this->pedidoModel->update($this->pedido->id, $dates); } + public function getProveedorTarea($tarea_id) + { + $proveedor = null; + $tareaEntity = $this->otTarea->find($tarea_id); + if ($tareaEntity) { + $proveedorEncuadernado = $tareaEntity->presupuesto_encuadernacion(); + $proveedorAcabado = $tareaEntity->presupuesto_acabado(); + if ($proveedorEncuadernado) { + $proveedor = $proveedorEncuadernado->proveedor(); + } elseif ($proveedorAcabado) { + $proveedor = $proveedorAcabado->proveedor(); + } else { + $proveedor = null; + } + } + return ["tarea" => $tareaEntity, "proveedor" => $proveedor]; + } + public function updateProveedorLinea($tarea_id, $proveedor_id) + { + $status = false; + $tareaEntity = $this->otTarea->find($tarea_id); + $presupuestoEncuadernado = $tareaEntity->presupuesto_encuadernacion(); + $presupuestoAcabado = $tareaEntity->presupuesto_acabado(); + if ($presupuestoEncuadernado) { + $status = $this->presupuestoEncuadernacionModel->update($presupuestoEncuadernado->id, ['proveedor_id' => $proveedor_id]); + } elseif ($presupuestoAcabado) { + $status = $this->presupuestoAcabadoModel->update($presupuestoAcabado->id, ['proveedor_id' => $proveedor_id]); + } else { + $status = null; + } + return $status; + } + public function otTareaImpresionWithDates() + { + $tareasImpresion = $this->ot->tareas_impresion(); + $data = []; + foreach ($tareasImpresion as $key => $tareaImpresion) { + if ($tareaImpresion->is_corte) { + $data[$tareaImpresion->id] = 'corte_at'; + continue; + } + $presupuestoLineaEntity = $tareaImpresion->presupuesto_linea(); + if ($presupuestoLineaEntity) { + if ($presupuestoLineaEntity->isGuarda()) { + $data[$tareaImpresion->id] = 'guarda_at'; + } elseif ($presupuestoLineaEntity->isCubierta()) { + $data[$tareaImpresion->id] = 'cubierta_at'; + } elseif ($presupuestoLineaEntity->isColor()) { + $data[$tareaImpresion->id] = 'interior_color_at'; + } elseif ($presupuestoLineaEntity->isBN()) { + $data[$tareaImpresion->id] = 'interior_bn_at'; + } elseif ($presupuestoLineaEntity->isSobreCubierta()) { + $data[$tareaImpresion->id] = 'sobrecubierta_at'; + } + } + } + return $data; + } + public function tareaImpresionDate($tarea): string + { + + $dateName = ""; + $presupuestoLineaEntity = $tarea->presupuesto_linea(); + if ($presupuestoLineaEntity) { + if ($presupuestoLineaEntity->isGuarda()) { + $dateName = 'guarda_at'; + } elseif ($presupuestoLineaEntity->isCubierta()) { + $dateName = 'cubierta_at'; + } elseif ($presupuestoLineaEntity->isColor()) { + $dateName = 'interior_color_at'; + } elseif ($presupuestoLineaEntity->isBN()) { + $dateName = 'interior_bn_at'; + } elseif ($presupuestoLineaEntity->isSobreCubierta()) { + $dateName = 'sobrecubierta_at'; + } + if ($tarea->is_corte) { + $dateName = 'corte_at'; + } + } + return $dateName; + } + public function otTareaAcabadoWithDates() + { + $tareasAcabado = $this->ot->tareas_acabado(); + $data = []; + foreach ($tareasAcabado as $key => $tareasAcabado) { + $tarifaAcabado = $tareasAcabado->presupuesto_acabado()?->tarifa(); + if ($tarifaAcabado) { + if ($tarifaAcabado->plastificado) { + $data[$tareasAcabado->id] = 'plastificado_at'; + } + if ($tarifaAcabado->rectractilado) { + $data[$tareasAcabado->id] = 'rectractilado_at'; + } + if ($tarifaAcabado->estampado) { + $data[$tareasAcabado->id] = 'estampado_at'; + } + if ($tarifaAcabado->uvi) { + $data[$tareasAcabado->id] = 'uvi_at'; + } + } + } + return $data; + } + public function tareaAcabadoDate($tarea): string + { + + $dateName = ""; + $tarifaAcabado = $tarea->presupuesto_acabado()?->tarifa();; + if ($tarifaAcabado) { + if ($tarifaAcabado->plastificado) { + $dateName = 'plastificado_at'; + } + if ($tarifaAcabado->rectractilado) { + $dateName = 'rectractilado_at'; + } + if ($tarifaAcabado->plakene) { + $dateName = 'plakene_at'; + } + if ($tarifaAcabado->estampado) { + $dateName = 'estampado_at'; + } + if ($tarifaAcabado->uvi) { + $dateName = 'uvi_at'; + } + } + return $dateName; + } + public function otTareaEncuadernadoWithDates() + { + $tareas = $this->ot->tareas_encuadernado(); + $data = []; + foreach ($tareas as $key => $tarea) { + $data[$tarea->id] = "encuadernacion_at"; + } + return $data; + } + + public function otTareaManipuladooWithDates() + { + $tareas = $this->ot->tareas_manipulado(); + $data = []; + foreach ($tareas as $key => $tarea) { + $data[$tarea->id] = "entrada_manipulado_at"; + } + return $data; + } + public function getOrdenTrabajoTareaDates(): array + { + $dates = []; + foreach ($this->ot->tareas() as $key => $tarea) { + $dates[] = $this->getOrdenTrabajoTareaDate($tarea); + } + return array_unique($dates); + } + public function getOrdenTrabajoTareaDate(OrdenTrabajoTareaEntity $tarea): ?string + { + $dateName = null; + if ($tarea->isImpresion()) { + $dateName = $this->tareaImpresionDate($tarea); + } + if ($tarea->isAcabado()) { + $dateName = $this->tareaAcabadoDate($tarea); + } + if ($tarea->isManipulado()) { + $dateName = "entrada_manipulado_at"; + } + if ($tarea->isEncuadernado()) { + $dateName = "encuadernacion_at"; + } + return $dateName; + } } diff --git a/ci4/app/Views/themes/vuexy/components/tables/maquinista_tarea_table.php b/ci4/app/Views/themes/vuexy/components/tables/maquinista_tarea_table.php index cbf06dde..2ff699af 100755 --- a/ci4/app/Views/themes/vuexy/components/tables/maquinista_tarea_table.php +++ b/ci4/app/Views/themes/vuexy/components/tables/maquinista_tarea_table.php @@ -6,9 +6,6 @@
| = lang('Produccion.task.order') ?> | @@ -8,6 +8,7 @@= lang('Produccion.task.maquina_presupuesto') ?> | = lang('Produccion.task.maquina_actual') ?> | = lang('Produccion.task.imposicion') ?> | += lang('Produccion.task.proveedor') ?> | = lang('Produccion.task.tiempo_estimado') ?> | = lang('Produccion.task.tiempo') ?> | diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php index f2aff0f7..5223e062 100755 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otComments.php @@ -75,13 +75,25 @@ role="tab" data-bs-toggle="tab" data-bs-target="#comentarios-logistica" - aria-controls="comentarios-logiscita" + aria-controls="comentarios-logistica" aria-selected="false"> = lang("Produccion.comentariosLogistica") ?> + | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| = $encuadernacion->tarifa()->nombre ?> | -+ | Plástico | = $flags['isPlakene'] ? "SI" : "NO" ?> | = $plakene_tipo ?? "" ?> | diff --git a/ci4/app/Views/themes/vuexy/pdfs/encuadernados/WIO.php b/ci4/app/Views/themes/vuexy/pdfs/encuadernados/WIO.php index 026a4b7a..f72f29b8 100644 --- a/ci4/app/Views/themes/vuexy/pdfs/encuadernados/WIO.php +++ b/ci4/app/Views/themes/vuexy/pdfs/encuadernados/WIO.php @@ -1,7 +1,7 @@
| Encuadernacion | -Color | +Tipo | Plakenes | Plakene | Externo | @@ -10,7 +10,7 @@ 0): ?>
|---|---|---|---|---|---|
| = $encuadernacion->tarifa()->nombre ?> | -+ | Metálico | = $flags['isPlakene'] ? "SI" : "NO" ?> | = $plakene_tipo ?? "" ?> | = $encuadernacion->proveedor() ? $encuadernacion->proveedor()->nombre : "" ?> | diff --git a/ci4/app/Views/themes/vuexy/pdfs/ferro.php b/ci4/app/Views/themes/vuexy/pdfs/ferro.php index 52e6ede9..2b22a376 100755 --- a/ci4/app/Views/themes/vuexy/pdfs/ferro.php +++ b/ci4/app/Views/themes/vuexy/pdfs/ferro.php @@ -251,7 +251,7 @@ $settings = $session->get('settings');
diff --git a/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php b/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php index 926d822f..315a5bf6 100755 --- a/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php +++ b/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo.php @@ -255,7 +255,7 @@ $settings = $session->get('settings');
@@ -294,7 +294,7 @@ $settings = $session->get('settings'); -
@@ -382,7 +382,7 @@ $settings = $session->get('settings');
@@ -294,7 +294,7 @@ $settings = $session->get('settings'); -
diff --git a/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaList.js b/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaList.js index 9b964203..6e7dc076 100644 --- a/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaList.js +++ b/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaList.js @@ -11,9 +11,9 @@ class MaquinistaTareaList { { data: 'otId', searchable: false, sortable: false }, { data: 'tareaName', searchable: false, sortable: false }, { 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 }, + // { data: 'presupuesto_titulo', searchable: false, sortable: false }, + // { data: 'papel_impresion', searchable: false, sortable: false }, + // { data: 'papel_gramaje', searchable: false, sortable: false }, { data: 'fecha_impresion', searchable: false, sortable: false }, { data: 'action', searchable: false, sortable: false, width: "20rem" }, ] diff --git a/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js b/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js index b4e20735..eb2003af 100644 --- a/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js +++ b/httpdocs/assets/js/safekat/pages/configuracion/maquinista/maquinistaTareaView.js @@ -1,6 +1,6 @@ import Ajax from '../../../components/ajax.js' -import { alertConfirmAction } from '../../../components/alerts/sweetAlert.js' +import { alertConfirmAction, alertError, alertSuccess } from '../../../components/alerts/sweetAlert.js' class MaquinistaTareaView { constructor(domItem) { this.item = domItem @@ -84,7 +84,7 @@ class MaquinistaTareaView { handleUpdateClickInputError(error) { popErrorAlert(error) } - updateContentClick(clicks){ + updateContentClick(clicks) { this.item.find('#clicks-info').empty().html(clicks) } handleDeleteTareaProgress() { @@ -155,11 +155,13 @@ class MaquinistaTareaView { window.location.href = '/produccion/ordentrabajo/maquinista/maquinas/view' } this.showBasedOnStatus(response.data.status) + alertSuccess(response.message, null, { position: 'top' }).fire() } this.actionLoader(false) } handleUpdateTareaProgressError(error) { popErrorAlert(error.error) + alertError(error.error, null, { position: 'top' }).fire() this.actionLoader(false) } diff --git a/httpdocs/assets/js/safekat/pages/produccion/ot.js b/httpdocs/assets/js/safekat/pages/produccion/ot.js index c6ec547f..d0e6f7a7 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/ot.js +++ b/httpdocs/assets/js/safekat/pages/produccion/ot.js @@ -28,15 +28,35 @@ class OrdenTrabajo { this.otEstado = this.item.find("#ot-estado"); this.datatableColumns = [ - { data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this), width: "10%" }, - { data: 'nombre', searchable: true, sortable: true, width: "20%" }, - { data: 'maquina_presupuesto_linea', searchable: true, sortable: true, width: "20%" }, - { data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "20%" }, - { data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this) }, + { data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this) }, + { data: 'nombre', searchable: true, sortable: true }, + { + data: 'maquina_presupuesto_linea', searchable: true, sortable: true, render: (d) => { + if (d) { + + return ` +
@@ -276,7 +276,7 @@ $settings = $session->get('settings');