feat colors

This commit is contained in:
amazuecos
2025-04-14 20:41:23 +02:00
parent 137d5b9db2
commit ebf0a9d5d7
6 changed files with 154 additions and 16 deletions

View File

@ -50,6 +50,7 @@ class ProductionService extends BaseService
protected MaquinaEntity $defaultMaquinaCorte;
protected MaquinaModel $maquinaModel;
protected OrdenTrabajo $ordenTrabajoConfig;
public string $statusColor;
/**
* Pedido Entity
@ -74,6 +75,7 @@ class ProductionService extends BaseService
$this->otFileModel = model(OrdenTrabajoFileModel::class);
$this->pedidoModel = model(PedidoModel::class);
$this->ordenTrabajoConfig = config('OrdenTrabajo');
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
}
public function init(int $orden_trabajo_id): self
{
@ -83,6 +85,7 @@ class ProductionService extends BaseService
$pedido = $this->ot->pedido();
$this->setPedido($pedido);
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
return $this;
}
/**
@ -631,6 +634,7 @@ class ProductionService extends BaseService
"tareas_preimpresion" => $this->tareas_preimpresion(),
"tareas_impresion" => $this->tareas_impresion(),
"tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(),
"statusColor" => $this->getOtColorStatus(),
];
return $summary;
}
@ -1107,10 +1111,81 @@ class ProductionService extends BaseService
}
$progreso = (float) $fill_dates / $total * 100;
$status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso,2)]);
}else{
$status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]);
} else {
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
}
return $status;
}
public function getOtColorStatus(): string
{
if($this->ot->dates()){
$this->updateColor();
}
return $this->statusColor;
}
protected function otSinImprimirColor()
{
if ($this->ot->dates()->sinImprimirStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
};
}
protected function otImpresionIntColor()
{
if ($this->ot->dates()->impresionInteriorStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["impreso_int"];
};
}
protected function otImpresionCubiertaColor()
{
if ($this->ot->dates()->impresionCubiertaStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["impreso_cub"];
};
}
protected function otPlastificadoColor()
{
if ($this->ot->dates()->plastificadoStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["plastificado"];
};
}
protected function otSolapaColor()
{
}
protected function otEncuadernadoColor()
{
if ($this->ot->dates()->encuadernadoStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["encuadernado"];
};
}
protected function otPreparadoColor()
{
if ($this->ot->dates()->preparacionInterioresStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["preparado"];
};
}
protected function otCorteColor()
{
if ($this->ot->dates()->corteStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["corte"];
};
}
protected function otCosidoColor()
{
}
protected function otGrapadoColor()
{
}
protected function updateColor(){
$this->otSinImprimirColor();
$this->otImpresionIntColor();
$this->otCosidoColor();
$this->otImpresionCubiertaColor();
$this->otPlastificadoColor();
$this->otSolapaColor();
$this->otPreparadoColor();
$this->otGrapadoColor();
$this->otEncuadernadoColor();
$this->otCorteColor();
}
}