updated : solutions

This commit is contained in:
2025-09-26 22:51:16 +03:00
parent 1f90602550
commit 5765798905
53 changed files with 256 additions and 7746 deletions

View File

@@ -2065,6 +2065,47 @@ def update_printed_status(order_id):
print(f"DEBUG: Error in update_printed_status: {e}")
return jsonify({'error': 'Internal server error'}), 500
@bp.route('/download_print_service')
def download_print_service():
"""Download the direct print service package"""
try:
from flask import send_from_directory, current_app
import os
# Check if complete package is requested
package_type = request.args.get('package', 'basic')
if package_type == 'complete':
# Serve the complete package
filename = 'QualityPrintService_Complete.zip'
else:
# Serve the basic package (legacy)
filename = 'RecticelPrintService.zip'
# Path to the print service files
service_path = os.path.join(current_app.root_path, 'static', 'downloads')
# Create the directory if it doesn't exist
os.makedirs(service_path, exist_ok=True)
# Check if the zip file exists
full_path = os.path.join(service_path, filename)
if not os.path.exists(full_path):
# If the zip doesn't exist, return information about creating it
return jsonify({
'error': f'Print service package ({filename}) not found',
'message': f'The {package_type} print service package is not available',
'suggestion': 'Please contact the administrator or use the basic package'
}), 404
return send_from_directory(service_path, filename, as_attachment=True)
except Exception as e:
print(f"DEBUG: Error downloading print service: {e}")
return jsonify({'error': 'Failed to download print service'}), 500
@bp.route('/get_order_data/<int:order_id>', methods=['GET'])
def get_order_data(order_id):
"""Get specific order data for preview"""