Merge branch 'add/view_logistica_principal' of https://git.imnavajas.es/jjimenez/safekat into add/view_logistica_principal

This commit is contained in:
2025-04-15 18:48:07 +02:00
34 changed files with 993 additions and 145 deletions

View File

@ -40,6 +40,7 @@ class ChatService extends BaseService
"presupuesto" => "presupuesto_id",
"pedido" => "pedido_id",
"factura" => "factura_id",
"ot" => "orden_trabajo_id"
];
protected array $modelClassMap;
public function __construct()
@ -122,6 +123,9 @@ class ChatService extends BaseService
case 'factura':
$r = $this->chatModel->createChatFactura($chatDepartmentId, $modelId);
break;
case 'ot':
$r = $this->chatModel->createChatOrdenTrabajo($chatDepartmentId, $modelId);
break;
default:
break;
}

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,16 +75,24 @@ 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
{
$this->maquinaModel = model(MaquinaModel::class);
$this->otModel = model(OrdenTrabajoModel::class);
$this->ot = $this->otModel->find($orden_trabajo_id);
$pedido = $this->ot->pedido();
$this->setPedido($pedido);
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
return $this;
try {
//code...
$this->maquinaModel = model(MaquinaModel::class);
$this->otModel = model(OrdenTrabajoModel::class);
$this->ot = $this->otModel->find($orden_trabajo_id);
$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;
} catch (\Throwable $th) {
dd($orden_trabajo_id);
throw $th;
}
}
/**
* Establece el pedido sobre el que se va a trabajar
@ -631,6 +640,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 +1117,89 @@ 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()
{
if ($this->ot->dates()->solapaStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["solapa"];
};
}
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()
{
if ($this->ot->dates()->cosidoStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["cosido"];
};
}
protected function otGrapadoColor()
{
if ($this->ot->dates()->grapadoStatus()) {
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["grapado"];
};
}
protected function updateColor(){
$this->otSinImprimirColor();
$this->otImpresionIntColor();
$this->otCosidoColor();
$this->otImpresionCubiertaColor();
$this->otPlastificadoColor();
$this->otSolapaColor();
$this->otPreparadoColor();
$this->otGrapadoColor();
$this->otEncuadernadoColor();
$this->otCorteColor();
}
}