Back to All Projects
Architecture & Case Study

Textile Spinning Mill ERP — Sales, Mixing Plan & Production (Frappe/ERPNext)

FrappeERPNextPythonMariaDBManufacturing ERPSupply ChainB2B
Textile Spinning Mill ERP — Sales, Mixing Plan & Production (Frappe/ERPNext)
Live Preview

Overview & Technical Scope

Executive Summary

Textile spinning mills operate in a high-volume, precision-sensitive manufacturing environment where thousands of kilograms of raw cotton are processed daily into specialized yarn counts (such as 20s Carded, 30s Combed, or 40s Compact).

Before this implementation, the mill relied on disconnected Excel sheets, manual paper registers, and error-prone verbal communication between the sales office, raw material warehouses, and spinning floor supervisors.

As part of the in-house ERP development team, I owned the Sales and Production modules end to end, designing and implementing customized Frappe/ERPNext workflows that digitized the entire lifecycle from raw cotton requisition and export sales contracts to specialized cotton mixing plans and shop-floor machine tracking.


1. Sales & Commercial Export Module (Owned End-to-End)

Export textile sales require strict compliance with international trade documentation and financial banking regulations (Letter of Credit / LC). I architected the sales pipeline to ensure 100% document accuracy and zero shipment delays:

  • Sales Inquiries & Quotation Management: Configured dynamic pricing matrices calculating FOB (Free On Board) and CFR (Cost and Freight) yarn rates based on yarn count, raw cotton market rates, and packaging types.
  • Export Sales Order: Formal contract record tracking buyer specifications (yarn count, CSP strength, twist multiplier, cone weight, and container volume).
  • Export Letter of Credit (LC) Tracking: Built custom fields and validations to link Sales Orders directly to bank-issued Export LCs, monitoring credit limits, expiry dates, tolerance percentages (+/- 5%), and required shipping documents.
  • Export Commercial Invoice & Packing List: Automated the generation of export-compliant commercial invoices and detailed cone-by-cone / carton-by-carton packing lists directly from dispatch records.
  • Delivery Challan & Gate Pass: Streamlined warehouse dispatch records with vehicle number verification, seal numbers, and automated inventory depletion.

2. Material Requisition & Quality Control

Raw cotton fiber quality varies significantly across shipments. Maintaining uniform yarn quality requires rigorous raw material validation:

  • Automated Material Requests: Configured automated requisition triggers when raw cotton bale stock falls below defined safety buffers based on upcoming production commitments.
  • Bale Inventory & Lot Tracking: Grouped incoming cotton shipments by Lot Number, tracking key fiber characteristics (staple length, micronaire value, trash percentage, and moisture content).
  • Goods Receipt & Quality Inspection: Enforced mandatory Quality Inspection (QI) sign-offs before newly arrived cotton bales could be cleared for warehouse storage and mixing floor issuance.

3. Flagship Engineering: Custom "Mixing Plan" DocType

In textile spinning, cotton blending is the most critical and expensive step. Spinning mills cannot simply use one type of cotton; they must blend different lots (e.g., local cotton, imported Brazilian cotton, combed sliver waste) in exact mathematical ratios to achieve the target yarn strength (CSP) while minimizing raw material costs.

I designed and engineered the Mixing Plan DocType from scratch:

[ Raw Cotton Warehouse ] 
         │ (Lot A: 50% | Lot B: 30% | Combed Waste: 20%)
         ▼
[ Custom Mixing Plan DocType ] ──► Validates Total = 100% & Calculates Target Micronaire
         │
         ▼ (Approved & Submitted)
[ Blowroom Issuance / Stock Entry ] ──► Depletes exact bale weights from inventory
         │
         ▼
[ Spinning Floor Production (Carding ➔ Drawing ➔ Simplex ➔ Ring Frame ➔ Auto Coner) ]

Key Features of the Mixing Plan:

  1. Dynamic Blend Ratio Calculator: A custom Frappe JavaScript client script that calculates real-time percentage distributions across multiple raw cotton lots, ensuring the total blend strictly equals 100% before submission.
  2. Fiber Quality Prediction: Automatically computes the weighted average staple length and micronaire of the mixture to predict final yarn quality before spinning begins.
  3. Automated Stock Deduction: Upon manager approval, the Mixing Plan automatically generates backend Stock Entry (Manufacture / Issue) records, deducting exact bale counts from raw material stores and issuing them to the Blowroom line.
  4. Waste Minimization: Tracks reusable waste (pneumafil, lap waste, sliver waste) and integrates it back into lower-count mixing batches, reducing material loss.

4. Production Planning & Shop-Floor Execution

To digitize the physical mill floor (consisting of 50,000+ spindles running 24/7 in 3 shifts), I modeled the complete multi-stage spinning process:

  1. Blowroom & Carding: Opening cotton tufts and converting raw fiber into uniform sliver.
  2. Drawing Frame: Blending and doubling slivers to level out irregularities.
  3. Simplex / Roving Frame: Drafting slivers into thinner roving bobbins.
  4. Ring Frame (Spinning): The heart of the mill, where roving is spun into high-strength yarn onto cops.
  5. Auto Coner / Winding: Electronic yarn clearing, defect slicing, and winding onto conical paper cones.

