Merge branch 'feat/ots' into feat/ordenes-trabajo

This commit is contained in:
amazuecos
2024-11-09 16:20:28 +01:00
2 changed files with 601 additions and 0 deletions

View File

@ -0,0 +1,449 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"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");
}
}

View File

@ -0,0 +1,152 @@
<?php
namespace App\Models\OrdenTrabajo;
use CodeIgniter\Model;
class OrdenTrabajoModel extends Model
{
protected $table = 'ots';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
"user_created_id",
"user_update_id",
"maquina_orden_negro_id",
"maquina_orden_color_id",
"maquina_orden_portada_id",
"maquina_orden_cubierta_id",
"negro_forma_id",
"color_forma_id",
"portada_forma_id",
"cubierta_forma_id",
"tirada",
"negro_pliegos_pedido",
"color_pliegos_pedido",
"portada_pliegos_pedido",
"cubierta_pliegos_pedido",
"negro_clicks_pedido",
"color_clicks_pedido",
"portada_clicks_pedido",
"cubierta_clicks_pedido",
"pliegos1",
"paginas1",
"pliegos2",
"paginas2",
"negro_proveedor_nombre",
"color_proveedor_nombre",
"portada_proveedor_nombre",
"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",
"finalizado",
"comentarios"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}