Installation Guide

Execute the Below in your Server and its all Done!!


Step 1: SQL Tables for Data Storage:

Instructions

  1. Open your database management tool (e.g., phpMyAdmin or HeidiSQL).

  2. Select Your Database.

  3. Run the following SQL code to create the required tables:

-- Moon Logistics Database Structure
-- This file contains the database schema for the warehouse + trucking system

-- ============================================
-- WAREHOUSE STOCK TABLE
-- ============================================
CREATE TABLE IF NOT EXISTS `warehouse_stock` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `item_name` VARCHAR(100) NOT NULL,
    `quantity` INT(11) NOT NULL DEFAULT 0,
    `min_quantity` INT(11) NOT NULL DEFAULT 10,
    `price` INT(11) NOT NULL DEFAULT 10,
    `last_updated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `item_name` (`item_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ============================================
-- BUSINESS ORDERS TABLE
-- ============================================
CREATE TABLE IF NOT EXISTS `warehouse_orders` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `order_id` VARCHAR(50) NOT NULL UNIQUE,
    `business_name` VARCHAR(100) NOT NULL,
    `business_owner` VARCHAR(50) NOT NULL,
    `delivery_location` VARCHAR(255) NOT NULL,
    `items` LONGTEXT NOT NULL, -- JSON format: [{"item": "onions", "quantity": 10}]
    `status` ENUM('pending', 'processing', 'packed', 'in_transit', 'delivered', 'cancelled') DEFAULT 'pending',
    `warehouse_employee` VARCHAR(50) NULL,
    `trucker_name` VARCHAR(50) NULL,
    `total_cost` INT(11) NOT NULL DEFAULT 0,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ============================================
-- DELIVERY JOBS TABLE
-- ============================================
CREATE TABLE IF NOT EXISTS `warehouse_deliveries` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `order_id` VARCHAR(50) NOT NULL,
    `trucker_identifier` VARCHAR(50) NOT NULL,
    `pickup_location` VARCHAR(255) NOT NULL,
    `delivery_location` VARCHAR(255) NOT NULL,
    `status` ENUM('assigned', 'picked_up', 'delivering', 'completed', 'failed') DEFAULT 'assigned',
    `payment` INT(11) NOT NULL DEFAULT 0,
    `assigned_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `completed_at` TIMESTAMP NULL,
    PRIMARY KEY (`id`),
    KEY `trucker_identifier` (`trucker_identifier`),
    KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ============================================
-- WAREHOUSE STOCK DATA
-- ============================================
-- NOTE: Warehouse stock is automatically synced from Config.StockItems on resource start.
-- No manual INSERT needed - items are added/updated/removed based on config.lua

Step 2: Review the install Folder

Before configuring config.lua, you must review the install folder included with Moon Logistics.

This folder contains ready-made files and references required for the script to work correctly with your framework and inventory.


📁 What’s Inside the install Folder?

The install folder includes everything you need to set up items, images, and jobs without writing code from scratch.

🧾 Inventory Item Definitions

Pre-configured item entries for:

  • ox_inventory

  • qb-inventory

⚠️ You must add these items to your inventory system, or the script will not function correctly.


🖼️ Item Images

Item images ready to use for all stock items, such as:

  • Onions

  • Potatoes

📂 Place images in:

  • ox_inventory/web/images/ (ox_inventory)

  • qb-inventory/html/images/ (qb-inventory)

Image names must match the item names exactly.


👷 Job Definitions

Pre-made job entries for:

  • QBCore

  • QBX Core

Jobs included:

  • warehouse

  • trucker

📌 Add only the job file that matches your framework.


Step 3: Configure the Config.lua File

Customize the Config.lua file based on your preferences and requirements. Ensure the settings align with your server's intended functionality and features. Check The Below Link for Advanced Configuration

Advanced Configuration

Last updated