Add boxes/crates management system to warehouse module
- Created boxes_crates table with 8-digit auto-generated box numbers - Added manage_boxes route and full CRUD operations - Implemented box status tracking (open/closed) - Added location assignment functionality - Integrated QZ Tray printing with barcode labels - Created manage_boxes.html with table, preview, and print features - Added 'Manage Boxes/Crates' card to warehouse main page - Boxes can be created without location and assigned later - Includes delete functionality for admin/management roles - Added box statistics display
This commit is contained in:
@@ -184,6 +184,38 @@ def create_warehouse_locations_table():
|
||||
print_error(f"Failed to create warehouse_locations table: {e}")
|
||||
return False
|
||||
|
||||
def create_boxes_crates_table():
|
||||
"""Create boxes_crates table for tracking boxes containing scanned orders"""
|
||||
print_step(5, "Creating Boxes/Crates Table")
|
||||
|
||||
try:
|
||||
conn = mariadb.connect(**DB_CONFIG)
|
||||
cursor = conn.cursor()
|
||||
|
||||
boxes_query = """
|
||||
CREATE TABLE IF NOT EXISTS boxes_crates (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
box_number VARCHAR(8) NOT NULL UNIQUE,
|
||||
status ENUM('open', 'closed') DEFAULT 'open',
|
||||
location_id BIGINT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
created_by VARCHAR(100),
|
||||
FOREIGN KEY (location_id) REFERENCES warehouse_locations(id) ON DELETE SET NULL
|
||||
);
|
||||
"""
|
||||
cursor.execute(boxes_query)
|
||||
print_success("Table 'boxes_crates' created successfully")
|
||||
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print_error(f"Failed to create boxes_crates table: {e}")
|
||||
return False
|
||||
|
||||
def create_permissions_tables():
|
||||
"""Create permission management tables"""
|
||||
print_step(5, "Creating Permission Management Tables")
|
||||
@@ -705,6 +737,7 @@ def main():
|
||||
create_scan_tables,
|
||||
create_order_for_labels_table,
|
||||
create_warehouse_locations_table,
|
||||
create_boxes_crates_table,
|
||||
create_permissions_tables,
|
||||
create_users_table_mariadb,
|
||||
# create_sqlite_tables, # Disabled - using MariaDB only
|
||||
|
||||
Reference in New Issue
Block a user