Add quality template logic
This commit is contained in:
@@ -104,7 +104,7 @@ class ProductionAlertService(BaseAlertService, AlertServiceMixin):
|
||||
JOIN production_capacity pc ON pc.equipment_id = p.equipment_id
|
||||
WHERE p.planned_date >= CURRENT_DATE
|
||||
AND p.planned_date <= CURRENT_DATE + INTERVAL '3 days'
|
||||
AND p.status IN ('planned', 'in_progress')
|
||||
AND p.status IN ('PENDING', 'IN_PROGRESS')
|
||||
AND p.tenant_id = $1
|
||||
GROUP BY p.tenant_id, p.planned_date
|
||||
)
|
||||
@@ -226,10 +226,10 @@ class ProductionAlertService(BaseAlertService, AlertServiceMixin):
|
||||
COALESCE(pb.priority::text, 'medium') as priority_level,
|
||||
1 as affected_orders -- Default to 1 since we can't count orders
|
||||
FROM production_batches pb
|
||||
WHERE pb.status IN ('IN_PROGRESS', 'DELAYED')
|
||||
WHERE pb.status IN ('IN_PROGRESS', 'ON_HOLD', 'QUALITY_CHECK')
|
||||
AND (
|
||||
(pb.planned_end_time < NOW() AND pb.status = 'IN_PROGRESS')
|
||||
OR pb.status = 'DELAYED'
|
||||
OR pb.status IN ('ON_HOLD', 'QUALITY_CHECK')
|
||||
)
|
||||
AND pb.planned_end_time > NOW() - INTERVAL '24 hours'
|
||||
ORDER BY
|
||||
@@ -831,7 +831,7 @@ class ProductionAlertService(BaseAlertService, AlertServiceMixin):
|
||||
FROM production_batches pb
|
||||
JOIN recipe_ingredients ri ON ri.recipe_id = pb.recipe_id
|
||||
WHERE ri.ingredient_id = $1
|
||||
AND pb.status IN ('planned', 'in_progress')
|
||||
AND pb.status IN ('PENDING', 'IN_PROGRESS')
|
||||
AND pb.planned_completion_time > NOW()
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user