104 lines
3.9 KiB
Markdown
104 lines
3.9 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
python main.py
|
|
```
|
|
|
|
The application will:
|
|
1. Create a SQLite database (`fabric_library.db`) in the same directory if it doesn't exist
|
|
2. Show a login dialog with default passwords (123456 for both admin and user modes)
|
|
3. 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:
|
|
```bash
|
|
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 images
|
|
- `garment_materials` - Material usage per garment style
|
|
- `fabric_stock_in` - Inventory purchase records
|
|
- `fabric_consumption` - Production consumption tracking
|
|
- `admin_settings` - User passwords and settings
|
|
|
|
### Main Components
|
|
|
|
1. **LoginDialog** (`fabric_manager_pro.py:28-142`)
|
|
- Handles user authentication (admin vs regular user modes)
|
|
- Password management functionality
|
|
|
|
2. **FabricManager** (Main Window) (`fabric_manager_pro.py:1205-1653`)
|
|
- Central application controller
|
|
- Batch calculation interface for production planning
|
|
- Unit conversion calculator
|
|
|
|
3. **RawMaterialLibraryDialog** (`fabric_manager_pro.py:239-758`)
|
|
- Fabric/material database management
|
|
- Multi-level categorization (major/sub categories)
|
|
- Supplier and pricing management
|
|
- Stock tracking integration
|
|
|
|
4. **GarmentLibraryDialog** (`fabric_manager_pro.py:760-871`)
|
|
- Garment style catalog management
|
|
- Image upload and preview functionality
|
|
|
|
5. **GarmentEditDialog** (`fabric_manager_pro.py:873-1111`)
|
|
- Detailed garment specification editor
|
|
- Material usage definition per garment
|
|
- Integration with fabric library for material selection
|
|
|
|
6. **StockInDialog** (`fabric_manager_pro.py:144-237`)
|
|
- Inventory management for fabric purchases
|
|
- Stock level tracking and reporting
|
|
|
|
7. **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 point
|
|
- `database.py` - Database connection and initialization
|
|
- `login_dialog.py` - User login and password management
|
|
- `stock_dialog.py` - Inventory management dialogs
|
|
- `raw_material_dialog.py` - Raw material library management
|
|
- `garment_dialogs.py` - Garment style management
|
|
- `purchase_order_dialog.py` - Purchase order generation
|
|
- `fabric_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 |