get_step info bug
This commit is contained in:
parent
464f1930fc
commit
4dc8918f80
|
@ -13,20 +13,19 @@ from rest_framework.exceptions import ParseError
|
||||||
class WpmService(object):
|
class WpmService(object):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_step_info(cls, subproduction_plan:SubProductionPlan, nowstep:Step, get_next=True):
|
def get_step_info(cls, subproduction_plan:SubProductionPlan, nowstep:Step):
|
||||||
"""
|
"""
|
||||||
获取本步骤或下一步骤的信息
|
返回下一步骤, 当前步骤是否需要检验, 当前步骤是否需要复用表
|
||||||
"""
|
"""
|
||||||
used_steps = UsedStep.objects.filter(subproduction=subproduction_plan.subproduction).order_by('step__number')
|
used_steps = UsedStep.objects.filter(subproduction=subproduction_plan.subproduction).order_by('step__number')
|
||||||
for index, i in enumerate(used_steps):
|
for index, i in enumerate(used_steps):
|
||||||
if i.step == nowstep and get_next:
|
if i.step == nowstep:
|
||||||
try:
|
try:
|
||||||
used_step = used_steps[index+1]
|
used_step = used_steps[index+1]
|
||||||
return used_step.step, used_step.need_test, used_step.reuse_form
|
return used_step.step, i.need_test, i.reuise_form
|
||||||
except:
|
except:
|
||||||
return nowstep, i.need_test, i.reuse_form
|
return nowstep, False, True
|
||||||
elif i.step == nowstep and get_next == False:
|
raise ParseError('获取步骤信息失败')
|
||||||
return nowstep, i.need_test, i.reuse_form
|
|
||||||
|
|
||||||
# steps_list = subproduction_plan.steps
|
# steps_list = subproduction_plan.steps
|
||||||
# stepIds = [i['id'] for i in steps_list]
|
# stepIds = [i['id'] for i in steps_list]
|
||||||
|
|
|
@ -213,8 +213,8 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOCOMBTEST:
|
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOCOMBTEST:
|
||||||
savedict['type'] = TestRecord.TEST_COMB
|
savedict['type'] = TestRecord.TEST_COMB
|
||||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST:
|
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST:
|
||||||
step, need_test, _ = WpmService.get_step_info(wproduct.subproduction_plan, wproduct.pre_step, get_next=False)
|
_, need_test, _ = WpmService.get_step_info(wproduct.subproduction_plan, wproduct.pre_step)
|
||||||
if need_test and wproduct.step != step:
|
if need_test and wproduct.step != wproduct.pre_step:
|
||||||
savedict['is_midtesting'] = True
|
savedict['is_midtesting'] = True
|
||||||
# if UsedStep.objects.filter(subproduction=wproduct.subproduction_plan.subproduction).first().need_test:
|
# if UsedStep.objects.filter(subproduction=wproduct.subproduction_plan.subproduction).first().need_test:
|
||||||
tr = TestRecord.objects.create(**savedict)
|
tr = TestRecord.objects.create(**savedict)
|
||||||
|
|
Loading…
Reference in New Issue