Initial commit: Inventory Barcode System

This commit is contained in:
2025-07-22 20:24:51 -04:00
commit 511b01748d
63 changed files with 26932 additions and 0 deletions

507
docs/API.md Normal file
View File

@ -0,0 +1,507 @@
# Inventory Barcode System API Documentation
## Overview
The Inventory Barcode System provides a RESTful API for managing products, inventory levels, and generating barcodes/QR codes. This documentation covers all available endpoints, request/response formats, and usage examples.
## Base URL
```
http://localhost:3000/api
```
## Authentication
Currently, the API does not require authentication. In production environments, consider implementing proper authentication and authorization mechanisms.
## Error Handling
All API endpoints return consistent error responses:
```json
{
"error": true,
"message": "Error description",
"code": "ERROR_CODE",
"details": {}
}
```
Common HTTP status codes:
- `200` - Success
- `201` - Created
- `400` - Bad Request
- `404` - Not Found
- `409` - Conflict
- `500` - Internal Server Error
## Products API
### Get All Products
Retrieve a list of all products in the system.
**Endpoint:** `GET /api/products`
**Query Parameters:**
- `page` (optional): Page number for pagination (default: 1)
- `limit` (optional): Number of items per page (default: 50)
- `search` (optional): Search term for product code or description
- `category` (optional): Filter by product category
**Response:**
```json
{
"success": true,
"data": [
{
"id": 1,
"product_code": "ABC123",
"description": "Sample Product",
"category": "Electronics",
"unit_of_measure": "pcs",
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 100,
"pages": 2
}
}
```
### Get Product by ID
Retrieve a specific product by its ID.
**Endpoint:** `GET /api/products/:id`
**Response:**
```json
{
"success": true,
"data": {
"id": 1,
"product_code": "ABC123",
"description": "Sample Product",
"category": "Electronics",
"unit_of_measure": "pcs",
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
}
```
### Create Product
Create a new product in the system.
**Endpoint:** `POST /api/products`
**Request Body:**
```json
{
"product_code": "ABC123",
"description": "Sample Product",
"category": "Electronics",
"unit_of_measure": "pcs"
}
```
**Response:**
```json
{
"success": true,
"data": {
"id": 1,
"product_code": "ABC123",
"description": "Sample Product",
"category": "Electronics",
"unit_of_measure": "pcs",
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
}
```
### Update Product
Update an existing product.
**Endpoint:** `PUT /api/products/:id`
**Request Body:**
```json
{
"description": "Updated Product Description",
"category": "Updated Category",
"unit_of_measure": "kg"
}
```
### Delete Product
Delete a product from the system.
**Endpoint:** `DELETE /api/products/:id`
**Response:**
```json
{
"success": true,
"message": "Product deleted successfully"
}
```
### Import Products from Excel
Import products from an Excel file.
**Endpoint:** `POST /api/products/import`
**Request:** Multipart form data with Excel file
**Response:**
```json
{
"success": true,
"data": {
"imported": 50,
"skipped": 5,
"errors": [
{
"row": 10,
"error": "Invalid product code format"
}
]
}
}
```
## Inventory API
### Get Inventory Levels
Retrieve inventory levels for all products or specific products.
**Endpoint:** `GET /api/inventory`
**Query Parameters:**
- `product_id` (optional): Filter by specific product ID
- `low_stock` (optional): Show only products with low stock levels
**Response:**
```json
{
"success": true,
"data": [
{
"id": 1,
"product_id": 1,
"product_code": "ABC123",
"description": "Sample Product",
"current_level": 100,
"minimum_level": 10,
"maximum_level": 500,
"last_updated": "2024-01-01T00:00:00.000Z",
"updated_by": "system"
}
]
}
```
### Update Inventory Level
Update the inventory level for a specific product.
**Endpoint:** `PUT /api/inventory/:productId`
**Request Body:**
```json
{
"new_level": 150,
"change_reason": "Stock replenishment",
"updated_by": "user123"
}
```
**Response:**
```json
{
"success": true,
"data": {
"product_id": 1,
"old_level": 100,
"new_level": 150,
"change_reason": "Stock replenishment",
"updated_by": "user123",
"updated_at": "2024-01-01T00:00:00.000Z"
}
}
```
### Get Inventory History
Retrieve the history of inventory changes for a product.
**Endpoint:** `GET /api/inventory/:productId/history`
**Query Parameters:**
- `limit` (optional): Number of history records to return (default: 50)
- `from_date` (optional): Start date for history filter (ISO format)
- `to_date` (optional): End date for history filter (ISO format)
**Response:**
```json
{
"success": true,
"data": [
{
"id": 1,
"product_id": 1,
"old_level": 90,
"new_level": 100,
"change_reason": "Stock adjustment",
"updated_by": "user123",
"updated_at": "2024-01-01T00:00:00.000Z"
}
]
}
```
### Export Inventory to Excel
Export current inventory levels to an Excel file.
**Endpoint:** `GET /api/inventory/export`
**Query Parameters:**
- `format` (optional): Export format ('xlsx' or 'csv', default: 'xlsx')
- `include_history` (optional): Include inventory history (true/false, default: false)
**Response:** Excel file download
## Codes API
### Generate Barcode
Generate a barcode for a specific product.
**Endpoint:** `POST /api/codes/barcode`
**Request Body:**
```json
{
"product_code": "ABC123",
"format": "CODE128",
"width": 2,
"height": 100,
"displayValue": true
}
```
**Response:**
```json
{
"success": true,
"data": {
"product_code": "ABC123",
"format": "CODE128",
"barcode_svg": "<svg>...</svg>",
"barcode_base64": "data:image/png;base64,..."
}
}
```
### Generate QR Code
Generate a QR code for a specific product.
**Endpoint:** `POST /api/codes/qrcode`
**Request Body:**
```json
{
"product_code": "ABC123",
"size": 200,
"error_correction": "M",
"include_product_info": true
}
```
**Response:**
```json
{
"success": true,
"data": {
"product_code": "ABC123",
"qr_code_svg": "<svg>...</svg>",
"qr_code_base64": "data:image/png;base64,...",
"embedded_data": {
"product_code": "ABC123",
"description": "Sample Product",
"timestamp": "2024-01-01T00:00:00.000Z"
}
}
}
```
### Generate Printable Layout
Generate a printable PDF layout with barcodes/QR codes.
**Endpoint:** `POST /api/codes/printable`
**Request Body:**
```json
{
"products": ["ABC123", "DEF456", "GHI789"],
"code_type": "barcode",
"layout": {
"page_size": "A4",
"labels_per_row": 3,
"labels_per_column": 8,
"include_description": true,
"font_size": 10
}
}
```
**Response:** PDF file download
### Decode Scanned Code
Decode a scanned barcode or QR code and retrieve product information.
**Endpoint:** `POST /api/codes/decode`
**Request Body:**
```json
{
"code_data": "ABC123",
"code_type": "barcode"
}
```
**Response:**
```json
{
"success": true,
"data": {
"product": {
"id": 1,
"product_code": "ABC123",
"description": "Sample Product",
"category": "Electronics"
},
"inventory": {
"current_level": 100,
"minimum_level": 10,
"last_updated": "2024-01-01T00:00:00.000Z"
}
}
}
```
## Health Check
### System Health
Check the health status of the application.
**Endpoint:** `GET /health`
**Response:**
```json
{
"status": "OK",
"timestamp": "2024-01-01T00:00:00.000Z",
"uptime": 3600,
"memory": {
"rss": 50331648,
"heapTotal": 20971520,
"heapUsed": 15728640,
"external": 1048576
},
"version": "v18.17.0"
}
```
## Rate Limiting
API endpoints are rate-limited to prevent abuse:
- Default: 100 requests per 15 minutes per IP address
- File upload endpoints: 10 requests per 15 minutes per IP address
## File Upload Limits
- Maximum file size: 10MB
- Supported formats: .xlsx, .xls
- Maximum concurrent uploads: 3
## Examples
### Complete Import Workflow
1. **Upload Excel file:**
```bash
curl -X POST \
http://localhost:3000/api/products/import \
-H 'Content-Type: multipart/form-data' \
-F 'file=@inventory.xlsx'
```
2. **Generate barcodes for imported products:**
```bash
curl -X POST \
http://localhost:3000/api/codes/printable \
-H 'Content-Type: application/json' \
-d '{
"products": ["ABC123", "DEF456"],
"code_type": "barcode",
"layout": {
"page_size": "A4",
"labels_per_row": 3,
"include_description": true
}
}'
```
3. **Update inventory after scanning:**
```bash
curl -X PUT \
http://localhost:3000/api/inventory/1 \
-H 'Content-Type: application/json' \
-d '{
"new_level": 85,
"change_reason": "Scanned update",
"updated_by": "scanner_user"
}'
```
4. **Export updated inventory:**
```bash
curl -X GET \
'http://localhost:3000/api/inventory/export?format=xlsx' \
--output updated_inventory.xlsx
```
## Error Codes
| Code | Description |
|------|-------------|
| `VALIDATION_ERROR` | Request validation failed |
| `PRODUCT_NOT_FOUND` | Product does not exist |
| `DUPLICATE_PRODUCT_CODE` | Product code already exists |
| `INVALID_FILE_FORMAT` | Unsupported file format |
| `FILE_TOO_LARGE` | File exceeds size limit |
| `DATABASE_ERROR` | Database operation failed |
| `GENERATION_ERROR` | Code generation failed |
| `EXPORT_ERROR` | Export operation failed |
## Support
For technical support or questions about the API, please refer to the system documentation or contact the development team.

