3.9 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a standalone Python desktop application for fabric and garment management in the textile/clothing industry. The application is built using PyQt5 and SQLite, providing a comprehensive system for managing fabric inventory, garment specifications, and production calculations.
Running the Application
python main.py
The application will:
- Create a SQLite database (
fabric_library.db) in the same directory if it doesn't exist - Show a login dialog with default passwords (123456 for both admin and user modes)
- Launch the main application window
Dependencies
The application requires these Python packages:
- PyQt5 (GUI framework)
- sqlite3 (database, built-in)
- PIL/Pillow (image processing)
- datetime, os, sys (built-in modules)
Install dependencies:
pip install PyQt5 Pillow
Architecture Overview
Database Schema
The application uses SQLite with these main tables:
fabrics- Raw material library (fabric types, suppliers, pricing)garments- Garment style definitions with imagesgarment_materials- Material usage per garment stylefabric_stock_in- Inventory purchase recordsfabric_consumption- Production consumption trackingadmin_settings- User passwords and settings
Main Components
-
LoginDialog (
fabric_manager_pro.py:28-142)- Handles user authentication (admin vs regular user modes)
- Password management functionality
-
FabricManager (Main Window) (
fabric_manager_pro.py:1205-1653)- Central application controller
- Batch calculation interface for production planning
- Unit conversion calculator
-
RawMaterialLibraryDialog (
fabric_manager_pro.py:239-758)- Fabric/material database management
- Multi-level categorization (major/sub categories)
- Supplier and pricing management
- Stock tracking integration
-
GarmentLibraryDialog (
fabric_manager_pro.py:760-871)- Garment style catalog management
- Image upload and preview functionality
-
GarmentEditDialog (
fabric_manager_pro.py:873-1111)- Detailed garment specification editor
- Material usage definition per garment
- Integration with fabric library for material selection
-
StockInDialog (
fabric_manager_pro.py:144-237)- Inventory management for fabric purchases
- Stock level tracking and reporting
-
PurchaseOrderDialog (
fabric_manager_pro.py:1113-1203)- Automated purchase order generation
- Export functionality (clipboard/file)
Key Features
- Multi-user System: Admin and regular user modes with different permissions
- Inventory Tracking: Complete fabric stock management with purchase/consumption tracking
- Production Planning: Calculate material requirements for batch production
- Unit Conversion: Built-in calculator for meters/yards/kilograms conversion
- Image Management: Garment style images with automatic resizing and storage
- Data Export: Purchase order generation with multiple export options
File Structure
main.py- Main application entry pointdatabase.py- Database connection and initializationlogin_dialog.py- User login and password managementstock_dialog.py- Inventory management dialogsraw_material_dialog.py- Raw material library managementgarment_dialogs.py- Garment style managementpurchase_order_dialog.py- Purchase order generationfabric_library.db- SQLite database (auto-created)images/- Directory for garment style images (auto-created)
Development Notes
- The application uses method binding in
__init__to avoid AttributeError issues - Database connections use context managers for proper resource cleanup
- Image processing includes automatic thumbnail generation and format conversion
- All database operations include proper error handling and user feedback