fix update pedido espera update

This commit is contained in:
amazuecos
2025-04-15 19:39:07 +02:00
parent 10e18d60e4
commit c6db000057
5 changed files with 42 additions and 9 deletions

View File

@ -90,7 +90,6 @@ class ProductionService extends BaseService
$this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"];
return $this;
} catch (\Throwable $th) {
dd($orden_trabajo_id);
throw $th;
}
}
@ -141,10 +140,10 @@ class ProductionService extends BaseService
];
$id = $this->otModel->insert($data);
$this->init($id);
$this->updatePedidoEspera();
$this->storeOrdenTrabajoUsers();
$this->storeOrdenTrabajoDates();
$this->storeAllTareas();
$this->updatePedidoEspera();
return $this->ot;
}
@ -177,6 +176,24 @@ class ProductionService extends BaseService
"orden_trabajo_id" => $this->ot->id,
]);
}
public function reInsertOrdenTrabajoUsers(): int|bool|string
{
$status = false;
if($this->otUser->where('orden_trabajo_id',$this->ot->id)->countAllResults() == 0)
{
$status = $this->storeOrdenTrabajoUsers();
}
return $status;
}
public function reInsertOrdenTrabajoDates(): int|bool|string
{
$status = false;
if($this->otDate->where('orden_trabajo_id',$this->ot->id)->countAllResults() == 0)
{
$status = $this->storeOrdenTrabajoDates();
}
return $status;
}
protected function storeAllTareas()
{
$this->storeOrdenTrabajoTareas();
@ -757,8 +774,8 @@ class ProductionService extends BaseService
{
$result = [];
$otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id)
->set([$data['name'] => $data[$data['name']]])
->update($data);
->set($data['name'],$data[$data['name']])
->update();
$this->otDate->updateUserDateMap($this->ot->id, $data);
$ot_users = $this->ot->users();
if (isset($this->ordenTrabajoConfig->DATE_USER_MAPPING[$data["name"]])) {
@ -1063,7 +1080,7 @@ class ProductionService extends BaseService
$status = false;
$presupuestoFiles = $this->presupuesto->files();
if (count($presupuestoFiles) == 0) {
$status = $this->otModel->update($this->ot->id, ['pedido_espera' => true]);
$status = $this->otModel->update($this->ot->id, ['is_pedido_espera' => true]);
}
return $status;
}