581
docs/DEPLOYMENT.md Normal file
View File

@ -0,0 +1,581 @@
# Deployment Guide
## Overview
This guide covers the deployment of the Inventory Barcode System in production environments. The system supports both Docker-based containerized deployment and traditional server deployment.
## Prerequisites
### System Requirements
**Minimum Requirements:**
- CPU: 2 cores
- RAM: 2GB
- Storage: 10GB free space
- OS: Linux, Windows, or macOS
**Recommended Requirements:**
- CPU: 4 cores
- RAM: 4GB
- Storage: 50GB free space
- OS: Linux (Ubuntu 20.04+ or CentOS 8+)
### Software Dependencies
**Required:**
- Docker 20.10+
- Docker Compose 2.0+
- Node.js 18+ (for non-Docker deployment)
**Optional:**
- Nginx (for reverse proxy)
- SSL certificates (for HTTPS)
## Docker Deployment (Recommended)
### Quick Start
1. **Clone the repository:**
```bash
git clone <repository-url>
cd inventory-barcode-system
```
2. **Configure environment:**
```bash
cp .env.example .env
# Edit .env file with your settings
```
3. **Deploy with Docker Compose:**
```bash
# Linux/macOS
./scripts/deploy.sh
# Windows PowerShell
.\scripts\deploy.ps1
```
4. **Verify deployment:**
```bash
curl http://localhost:3000/health
```
### Environment Configuration
Edit the `.env` file with your production settings:
```bash
# Server Configuration
NODE_ENV=production
PORT=3000
HOST=0.0.0.0
# Database Configuration
DATABASE_PATH=./data/inventory.db
DATABASE_BACKUP_PATH=./data/backups
DATABASE_BACKUP_INTERVAL=3600000
# File Upload Configuration
UPLOAD_MAX_SIZE=10485760
TEMP_DIR=./data/temp
# Logging Configuration
LOG_LEVEL=info
LOG_DIR=./logs
# Backup Configuration
BACKUP_ENABLED=true
BACKUP_SCHEDULE=0 2 * * *
BACKUP_RETENTION_DAYS=30
```
### Docker Compose Configuration
The `docker-compose.yml` file includes:
- **Application container** with health checks
- **Persistent volumes** for data and logs
- **Environment variable** configuration
- **Automatic restart** policies
### Deployment Commands
```bash
# Deploy application
./scripts/deploy.sh deploy
# Check status
./scripts/deploy.sh status
# View logs
./scripts/deploy.sh logs
# Restart application
./scripts/deploy.sh restart
# Stop application
./scripts/deploy.sh stop
# Rollback deployment
./scripts/deploy.sh rollback
```
## Manual Deployment
### Server Setup
1. **Install Node.js:**
```bash
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# CentOS/RHEL
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
```
2. **Install system dependencies:**
```bash
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y build-essential python3 sqlite3
# CentOS/RHEL
sudo yum groupinstall -y "Development Tools"
sudo yum install -y python3 sqlite
```
3. **Create application user:**
```bash
sudo useradd -m -s /bin/bash inventory
sudo usermod -aG sudo inventory
```
### Application Deployment
1. **Deploy application files:**
```bash
# Copy files to server
scp -r . inventory@server:/opt/inventory-barcode-system/
# Set permissions
sudo chown -R inventory:inventory /opt/inventory-barcode-system
```
2. **Install dependencies:**
```bash
cd /opt/inventory-barcode-system
npm ci --only=production
```
3. **Configure environment:**
```bash
cp .env.example .env
# Edit .env with production settings
```
4. **Create systemd service:**
```bash
sudo tee /etc/systemd/system/inventory-barcode.service > /dev/null <<EOF
[Unit]
Description=Inventory Barcode System
After=network.target
[Service]
Type=simple
User=inventory
WorkingDirectory=/opt/inventory-barcode-system
ExecStart=/usr/bin/node server.js
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
```
5. **Start service:**
```bash
sudo systemctl daemon-reload
sudo systemctl enable inventory-barcode
sudo systemctl start inventory-barcode
```
## Reverse Proxy Setup
### Nginx Configuration
1. **Install Nginx:**
```bash
# Ubuntu/Debian
sudo apt-get install nginx
# CentOS/RHEL
sudo yum install nginx
```
2. **Configure virtual host:**
```bash
sudo tee /etc/nginx/sites-available/inventory-barcode > /dev/null <<EOF
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade;
}
# Static file serving
location /static/ {
alias /opt/inventory-barcode-system/public/;
expires 1y;
add_header Cache-Control "public, immutable";
}
}
EOF
```
3. **Enable site:**
```bash
sudo ln -s /etc/nginx/sites-available/inventory-barcode /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
```
### SSL Configuration
1. **Install Certbot:**
```bash
sudo apt-get install certbot python3-certbot-nginx
```
2. **Obtain SSL certificate:**
```bash
sudo certbot --nginx -d your-domain.com
```
3. **Auto-renewal:**
```bash
sudo crontab -e
# Add: 0 12 * * * /usr/bin/certbot renew --quiet
```
## Database Management
### Backup Configuration
The system includes automated backup functionality:
```javascript
// Backup settings in .env
BACKUP_ENABLED=true
BACKUP_SCHEDULE=0 2 * * * // Daily at 2 AM
BACKUP_RETENTION_DAYS=30
```
### Manual Backup
```bash
# Create backup
node -e "
const BackupManager = require('./utils/backup');
const backup = new BackupManager();
backup.createBackup().then(console.log).catch(console.error);
"
# List backups
ls -la data/backups/
# Restore from backup
node -e "
const BackupManager = require('./utils/backup');
const backup = new BackupManager();
backup.restoreBackup('data/backups/backup-file.db').then(console.log).catch(console.error);
"
```
### Database Migration
For schema updates:
```bash
# Backup current database
cp inventory.db inventory.db.backup
# Run migration script (if available)
node scripts/migrate.js
# Verify migration
node -e "
const db = require('./models/database');
console.log('Database schema version:', db.getSchemaVersion());
"
```
## Monitoring and Logging
### Log Management
Logs are stored in the `logs/` directory:
- `application.log` - General application logs
- `error.log` - Error logs
- `http.log` - HTTP request logs
### Log Rotation
Configure log rotation with logrotate:
```bash
sudo tee /etc/logrotate.d/inventory-barcode > /dev/null <<EOF
/opt/inventory-barcode-system/logs/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 644 inventory inventory
postrotate
systemctl reload inventory-barcode
endscript
}
EOF
```
### Health Monitoring
The system provides a health check endpoint:
```bash
# Check application health
curl http://localhost:3000/health
# Response format:
{
"status": "OK",
"timestamp": "2024-01-01T00:00:00.000Z",
"uptime": 3600,
"memory": {...},
"version": "v18.17.0"
}
```
### Performance Monitoring
Monitor key metrics:
- **Response time**: Average API response time
- **Memory usage**: Node.js heap usage
- **Database size**: SQLite file size growth
- **Error rate**: Application error frequency
## Security Considerations
### Network Security
- Use HTTPS in production
- Configure firewall rules
- Limit database access
- Use reverse proxy for SSL termination
### Application Security
- Keep dependencies updated
- Use environment variables for secrets
- Implement rate limiting
- Enable security headers (Helmet.js)
### Data Security
- Regular database backups
- Encrypt sensitive data
- Implement access controls
- Monitor for unauthorized access
## Scaling Considerations
### Horizontal Scaling
For high-traffic deployments:
1. **Load Balancer Setup:**
```nginx
upstream inventory_backend {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
location / {
proxy_pass http://inventory_backend;
}
}
```
2. **Database Considerations:**
- SQLite limitations for concurrent writes
- Consider PostgreSQL for high concurrency
- Implement database connection pooling
### Vertical Scaling
- Increase server resources (CPU, RAM)
- Optimize Node.js memory settings
- Configure PM2 for process management
## Troubleshooting
### Common Issues
**Application won't start:**
```bash
# Check logs
docker-compose logs inventory-app
# or
journalctl -u inventory-barcode -f
# Check port availability
netstat -tlnp | grep :3000
# Check file permissions
ls -la /opt/inventory-barcode-system
```
**Database errors:**
```bash
# Check database file
sqlite3 inventory.db ".schema"
# Check disk space
df -h
# Check file permissions
ls -la inventory.db
```
**Performance issues:**
```bash
# Check system resources
top
htop
free -h
# Check application metrics
curl http://localhost:3000/health
```
### Log Analysis
```bash
# View recent errors
tail -f logs/error.log
# Search for specific errors
grep "ERROR" logs/application.log
# Monitor HTTP requests
tail -f logs/http.log
```
## Maintenance
### Regular Tasks
**Daily:**
- Check application health
- Monitor error logs
- Verify backup completion
**Weekly:**
- Review performance metrics
- Update system packages
- Clean temporary files
**Monthly:**
- Update Node.js dependencies
- Review security patches
- Optimize database
### Update Procedure
1. **Backup current deployment:**
```bash
./scripts/deploy.sh rollback # Creates backup
```
2. **Deploy new version:**
```bash
git pull origin main
./scripts/deploy.sh deploy
```
3. **Verify deployment:**
```bash
./scripts/deploy.sh status
curl http://localhost:3000/health
```
4. **Rollback if needed:**
```bash
./scripts/deploy.sh rollback
```
## Support
For deployment issues:
1. Check this documentation
2. Review application logs
3. Verify system requirements
4. Contact system administrator
5. Refer to troubleshooting section
## Appendix
### Environment Variables Reference
| Variable | Default | Description |
|----------|---------|-------------|
| `NODE_ENV` | `production` | Application environment |
| `PORT` | `3000` | Server port |
| `HOST` | `0.0.0.0` | Server host |
| `DATABASE_PATH` | `./inventory.db` | Database file path |
| `LOG_LEVEL` | `info` | Logging level |
| `BACKUP_ENABLED` | `true` | Enable automatic backups |
### Port Requirements
| Port | Service | Description |
|------|---------|-------------|
| `3000` | Application | Main application port |
| `80` | HTTP | Web server (if using reverse proxy) |
| `443` | HTTPS | Secure web server |
### File Permissions
```bash
# Application files
chown -R inventory:inventory /opt/inventory-barcode-system
chmod -R 755 /opt/inventory-barcode-system
chmod 644 /opt/inventory-barcode-system/.env
# Database files
chmod 660 /opt/inventory-barcode-system/inventory.db
chmod 755 /opt/inventory-barcode-system/data
# Log files
chmod 644 /opt/inventory-barcode-system/logs/*.log
```

