Fix print_lost_labels compact styling and production data import

- Added compact table styling to print_lost_labels page (smaller fonts, reduced padding)
- Fixed production data import missing fields (production_order_line, line_number)
- Added better error handling and logging for Excel file imports
- Skip empty rows in production data import
- Log all columns and columns with data for debugging
This commit is contained in:
ske087
2025-11-26 21:59:03 +02:00
parent d3a0123acc
commit d070db0052
13 changed files with 649 additions and 1042 deletions

View File

@@ -184,7 +184,11 @@ class DailyMirrorDatabase:
raise Exception("Could not read Excel file. Please ensure it has a 'Production orders Data' or 'DataSheet' sheet.")
logger.info(f"Loaded production data from {sheet_used}: {len(df)} rows, {len(df.columns)} columns")
logger.info(f"First 5 column names: {list(df.columns)[:5]}")
logger.info(f"All column names: {list(df.columns)}")
# Log columns that have at least some non-null data
columns_with_data = [col for col in df.columns if df[col].notna().any()]
logger.info(f"Columns with data ({len(columns_with_data)}): {columns_with_data}")
cursor = self.connection.cursor()
success_count = 0
@@ -235,6 +239,10 @@ class DailyMirrorDatabase:
for index, row in df.iterrows():
try:
# Skip rows where production order is empty
if pd.isna(row.get('Comanda Productie')) or str(row.get('Comanda Productie')).strip() == '':
continue
# Create concatenated fields with dash separator
opened_for_order = str(row.get('Opened for Order', '')).strip() if pd.notna(row.get('Opened for Order')) else ''
linia = str(row.get('Linia', '')).strip() if pd.notna(row.get('Linia')) else ''
@@ -269,6 +277,8 @@ class DailyMirrorDatabase:
# Prepare data tuple
data = (
safe_str(row.get('Comanda Productie')), # production_order
safe_str(row.get('Opened for Order')), # production_order_line
safe_str(row.get('Linia')), # line_number
open_for_order_line, # open_for_order_line (concatenated)
client_order_line, # client_order_line (concatenated)
safe_str(row.get('Cod. Client')), # customer_code