Skip to content

mangod12/industryERP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

77 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KumarBrothers Steel ERP

CI Deploy to Microsoft Azure

A comprehensive steel fabrication tracking and inventory management system with automatic material deduction, Excel import, and real-time dashboard.

Live Azure deployment: https://industryerp-06161244878.azurewebsites.net

Deployment target: Microsoft Azure App Service for Containers, backed by Azure Container Registry and Azure Database for PostgreSQL.

πŸ“Έ System Screenshots

Dashboard

Raw Materials Inventory

Customers & Excel Upload

Production Tracking Board



πŸ“‹ System Workflow (How It Works)

Overview Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        KUMARBROTHERS STEEL ERP WORKFLOW                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    STEP 1                    STEP 2                    STEP 3
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Add Raw    β”‚          β”‚ Add Customerβ”‚          β”‚Upload Excel β”‚
β”‚  Materials  β”‚    β†’     β”‚  /Project   β”‚    β†’     β”‚  Tracking   β”‚
β”‚  (Profiles) β”‚          β”‚             β”‚          β”‚    File     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                                                  β”‚
      β”‚                                                  β–Ό
      β”‚                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                                    β”‚ System Auto-Links        β”‚
      β”‚                                    β”‚ PROFILE β†’ Raw Material   β”‚
      β”‚                                    β”‚ (e.g., UB203X133X25)     β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                         β”‚
                                                         β–Ό
                         TRACKING STAGES (Sequential - Cannot Skip)
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  FABRICATION    β”‚    PAINTING     β”‚    DISPATCH     β”‚
    β”‚    (Stage 1)    β”‚    (Stage 2)    β”‚    (Stage 3)    β”‚
    β”‚                 β”‚                 β”‚                 β”‚
    β”‚  βœ“ Complete     β”‚  βœ“ Complete     β”‚  βœ“ Complete     β”‚
    β”‚      ↓          β”‚      ↓          β”‚      ↓          β”‚
    β”‚  AUTO-DEDUCT    β”‚  Move to next   β”‚    FINISHED!    β”‚
    β”‚  from inventory β”‚     stage       β”‚                 β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                         β”‚
                                                         β–Ό
                                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                          β”‚  Dashboard Updates       β”‚
                                          β”‚  - Stock reduced         β”‚
                                          β”‚  - Progress shown        β”‚
                                          β”‚  - All users see changes β”‚
                                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ Step-by-Step Guide

STEP 1: Add Raw Materials (Admin)

Page: Raw Materials β†’ /raw_material.html

Before tracking can auto-deduct materials, you must add your steel profiles:

Field Example Value Description
Name UB203X133X25 Profile name (must match Excel PROFILE column)
Total 5000 Total quantity in kg
Used 0 Already used (starts at 0)
Unit kg Unit of measurement

Example Raw Materials to Add:

UB203X133X25    - Universal Beam 203x133x25
UB254X146X31    - Universal Beam 254x146x31
ISMC250         - Indian Standard Medium Channel 250

⚠️ Important: The material NAME must match the PROFILE column in your tracking Excel/CSV file for auto-deduction to work.


STEP 2: Add Customer/Project (Admin)

Page: Customers β†’ /customers.html

  1. Click "+ Add Customer"
  2. Enter customer name and project details
  3. Save the customer

Each customer can have multiple tracking Excel files uploaded.


STEP 3: Upload Tracking Excel (Admin)

Page: Customers β†’ Click "Upload Excel" button on any customer

Supported File Formats:

  • βœ… Excel (.xlsx)
  • βœ… Macro/template Excel (.xlsm, .xltx, .xltm)
  • βœ… CSV (.csv)

Supported Column Names (Flexible):

The system auto-detects these columns:

Excel Column Maps To Example
Drawing no Item Code TCI-SFD-49-02-11-07-000-01817
ASSEMBLY Assembly B1, B2, C1
NAME Item Name BEAM, COLUMN
PROFILE Section UB203X133X25 (links to Raw Material)
QTY. Quantity 1, 2, 5
WT-(kg) Weight 45.6, 123.4
AR(mΒ²) Area 1.23
PAINT Paint Status -
LOT 1 Lot Number Lot tracking

What Happens on Upload:

  1. Preview shows which profiles match inventory (βœ…) vs unmatched (⚠️)
  2. Auto-Link: System links PROFILE column to Raw Materials
  3. Import: Creates tracking items in Fabrication stage
  4. Notification: Warns if any profiles need to be added to Raw Materials

STEP 4: Track Progress Through Stages

Page: Tracking β†’ /tracking_v2.html

All items follow this sequence (cannot skip stages):

FABRICATION β†’ PAINTING β†’ DISPATCH β†’ COMPLETED

For Each Item:

  1. Start Stage β†’ Status becomes "In Progress"
  2. Complete Stage β†’ Status becomes "Completed", moves to next stage

Special: Fabrication Completion

When Fabrication is marked Complete:

  • βœ… System automatically deducts materials from inventory
  • βœ… Deduction = Weight (kg) Γ— Quantity from Excel
  • βœ… Only happens ONCE per item (tracked by system)
  • βœ… Dashboard immediately shows updated stock

STEP 5: Monitor on Dashboard

Page: Dashboard β†’ /index.html

Real-time display (auto-refreshes every 10 seconds):

Metric Description
Total Stock (kg) Current available raw materials
Total Consumed (kg) Materials deducted by completed fabrication
Utilization % Consumed / Purchased ratio
Low Stock Alerts Items below 15% remaining
Stage Counts Jobs in Fabrication/Painting/Dispatch

πŸ“Š Example Workflow

Scenario: New Project "TCIL Building Structure"

1. Admin adds Raw Materials:

UB203X133X25  - 5000 kg
ISMC250       - 3000 kg

2. Admin adds Customer: "TCIL Corporation"

3. Admin uploads tracking CSV with 100 items:

Drawing no,NAME,PROFILE,QTY.,WT-(kg)
DWG-001,BEAM,UB203X133X25,1,45.6
DWG-002,BEAM,UB203X133X25,2,91.2
DWG-003,CHANNEL,ISMC250,1,38.5
...

4. System shows preview:

  • βœ… UB203X133X25 β†’ Matched to "UB203X133X25" (5000 kg available)
  • βœ… ISMC250 β†’ Matched to "ISMC250" (3000 kg available)

5. Import creates 100 tracking items in Fabrication stage

6. Worker completes fabrication for DWG-001:

  • Click "Complete" on Fabrication
  • System deducts 45.6 kg from UB203X133X25
  • Item moves to Painting stage
  • Dashboard shows: UB203X133X25 = 4954.4 kg remaining

7. Dashboard shows:

  • Fabrication: 99 jobs remaining
  • Painting: 1 job
  • Stock: 4954.4 kg (UB203X133X25)

🎯 Key Features

Feature Description
Flexible Excel Import Supports 40+ column name variations
Auto Material Linking PROFILE column auto-matches to inventory
Auto Deduction Materials deduct when Fabrication completes
Stage Enforcement Cannot skip stages (Fab β†’ Paint β†’ Dispatch)
Real-time Dashboard Updates every 10 seconds for all users
Low Stock Alerts Notifications when materials run low
Edit & Checklist Each item has edit and checklist features
Search & Filter Find items by name, code, customer, stage

πŸš€ Quick Start

Prerequisites

  • Python 3.10+
  • pip (Python package manager)

Step 1: Setup Environment

cd D:\industryERP

# Create and activate virtual environment (optional but recommended)
python -m venv .venv
.venv\Scripts\Activate.ps1

# Install dependencies
pip install -r requirements.txt

Step 2: Start Backend Server

python -m uvicorn backend_core.app.main:app --reload --host 127.0.0.1 --port 8000

Backend and frontend will be available from the same local server: http://127.0.0.1:8000

Step 3: Access the Application

Open your browser and navigate to: http://127.0.0.1:8000/login.html


πŸ” Test Credentials

Username Password Role Permissions
admin Boss1234! Boss Full access to all seeded local demo features

Creating Additional Test Users

After logging in as admin, you can create users with different roles:

Role Description
Boss Full system access
Software Supervisor Inventory, GRN, Dispatch management
Store Keeper Stock operations, GRN creation
QA Inspector Quality inspection and approval
Dispatch Operator Dispatch operations only
User View-only access

πŸ“± Available Pages

Page URL Description
Login /login.html User authentication
Dashboard /index.html Overview and stats
Raw Materials /raw_material.html Add/manage steel profiles
Customers /customers.html Customer management + Excel upload
Tracking /tracking_v2.html Stage tracking (Fab/Paint/Dispatch)
GRN /grn.html Goods Receipt Notes
Dispatch /dispatch.html Outward dispatch management
Settings /settings.html System settings

πŸ”§ API Documentation

Once the backend is running, access the interactive API docs:

Key API Endpoints

Endpoint Description
POST /auth/login User authentication
GET /inventory/ List all raw materials
GET /inventory/dashboard-data Dashboard statistics
POST /excel/preview-import/{customer_id} Preview Excel with material matching
POST /excel/import-tracking/{customer_id} Import tracking items
POST /tracking/complete-stage Complete a stage (triggers auto-deduction)
GET /tracking/all-items List all tracking items

πŸ—οΈ Project Structure

