feat: validate_dag增加传入参数2
This commit is contained in:
parent
77c7811476
commit
18c66eee7a
|
|
@ -476,7 +476,7 @@ class Route(CommonADModel):
|
|||
return rqs
|
||||
|
||||
@classmethod
|
||||
def validate_dag(cls, final_material_out:Material, rqs, check_input=True):
|
||||
def validate_dag(cls, final_material_out:Material, rqs, check_final=True):
|
||||
"""
|
||||
TN:校验工艺路线是否正确:
|
||||
- 所有 Route 必须有 material_in 和 material_out
|
||||
|
|
@ -507,7 +507,7 @@ class Route(CommonADModel):
|
|||
|
||||
# 3. 检查final_material_out是否是终点
|
||||
final_id = final_material_out.id
|
||||
if check_input and final_id in reverse_graph:
|
||||
if check_final and final_id in reverse_graph:
|
||||
# raise ParseError(
|
||||
# f"最终物料 {final_material_out.name}(ID:{final_id}) 不能作为任何Route的输入"
|
||||
# )
|
||||
|
|
@ -527,7 +527,7 @@ class Route(CommonADModel):
|
|||
|
||||
# 5. 检查未到达的物料
|
||||
unreachable_ids = all_material_ids - visited
|
||||
if unreachable_ids:
|
||||
if check_final and unreachable_ids:
|
||||
# unreachable_materials = Material.objects.filter(id__in=unreachable_ids).values_list('name', flat=True)
|
||||
# raise ParseError(
|
||||
# f"以下物料无法到达最终物料: {list(unreachable_materials)}"
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class PmService:
|
|||
rqs = Route.get_routes(material=product)
|
||||
if not rqs.exists():
|
||||
raise ParseError('未配置工艺路线')
|
||||
Route.validate_dag(product, rqs, check_input=False)
|
||||
Route.validate_dag(product, rqs, check_final=False)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue