FG Scan form validation improvements with warehouse module updates
- Fixed 3 JavaScript syntax errors in fg_scan.html (lines 951, 840-950, 1175-1215) - Restored form field validation with proper null safety checks - Re-enabled auto-advance between form fields - Re-enabled CP code auto-complete with hyphen detection - Updated validation error messages with clear format specifications and examples - Added autocomplete='off' to all input fields - Removed auto-prefix correction feature - Updated warehouse routes and modules for box assignment workflow - Added/improved database initialization scripts - Updated requirements.txt dependencies Format specifications implemented: - Operator Code: OP + 2 digits (example: OP01, OP99) - CP Code: CP + 8 digits + hyphen + 4 digits (example: CP00000000-0001) - OC1/OC2 Codes: OC + 2 digits (example: OC01, OC99) - Defect Code: 3 digits only
This commit is contained in:
@@ -57,7 +57,7 @@ def save_fg_scan(operator_code, cp_code, oc1_code, oc2_code, defect_code, date,
|
||||
time: Scan time
|
||||
|
||||
Returns:
|
||||
tuple: (success: bool, approved_count: int, rejected_count: int)
|
||||
tuple: (success: bool, scan_id: int, approved_count: int, rejected_count: int)
|
||||
"""
|
||||
try:
|
||||
from datetime import datetime
|
||||
@@ -79,6 +79,9 @@ def save_fg_scan(operator_code, cp_code, oc1_code, oc2_code, defect_code, date,
|
||||
cursor.execute(insert_query, (operator_code, cp_code, oc1_code, oc2_code, defect_code, date, time))
|
||||
db.commit()
|
||||
|
||||
# Get the ID of the inserted record
|
||||
scan_id = cursor.lastrowid
|
||||
|
||||
# Get the quantities from the table for feedback
|
||||
cursor.execute("""
|
||||
SELECT COUNT(*) as total_scans,
|
||||
@@ -91,8 +94,8 @@ def save_fg_scan(operator_code, cp_code, oc1_code, oc2_code, defect_code, date,
|
||||
approved_count = result[1] if result and result[1] else 0
|
||||
rejected_count = result[2] if result and result[2] else 0
|
||||
|
||||
logger.info(f"Scan saved successfully: {cp_code} by {operator_code}")
|
||||
return True, approved_count, rejected_count
|
||||
logger.info(f"Scan saved successfully: {cp_code} by {operator_code} with ID {scan_id}")
|
||||
return True, scan_id, approved_count, rejected_count
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error saving finish goods scan data: {e}")
|
||||
|
||||
Reference in New Issue
Block a user