diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index 9552d726..cb059577 100755 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -76,6 +76,7 @@ return [ "formato" => "Formato", "paginas" => "Páginas", "guillotina" => "Guillotina/Corte", + "prep_interior_guillotina" => "Prep. interior guillotina", "tirada" => "Tirada", "merma" => "Merma", "pendiente_ferro" => "Pendiente ferro", diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index dced1317..c4699178 100755 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -188,6 +188,14 @@ class ProductionService extends BaseService * @var boolean */ public bool $isCorte = false; //* CHECK DONE + + /** + * Indica si hay una tarea de preparacion interior de guillotina ya se cubierta o interior + * Se usa para mostrar la fecha correspondiente en la vista + * + * @var boolean + */ + public bool $isPrepInteriorGuillotina = false; //* CHECK DONE /** * Pedido Entity * @@ -436,13 +444,14 @@ class ProductionService extends BaseService { $maquina_id = $this->presupuesto->solapas == 1 ? $this->trimmingMaquinaId : $this->defaultMaquinaCorte->id; $presupuestoLineaImpresion = $this->presupuesto->presupuestoLineaImpresion(); + $maquinaCorteEntity = $this->maquinaModel->find($maquina_id); $data = [ 'orden_trabajo_id' => $this->ot->id, 'presupuesto_linea_id' => $presupuestoLineaImpresion->id, 'nombre' => lang('Produccion.end_cut'), 'maquina_id' => $maquina_id, - 'orden' => $this->maquinaModel->find($maquina_id)->orden_planning, - 'tiempo_estimado' => 0, + 'orden' => $maquinaCorteEntity->orden_planning, + 'tiempo_estimado' => $this->tiempoCorteFinalEstimado($maquinaCorteEntity), 'tiempo_real' => 0, 'is_corte' => true, 'tipo_corte' => "bobina", @@ -463,6 +472,7 @@ class ProductionService extends BaseService $otCorte = null; $presupuestoTipo = $this->presupuesto->tipo_presupuesto()->codigo; $isRusticaFresado = str_contains($presupuestoTipo, "Fresado"); + $maquinaCorteEntity = $this->maquinaModel->find($this->guillotinaPreparacionInteriorMaquinaId); $data = [ 'orden_trabajo_id' => $this->ot->id, 'presupuesto_linea_id' => $pLinea->id, @@ -476,10 +486,14 @@ class ProductionService extends BaseService ]; if ($pLinea->isCubierta()) { $data['nombre'] = lang('Produccion.cover_cut'); + $data['tiempo_estimado'] = $this->tiempoCortePrepInterior($maquinaCorteEntity); $tareaId = $this->otTarea->insert($data); $otCorte = $this->otTarea->find($tareaId); } if ($pLinea->isImpresionInteriorPlana() || $pLinea->isRotativa()) { + if ($pLinea->isImpresionInteriorPlana()) { + $data['tiempo_estimado'] = $this->tiempoCortePrepInterior($maquinaCorteEntity); + } $data['nombre'] = lang('Produccion.interior_cut'); //* Si es rustica fresado y rotativa no se añade preparación de interior en guillotina if (!$isRusticaFresado && !$pLinea->isRotativa()) { @@ -939,7 +953,7 @@ class ProductionService extends BaseService ->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.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('lg_maquinas',"lg_maquinas.id = orden_trabajo_tareas.maquina_id","left") + ->join('lg_maquinas', "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left") ->where("orden_trabajo_tareas.deleted_at", null) ->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE) ->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA) @@ -1364,7 +1378,7 @@ class ProductionService extends BaseService } return $query->get()->getResultArray(); } - public function querySelectMaquinaPlanningPlana($q,?string $padreId) + public function querySelectMaquinaPlanningPlana($q, ?string $padreId) { $query = $this->otModel->builder()->select([ "orden_trabajo_tareas.maquina_id as id", @@ -1381,8 +1395,8 @@ class ProductionService extends BaseService if ($q) { $query->like('lg_maquinas.nombre', $q); } - if($padreId){ - $query->where('lg_maquinas.padre_id',$padreId); + if ($padreId) { + $query->where('lg_maquinas.padre_id', $padreId); } return $query->get()->getResultArray(); } @@ -1889,6 +1903,7 @@ class ProductionService extends BaseService "isColor" => $this->isColor, "isBN" => $this->isBN, "isCorte" => $this->corte(), + "isPrepInteriorGuillotina" => $this->hasPrepInteriorGuillotina(), "isGrapado" => $this->isGrapado, "isCosido" => $this->cosido(), ]; @@ -2054,6 +2069,17 @@ class ProductionService extends BaseService } return $this->isCorte; } + public function hasPrepInteriorGuillotina(): bool + { + $ot_tareas = $this->ot->tareas(); + foreach ($ot_tareas as $key => $tarea) { + if ($tarea->is_corte && $tarea->tipo_corte = "prep") { + $this->isPrepInteriorGuillotina = true; + break; + } + } + return $this->isPrepInteriorGuillotina; + } public function getFileBarCode() { return $this->ot->getBarCodeFile(); @@ -2359,6 +2385,12 @@ class ProductionService extends BaseService if ($tarea->isEncuadernado()) { $dateName = "encuadernacion_at"; } + if ($tarea->is_corte) { + $dateName = "corte_at"; + } + if ($tarea->is_corte && $tarea->tipo_corte == "prep") { + $dateName = "preparacion_interiores_at"; + } return $dateName; } public function getTitleTareaEstado($tarea_id): array @@ -2380,4 +2412,38 @@ class ProductionService extends BaseService "userName" => $userName ?? "", ]; } + /** + * Devuelve en segundos el tiempo que tarda una máquina de corte en realizar el corte de la tirada completa + * + * $t = tirada[libros] / velocidad_maquina[libros/minutos]$ + * + * @param MaquinaEntity $maquina + * @return float $seconds + */ + public function tiempoCorteFinalEstimado(MaquinaEntity $maquina): float + { + $seconds = 0; + if ($this->presupuesto->tirada > 0) { + $minutos = $this->presupuesto->tirada / $maquina->velocidad; + $seconds = $minutos * 60; + } + return $seconds; + } + /** + * Devuelve en segundos el tiempo que tarda una máquina de corte en realizar + * + * $t = tirada[libros] / velocidad_maquina[libros/minutos]$ + * + * @param MaquinaEntity $maquina + * @return float $seconds + */ + public function tiempoCortePrepInterior(MaquinaEntity $maquina) + { + $seconds = 0; + if ($this->presupuesto->tirada > 0) { + $minutos = $this->presupuesto->tirada / $maquina->velocidad; + $seconds = $minutos * 60; + } + return $seconds; + } } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php index e9457217..12e4646a 100755 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php @@ -280,15 +280,16 @@
" ?>
-
"> - +
"> +
- > + >
-
" ?>
+
" ?>
+
"> @@ -309,6 +310,16 @@
" ?>
+ +
"> + +
+ > + +
+
" ?>
+ +
diff --git a/httpdocs/assets/js/safekat/pages/produccion/ot.js b/httpdocs/assets/js/safekat/pages/produccion/ot.js index 34f05244..ef2a16e9 100644 --- a/httpdocs/assets/js/safekat/pages/produccion/ot.js +++ b/httpdocs/assets/js/safekat/pages/produccion/ot.js @@ -119,6 +119,8 @@ class OrdenTrabajo { this.entradaManipulado = new DatePicker(this.otForm.find("#ot-manipulado"), option) this.prepGuillotina = new DatePicker(this.otForm.find("#ot-prep-guillotina"), option) + this.prepInteriorGuillotina = new DatePicker(this.otForm.find("#ot-prep-interior-guillotina"), option) + this.prepCosido = new DatePicker(this.otForm.find("#ot-prep-cosido"), option) @@ -527,7 +529,8 @@ class OrdenTrabajo { this.encuadernacion.setDate(this.summaryData.dates.encuadernacion_at) this.prepGuillotina.setDate(this.summaryData.dates.corte_at) - + this.prepInteriorGuillotina.setDate(this.summaryData.dates.preparacion_interiores_at) + this.entradaManipulado.setDate(this.summaryData.dates.entrada_manipulado_at) // this.prepCosido.setDate(this.summaryData.dates.cosido_at)