> For the complete documentation index, see [llms.txt](https://axcos.gitbook.io/axcos-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axcos.gitbook.io/axcos-docs/scripts/supplychain-delivery.md).

# SUPPLYCHAIN DELIVERY

Kurye teslimat modülü – bossmenu'de onaylanan siparişler kurye panelinden alınır, tedarikçi deposundan bagaja yüklenir ve alıcı teslim noktasına götürülür.

***

## Özellikler

* **İşletme bazlı laptop:** Her işletme için ox\_target ile erişilen laptop (prop) konumu
* **Sadece çalışanlar:** Sadece tedarikçi işletmesinin çalışanları (0..boss grade) görev alabilir
* **Tek aktif görev:** Bir kurye aynı anda sadece 1 görev alabilir (`SingleActiveJobPerCourier`)
* **Blip + Waypoint + 3D Checkpoint:** Teslim noktası haritada, rota çizgili, oyun içinde yuvarlak marker
* **Araç zorunluluğu:** Teslim için araçta olma (bagaj doğrulaması için)
* **ox\_inventory entegrasyonu:** Warehouse stash → bagaj, bagaj → store stash aktarımı
* **jg-advancedgarages:** İş garajından araç spawn (opsiyonel)
* **axcos\_effort\_logs:** Teslimat sonrası efor logu (bossmenu analitiği)

***

## Akış Özeti

{% stepper %}
{% step %}

### Bossmenu

Patron sipariş oluşturur → Tedarikçi patronu onaylar
{% endstep %}

{% step %}

### Kurye Panel

Laptop'tan "Kurye Paneli" açar, uygun siparişi alır
{% endstep %}

{% step %}

### Yükleme

Warehouse stash'e gider, malzemeleri bagaja yükler (ox\_inventory)
{% endstep %}

{% step %}

### Teslim

Dropoff noktasına gider, araçta iken \[E] ile teslim eder
{% endstep %}

{% step %}

### Tamamlandı

Malzemeler alıcının store stash'ine aktarılır, efor logu yazılır
{% endstep %}
{% endstepper %}

***

## Gereksinimler

* **ox\_lib** (zorunlu)
* **oxmysql** (zorunlu)
* **axcos\_core** (zorunlu)
* **ox\_target** (zorunlu – laptop etkileşimi için)
* **ox\_inventory** (zorunlu – stash, trunk, item transfer)
* **jg-advancedgarages** (opsiyonel – iş garajı)
* **axcos\_bossmenu** (sipariş oluşturma/onaylama için önerilir)

***

## Kurulum

### 1. Veritabanını import edin

```bash
# axcos_supplychain_delivery/server/db/schema.sql
```

Bu dosya `axcos_supply_orders`, `axcos_effort_logs`, `axcos_efforts` tablolarını oluşturur.

### 2. Bağımlılıkları ekleyin

```cfg
ensure ox_lib
ensure oxmysql
ensure axcos_core
ensure ox_target
ensure axcos_supplychain_delivery
```

### 3. Config'i düzenleyin

`shared/config.lua` içinde her işletme için `BusinessLaptops` tanımlayın.

***

## Config Referansı

### Config.BusinessLaptops

Her işletme (job) için laptop konumu, garaj, stash ve dropoff noktası:

```lua
Config.BusinessLaptops = {
  nox = {
    enabled = true,
    coords = vec4(-222.6, -335.75, 30.26, 309.98),
    garageName = 'noxJobGarage',       -- jg-advancedgarages id
    stashes = {
      warehouse = 'noxNightclubLocker', -- Malzeme yükleme stash (tedarikçi)
      store = 'noxNightclubLocker',     -- Teslim stash (alıcı)
    },
    dropoffCoords = vec3(-237.38, -334.12, 29.05),  -- Teslim noktası (alıcı tarafı)
    laptopModel = `prop_laptop_01a`,    -- Opsiyonel (DefaultLaptop kullanılır)
    target = { ... },                   -- Opsiyonel (label, icon, distance)
  },
}
```

| Parametre         | Açıklama                                   | Zorunlu                            |
| ----------------- | ------------------------------------------ | ---------------------------------- |
| enabled           | Bu işletme için panel açık mı              | Evet                               |
| coords            | Laptop konumu (x, y, z, heading)           | Evet                               |
| garageName        | jg-advancedgarages garaj id                | Hayır                              |
| stashes.warehouse | Tedarikçi deposu (ox\_inventory stash)     | Evet                               |
| stashes.store     | Alıcı mağaza deposu (ox\_inventory stash)  | Evet                               |
| dropoffCoords     | Bu işletmeye teslim noktası (alıcı olarak) | Hayır (sipariş dropoff kullanılır) |

### Config.Dropoff

Teslim noktası davranışı:

| Parametre      | Açıklama                       | Varsayılan             |
| -------------- | ------------------------------ | ---------------------- |
| radius         | Teslim alanı mesafesi ( metre) | `5.0`                  |
| deliverKey     | Teslim tuşu (38 = E)           | `38`                   |
| requireVehicle | Araçta olma zorunluluğu        | `true`                 |
| showMarker     | 3D checkpoint göster           | `true`                 |
| markerType     | DrawMarker tipi (1 = silindir) | `1`                    |
| markerScale    | Marker boyutu (x, y, z)        | `vec3(5.0, 5.0, 1.0)`  |
| markerColor    | RGBA renk                      | `{ 0, 255, 100, 150 }` |

### Config.DefaultLaptop

İşletme özel değer vermezse kullanılan varsayılanlar:

```lua
Config.DefaultLaptop = {
  laptopModel = `prop_laptop_01a`,
  target = {
    label = 'Kurye Paneli',
    icon = 'fa-solid fa-laptop',
    distance = 2.0
  }
}
```

### Diğer Ayarlar

| Parametre                        | Açıklama                              | Varsayılan |
| -------------------------------- | ------------------------------------- | ---------- |
| Config.MaxVisibleJobs            | Panelde listelenen max sipariş sayısı | `20`       |
| Config.SingleActiveJobPerCourier | Tek görev kuralı                      | `true`     |
| Config.GarageVehicleType         | Garaj araç tipi (jg)                  | `'car'`    |
| Config.Debug                     | Konsol logları                        | `false`    |

***

## Sipariş Durumları (status)

| Durum       | Açıklama                                            |
| ----------- | --------------------------------------------------- |
| pending     | Bossmenu'de oluşturuldu, tedarikçi onayı bekleniyor |
| available   | Onaylandı, kurye alabilir                           |
| assigned    | Kurye aldı                                          |
| in\_transit | Kurye yolda (opsiyonel güncelleme)                  |
| delivered   | Teslim edildi                                       |
| cancelled   | Reddedildi veya iptal                               |

***

## Exports (Server)

| Export                                                                                      | Açıklama                                    |
| ------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `CreateSupplyOrder(buyer_job, supplier_job, dx, dy, dz, total_amount, profit_amount, meta)` | Yeni sipariş oluşturur (pending)            |
| `ApproveSupplyOrder(orderId, supplierJob)`                                                  | Siparişi onaylar (available)                |
| `RejectSupplyOrder(orderId, supplierJob)`                                                   | Siparişi reddeder, alıcıya para iade        |
| `GetSuppliersForBuyer(buyer_job)`                                                           | Bossmenu kullanmıyorsanız tedarikçi listesi |

***

## Veritabanı Tabloları

### axcos\_supply\_orders

| Sütun                                      | Tip         | Açıklama                                                                  |
| ------------------------------------------ | ----------- | ------------------------------------------------------------------------- |
| id                                         | INT         | Sipariş ID                                                                |
| buyer\_job                                 | VARCHAR(64) | Alıcı işletme                                                             |
| supplier\_job                              | VARCHAR(64) | Tedarikçi işletme                                                         |
| status                                     | VARCHAR(24) | pending \| available \| assigned \| in\_transit \| delivered \| cancelled |
| eligible\_min\_grade, eligible\_max\_grade | TINYINT     | Kurye grade aralığı                                                       |
| dropoff\_x, dropoff\_y, dropoff\_z         | DOUBLE      | Teslim koordinatları                                                      |
| total\_amount                              | BIGINT      | Alıcının ödediği (gross)                                                  |
| profit\_amount                             | BIGINT      | Tedarikçi kârı (net)                                                      |
| courier\_identifier                        | VARCHAR(96) | Kurye (citizenid)                                                         |
| courier\_name\_cache                       | VARCHAR(96) | Kurye isim                                                                |
| courier\_state                             | VARCHAR(24) | none \| assigned \| in\_transit \| delivered                              |
| assigned\_at                               | TIMESTAMP   | Görev alınma zamanı                                                       |
| delivered\_at                              | TIMESTAMP   | Teslim zamanı                                                             |
| meta                                       | JSON        | items: { itemName: count }                                                |
| created\_at                                | TIMESTAMP   | Oluşturulma                                                               |

### axcos\_effort\_logs

Teslimat bazlı efor logu (bossmenu analitiği için).

### axcos\_efforts

Çalışan bazlı toplam teslimat sayısı, gelir (bossmenu efor tablosu için).

***

## Dosya Yapısı

```
axcos_supplychain_delivery/
├── shared/
│   └── config.lua      # BusinessLaptops, Dropoff, DefaultLaptop
├── client/
│   └── main.lua        # Laptop spawn, panel, dropoff marker, teslim
├── server/
│   ├── main.lua        # Callback'ler, exports, DB
│   └── db/
│       └── schema.sql  # axcos_supply_orders, axcos_effort_*
├── ui/
│   ├── index.html      # Kurye paneli NUI
│   ├── css/style.css
│   └── js/app.js
├── fxmanifest.lua
└── README.md
```

***

## Test Komutu

`Config.Debug = true` iken:

```
/scd_testorder <buyerJob> <supplierJob> <total> <profit>
```

Mevcut koordinatlarda dropoff ile test siparişi oluşturur.

***

## Stash Akışı

1. **Warehouse stash:** Tedarikçi işletmesinin `stashes.warehouse` değeri – malzemeler buradan alınır
2. **Trunk:** `trunk` + plaka (ox\_inventory) – bagaja yüklenir
3. **Store stash:** Alıcı işletmesinin `stashes.store` değeri – teslimde buraya aktarılır

ox\_inventory stashes.lua'da bu stash id'leri tanımlı olmalıdır.

***

## Modül Kontrolü

`axcos_core` üzerinden `Config.Modules.supplychain_delivery = false` yapılırsa resource çalışmaz (IsModuleEnabled kontrolü).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://axcos.gitbook.io/axcos-docs/scripts/supplychain-delivery.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