Production Features Implemented:

  • Multi-Level Bill of Materials (BOM): Configured multi-tier BOMs linking raw cotton → carded sliver → drawn sliver → roving → finished yarn cones + packaging materials (cartons, poly bags, cones).
  • Work Orders & Job Cards: Automated job card dispatch to specific machine lines and shift supervisors.
  • Daily Production Log & Spindle Efficiency: Real-time tracking of GPS (Grams per Spindle per 8 Hours) and machine stoppage logs (power outages, maintenance, roving breaks).

5. Technical Highlights & Code Patterns

# Custom validation snippet from the Mixing Plan Controller (frappe/python)
import frappe
from frappe.model.document import Document
from frappe import _

class MixingPlan(Document):
    def validate(self):
        self.validate_total_percentage()
        self.calculate_weighted_properties()
        self.check_warehouse_availability()

    def validate_total_percentage(self):
        total_ratio = sum([item.blend_percentage or 0 for item in self.cotton_items])
        if round(total_ratio, 2) != 100.0:
            frappe.throw(
                _("Total blend ratio must equal exactly 100%. Current total: {0}%").format(total_ratio)
            )

    def calculate_weighted_properties(self):
        total_weight = self.total_mixing_weight_kg or 0
        weighted_mic = 0
        
        for item in self.cotton_items:
            item_weight = (item.blend_percentage / 100.0) * total_weight
            item.allocated_weight_kg = item_weight
            weighted_mic += (item.micronaire_value or 0) * (item.blend_percentage / 100.0)
            
        self.predicted_micronaire = round(weighted_mic, 2)
  • Server-Side Python Hooks: Leveraged Frappe Document lifecycle hooks (validate, before_save, on_submit, on_cancel) to guarantee transaction integrity across stock ledgers.
  • Client-Side Frappe Scripting: Implemented responsive form event listeners (cur_frm.cscript) to auto-fill cotton lot quality parameters upon selecting a Lot Number in child tables.
  • Custom MariaDB Query Reports: Authored optimized SQL reports for Daily Spinning Production Efficiency, Bale Consumption Summary, and Export Order Shipment Readiness.
  • Role-Based Access Control (RBAC): Implemented strict permission boundaries for Sales Manager, Commercial Officer, Quality Inspector, Floor Supervisor, and Managing Director.

6. Business Impact & Measurable Outcomes

  • 100% Automated Mixing Calculation Accuracy: Eliminated error-prone manual Excel formulas and ratio typos, guaranteeing consistent yarn tensile strength before batch issuance.
  • Export LC Documentation in Under 15 Minutes: Cut export commercial document preparation time down from 2–3 business days to under 15 minutes per shipment.
  • Raw Material Waste Reduced to < 1.8%: Lowered unmonitored cotton loss from ~4.2% to under 1.8% through exact lot-by-lot blending and waste recycling tracking.
  • Real-Time Shop-Floor Visibility: Replaced end-of-day handwritten logs with shift-by-shift machine efficiency tracking (GPS - Grams per Spindle) across 50,000+ spindles.
  • End-to-End Batch Traceability: Replaced disconnected paper binders with full backward audit traceability from finished yarn cone barcodes back to raw cotton bale lots.

Key Takeaways for Technical Recruiters

  • Domain Complexity & Scale: Demonstrated capability to digitize industrial manufacturing workflows with multi-currency export sales, regulatory banking compliance (LC), and shop-floor machinery.
  • Full-Stack Frappe/Python Mastery: Built custom DocTypes, complex child tables, server-side business rules, client scripts, and custom SQL analytics.
  • Product & Systems Thinking: Bridged the gap between real-world textile engineering processes (fiber micronaire, cotton lot blending, machine efficiency) and scalable database architecture.

Key Responsibilities & Contribution

Owned the Sales, Commercial Export, and Production modules end to end — including architecting and developing the custom Mixing Plan DocType from scratch — while contributing to floor requisition workflows and the HRMS/Payroll module as part of the core implementation team.

Interactive 3D Tech Stack

TOPOLOGY MESH|6 NODES
🖱️ Drag to rotate 360° • Scroll to zoom • Click node to inspect
Frappe FrameworkPythonMariaDBJavaScriptREST/RPC APIFrappe Desk UI

System Architecture & Data Flow

01

Frappe Desk (Client Layer)

Customized web interface used by Sales Executives, Commercial Managers, Floor Supervisors, and Quality Engineers to manage records and live reports.

02

REST / RPC API & Auth Layer

Frappe's built-in API framework managing request routing, session authentication, and role-based permissions (RBAC) across departments.

03

Python Controllers & Business Logic

Custom DocType server-side controllers handling validation, Mixing Plan ratio calculations, multi-stage BOM generation, and automated LC document workflows.

04

MariaDB Relational Database

High-performance relational storage for transactional sales records, multi-level BOMs, cotton lot batches, and shop-floor production logs.

Textile Spinning Mill ERP — Sales, Mixing Plan & Production (Frappe/ERPNext) - Somapti's Journal