Merge branch 'feat/lg_maquinas_etiqueta_pedido' into 'main'

Feat/lg maquinas etiqueta pedido

See merge request jjimenez/safekat!768
This commit is contained in:
Alvaro
2025-05-05 06:29:00 +00:00
15 changed files with 87 additions and 44 deletions

View File

@ -207,6 +207,9 @@ class Maquinas extends \App\Controllers\BaseResourceController
if ($this->request->getPost('is_inkjet') == null) {
$sanitizedData['is_inkjet'] = false;
}
if ($this->request->getPost('etiqueta_envio') == null) {
$sanitizedData['etiqueta_envio'] = false;
}
// JJO
$sanitizedData['user_updated_id'] = auth()->user()->id;

View File

@ -219,8 +219,9 @@ class Ordentrabajo extends BaseController
$this->viewData["user_dates"] = $this->produccionService->userDates();
$this->viewData["pedido_user_dates"] = $this->produccionService->pedidoUserDates();
$this->viewData["colors"] = $this->produccionService->getPdfColors();
$this->viewData["tiempo_estimado"] = $this->produccionService->getTiempoProcesamientoHHMM();
$this->viewData["tiempo_estimado"] = $this->produccionService->getTiempoProcesamientoHHMMSS();
$this->viewData["flags"] = $this->produccionService->getFlags();
$this->viewData["tareaCosido"] = $this->produccionService->getTareaCosido();
return view(static::$viewPath . $this->editRoute, $this->viewData);

View File

@ -0,0 +1,25 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddEtiquetaEnvioCheckLgMaquinasTable extends Migration
{
protected array $COLUMNS = [
'etiqueta_envio' => [
'type' => 'BOOL',
'default' => false
],
];
public function up()
{
$this->forge->addColumn('lg_maquinas',$this->COLUMNS);
}
public function down()
{
$this->forge->dropColumn('lg_maquinas',array_keys($this->COLUMNS));
}
}

View File

@ -42,6 +42,7 @@ class Maquina extends \CodeIgniter\Entity\Entity
"updated_at" => null,
"user_created_id" => 0,
"user_updated_id" => 0,
"etiqueta_envio" => false
];
protected $casts = [
"is_padre" => "boolean",
@ -57,6 +58,7 @@ class Maquina extends \CodeIgniter\Entity\Entity
"duracion_jornada" => "int",
"orden_planning" => "int",
"is_rotativa" => "boolean",
"etiqueta_envio" => "boolean",
"precio_tinta_negro" => "float",
"is_inkjet" => "boolean",
"precio_tinta_color" => "float",

View File

@ -212,7 +212,7 @@ class OrdenTrabajoTareaEntity extends Entity
public function isCosido(): bool
{
$isTareaCosido = false;
$pm = $this->presupuesto_manipulado();
$pm = $this->presupuesto_encuadernacion();
if ($pm) {
$isTareaCosido = $pm->tarifa()->isCosido();
}

View File

@ -40,7 +40,10 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
$words_initial = array_map(fn($w) => substr(strtoupper($w),0,1),$words);
return implode("",$words_initial);
}
public function isCosido(): bool
{
return in_array($this->attributes['id'], [3, 17]);
}
}

View File

@ -36,6 +36,6 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
public function isCosido(): bool
{
return in_array($this->attributes['id'], [3, 17]);
return in_array($this->attributes['id'], [2, 3, 17, 45]);
}
}

View File

@ -20,6 +20,7 @@ return [
'isPadre' => 'Usar para variante?',
'isRotativa' => 'Es Rotativa?',
'isTinta' => 'Inkjet',
'isEtiquetaEnvio' => 'Etiqueta envío',
'manipulado' => 'manipulado',
'maquina' => 'Maquina',
'maquinaList' => 'Lista Máquinas',

View File

@ -52,7 +52,8 @@ class MaquinaModel extends \App\Models\BaseModel
"deleted_at",
"is_deleted",
"user_created_id",
"user_updated_id"
"user_updated_id",
"etiqueta_envio",
];
protected $returnType = "App\Entities\Configuracion\Maquina";

View File

@ -873,7 +873,7 @@ class ProductionService extends BaseService
"tareas_encuadernacion" => $this->tareas_encuadernacion(),
"tareas_preimpresion" => $this->tareas_preimpresion(),
"tareas_impresion" => $this->tareas_impresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMMSS(),
"tiempo_total" => $this->getTiempoTotalTareas(),
"statusColor" => $this->getOtColorStatus(),
"tareaCosido" => $this->getTareaCosido(),
@ -902,8 +902,8 @@ class ProductionService extends BaseService
"peso_unidad" => $logistica_data["peso_unidad"],
"peso_pedido" => $logistica_data["peso_pedido"],
"imposicion" => $this->getImposicionTareaImpresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_impresion" => $this->getTiempoTareasImpresionHHMM(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMMSS(),
"tiempo_impresion" => $this->getTiempoTareasImpresionHHMMSS(),
"colors" => $this->getPdfColors(),
"isPOD" => $this->isPOD,
"uvi" => $this->getUVI(),
@ -1435,17 +1435,17 @@ class ProductionService extends BaseService
}
return $pedidoUserDates;
}
public function getTiempoProcesamientoHHMM(): ?string
public function getTiempoProcesamientoHHMMSS(): ?string
{
try {
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
$seconds = array_sum($time_tareas_seconds);
return float_seconds_to_hhmm_string($seconds);
return float_seconds_to_hhmmss_string($seconds);
} catch (\Throwable $th) {
return '00:00';
return '00:00:00';
}
}
public function getTiempoTareasImpresionHHMM(): string
public function getTiempoTareasImpresionHHMMSS(): string
{
try {
$tareas_impresion = $this->ot->tareas_impresion();
@ -1455,7 +1455,7 @@ class ProductionService extends BaseService
$tiempo_seconds += $tarea->tiempo_estimado;
}
}
return float_seconds_to_hhmm_string($tiempo_seconds);
return float_seconds_to_hhmmss_string($tiempo_seconds);
} catch (\Throwable $th) {
return '00:00';
}
@ -1642,22 +1642,22 @@ class ProductionService extends BaseService
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
if (str_contains($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
if (str_contains($papel_code, "AH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
if (str_contains($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
if (str_contains($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
if (str_contains($papel_code, "EM")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
if (str_contains($papel->nombre, "CARTULINA")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
@ -1675,22 +1675,22 @@ class ProductionService extends BaseService
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['default'];
$papel_code = $papel->code_ot;
if ($papel_code) {
if (strpos($papel_code, "BCLOF")) {
if (str_contains($papel_code, "BCLOF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['blanco'];
}
if (strpos($papel_code, "AH") && $papel->code == "OFF2") {
if (str_contains($papel_code, "AH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['ahuesado'];
}
if (strpos($papel_code, "MARF")) {
if (str_contains($papel_code, "MARF")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['marfil'];
}
if (strpos($papel_code, "VOLAH")) {
if (str_contains($papel_code, "VOLAH")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['volumen_ahuesado'];
}
if ($papel_code == "EM") {
if (str_contains($papel_code, "EM")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['estucado_mate'];
}
if ($papel_code == "CGE") {
if (str_contains($papel->nombre, "CARTULINA")) {
$color = $this->ordenTrabajoConfig->OT_PAPEL_COLOR['cartulina'];
}
}
@ -1845,10 +1845,10 @@ class ProductionService extends BaseService
public function cosido(): bool
{
$flag = false;
$manipulados = $this->presupuesto->manipulados();
foreach ($manipulados as $key => $manipulado) {
$tarifa_manipulado = $manipulado->tarifa();
if ($tarifa_manipulado->isCosido()) {
$encuadernaciones = $this->presupuesto->encuadernaciones();
foreach ($encuadernaciones as $key => $encuadernacion) {
$tarifaEncuadernacionEntity = $encuadernacion->tarifa();
if ($tarifaEncuadernacionEntity->isCosido()) {
$flag = true;
break;
}

View File

@ -3,6 +3,7 @@
<table id="<?= $id ?>" class="table table-hover text-dark" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Produccion.datatable.ot_id') ?></th>
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
<th><?= lang('Produccion.datatable.fecha_encuadernacion') ?></th>
<th><?= lang('Produccion.datatable.cliente') ?></th>

View File

@ -173,7 +173,19 @@
</label>
</div>
</div>
<div class="col-md-3 mt-4 mb-4">
<div class="form-check form-check-inline">
<input type="checkbox"
id="isEtiquetaEnvio"
name="etiqueta_envio"
value="1"
class="form-check-input"<?= $maquina->etiqueta_envio == true ? 'checked' : ''; ?>
>
<label for="isPadre" class="form-check-label">
<?= lang('Maquinas.isEtiquetaEnvio') ?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-2 datosRotativa datosInkjet" style="display: none;">

View File

@ -39,11 +39,13 @@
<div class="tab-content">
<div class="tab-pane fade show active" id="navs-tarea">
<div class="container-fluid h-100">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<div class="row mb-2 h-100 d-flex flex-wrap">
<div class="col-md-12 d-flex justify-content-end mb-2">
<button class="btn-primary btn d-flex justify-content-evenly gap-2"><span class="ti ti-barcode ti-lg"></span><?= lang('Produccion.print_label') ?></button>
</div>
<?php if ($ot_tarea?->maquina_actual()?->etiqueta_envio): ?>
<div class="col-md-12 d-flex justify-content-end mb-2">
<button class="btn-primary btn d-flex justify-content-evenly gap-2" data-id="<?=$ot_tarea?->maquina_actual()->id?>"><span class="ti ti-barcode ti-lg"></span><?= lang('Produccion.print_label') ?></button>
</div>
<?php endif; ?>
<div class="col-md-6 tarea-card-info-block">
<?= view("/themes/vuexy/components/cards/tarea_card.php") ?>
</div>

View File

@ -15,7 +15,7 @@
<div class="row">
<!-- Date 1-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-tiempo-procesamiento" class="form-label"><?= @lang("Produccion.tiempo_procesamiento") ?> (HH:MM)</label>
<label for="ot-tiempo-procesamiento" class="form-label"><?= @lang("Produccion.tiempo_procesamiento") ?> (HH:MM:SS)</label>
<div class="input-group">
<input type="text" class="form-control" name="tiempo_procesamiento" placeholder="HH:MM" id="ot-tiempo-procesamiento" data-input disabled>
<button class="btn btn-outline-warning btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
@ -99,15 +99,6 @@
</div>
</div>
<!-- Date 6-->
<div class="col-xs-12 col-md-4 col-lg-4 mb-2">
<label for="ot-fecha-entrega" class="form-label"><?= @lang("Produccion.fecha_entrega_estimada") ?></label>
<div class="input-group">
<input type="date" class="form-control ot-date" placeholder="DD/MM/YYYY" name="fecha_entrega_estimada_at" id="ot-fecha-entrega-estimada" data-input disabled />
<button class="btn btn-outline-warning btn-erase-date" type="button"><i class="ti-eraser ti"></i></button>
</div>
</div>
</div>
</div>
</div>

View File

@ -15,6 +15,7 @@ class OrdenTrabajoDatatable {
this.datatableColumns = [
{ data: 'id', searchable: false, sortable: false },
{ data: 'pedido_id', searchable: false, sortable: false },
{ data: 'fecha_encuadernado_at', searchable: false, sortable: false },
{ data: 'cliente_nombre', searchable: false, sortable: false },