erase ot dates

This commit is contained in:
amazuecos
2025-04-25 12:57:14 +02:00
parent cc2c9eee1c
commit 4379a9d23b
6 changed files with 274 additions and 51 deletions

View File

@ -982,6 +982,18 @@ class ProductionService extends BaseService
$this->updateProgress();
return $result;
}
public function emptyOrdenTrabajoDate(int $orden_trabajo_id, string $dateName)
{
$status = $this->otDate->where('orden_trabajo_id', $orden_trabajo_id)
->set($dateName, null)
->update();
if (isset($this->ordenTrabajoConfig->DATE_USER_MAPPING[$dateName])) {
$this->otUser->where('orden_trabajo_id', $orden_trabajo_id)
->set($this->ordenTrabajoConfig->DATE_USER_MAPPING[$dateName], auth()->user()->id)
->update();
}
return $status;
}
public function updateOrdenTrabajoPedidoDate($data): array
{
$status = false;
@ -1004,6 +1016,25 @@ class ProductionService extends BaseService
"status" => $status
];
}
public function emptyOrdenTrabajoPedidoDate(string $dateName)
{
$status = false;
$user = auth()->user();
$row = [];
$pedidoDatesUser = $this->ordenTrabajoConfig->DATE_USER_MAPPING_PEDIDO;
if (isset($pedidoDatesUser[$dateName])) {
$attrUserPedido = $pedidoDatesUser[$dateName];
$row[$attrUserPedido] = $user->id;
$row[$dateName] = null;
$status = $this->pedidoModel->update($this->pedido->id, $row);
$this->updateProgress();
} else {
throw new Exception(lang('Produccion.errors.attr_not_exist', [$dateName]));
}
return $status;
}
public function updateOrdenTrabajo($data): bool
{
if (isset($data["is_pedido_espera"])) {