feat/ot-datatable-news

This commit is contained in:
amazuecos
2025-05-02 07:56:28 +02:00
parent 9283059f9d
commit 5138681718
14 changed files with 346 additions and 65 deletions

View File

@ -110,6 +110,12 @@ class ProductionService extends BaseService
* @var boolean
*/
public bool $isPlastificado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene retractilado
* Se usa para mostrar la fecha correspondiente en la vista
* @var boolean
*/
public bool $isRetractilado = false; //* CHECK DONE
/**
* Indica si la orden de trabajo contiene gofrado
* Se usa para mostrar la fecha correspondiente en la vista
@ -273,6 +279,10 @@ class ProductionService extends BaseService
$this->storeOrdenTrabajoUsers();
$this->storeOrdenTrabajoDates();
$this->storeAllTareas();
try {
$this->updatePodDates();
} catch (\Throwable $th) {
}
$this->updatePedidoEspera();
return $this->ot;
}
@ -844,6 +854,7 @@ class ProductionService extends BaseService
"tareas_preimpresion" => $this->tareas_preimpresion(),
"tareas_impresion" => $this->tareas_impresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"tiempo_total" => $this->getTiempoTotalTareas(),
"statusColor" => $this->getOtColorStatus(),
"tareaCosido" => $this->getTareaCosido(),
];
@ -989,8 +1000,8 @@ class ProductionService extends BaseService
throw new Exception(lang('Produccion.task_already_finished'));
}
}
if(isset($data['estado'])){
if($data['estado'] == 'F'){
if (isset($data['estado'])) {
if ($data['estado'] == 'F') {
$tareaEntity = $this->otTarea->find($data['ot_tarea_id']);
$this->init($tareaEntity->orden_trabajo_id);
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
@ -1015,11 +1026,11 @@ class ProductionService extends BaseService
$data["action_at"] = Time::now()->format('Y-m-d H:i:s');
$data["action_user_id"] = auth()->user()->id;
$status = $this->otTareaProgressDate->where('ot_tarea_id', $orden_trabajo_tarea_id)->delete();
if($status){
$tareaEntity = $this->otTarea->find($orden_trabajo_tarea_id);
$this->init($tareaEntity->orden_trabajo_id);
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
$this->emptyOrdenTrabajoDate($this->ot->id,$dateName);
if ($status) {
$tareaEntity = $this->otTarea->find($orden_trabajo_tarea_id);
$this->init($tareaEntity->orden_trabajo_id);
$dateName = $this->getOrdenTrabajoTareaDate($tareaEntity);
$this->emptyOrdenTrabajoDate($this->ot->id, $dateName);
}
if ($status) {
$response = $this->storeOrdenTrabajoTareaProgressDate($data);
@ -1409,14 +1420,33 @@ class ProductionService extends BaseService
}
public function getTiempoTareasImpresionHHMM(): string
{
$tareas_impresion = $this->ot->tareas_impresion();
$tiempo_seconds = 0;
foreach ($tareas_impresion as $key => $tarea) {
if ($tarea->is_corte == false) {
$tiempo_seconds += $tarea->tiempo_estimado;
try {
$tareas_impresion = $this->ot->tareas_impresion();
$tiempo_seconds = 0;
foreach ($tareas_impresion as $key => $tarea) {
if ($tarea->is_corte == false) {
$tiempo_seconds += $tarea->tiempo_estimado;
}
}
return float_seconds_to_hhmm_string($tiempo_seconds);
} catch (\Throwable $th) {
return '00:00';
}
}
public function getTiempoTotalTareas(): string
{
try {
$tareas = $this->ot->tareas();
$tiempo_seconds = 0;
foreach ($tareas as $key => $tarea) {
if ($tarea->tiempo_real) {
$tiempo_seconds += $tarea->tiempo_real;
}
}
return float_seconds_to_hhmm_string($tiempo_seconds);
} catch (\Throwable $th) {
return '00:00';
}
return float_seconds_to_hhmm_string($tiempo_seconds);
}
public function getUVI(): ?TarifaAcabadoEntity
{
@ -1735,13 +1765,13 @@ class ProductionService extends BaseService
$acabados = $this->presupuesto->acabados();
foreach ($acabados as $key => $acabado) {
$tarifa_acabado = $acabado->tarifa();
if ($tarifa_acabado->retractilado) {
if ($tarifa_acabado->rectractilado) {
$flag = true;
break;
}
}
$this->isPlakene = $flag;
return $this->isPlakene;
$this->isRetractilado = $flag;
return $this->isRetractilado;
}
public function plakene_tipo(): ?string
{
@ -1891,7 +1921,7 @@ class ProductionService extends BaseService
)
->join("pedidos", "pedidos.id = ordenes_trabajo.pedido_id", "right")
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
->where('orden_trabajo_tareas.maquina_id', $maquina_id)
->where('orden_trabajo_tareas.maquina_id', $maquina_id)
// ->where('pedidos.fecha_impresion IS NOT NULL', null, false)
->where("orden_trabajo_tareas.deleted_at", null)
->where("tarea_progress.estado", 'P')