mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ot dev
This commit is contained in:
@ -388,5 +388,9 @@ class Pedido extends \App\Controllers\BaseResourceController
|
||||
// $xml_service = new PedidoXMLService($this->model);
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function pedidoToProduction(int $pedido_id){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
114
ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
Normal file
114
ci4/app/Entities/Produccion/OrdenTrabajoEntity.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class OrdenTrabajoEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"pedido_id" => null,
|
||||
"maquina_orden_negro_id" => null,
|
||||
"maquina_orden_color_id" => null,
|
||||
"maquina_orden_portada_id" => null,
|
||||
"maquina_orden_cubierta_id" => null,
|
||||
"negro_forma_id" => null,
|
||||
"color_forma_id" => null,
|
||||
"portada_forma_id" => null,
|
||||
"cubierta_forma_id" => null,
|
||||
"tirada" => null,
|
||||
"negro_pliegos_pedido" => null,
|
||||
"color_pliegos_pedido" => null,
|
||||
"portada_pliegos_pedido" => null,
|
||||
"cubierta_pliegos_pedido" => null,
|
||||
"negro_clicks_pedido" => null,
|
||||
"color_clicks_pedido" => null,
|
||||
"portada_clicks_pedido" => null,
|
||||
"cubierta_clicks_pedido" => null,
|
||||
"pliegos1" => null,
|
||||
"paginas1" => null,
|
||||
"pliegos2" => null,
|
||||
"paginas2" => null,
|
||||
"negro_proveedor_nombre" => null,
|
||||
"color_proveedor_nombre" => null,
|
||||
"portada_proveedor_nombre" => null,
|
||||
"corte_pie" => null,
|
||||
"lomo" => null,
|
||||
"tipo_entrada" => null,
|
||||
"fecha_entrega_real_warning" => null,
|
||||
"fecha_entrega_warning" => null,
|
||||
"fecha_entrega_warning_revised" => null,
|
||||
"ferro_disponible" => null,
|
||||
"ferro_disponible_thread_id" => null,
|
||||
"ferro_cp" => null,
|
||||
"ferro_proveedor" => null,
|
||||
"ferro_tracking" => null,
|
||||
"pre_formato" => null,
|
||||
"pre_lomo" => null,
|
||||
"pre_solapa" => null,
|
||||
"pre_isbn" => null,
|
||||
"pre_codbarras" => null,
|
||||
"pre_imposicion" => null,
|
||||
"pre_imprimir" => null,
|
||||
"pre_faltan_materiales" => null,
|
||||
"pre_faltan_materiales_note" => null,
|
||||
"progreso" => null,
|
||||
"message_production_send" => null,
|
||||
"finalizado" => null,
|
||||
"comentarios" => null
|
||||
];
|
||||
protected $casts = [
|
||||
"pedido_id" => 'integer',
|
||||
"maquina_orden_negro_id" => '?integer',
|
||||
"maquina_orden_color_id" => '?integer',
|
||||
"maquina_orden_portada_id" => '?integer',
|
||||
"maquina_orden_cubierta_id" => '?integer',
|
||||
"negro_forma_id" => '?integer',
|
||||
"color_forma_id" => '?integer',
|
||||
"portada_forma_id" => '?integer',
|
||||
"cubierta_forma_id" => '?integer',
|
||||
"tirada" => 'integer',
|
||||
"negro_pliegos_pedido" => '?integer',
|
||||
"color_pliegos_pedido" => 'string',
|
||||
"portada_pliegos_pedido" => 'string',
|
||||
"cubierta_pliegos_pedido" => 'string',
|
||||
"negro_clicks_pedido" => '?integer',
|
||||
"color_clicks_pedido" => '?integer',
|
||||
"portada_clicks_pedido" => '?integer',
|
||||
"cubierta_clicks_pedido" => null,
|
||||
"pliegos1" => '?integer',
|
||||
"paginas1" => '?integer',
|
||||
"pliegos2" => '?integer',
|
||||
"paginas2" => '?integer',
|
||||
"negro_proveedor_nombre" => null,
|
||||
"color_proveedor_nombre" => null,
|
||||
"portada_proveedor_nombre" => null,
|
||||
"corte_pie" => null,
|
||||
"lomo" => null,
|
||||
"tipo_entrada" => 'string',
|
||||
"fecha_entrega_real_warning" => 'boolean',
|
||||
"fecha_entrega_warning" => 'boolean',
|
||||
"fecha_entrega_warning_revised" => 'boolean',
|
||||
"ferro_disponible" => 'boolean',
|
||||
"ferro_disponible_thread_id" => '?integer',
|
||||
"ferro_cp" => '?string',
|
||||
"ferro_proveedor" => '?string',
|
||||
"ferro_tracking" => '?string',
|
||||
"pre_formato" => '?string',
|
||||
"pre_lomo" => '?string',
|
||||
"pre_solapa" => '?string',
|
||||
"pre_isbn" => '?string',
|
||||
"pre_codbarras" => '?string',
|
||||
"pre_imposicion" => '?string',
|
||||
"pre_imprimir" => 'boolean',
|
||||
"pre_faltan_materiales" => 'boolean',
|
||||
"pre_faltan_materiales_note" => '?string',
|
||||
"progreso" => 'float',
|
||||
"message_production_send" => 'boolean',
|
||||
"finalizado" => 'boolean',
|
||||
"comentarios" => 'string'
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
16
ci4/app/Language/en/Produccion.php
Normal file
16
ci4/app/Language/en/Produccion.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"ot" => "Orden de trabajo",
|
||||
"ots" => "Órdenes de trabajo",
|
||||
"btn_pedido_produccion_accion" => "Pasar a producción",
|
||||
"datatable" => [
|
||||
"pedido_id"=> "Order ID",
|
||||
"fecha_encuadernacion"=> "Bookbinding date",
|
||||
"cliente"=> "Client",
|
||||
"titulo"=> "Title",
|
||||
"ubicacion"=> "Location",
|
||||
"tirada"=> "Runs",
|
||||
"impresion"=> "Printing",
|
||||
]
|
||||
];
|
||||
13
ci4/app/Language/es/Produccion.php
Normal file
13
ci4/app/Language/es/Produccion.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"datatable" => [
|
||||
"pedido_id"=> "Pedido ID",
|
||||
"fecha_encuadernacion"=> "Fecha encuadernación",
|
||||
"cliente"=> "Cliente",
|
||||
"titulo"=> "Título",
|
||||
"ubicacion"=> "Ubicación",
|
||||
"tirada"=> "Tirada",
|
||||
"impresion"=> "Impresión",
|
||||
]
|
||||
];
|
||||
@ -2,15 +2,15 @@
|
||||
|
||||
namespace App\Models\OrdenTrabajo;
|
||||
|
||||
use App\Entities\Presupuestos\OrdenTrabajoEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class OrdenTrabajoModel extends Model
|
||||
{
|
||||
protected $table = 'ots';
|
||||
protected $table = 'ordenes_trabajo';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $returnType = OrdenTrabajoEntity::class;
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
@ -113,12 +113,12 @@ class OrdenTrabajoModel extends Model
|
||||
->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")
|
||||
|
||||
|
||||
;
|
||||
->groupBy("ot.id");
|
||||
return $q;
|
||||
}
|
||||
|
||||
public function updateMaquinas(OrdenTrabajoEntity $ot)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Models\Pedidos;
|
||||
|
||||
use App\Entities\Presupuestos\OrdenTrabajoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
|
||||
use function PHPSTORM_META\map;
|
||||
|
||||
class PedidoModel extends \App\Models\BaseModel
|
||||
@ -90,7 +93,7 @@ class PedidoModel extends \App\Models\BaseModel
|
||||
|
||||
return $lineasPresupuesto;
|
||||
}
|
||||
public function getPedidoPresupuestoTipoImpresion(int $presupuesto_id) : array|object|null
|
||||
public function getPedidoPresupuestoTipoImpresion(int $presupuesto_id): array|object|null
|
||||
{
|
||||
$q = $this->db->table($this->table)
|
||||
->select(
|
||||
@ -185,15 +188,51 @@ class PedidoModel extends \App\Models\BaseModel
|
||||
public function getPedidoPresupuestoFicheros($pedido_id)
|
||||
{
|
||||
$query = $this->db->table($this->table)
|
||||
->select([
|
||||
'presupuesto_ficheros.nombre as fileName',
|
||||
'presupuesto_ficheros.file_path as filePath'
|
||||
])
|
||||
->join('pedidos_linea', 'pedidos_linea.id = pedidos.id', 'left')
|
||||
->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left')
|
||||
->join('presupuesto_ficheros', 'presupuesto_ficheros.presupuesto_id = presupuestos.id', 'left')
|
||||
->where('pedidos.id', $pedido_id);
|
||||
$presupuesto_ficheros = $query->get()->getFirstRow();
|
||||
return $presupuesto_ficheros;
|
||||
->select([
|
||||
'presupuesto_ficheros.nombre as fileName',
|
||||
'presupuesto_ficheros.file_path as filePath'
|
||||
])
|
||||
->join('pedidos_linea', 'pedidos_linea.id = pedidos.id', 'left')
|
||||
->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left')
|
||||
->join('presupuesto_ficheros', 'presupuesto_ficheros.presupuesto_id = presupuestos.id', 'left')
|
||||
->where('pedidos.id', $pedido_id);
|
||||
$presupuesto_ficheros = $query->get()->getFirstRow();
|
||||
return $presupuesto_ficheros;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea una orden de trabajo asociada al pedido
|
||||
*
|
||||
* @param integer $pedido_id
|
||||
* @return void
|
||||
*/
|
||||
public function createOrdenTrabajo(int $pedido_id)
|
||||
{
|
||||
$otModel = model(OrdenTrabajoModel::class);
|
||||
$ot = new OrdenTrabajoEntity(["pedido_id" => $pedido_id]);
|
||||
$existOt = $this->hasOrdenTrabajo($pedido_id);
|
||||
if ($existOt) {
|
||||
$ot = $otModel->find($pedido_id);
|
||||
return $ot;
|
||||
}
|
||||
$otModel->updateMaquinas($ot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprueba si el pedido tiene ya una orden de trabajo asociada
|
||||
*
|
||||
* @param integer $pedido_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasOrdenTrabajo(int $pedido_id): bool
|
||||
{
|
||||
$hasOrdenTrabajo = false;
|
||||
$q = $this->builder()->select("orden_trabajo.pedido_id")
|
||||
->join("ordenes_trabajo", "ordenes_trabajo.pedido_id = pedidos.id", "left")
|
||||
->where("ordenes_trabajo.pedido_id", $pedido_id)->countAllResults();
|
||||
if ($q > 0) {
|
||||
$hasOrdenTrabajo = true;
|
||||
}
|
||||
return $hasOrdenTrabajo;
|
||||
}
|
||||
}
|
||||
|
||||
17
ci4/app/Views/themes/vuexy/components/tables/ot_table.php
Normal file
17
ci4/app/Views/themes/vuexy/components/tables/ot_table.php
Normal file
@ -0,0 +1,17 @@
|
||||
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
|
||||
<th><?= lang('Produccion.datatable.fecha_encuadernacion') ?></th>
|
||||
<th><?= lang('Produccion.datatable.cliente') ?></th>
|
||||
<th><?= lang('Produccion.datatable.titulo') ?></th>
|
||||
<th><?= lang('Produccion.datatable.ubicacion') ?></th>
|
||||
<th><?= lang('Produccion.datatable.tirada') ?></th>
|
||||
<th><?= lang('Produccion.datatable.impresion') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -19,15 +19,24 @@
|
||||
<?= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_lineasItems") ?>
|
||||
<?php if (!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_albaranesItems") ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_albaranesItems") ?>
|
||||
<?php endif; ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_facturasItems") ?>
|
||||
<?= view("themes/vuexy/components/chat_internal_pedido", data: ["modelId" => $pedidoEntity->id,"type" => "pedido"]) ?>
|
||||
<?= view("themes/vuexy/components/chat_internal_pedido", data: ["modelId" => $pedidoEntity->id, "type" => "pedido"]) ?>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="pt-4">
|
||||
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
</div><!-- /.card-footer -->
|
||||
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-md-12 d-flex justify-content-between">
|
||||
<div class="pt-4">
|
||||
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
</div><!-- /.card-footer -->
|
||||
<div class="pt-4">
|
||||
<button class="btn btn-primary btn-md"><span> <i class="ti ti-building-factory-2 ti-xs"></i> <?= lang("Produccion.btn_pedido_produccion_accion") ?> </span></button>
|
||||
</div><!-- /.card-footer -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- //.card -->
|
||||
</div>
|
||||
<!--//.col -->
|
||||
|
||||
@ -3,9 +3,41 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/sweetalert') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
|
||||
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
|
||||
|
||||
<?= $this->section('content'); ?>
|
||||
<!--Content Body-->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
<div class="nav-tabs-shadow nav-align-top">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link active" role="tab" id="navs-top-align-directos-tab" data-bs-toggle="tab" data-bs-target="#navs-top-align-ots"><?= lang("Produccion.ots") ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="ots-datatables-container">
|
||||
<div class="tab-pane fade show active" id="navs-top-align-directos">
|
||||
<?= view("themes/vuexy/components/tables/ot_table.php", ["id" => "ot-datatable"]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<!--//.card -->
|
||||
</div>
|
||||
</div>
|
||||
<!--//.col -->
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user