feat: add material matching logic for discrete material plan cleaner
- 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>
This commit is contained in:
28
db/materials_to_delete.py
Normal file
28
db/materials_to_delete.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
待删除物料查询组件
|
||||
从数据库查询指定负责人需要删除的物料名称
|
||||
"""
|
||||
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
|
||||
Reference in New Issue
Block a user