423
docs/USER_GUIDE.md Normal file
View File

@ -0,0 +1,423 @@
# Inventory Barcode System User Guide
## Table of Contents
1. [Getting Started](#getting-started)
2. [Excel File Requirements](#excel-file-requirements)
3. [Importing Inventory Data](#importing-inventory-data)
4. [Generating Barcodes and QR Codes](#generating-barcodes-and-qr-codes)
5. [Scanning and Updating Inventory](#scanning-and-updating-inventory)
6. [Exporting Data](#exporting-data)
7. [Troubleshooting](#troubleshooting)
8. [Best Practices](#best-practices)
## Getting Started
The Inventory Barcode System helps you convert your existing Excel-based inventory into a modern barcode/QR code system. This guide will walk you through each step of the process.
### System Requirements
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Camera access for barcode scanning (optional)
- Excel files in .xlsx or .xls format
### Accessing the System
1. Open your web browser
2. Navigate to the system URL (typically `http://localhost:3000`)
3. You'll see the main dashboard with four main sections:
- **Import**: Upload Excel files
- **Generate**: Create barcodes/QR codes
- **Scan**: Update inventory levels
- **Export**: Download updated data
## Excel File Requirements
### Supported File Formats
- Microsoft Excel (.xlsx) - Recommended
- Microsoft Excel 97-2003 (.xls)
- Maximum file size: 10MB
### Required Columns
Your Excel file must contain at least these columns (column names are flexible):
| Required Data | Example Column Names | Description |
|---------------|---------------------|-------------|
| Product Code | `Product Code`, `SKU`, `Item Code`, `Code` | Unique identifier for each product |
| Description | `Description`, `Product Name`, `Item Description` | Human-readable product name |
| Current Stock | `Stock`, `Quantity`, `Current Level`, `Qty` | Current inventory quantity |
### Optional Columns
| Optional Data | Example Column Names | Description |
|---------------|---------------------|-------------|
| Category | `Category`, `Type`, `Group` | Product categorization |
| Unit of Measure | `Unit`, `UOM`, `Measure` | Units (pcs, kg, liters, etc.) |
| Minimum Level | `Min Stock`, `Reorder Point` | Minimum stock threshold |
| Maximum Level | `Max Stock`, `Stock Limit` | Maximum stock capacity |
### Excel File Format Examples
#### Example 1: Basic Format
```
| Product Code | Description | Current Stock |
|-------------|--------------------|---------------|
| ABC123 | Widget A | 50 |
| DEF456 | Widget B | 25 |
| GHI789 | Widget C | 100 |
```
#### Example 2: Detailed Format
```
| SKU | Product Name | Category | Stock | Unit | Min | Max |
|--------|--------------------|-------------|-------|------|-----|-----|
| ABC123 | Premium Widget A | Electronics | 50 | pcs | 10 | 200 |
| DEF456 | Standard Widget B | Tools | 25 | pcs | 5 | 100 |
| GHI789 | Deluxe Widget C | Electronics | 100 | pcs | 20 | 300 |
```
### Data Validation Rules
- **Product Code**: Must be unique, 1-50 characters, alphanumeric
- **Description**: Required, maximum 255 characters
- **Current Stock**: Must be a non-negative number
- **Category**: Optional, maximum 100 characters
- **Unit of Measure**: Optional, maximum 20 characters
- **Min/Max Levels**: Optional, must be non-negative numbers
## Importing Inventory Data
### Step-by-Step Import Process
1. **Prepare Your Excel File**
- Ensure your file meets the format requirements
- Remove any empty rows or columns
- Verify all product codes are unique
2. **Access the Import Section**
- Click on the "Import" tab in the main interface
- You'll see a file upload area
3. **Upload Your File**
- Drag and drop your Excel file onto the upload area, OR
- Click "Choose File" to browse and select your file
- The system will begin processing immediately
4. **Review Import Preview**
- The system will display a preview of detected data
- Check that columns are mapped correctly
- Review any validation warnings or errors
5. **Confirm Import**
- If everything looks correct, click "Confirm Import"
- The system will process all records
- You'll see a summary of successful imports and any errors
### Handling Import Errors
Common import errors and solutions:
| Error | Cause | Solution |
|-------|-------|----------|
| "Duplicate product code" | Same code appears multiple times | Ensure all product codes are unique |
| "Invalid product code format" | Code contains invalid characters | Use only letters, numbers, and hyphens |
| "Missing required field" | Description or code is empty | Fill in all required fields |
| "Invalid stock quantity" | Non-numeric stock value | Ensure stock values are numbers |
### Import Options
- **Skip Duplicates**: Ignore products with existing codes
- **Update Existing**: Update existing products with new data
- **Create New Codes**: Automatically generate new codes for duplicates
## Generating Barcodes and QR Codes
### Choosing Code Type
**Barcodes:**
- Best for: Simple product identification
- Formats: Code128 (recommended), Code39, EAN13
- Advantages: Compact, widely supported
- Use when: You need simple, linear codes
**QR Codes:**
- Best for: Rich product information
- Can embed: Product code, description, category
- Advantages: More data capacity, works with smartphones
- Use when: You want to embed additional product details
### Generating Codes
1. **Select Products**
- Go to the "Generate" tab
- Choose products from your imported inventory
- Use filters to find specific products or categories
2. **Choose Code Settings**
- **Code Type**: Barcode or QR Code
- **Format**: Select barcode format (if applicable)
- **Size**: Adjust dimensions for your labels
- **Include Description**: Add product name to labels
3. **Configure Print Layout**
- **Page Size**: A4, Letter, or custom
- **Labels per Row**: Typically 2-4 depending on label size
- **Labels per Column**: Adjust based on your label sheets
- **Font Size**: Readable text size for descriptions
4. **Generate and Download**
- Click "Generate Codes"
- Download the PDF file
- Print on standard label sheets or regular paper
### Print Layout Options
#### Standard Label Sizes
- **Avery 5160**: 30 labels per sheet (2.625" x 1")
- **Avery 5163**: 10 labels per sheet (4" x 2")
- **Custom**: Define your own dimensions
#### Print Tips
- Use high-quality printer settings
- Test print on regular paper first
- Ensure adequate contrast (black codes on white background)
- Verify codes scan properly before mass printing
## Scanning and Updating Inventory
### Setting Up Scanning
1. **Camera Access**
- Allow camera access when prompted
- Ensure good lighting for scanning
- Position camera 6-12 inches from codes
2. **Manual Entry Fallback**
- If camera scanning fails, use manual entry
- Type or paste the product code
- System will look up the product automatically
### Scanning Process
1. **Access Scan Interface**
- Click on the "Scan" tab
- Camera view will appear (if available)
2. **Scan Product Code**
- Point camera at barcode or QR code
- Wait for automatic detection
- Product information will appear
3. **Update Inventory**
- Current stock level is displayed
- Enter new quantity or adjustment amount
- Add reason for change (optional but recommended)
- Click "Update Inventory"
4. **Confirmation**
- System confirms the update
- New stock level is saved immediately
- Change is logged in inventory history
### Scanning Tips
- **Good Lighting**: Ensure adequate lighting on codes
- **Steady Hands**: Hold device steady for better recognition
- **Clean Codes**: Ensure codes aren't damaged or dirty
- **Proper Distance**: Maintain 6-12 inches from code
- **Flat Surface**: Codes should be on flat, non-reflective surfaces
### Bulk Updates
For updating multiple items quickly:
1. Scan first product
2. Update quantity
3. Immediately scan next product
4. System remembers your workflow
5. Use "Quick Mode" for faster updates
## Exporting Data
### Export Options
1. **Full Inventory Export**
- All products with current stock levels
- Includes last update timestamps
- Maintains original Excel structure
2. **Filtered Export**
- Export specific categories
- Low stock items only
- Date range filters
3. **History Export**
- Include inventory change history
- Audit trail for stock movements
- User activity tracking
### Export Process
1. **Access Export Section**
- Click on the "Export" tab
- Choose export options
2. **Configure Export**
- **Format**: Excel (.xlsx) or CSV
- **Include History**: Add change logs
- **Date Range**: Filter by update dates
- **Categories**: Select specific product categories
3. **Generate and Download**
- Click "Generate Export"
- File will be prepared
- Download link will appear
- File includes timestamp in filename
### Export File Structure
The exported Excel file maintains your original structure with additional columns:
- **Last Updated**: Timestamp of last inventory change
- **Updated By**: User who made the last change
- **Change History**: Summary of recent changes (if included)
## Troubleshooting
### Common Issues and Solutions
#### Import Problems
**Problem**: "File format not supported"
- **Solution**: Ensure file is .xlsx or .xls format
- **Check**: File isn't corrupted or password-protected
**Problem**: "No data found in file"
- **Solution**: Verify file has data in first worksheet
- **Check**: Column headers are in first row
**Problem**: "Column mapping failed"
- **Solution**: Ensure required columns exist
- **Check**: Column names match expected patterns
#### Scanning Issues
**Problem**: "Camera not working"
- **Solution**: Check browser permissions for camera access
- **Alternative**: Use manual code entry
**Problem**: "Codes not scanning"
- **Solution**: Improve lighting conditions
- **Check**: Codes aren't damaged or too small
- **Try**: Different scanning angle or distance
**Problem**: "Product not found"
- **Solution**: Verify product was imported correctly
- **Check**: Product code matches exactly (case-sensitive)
#### Mobile Camera Issues (Android/iOS)
**Problem**: "Start Camera button gives error on Android Chrome"
- **Solution**: Ensure you're using HTTPS (required for camera access on mobile)
- **Check**: Allow camera permission when prompted
- **Try**: Refresh the page and try again
- **Alternative**: Clear browser cache and cookies
**Problem**: "Camera permission denied - no settings visible"
- **Solution**: This is a common Chrome Android issue. Try these steps:
1. Look for a camera icon (🎥) in the address bar and tap it
2. If no icon appears, go to Chrome menu (⋮) → Settings → Site settings → Camera
3. Find your website and set to "Allow"
4. Try using an incognito/private tab first, then allow permission
5. Use the "Request Permission Again" button that appears after the error
**Problem**: "Camera permission denied"
- **Solution**: Go to browser settings → Site permissions → Camera → Allow
- **Chrome Android**: Settings → Site Settings → Camera → Allow
- **Safari iOS**: Settings → Safari → Camera → Allow
**Problem**: "Camera shows black screen"
- **Solution**: Close other apps that might be using the camera
- **Check**: Restart the browser
- **Try**: Use a different browser (Chrome, Firefox, Safari)
**Problem**: "Camera is blurry or won't focus"
- **Solution**: Clean the camera lens
- **Check**: Ensure adequate lighting
- **Try**: Hold device 6-12 inches from the barcode
**Problem**: "Camera works but scanning is slow"
- **Solution**: Ensure good lighting conditions
- **Check**: Hold device steady
- **Try**: Use manual entry for faster updates
#### Performance Issues
**Problem**: "System running slowly"
- **Solution**: Clear browser cache and cookies
- **Check**: Close other browser tabs
- **Try**: Refresh the page
**Problem**: "Large file upload fails"
- **Solution**: Split large files into smaller batches
- **Check**: File size is under 10MB limit
### Getting Help
If you encounter issues not covered in this guide:
1. Check the system logs (if you have access)
2. Try refreshing your browser
3. Clear browser cache and cookies
4. Contact your system administrator
5. Refer to the technical documentation
## Best Practices
### File Management
- **Backup Original Files**: Keep copies of your original Excel files
- **Consistent Naming**: Use clear, consistent product codes
- **Regular Updates**: Import new products regularly rather than in large batches
- **Data Validation**: Clean your data before importing
### Code Generation
- **Test Print**: Always test print codes before mass production
- **Quality Check**: Verify codes scan properly after printing
- **Label Management**: Use high-quality label stock for durability
- **Size Considerations**: Ensure codes are large enough to scan reliably
### Inventory Management
- **Regular Scanning**: Update inventory levels frequently
- **Reason Codes**: Always include reasons for inventory changes
- **Audit Trail**: Review inventory history regularly
- **Backup Data**: Export data regularly for backup purposes
### System Maintenance
- **Regular Exports**: Export data weekly for backup
- **Monitor Performance**: Watch for slow response times
- **Update Browsers**: Keep browsers updated for best performance
- **Training**: Ensure all users understand proper procedures
### Security Considerations
- **Access Control**: Limit system access to authorized users
- **Data Privacy**: Protect inventory data from unauthorized access
- **Regular Backups**: Maintain regular data backups
- **Update Procedures**: Keep system software updated
## Conclusion
The Inventory Barcode System streamlines your inventory management by bridging traditional Excel-based tracking with modern barcode technology. By following this guide, you'll be able to:
- Successfully import your existing inventory data
- Generate professional barcode and QR code labels
- Efficiently update inventory levels through scanning
- Export updated data for record-keeping and integration
For additional support or advanced features, consult the technical documentation or contact your system administrator.