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:
@@ -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 = """
|
||||
|
||||
Reference in New Issue
Block a user