feat: validate_dag增加传入参数
This commit is contained in:
parent
d104ee90a4
commit
77c7811476
|
|
@ -476,7 +476,7 @@ class Route(CommonADModel):
|
||||||
return rqs
|
return rqs
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate_dag(cls, final_material_out:Material, rqs):
|
def validate_dag(cls, final_material_out:Material, rqs, check_input=True):
|
||||||
"""
|
"""
|
||||||
TN:校验工艺路线是否正确:
|
TN:校验工艺路线是否正确:
|
||||||
- 所有 Route 必须有 material_in 和 material_out
|
- 所有 Route 必须有 material_in 和 material_out
|
||||||
|
|
@ -507,7 +507,7 @@ class Route(CommonADModel):
|
||||||
|
|
||||||
# 3. 检查final_material_out是否是终点
|
# 3. 检查final_material_out是否是终点
|
||||||
final_id = final_material_out.id
|
final_id = final_material_out.id
|
||||||
if final_id in reverse_graph:
|
if check_input and final_id in reverse_graph:
|
||||||
# raise ParseError(
|
# raise ParseError(
|
||||||
# f"最终物料 {final_material_out.name}(ID:{final_id}) 不能作为任何Route的输入"
|
# f"最终物料 {final_material_out.name}(ID:{final_id}) 不能作为任何Route的输入"
|
||||||
# )
|
# )
|
||||||
|
|
|
||||||
|
|
@ -211,14 +211,18 @@ class PmService:
|
||||||
if not gjson_item:
|
if not gjson_item:
|
||||||
raise ParseError("缺少该产品的生产子图")
|
raise ParseError("缺少该产品的生产子图")
|
||||||
rqs = Route.get_routes(routeIds=gjson_item["routes"])
|
rqs = Route.get_routes(routeIds=gjson_item["routes"])
|
||||||
|
if not rqs.exists():
|
||||||
|
raise ParseError('未配置工艺路线')
|
||||||
|
Route.validate_dag(product, rqs)
|
||||||
else:
|
else:
|
||||||
rqs = Route.get_routes(material=product)
|
rqs = Route.get_routes(material=product)
|
||||||
|
if not rqs.exists():
|
||||||
|
raise ParseError('未配置工艺路线')
|
||||||
|
Route.validate_dag(product, rqs, check_input=False)
|
||||||
|
|
||||||
if not rqs.exists():
|
|
||||||
raise ParseError('未配置工艺路线')
|
|
||||||
|
|
||||||
# 通过出材率校正任务数, out_rate 默认为 100
|
# 通过出材率校正任务数, out_rate 默认为 100
|
||||||
Route.validate_dag(product, rqs)
|
|
||||||
r_count_dict = cls.cal_x_task_count(product.id, count, rqs)
|
r_count_dict = cls.cal_x_task_count(product.id, count, rqs)
|
||||||
|
|
||||||
# 创建小任务
|
# 创建小任务
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue