hberp/hb_server/apps/wpm/services.py

15 lines
511 B
Python

from apps.pm.models import SubProductionPlan
from apps.mtm.models import Step
class WpmServies(object):
@classmethod
def get_next_step(cls, subproduction_plan:SubProductionPlan, nowstep:Step):
"""
获取下一步骤
"""
stepIds = [i['id'] for i in subproduction_plan.steps]
pindex = stepIds.index(nowstep.id)
if pindex + 1 < len(stepIds):
return Step.objects.get(pk=stepIds[pindex+1]), True
else:
return nowstep, False