5.6 KiB
Here is the content for the documentation.md file that explains the functionality of the application:
Documentation for Quality Recticel Application
Overview
The Quality Recticel application is a web-based system designed to manage and monitor quality control processes, user roles, and database interactions. It includes modules for scanning, quality assurance, warehouse management, and administrative settings.
Features
1. User Management
- Roles:
superadmin: Full access to all features and settings.administrator: Limited administrative access.quality: Access to quality assurance features.warehouse: Access to warehouse management features.scan: Access to scanning features.
- Functionalities:
- Create, edit, and delete users.
- Assign roles to users.
- Manage user credentials.
2. Scan Module
- Input Form:
- Allows users to input scan data, including:
- Operator Code
- CP Code
- OC1 Code
- OC2 Code
- Defect Code
- Date and Time
- Allows users to input scan data, including:
- Latest Scans Table:
- Displays the last 15 scans with details such as:
- Approved Quantity
- Rejected Quantity
- Data is dynamically fetched from the database.
- Displays the last 15 scans with details such as:
3. Quality Module
- Provides tools for quality assurance personnel to monitor and manage quality-related data.
4. Warehouse Module
- Enables warehouse personnel to manage inventory and related processes.
5. Settings Module
- External Database Configuration:
- Allows the
superadminto configure external database settings, including:- Server Domain/IP
- Port
- Database Name
- Username and Password
- Allows the
- User Management:
- Provides an interface to manage users and their roles.
Database Structure
Table: scan1_orders
- Columns:
Id: Auto-incremented primary key.operator_code: Operator code (4 characters).CP_full_code: Full CP code (15 characters, unique).OC1_code: OC1 code (4 characters).OC2_code: OC2 code (4 characters).CP_base_code: Auto-generated base code (first 10 characters ofCP_full_code).quality_code: Quality code (3 digits).date: Date inyyyy-mm-ddformat.time: Time inhh:mm:ssformat.approved_quantity: Number of approved items (calculated dynamically).rejected_quantity: Number of rejected items (calculated dynamically).
Triggers
increment_approved_quantity:- Updates
approved_quantitybased on the number of rows with the sameCP_base_codeandquality_code = 000.
- Updates
increment_rejected_quantity:- Updates
rejected_quantitybased on the number of rows with the sameCP_base_codeandquality_code != 000.
- Updates
Key Files
1. run.py
- Entry point for the application.
- Starts the Flask server.
2. routes.py
- Defines the routes and logic for the application.
- Handles user authentication, form submissions, and database interactions.
3. models.py
- Defines the
Usermodel for managing user data.
4. create_scan_1db.py
- Script to create the
scan1_orderstable in the database.
5. create_triggers.py
- Script to create database triggers for dynamically updating
approved_quantityandrejected_quantity.
6. seed.py
- Seeds the database with default users.
7. Templates
scan.html:- Interface for the Scan Module.
settings.html:- Interface for managing users and external database settings.
How to Run the Application
-
Set Up the Environment:
- Install dependencies:
pip install flask mariadb
- Install dependencies:
-
Configure the Database:
- Update the
external_server.conffile with the correct database credentials.
- Update the
-
Create the Database and Triggers:
- Run the create_scan_1db.py script:
python py_app/app/db_create_scripts/create_scan_1db.py - Run the create_triggers.py script:
python py_app/app/db_create_scripts/create_triggers.py
- Run the create_scan_1db.py script:
-
Seed the Database:
- Run the seed.py script:
python py_app/seed.py
- Run the seed.py script:
-
Start the Application:
- Run the run.py file:
python py_app/run.py
- Run the run.py file:
-
Access the Application:
- Open a browser and navigate to:
http://127.0.0.1:5000
- Open a browser and navigate to:
Troubleshooting
-
Database Connection Issues:
- Ensure the
external_server.conffile is correctly configured. - Verify that the database server is running.
- Ensure the
-
Trigger Errors:
- Check the trigger definitions in the database using:
SHOW TRIGGERS;
- Check the trigger definitions in the database using:
-
Form Submission Errors:
- Verify that all required fields in the form are filled out.
-
Permission Issues:
- Ensure the user has the correct role for accessing specific modules.
Future Enhancements
- Add detailed logging for debugging.
- Implement role-based access control for more granular permissions.
- Add support for exporting scan data to CSV or Excel.
Save this content as documentation.md in the root directory of your project.3. Form Submission Errors:
- Verify that all required fields in the form are filled out.
- Permission Issues:
- Ensure the user has the correct role for accessing specific modules.
Future Enhancements
- Add detailed logging for debugging.
- Implement role-based access control for more granular permissions.
- Add support for exporting scan data to CSV or Excel.
Save this content as documentation.md in the root directory of your project.