- Add db/materials_to_delete.py for querying materials to delete by manager - Add manager_name parameter to DiscreteMaterialPlanCleaner - Implement material keyword matching logic in process_order - Update file paths from orderID.txt to ProductionID.txt Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
29 lines
751 B
Python
29 lines
751 B
Python
"""
|
|
待删除物料查询组件
|
|
从数据库查询指定负责人需要删除的物料名称
|
|
"""
|
|
from db.connection import get_connection
|
|
|
|
|
|
def get_materials_to_delete(manager_name):
|
|
"""
|
|
根据负责人名称查询待删除物料名称列表
|
|
|
|
Args:
|
|
manager_name: 负责人姓名
|
|
|
|
Returns:
|
|
物料名称列表(关键字)
|
|
"""
|
|
query = """
|
|
SELECT [MaterialName]
|
|
FROM [dbo].[MaterialsToBeDeleted]
|
|
WHERE [ManagerName] = ?
|
|
"""
|
|
|
|
with get_connection() as conn:
|
|
results = conn.execute_query(query, (manager_name,))
|
|
# 提取物料名称并去除空值
|
|
material_names = [row['MaterialName'] for row in results if row['MaterialName']]
|
|
return material_names
|