getSerialNumber(); $this->serialData = is_array($response['data'] ?? null) ? $response['data'] : ['value' => $response['data'] ?? null]; $this->errorMessage = $response['error'] ?? null; } catch (LogisticsApiException $e) { $this->errorMessage = $e->getMessage(); $this->serialData = []; } catch (\Throwable $e) { $this->errorMessage = "Erreur inattendue : {$e->getMessage()}"; $this->serialData = []; } } public function searchCodes(): void { if (blank($this->code)) { return; } try { $service = app(LogisticsService::class); $response = $service->codesList(['code' => $this->code]); $this->codesData = $response['data'] ?? []; $this->errorMessage = $response['error'] ?? null; } catch (LogisticsApiException $e) { $this->errorMessage = $e->getMessage(); $this->codesData = []; } catch (\Throwable $e) { $this->errorMessage = "Erreur inattendue : {$e->getMessage()}"; $this->codesData = []; } } public function updateStock(): void { if (blank($this->stkArtId) || blank($this->stkId) || blank($this->stkQty)) { return; } try { $service = app(LogisticsService::class); $params = array_filter([ 'ARTID' => $this->stkArtId, 'STKID' => $this->stkId, 'QTY' => $this->stkQty, 'TOCHECK' => $this->stkToCheck, 'TOCHECKDETAIL' => $this->stkToCheckDetail, 'MODE' => $this->stkMode, ]); $response = $service->customGeninvUpdatestock($params); $this->updateStockResult = $response['data'] ?? []; $this->errorMessage = $response['error'] ?? null; } catch (LogisticsApiException $e) { $this->errorMessage = $e->getMessage(); $this->updateStockResult = []; } catch (\Throwable $e) { $this->errorMessage = "Erreur inattendue : {$e->getMessage()}"; $this->updateStockResult = []; } } }