From e24839019a94a4bf0e645ecd4fd716542d1a6d29 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Wed, 4 Dec 2024 18:15:59 +0100 Subject: [PATCH] ots --- .../2024-10-06-085437_OrdenTrabajoTable.php | 449 ------------------ .../2024-11-30-160000_TareasServicioTable.php | 53 +++ .../2024-11-30-170000_OrdenTrabajoTable.php | 299 ++++++++++++ ...4-11-30-170001_OrdenTrabajoTareasTable.php | 56 +++ ...24-11-30-170002_OrdenTrabajoDatesTable.php | 171 +++++++ ...24-11-30-170002_OrdenTrabajoUsersTable.php | 190 ++++++++ ...-170006_OrdenTrabajoMaquetacionesTable.php | 77 +++ ...rdenTrabajoMaquetacionMovimientosTable.php | 63 +++ .../Models/OrdenTrabajo/OrdenTrabajoModel.php | 86 ++-- 9 files changed, 938 insertions(+), 506 deletions(-) delete mode 100644 ci4/app/Database/Migrations/2024-10-06-085437_OrdenTrabajoTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-160000_TareasServicioTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-170006_OrdenTrabajoMaquetacionesTable.php create mode 100644 ci4/app/Database/Migrations/2024-11-30-171007_OrdenTrabajoMaquetacionMovimientosTable.php diff --git a/ci4/app/Database/Migrations/2024-10-06-085437_OrdenTrabajoTable.php b/ci4/app/Database/Migrations/2024-10-06-085437_OrdenTrabajoTable.php deleted file mode 100644 index 2c861651..00000000 --- a/ci4/app/Database/Migrations/2024-10-06-085437_OrdenTrabajoTable.php +++ /dev/null @@ -1,449 +0,0 @@ - [ - "type" => "INT", - "unsigned" => true, - "auto_increment" => true - ], - "pedido_id" => [ - "type" => "INT", - "constraint" => 10, - "comment" => "Pedido asociado", - ], - "user_created_id" => [ - "type" => "INT", - "constraint" => 10, - ], - "user_update_id" => [ - "type" => "INT", - "constraint" => 10, - ], - "maquina_orden_negro_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - ], - "maquina_orden_color_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "maquina_orden_portada_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "maquina_orden_cubierta_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "negro_forma_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "color_forma_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "portada_forma_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "cubierta_forma_id" => [ - "type" => "INT", - "constraint" => 10, - "null" => true - - ], - "tirada" => [ - "type" => "DOUBLE", - ], - "negro_pliegos_pedido" => [ - "type" => "DOUBLE", - "null" => true - ], - "color_pliegos_pedido" => [ - "type" => "DOUBLE", - "null" => true - ], - "portada_pliegos_pedido" => [ - "type" => "DOUBLE", - "null" => true - ], - "cubierta_pliegos_pedido" => [ - "type" => "DOUBLE", - "null" => true - ], - "negro_clicks_pedido" => [ - "type" => "DOUBLE", - ], - "color_clicks_pedido" => [ - "type" => "DOUBLE", - ], - "portada_clicks_pedido" => [ - "type" => "DOUBLE", - ], - "cubierta_clicks_pedido" => [ - "type" => "DOUBLE", - ], - "pliegos1" => [ - "type" => "INT", - "constraint" => 11, - ], - "paginas1" => [ - "type" => "INT", - "constraint" => 11, - ], - "pliegos2" => [ - "type" => "INT", - "constraint" => 11, - ], - "paginas2" => [ - "type" => "INT", - "constraint" => 11, - ], - "negro_proveedor_nombre" => [ - "type" => "VARCHAR", - "constraint" => 225 - ], - "color_proveedor_nombre" => [ - "type" => "VARCHAR", - "constraint" => 225 - ], - "portada_proveedor_nombre" => [ - "type" => "VARCHAR", - "constraint" => 225 - ], - "corte_pie" => [ - "type" => "DOUBLE", - ], - "lomo" => [ - "type" => "INT", - "constraint" => 11, - "null" => true, - ], - "tipo_entrada" => [ - "type" => "ENUM", - "constraint" => ["in", "out"], - "default" => "out" - ], - "fecha_entrada_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "fecha_entrega_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "fecha_entrega_change_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "fecha_entrega_change_user_id" =>[ - "type" => "INT", - "constraint" => 11, - "null" => true, - - ], - "fecha_entrega_real_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "fecha_entrega_real_warning" => [ - "type" => "BOOLEAN", - "default" => false, - ], - "fecha_impresion_at" => [ - "type" => "DATE", - "null" => true, - ], - "fecha_encuardernado_at" => [ - "type" => "DATE", - "null" => true, - ], - "fecha_externo_at" => [ - "type" => "DATE", - "null" => true, - ], - "fecha_entrega_warning" => [ - "type" => "BOOLEAN", - "default" => false - ], - "fecha_entrega_warning_revised" => [ - "type" => "BOOLEAN", - "default" => false - ], - "inaplazable_revised_change_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pendiente_ferro_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "ferro_en_cliente_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "ferro_ok_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "interior_bn_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "interior_color_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "preparacion_interiores_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "cubierta_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "plastificado_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "encuadernacion_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "corte_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "embalaje_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "envio_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "entrada_manipulado_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "ferro_disponible" => [ - "type" => "TINYINT", - "constraint" => 4, - ], - "ferro_disponible_thread_id" => [ - "type" => "INT", - "constraint" => 10, - ], - "ferro_disponible_hecho_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "ferro_disponible_hecho_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "ferro_disponible_ok_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "ferro_disponible_ok_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "ferro_entregado_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "ferro_entregado_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "pendiente_ferro_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "ferro_en_cliente_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "ferro_ok_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "ferro_cp" => [ - "type" => "VARCHAR", - "constraint" => 10, - "null" => true - ], - "ferro_proveedor" => [ - "type" => "INT", - "unsigned" => true, - "constraint" => 10, - ], - "ferro_tracking" => [ - "type" => "VARCHAR", - "constraint" => 100, - "null" => true, - ], - "interior_bn_user_id" => [ - "type" => "INT", - "constraint" => 10, - ], - "interior_color_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "preparacion_interior_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "cubierda_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "plastificado_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "encuadernacion_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "corte_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "embalaje_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "envio_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "entrada_manipulado_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_formato" => [ - "type" => "BOOLEAN", - "default" => false - ], - "pre_formato_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "pre_formato_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_lomo" => [ - "type" => "BOOLEAN", - "default" => 0, - ], - "pre_lomo_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "pre_lomo_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_solapa" => [], - "pre_solapa_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "pre_solapa_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_isbn" => [], - "pre_isbn_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_codbarras" => [], - "pre_codbarras_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "pre_codbarras_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_imposicion" => [], - "pre_imposicion_at" => [ - "type" => "DATETIME", - "null" => true, - ], - "pre_imposicion_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_imprimir" => [], - "pre_imprimir_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_faltan_materiales" => [], - "pre_imprimir_user_id" => [ - "type" => "INT", - "constraint" => 11, - ], - "pre_faltan_materiales_note" => [], - "progreso" => [], - "message_production_send" => [], - "finalizado" => [], - "comentarios" => [] - ]; - 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->createTable("ots", true); - } - - public function down() - { - $this->forge->dropTable("ots"); - } -} diff --git a/ci4/app/Database/Migrations/2024-11-30-160000_TareasServicioTable.php b/ci4/app/Database/Migrations/2024-11-30-160000_TareasServicioTable.php new file mode 100644 index 00000000..1f72c764 --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-160000_TareasServicioTable.php @@ -0,0 +1,53 @@ + [ + "type" => "INT", + "unsigned" => true, + "autoincrement" => true + ], + "tarifa_acabado_id" => [ + "type" => "INT", + "unsigned" => true, + ], + "tarifa_manipulado_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->createTable("tareas_servicio", true); + } + + public function down() + { + $this->forge->dropTable("tareas_servicio"); + } +} diff --git a/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php b/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php new file mode 100644 index 00000000..654ed94b --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php @@ -0,0 +1,299 @@ + [ + "type" => "INT", + "unsigned" => true, + "auto_increment" => true + ], + "pedido_id" => [ + "type" => "INT", + "constraint" => 10, + "comment" => "Pedido asociado", + ], + "user_created_id" => [ + "type" => "INT", + "constraint" => 10, + ], + "user_update_id" => [ + "type" => "INT", + "constraint" => 10, + ], + "maquina_orden_negro_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + ], + "maquina_orden_color_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "maquina_orden_portada_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "maquina_orden_cubierta_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "negro_forma_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "color_forma_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "portada_forma_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "cubierta_forma_id" => [ + "type" => "INT", + "constraint" => 10, + "null" => true + + ], + "tirada" => [ + "type" => "DOUBLE", + ], + "negro_pliegos_pedido" => [ + "type" => "DOUBLE", + "null" => true + ], + "color_pliegos_pedido" => [ + "type" => "DOUBLE", + "null" => true + ], + "portada_pliegos_pedido" => [ + "type" => "DOUBLE", + "null" => true + ], + "cubierta_pliegos_pedido" => [ + "type" => "DOUBLE", + "null" => true + ], + "negro_clicks_pedido" => [ + "type" => "DOUBLE", + ], + "color_clicks_pedido" => [ + "type" => "DOUBLE", + ], + "portada_clicks_pedido" => [ + "type" => "DOUBLE", + ], + "cubierta_clicks_pedido" => [ + "type" => "DOUBLE", + ], + "pliegos1" => [ + "type" => "INT", + "constraint" => 11, + ], + "paginas1" => [ + "type" => "INT", + "constraint" => 11, + ], + "pliegos2" => [ + "type" => "INT", + "constraint" => 11, + ], + "paginas2" => [ + "type" => "INT", + "constraint" => 11, + ], + "negro_proveedor_nombre" => [ + "type" => "VARCHAR", + "constraint" => 225 + ], + "color_proveedor_nombre" => [ + "type" => "VARCHAR", + "constraint" => 225 + ], + "portada_proveedor_nombre" => [ + "type" => "VARCHAR", + "constraint" => 225 + ], + "corte_pie" => [ + "type" => "DOUBLE", + ], + "lomo" => [ + "type" => "INT", + "constraint" => 11, + "null" => true, + ], + "tipo_entrada" => [ + "type" => "ENUM", + "constraint" => ["in", "out"], + "default" => "out" + ], + + + + "fecha_entrega_real_warning" => [ + "type" => "BOOLEAN", + "default" => false, + ], + + + + "fecha_entrega_warning" => [ + "type" => "BOOLEAN", + "default" => false + ], + "fecha_entrega_warning_revised" => [ + "type" => "BOOLEAN", + "default" => false + ], + + + + + + + "ferro_disponible" => [ + "type" => "TINYINT", + "constraint" => 4, + ], + "ferro_disponible_thread_id" => [ + "type" => "INT", + "constraint" => 10, + ], + + + + "ferro_cp" => [ + "type" => "VARCHAR", + "constraint" => 10, + "null" => true + ], + "ferro_proveedor" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "ferro_tracking" => [ + "type" => "VARCHAR", + "constraint" => 100, + "null" => true, + ], + + "pre_formato" => [ + "type" => "BOOLEAN", + "default" => false + ], + + + "pre_lomo" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + + "pre_solapa" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + + "pre_isbn" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + "pre_codbarras" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + + "pre_imposicion" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + + "pre_imprimir" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + "pre_faltan_materiales" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + + "pre_faltan_materiales_note" => [ + "type" => "TEXT", + "null" => true, + ], + "progreso" => [ + "type" => "DOUBLE", + "default" => 0.00, + ], + "message_production_send" => [ + + "type" => "BOOLEAN", + "default" => 0, + ], + "finalizado" => [ + "type" => "BOOLEAN", + "default" => 0, + ], + "comentarios" => [ + "type" => "TEXT", + "null" => 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_orden_portada_id"],"lg_maquinas",["id"]); + // $this->forge->addForeignKey(["maquina_orden_negro_id"],"lg_maquinas",["id"]); + // $this->forge->addForeignKey(["maquina_orden_cubierta_id"],"lg_maquinas",["id"]); + // $this->forge->addForeignKey(["maquina_orden_color_id"],"lg_maquinas",["id"]); + $this->forge->createTable("ordenes_trabajo", true); + } + + public function down() + { + $this->forge->dropTable("ordenes_trabajo"); + } +} diff --git a/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php b/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php new file mode 100644 index 00000000..1fde78fd --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-170001_OrdenTrabajoTareasTable.php @@ -0,0 +1,56 @@ + [ + "type" => "INT", + "unsigned" => true, + "autoincrement" => true + ], + "tarea_servicio_id" => [ + "type" => "INT", + "unsigned" => true, + ], + "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("orden_trabajo_id","ordenes_trabajo","id"); + // $this->forge->addForeignKey("tarea_servicio_id","tareas_servicio","id"); + $this->forge->createTable("orden_trabajo_tareas", true); + } + + public function down() + { + $this->forge->dropTable("orden_trabajo_tareas"); + } +} diff --git a/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php new file mode 100644 index 00000000..bf2c4ace --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoDatesTable.php @@ -0,0 +1,171 @@ + [ + "type" => "DATETIME", + "null" => true, + ], + "fecha_entrega_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "fecha_entrega_change_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "fecha_entrega_real_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "fecha_entrega_real_warning" => [ + "type" => "BOOLEAN", + "default" => false, + ], + "fecha_impresion_at" => [ + "type" => "DATE", + "null" => true, + ], + "fecha_encuardernado_at" => [ + "type" => "DATE", + "null" => true, + ], + "fecha_externo_at" => [ + "type" => "DATE", + "null" => true, + ], + "fecha_entrega_warning" => [ + "type" => "BOOLEAN", + "default" => false + ], + "fecha_entrega_warning_revised" => [ + "type" => "BOOLEAN", + "default" => false + ], + + "pendiente_ferro_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "ferro_en_cliente_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "ferro_ok_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "interior_bn_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "interior_color_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "preparacion_interiores_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "cubierta_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "plastificado_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "encuadernacion_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "corte_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "embalaje_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "envio_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "entrada_manipulado_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + + "ferro_disponible_hecho_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "ferro_disponible_ok_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "ferro_entregado_at" => [ + "type" => "DATETIME", + "null" => true, + ], + "pre_formato_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "pre_lomo_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "pre_solapa_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "pre_codbarras_at" => [ + "type" => "DATETIME", + "null" => true, + ], + + "pre_imposicion_at" => [ + "type" => "DATETIME", + "null" => 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->createTable("orden_trabajo_dates", true); + } + + public function down() + { + $this->forge->dropTable("orden_trabajo_dates"); + } +} diff --git a/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php new file mode 100644 index 00000000..c943caf5 --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-170002_OrdenTrabajoUsersTable.php @@ -0,0 +1,190 @@ + [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "user_update_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "inaplazable_revised_change_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + + "ferro_disponible_hecho_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + "ferro_disponible_ok_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "ferro_entregado_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + "pendiente_ferro_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "ferro_en_cliente_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "ferro_ok_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + + + "interior_bn_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "interior_color_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "preparacion_interior_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "cubierda_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "plastificado_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "encuadernacion_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "corte_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "embalaje_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "envio_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "entrada_manipulado_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + + "pre_formato_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + + "pre_lomo_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + "pre_solapa_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + + "pre_codbarras_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + + "pre_imposicion_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "pre_imprimir_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "pre_imprimir_user_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + ]; + 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, + + ], + ]); + foreach ($this->COLUMNS as $key => $value) { + $this->forge->addForeignKey([$key],"users",["id"]); + } + $this->forge->createTable("orden_trabajo_users", true); + } + + public function down() + { + $this->forge->dropTable("orden_trabajo_users"); + } +} diff --git a/ci4/app/Database/Migrations/2024-11-30-170006_OrdenTrabajoMaquetacionesTable.php b/ci4/app/Database/Migrations/2024-11-30-170006_OrdenTrabajoMaquetacionesTable.php new file mode 100644 index 00000000..e83bd0bc --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-170006_OrdenTrabajoMaquetacionesTable.php @@ -0,0 +1,77 @@ + [ + "type" => "INT", + "unsigned" => true, + "auto_increment" => true + ], + "pedido_maquetacion_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "user_created_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "user_update_id" => [ + "type" => "INT", + "unsigned" => true, + "constraint" => 10, + ], + "entrada_at" => [ + "type" => "DATETIME", + "default" => null + ], + "salida_at" => [ + "type" => "DATETIME", + "default" => null + ], + "progreso" => [ + "type" => "DOUBLE", + "default" => 0 + ], + "finalizado" => [ + "type" => "BOOLEAN", + "default" => 0 + ] + ]; + 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->createTable("orden_trabajo_maquetaciones", true); + } + + public function down() + { + $this->forge->dropTable("orden_trabajo_maquetaciones"); + } +} diff --git a/ci4/app/Database/Migrations/2024-11-30-171007_OrdenTrabajoMaquetacionMovimientosTable.php b/ci4/app/Database/Migrations/2024-11-30-171007_OrdenTrabajoMaquetacionMovimientosTable.php new file mode 100644 index 00000000..b9056cd3 --- /dev/null +++ b/ci4/app/Database/Migrations/2024-11-30-171007_OrdenTrabajoMaquetacionMovimientosTable.php @@ -0,0 +1,63 @@ + [ + "type" => "INT", + "unsigned" => true, + "auto_increment" => true + ], + "orden_trabajo_maquetacion_id" => [ + "type" => "INT", + "unsigned" => true, + "null" => true, + + ], + "orden_trabajo_maquetacion_id" => [ + "type" => "INT", + "unsigned" => true, + "null" => true, + + ], + "file_id" => [ + "type" => "INT", + "unsigned" => true, + "null" => 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->createTable("orden_trabajo_maquetacion_movimientos", true); + } + + public function down() + { + $this->forge->dropTable("orden_trabajo_maquetacion_movimientos"); + } +} diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php index 72128ba2..d6a373f0 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoModel.php @@ -2,6 +2,7 @@ namespace App\Models\OrdenTrabajo; +use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Model; class OrdenTrabajoModel extends Model @@ -13,8 +14,7 @@ class OrdenTrabajoModel extends Model protected $useSoftDeletes = true; protected $protectFields = true; protected $allowedFields = [ - "user_created_id", - "user_update_id", + "pedido_id", "maquina_orden_negro_id", "maquina_orden_color_id", "maquina_orden_portada_id", @@ -42,77 +42,22 @@ class OrdenTrabajoModel extends Model "corte_pie", "lomo", "tipo_entrada", - "fecha_entrada_at", - "fecha_entrega_at", - "fecha_entrega_change_at", - "fecha_entrega_change_user_id", - "fecha_entrega_real_at", "fecha_entrega_real_warning", - "fecha_impresion_at", - "fecha_encuardernado_at", - "fecha_externo_at", "fecha_entrega_warning", "fecha_entrega_warning_revised", - "fecha_entrega_warning_revised", - "inaplazable_revised_change_user_id", - "pendiente_ferro_at", - "ferro_en_cliente_at", - "ferro_ok_at", - "interior_bn_at", - "interior_color_at", - "preparacion_interiores_at", - "cubierta_at", - "plastificado_at", - "encuadernacion_at", - "corte_at", - "embalaje_at", - "envio_at", - "entrada_manipulado_at", "ferro_disponible", "ferro_disponible_thread_id", - "ferro_disponible_hecho_at", - "ferro_disponible_hecho_user_id", - "ferro_disponible_ok_at", - "ferro_disponible_ok_user_id", - "ferro_entregado_user_id", - "ferro_entregado_at", - "pendiente_ferro_user_id", - "ferro_en_cliente_user_id", - "ferro_ok_user_id", "ferro_cp", "ferro_proveedor", "ferro_tracking", - "interior_bn_user_id", - "interior_color_user_id", - "preparacion_interior_user_id", - "cubierda_user_id", - "plastificado_user_id", - "encuadernacion_user_id", - "corte_user_id", - "embalaje_user_id", - "envio_user_id", - "entrada_manipulado_user_id", "pre_formato", - "pre_formato_at", - "pre_formato_user_id", "pre_lomo", - "pre_lomo_at", - "pre_lomo_user_id", "pre_solapa", - "pre_solapa_at", - "pre_solapa_user_id", "pre_isbn", - "pre_isbn_user_id", "pre_codbarras", - "pre_codbarras_at", - "pre_codbarras_user_id", "pre_imposicion", - "pre_imposicion_at", - "pre_imposicion_user_id", "pre_imprimir", - "pre_imprimir_user_id", "pre_faltan_materiales", - "pre_imprimir_user_id", "pre_faltan_materiales_note", "progreso", "message_production_send", @@ -149,4 +94,31 @@ class OrdenTrabajoModel extends Model protected $afterFind = []; protected $beforeDelete = []; protected $afterDelete = []; + + public function getDatatableQuery() : BaseBuilder + { + $q = $this->builder("ordenes_trabajo ot") + ->select([ + "pedidos.id", + "orden_trabajo_dates.fecha_encuadernado_at", + "clientes.nombre as client_name", + "presupuestos.titulo as presupuesto_title", + "tp.codigo as tipo_presupuesto_impresion", + "ubicaciones.nombre as ubicacion_name", + ]) + ->join("orden_trabajo_dates otdates","otdates.orden_trabajo_id = ot.id","left") + ->join("pedidos","pedidos.id = ot.pedido_id","left") + ->join("pedidos_linea","pedidos.id = pedidos_linea.pedido_id","left") + ->join("presupuestos","presupuestos.id = pedidos_linea.presupuesto_id","left") + ->join("clientes","clientes.id = presupuestos.cliente_id","left") + ->join("tipos_presupuestos tp","presupuestos.tipo_impresion_id = tp.id","left") + ->join("ubicaciones","ubicaciones.id = pedidos_linea.ubicacion_id","left") + + + ->groupBy("ot.id") + + + ; + return $q; + } }