检验流转bug

This commit is contained in:
曹前明 2022-06-29 18:07:19 +08:00
parent 4dc8918f80
commit 3a31196f15
3 changed files with 11 additions and 4 deletions

View File

@ -166,7 +166,7 @@ class UsedStepViewSet(OptimizationMixin, CreateModelMixin, DestroyModelMixin, Li
'put':'subproduction_update', 'delete':'subproduction_update'}
queryset = UsedStep.objects.all()
filterset_fields = ['subproduction', 'step']
ordering = ['step__sort', '-step__create_time']
ordering = ['step__number', 'step__create_time']
def get_serializer_class(self):
if self.action =='create':

View File

@ -2,6 +2,7 @@ from django.utils import timezone
from typing import List
from django.db.models.expressions import F
from apps.mtm.serializers import UsedStepListSerializer
from apps.pm.models import ProductionPlan, SubProductionPlan, SubProductionProgress
from apps.mtm.models import Material, Step, SubprodctionMaterial, UsedStep
from apps.qm.models import TestRecord
@ -18,13 +19,18 @@ class WpmService(object):
返回下一步骤 当前步骤是否需要检验 当前步骤是否需要复用表
"""
used_steps = UsedStep.objects.filter(subproduction=subproduction_plan.subproduction).order_by('step__number')
if nowstep is None:
try:
nowstep = used_steps[0].step
except:
pass
for index, i in enumerate(used_steps):
if i.step == nowstep:
try:
used_step = used_steps[index+1]
return used_step.step, i.need_test, i.reuise_form
return used_step.step, i.need_test, i.reuse_form
except:
return nowstep, False, True
return nowstep, i.need_test, i.reuse_form
raise ParseError('获取步骤信息失败')
# steps_list = subproduction_plan.steps

View File

@ -36,7 +36,7 @@ from apps.wpm.services import WpmService
from django.utils import timezone
from rest_framework import status
from django.db.models import Count, Q
from rest_framework.exceptions import ParseError
from utils.tools import ranstr
@ -717,6 +717,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
else:
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
if needTest: #子工序若需要检验
print(needTest, reuseForm)
wp.act_state = WProduct.WPR_ACT_STATE_TOTEST
last_test = wp.last_wp_test
if last_test and reuseForm: