Fix: Resolve 'Column date cannot be null' error in FG scan

- Added default date/time handling in save_fg_scan() function
- Backend now uses current date/time if values not provided
- Added hidden date/time form fields in frontend
- Updated JavaScript to populate hidden fields before submission
- Prevents null database errors when scanning orders
This commit is contained in:
Quality App Developer
2026-01-27 17:52:57 +02:00
parent e4ec223b6e
commit 59e82c0209
2 changed files with 23 additions and 0 deletions

View File

@@ -60,8 +60,16 @@ def save_fg_scan(operator_code, cp_code, oc1_code, oc2_code, defect_code, date,
tuple: (success: bool, approved_count: int, rejected_count: int)
"""
try:
from datetime import datetime
db = get_db()
cursor = db.cursor()
# Default to current date/time if not provided
if not date:
date = datetime.now().strftime('%Y-%m-%d')
if not time:
time = datetime.now().strftime('%H:%M:%S')
# Insert a new entry - each scan is a separate record
insert_query = """