industryERP/
β”œβ”€β”€ backend_core/           # FastAPI Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py         # App entry point
β”‚   β”‚   β”œβ”€β”€ models.py       # Database models
β”‚   β”‚   β”œβ”€β”€ excel.py        # Excel/CSV import with auto-linking
β”‚   β”‚   β”œβ”€β”€ tracking.py     # Stage tracking with auto-deduction
β”‚   β”‚   β”œβ”€β”€ inventory.py    # Raw materials & dashboard stats
β”‚   β”‚   β”œβ”€β”€ security.py     # Authentication & RBAC
β”‚   β”‚   β”œβ”€β”€ deps.py         # Dependencies
β”‚   β”‚   └── routers/        # Additional API routers
β”‚   └── data/
β”‚       └── kumar_core.db   # SQLite database
β”‚
β”œβ”€β”€ kumar_frontend/         # Frontend (HTML/JS/CSS)
β”‚   β”œβ”€β”€ index.html          # Dashboard with grand totals
β”‚   β”œβ”€β”€ login.html          # Login page
β”‚   β”œβ”€β”€ raw_material.html   # Raw materials management
β”‚   β”œβ”€β”€ customers.html      # Customers + Excel upload
β”‚   β”œβ”€β”€ tracking_v2.html    # Stage tracking
β”‚   β”œβ”€β”€ grn.html            # Goods Receipt Notes
β”‚   β”œβ”€β”€ dispatch.html       # Dispatch management
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   β”œβ”€β”€ config.js       # API config
β”‚   β”‚   └── main.js         # Main application JS
β”‚   └── css/
β”‚       └── main.css        # Styles
β”‚
β”œβ”€β”€ scripts/
β”‚   └── create_admin.py     # Admin user creation script
β”‚
└── requirements.txt        # Python dependencies

❓ Frequently Asked Questions

Q: Why aren't materials being deducted automatically?

A: Make sure:

  1. The PROFILE column in your Excel matches the material NAME in Raw Materials
  2. The item has WT-(kg) value in the Excel
  3. You clicked "Complete" on Fabrication stage (not just "Start")

Q: Can I upload different Excel formats?

A: Yes! The system supports 40+ column name variations. It auto-detects columns like "Drawing no", "PROFILE", "QTY.", "WT-(kg)", etc. Column order doesn't matter.

Q: What happens if a profile is not in Raw Materials?

A: The item will still be imported, but no auto-deduction will happen. You'll see a warning to add the missing profile.

Q: Can I skip the Painting stage?

A: No, stages must be completed in order: Fabrication β†’ Painting β†’ Dispatch.

Q: How do I see all tracking items for a customer?

A: Go to Tracking page and filter by customer name.


βš™οΈ Environment Variables (Production)

For production deployment, set these environment variables:

$env:KUMAR_SECRET_KEY = "your-secure-64-char-secret-key"
$env:ENVIRONMENT = "production"
$env:DATABASE_URL = "postgresql://..."
$env:CORS_ORIGINS = "https://industryerp-06161244878.azurewebsites.net"

☁️ Microsoft Azure CI/CD

Production deployment is handled by GitHub Actions workflow .github/workflows/deploy.yml.

The deploy workflow runs manually through workflow_dispatch and automatically after the KBSteel CI workflow succeeds on main.

Required GitHub repository variables:

Variable Purpose
AZURE_WEBAPP_NAME Azure App Service name
AZURE_RESOURCE_GROUP Production resource group
AZURE_CONTAINER_REGISTRY ACR login server
AZURE_IMAGE_NAME Container image repository name
AZURE_LIVE_URL Public Azure URL used for health verification

Required GitHub repository secrets:

Secret Purpose
AZURE_CLIENT_ID GitHub OIDC Azure application client ID
AZURE_TENANT_ID Azure tenant ID
AZURE_SUBSCRIPTION_ID Azure subscription ID

Azure runtime settings are configured on the App Service. Secret runtime values such as DATABASE_URL, KUMAR_SECRET_KEY, and admin credentials must remain in Azure App Service configuration, not in the repository.


πŸ› Troubleshooting

Port already in use

# Find and kill process on port 8000
netstat -ano | findstr :8000
taskkill /PID <PID> /F

Database reset

# Delete database and restart server (will recreate tables)
Remove-Item backend_core/data/kumar_core.db
# Restart backend server
# Run create_admin.py to create admin user again

Create admin user manually

cd D:\industryERP
python scripts/create_admin.py

πŸ“ž Support

For issues or questions, contact the development team.

About

industry ERP is a steel fabrication and inventory management system designed to automate material tracking, stage-based workflow control, and real-time stock visibility. Built with FastAPI and a lightweight web frontend, the system enables Excel/CSV import of project tracking files.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors